Built a tool used for faster releases.

This commit is contained in:
Bitl 2020-07-17 10:54:47 -07:00
parent 14d3f0556c
commit 98a4ea4d3b
8 changed files with 298 additions and 26 deletions

View File

@ -0,0 +1,69 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{64A99062-3C1C-4D2E-99E4-D6D92443AC98}</ProjectGuid>
<OutputType>Exe</OutputType>
<RootNamespace>Novetus.ReleasePreparer</RootNamespace>
<AssemblyName>ReleasePreparer</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>false</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<ApplicationIcon>NovetusIcon.ico</ApplicationIcon>
</PropertyGroup>
<ItemGroup>
<Reference Include="Nini, Version=1.1.0.0, Culture=neutral, PublicKeyToken=691faec150a7fa7b, processorArchitecture=MSIL">
<HintPath>..\packages\Trove.Nini.1.1.0.0\lib\net20\Nini.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="ReleasePreparer.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<Content Include="NovetusIcon.ico" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>SET path=$(SolutionDir)build
if not exist "%25path%25" mkdir "%25path%25"
copy $(ProjectDir)$(OutDir) "%25path%25"\*
del "%25path%25"\*.vshost.exe
del "%25path%25"\*.vshost.exe.config
del "%25path%25"\*.vshost.exe.manifest
del "%25path%25"\*.xml</PostBuildEvent>
</PropertyGroup>
</Project>

Binary file not shown.

After

Width:  |  Height:  |  Size: 130 KiB

View File

@ -0,0 +1,34 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("ReleasePreparer")]
[assembly: AssemblyDescription("A utility designed for faster releases.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Bitl")]
[assembly: AssemblyProduct("ReleasePreparer")]
[assembly: AssemblyCopyright("Copyright © 2020")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("64a99062-3c1c-4d2e-99e4-d6d92443ac98")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.0.*")]

View File

@ -0,0 +1,173 @@
#region Usings
using Nini.Config;
using System;
using System.IO;
using System.Linq;
using System.Reflection;
#endregion
namespace Novetus.ReleasePreparer
{
#region ReleasePreparer
class ReleasePreparer
{
static void Main(string[] args)
{
if (args.Length > 0)
{
if (args.Contains("-lite"))
{
string novpath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + @"\\Novetus";
string litepath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + @"\\Novetus-Lite";
if (!Directory.Exists(litepath))
{
Console.WriteLine("Novetus Lite does not exist. Creating " + litepath);
Directory.CreateDirectory(litepath);
//https://stackoverflow.com/questions/58744/copy-the-entire-contents-of-a-directory-in-c-sharp
Console.WriteLine("Creating directories...");
//Now Create all of the directories
foreach (string dirPath in Directory.GetDirectories(novpath, "*",
SearchOption.AllDirectories)
.Where(m => !m.Contains("Maps released by year"))
.Where(c06 => !c06.Contains("2006S"))
.Where(c07s => !c07s.Contains("2007M-Shaders"))
.Where(c06s => !c06s.Contains("2006S-Shaders"))
.Where(c09e => !c09e.Contains("2009E"))
.Where(music => !music.Contains("OldSoundtrack"))
)
Directory.CreateDirectory(dirPath.Replace(novpath, litepath));
Console.WriteLine("Copying files...");
//Copy all the files & Replaces any files with the same name
foreach (string newPath in Directory.GetFiles(novpath, "*.*",
SearchOption.AllDirectories)
.Where(m => !m.Contains("Maps released by year"))
.Where(c06 => !c06.Contains("2006S"))
.Where(c07s => !c07s.Contains("2007M-Shaders"))
.Where(c06s => !c06s.Contains("2006S-Shaders"))
.Where(c09e => !c09e.Contains("2009E"))
.Where(music => !music.Contains("OldSoundtrack"))
.Where(php => !php.Contains("php"))
)
FixedFileCopy(newPath, newPath.Replace(novpath, litepath), true);
Console.WriteLine("Overwriting files with lite alternatives...");
string litefiles = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + @"\\litefiles";
foreach (string newPath in Directory.GetFiles(litefiles, "*.*",
SearchOption.AllDirectories))
FixedFileCopy(newPath, newPath.Replace(litefiles, litepath), true);
}
string infopathlite = litepath + @"\\config\\info.ini";
Console.WriteLine("Editing " + infopathlite);
SetBranch(infopathlite);
string currbranchlite = GetBranch(infopathlite);
string pathlite = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + @"\\releasenomapsversion.txt";
Console.WriteLine("Creating " + pathlite);
if (!File.Exists(pathlite))
{
// Create a file to write to.
using (StreamWriter sw = File.CreateText(pathlite))
{
sw.Write(currbranchlite);
}
}
}
else if (args.Contains("-snapshot"))
{
string novbetapath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + @"\\Novetus";
string infopath = novbetapath + @"\\changelog.txt";
string currver = File.ReadLines(infopath).First();
string pathbeta = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + @"\\betaversion.txt";
Console.WriteLine("Creating " + pathbeta);
if (!File.Exists(pathbeta))
{
// Create a file to write to.
using (StreamWriter sw = File.CreateText(pathbeta))
{
sw.Write(currver);
}
}
}
else if (args.Contains("-release"))
{
string novpath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + @"\\Novetus";
string infopath = novpath + @"\\config\\info.ini";
string currbranch = GetBranch(infopath);
string path = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + @"\\releaseversion.txt";
Console.WriteLine("Creating " + path);
if (!File.Exists(path))
{
// Create a file to write to.
using (StreamWriter sw = File.CreateText(path))
{
sw.Write(currbranch);
}
}
}
}
}
public static void FixedFileCopy(string src, string dest, bool overwrite)
{
if (File.Exists(dest))
{
File.SetAttributes(dest, FileAttributes.Normal);
}
File.Copy(src, dest, overwrite);
}
public static void FixedFileDelete(string src)
{
if (File.Exists(src))
{
File.SetAttributes(src, FileAttributes.Normal);
File.Delete(src);
}
}
public static string GetBranch(string infopath)
{
//READ
string versionbranch;
IniConfigSource ini = new IniConfigSource(infopath);
string section = "ProgramInfo";
versionbranch = ini.Configs[section].Get("Branch", "0.0");
return versionbranch;
}
public static void SetBranch(string infopath)
{
//READ
string versionbranch;
IniConfigSource ini = new IniConfigSource(infopath);
string section = "ProgramInfo";
versionbranch = ini.Configs[section].Get("Branch", "0.0");
try
{
if (!versionbranch.Contains("(Lite)"))
{
ini.Configs[section].Set("Branch", versionbranch + " (Lite)");
ini.Save();
}
}
catch (Exception)
{
SetBranch(infopath);
}
}
}
#endregion
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 130 KiB

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Trove.Nini" version="1.1.0.0" targetFramework="net40" />
</packages>

View File

@ -13,6 +13,8 @@ Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "Novetus.Core", "NovetusCore
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Novetus.ClientScriptTester", "Novetus.ClientScriptTester\Novetus.ClientScriptTester.csproj", "{83B08607-65B8-4F9C-8D0F-AB1C8EEFFAE0}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Novetus.ReleasePreparer", "Novetus.ReleasePreparer\Novetus.ReleasePreparer.csproj", "{64A99062-3C1C-4D2E-99E4-D6D92443AC98}"
EndProject
Global
GlobalSection(SharedMSBuildProjectFiles) = preSolution
NovetusCore\NovetusCore.projitems*{2070eaa6-7606-4006-a628-5705c24a3644}*SharedItemsImports = 4
@ -41,6 +43,10 @@ Global
{83B08607-65B8-4F9C-8D0F-AB1C8EEFFAE0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{83B08607-65B8-4F9C-8D0F-AB1C8EEFFAE0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{83B08607-65B8-4F9C-8D0F-AB1C8EEFFAE0}.Release|Any CPU.Build.0 = Release|Any CPU
{64A99062-3C1C-4D2E-99E4-D6D92443AC98}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{64A99062-3C1C-4D2E-99E4-D6D92443AC98}.Debug|Any CPU.Build.0 = Debug|Any CPU
{64A99062-3C1C-4D2E-99E4-D6D92443AC98}.Release|Any CPU.ActiveCfg = Release|Any CPU
{64A99062-3C1C-4D2E-99E4-D6D92443AC98}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View File

@ -166,66 +166,52 @@ IF %checkoption%==3 GOTO RELEASENOMAPS_DRY
:RELEASE
CLS
ReleasePreparer.exe -release
butler push Novetus bitl/novetus:windows --if-changed --userversion-file releaseversion.txt
pause
del releaseversion.txt
GOTO MENU
:RELEASENOMAPS
CLS
robocopy Novetus Novetus-lite /E
rmdir /s /q "Novetus-Lite\maps\Maps released by year"
rmdir /s /q "Novetus-Lite\clients\2006S"
rmdir /s /q "Novetus-Lite\clients\2006S-Shaders"
rmdir /s /q "Novetus-Lite\clients\2007M-Shaders"
rmdir /s /q "Novetus-Lite\clients\2009E"
del /s /q Novetus-Lite\config\clients\GlobalSettings_4_2009E_default.xml
del /s /q Novetus-Lite\config\clients\GlobalSettings4_2006S_default.xml
del /s /q Novetus-Lite\config\clients\GlobalSettings4_2006S-Shaders_default.xml
del /s /q Novetus-Lite\config\clients\GlobalSettings4_2007M-Shaders_default.xml
rmdir /s /q "Novetus-Lite\shareddata\music\ROBLOX\OldSoundtrack"
rmdir /s /q "Novetus-Lite\bin\data\php"
robocopy litefiles Novetus-lite /E
ReleasePreparer.exe -lite
butler push Novetus-Lite bitl/novetus:windows-lite --if-changed --userversion-file releasenomapsversion.txt
pause
rmdir /s /q "Novetus-Lite"
del releasenomapsversion.txt
GOTO MENU
:BETA
CLS
ReleasePreparer.exe -snapshot
butler push Novetus bitl/novetus:windows-beta --if-changed --userversion-file betaversion.txt
pause
del betaversion.txt
GOTO MENU
:RELEASE_DRY
CLS
ReleasePreparer.exe -release
butler push Novetus bitl/novetus:windows --if-changed --userversion-file releaseversion.txt --dry-run
pause
del releaseversion.txt
GOTO MENU
:RELEASENOMAPS_DRY
CLS
robocopy Novetus Novetus-lite /E
rmdir /s /q "Novetus-Lite\maps\Maps released by year"
rmdir /s /q "Novetus-Lite\clients\2006S"
rmdir /s /q "Novetus-Lite\clients\2006S-Shaders"
rmdir /s /q "Novetus-Lite\clients\2007M-Shaders"
rmdir /s /q "Novetus-Lite\clients\2009E"
del /s /q Novetus-Lite\config\clients\GlobalSettings_4_2009E_default.xml
del /s /q Novetus-Lite\config\clients\GlobalSettings4_2006S_default.xml
del /s /q Novetus-Lite\config\clients\GlobalSettings4_2006S-Shaders_default.xml
del /s /q Novetus-Lite\config\clients\GlobalSettings4_2007M-Shaders_default.xml
rmdir /s /q "Novetus-Lite\shareddata\music\ROBLOX\OldSoundtrack"
rmdir /s /q "Novetus-Lite\bin\data\php"
robocopy litefiles Novetus-lite /E
ReleasePreparer.exe -lite
butler push Novetus-Lite bitl/novetus:windows-lite --if-changed --userversion-file releasenomapsversion.txt --dry-run
pause
rmdir /s /q "Novetus-Lite"
del releasenomapsversion.txt
GOTO MENU
:BETA_DRY
CLS
ReleasePreparer.exe -snapshot
butler push Novetus bitl/novetus:windows-beta --if-changed --userversion-file betaversion.txt --dry-run
pause
del betaversion.txt
GOTO MENU
:VALIDATE