From d27ae9c518c8fb20566120e7a14ae695d495c40b Mon Sep 17 00:00:00 2001
From: MaxED <j.maxed@gmail.com>
Date: Wed, 8 Jan 2014 15:20:56 +0000
Subject: [PATCH] Added a bath file, which can be used to make an SVN build of
 GZDB. Program version, including revision number, is now updated and handled
 properly.

---
 MakeSVNRelease.bat                            | 190 ++++++++++++++++++
 Source/Core/GZBuilder/GZGeneral.cs            |   4 -
 Source/Core/General/General.cs                |   5 +-
 Source/Core/Properties/AssemblyInfo.cs        |   5 +-
 Source/Core/Windows/AboutForm.cs              |   4 +-
 Source/Core/Windows/MainForm.cs               |   2 +-
 .../BuilderModes/IO/WavefrontExporter.cs      |   5 +-
 .../BuilderModes/Properties/AssemblyInfo.cs   |   5 +-
 Source/Plugins/ColorPicker/BuilderPlug.cs     |  17 +-
 9 files changed, 204 insertions(+), 33 deletions(-)
 create mode 100644 MakeSVNRelease.bat

diff --git a/MakeSVNRelease.bat b/MakeSVNRelease.bat
new file mode 100644
index 000000000..368724a8e
--- /dev/null
+++ b/MakeSVNRelease.bat
@@ -0,0 +1,190 @@
+@ECHO OFF
+
+ECHO.
+ECHO.     This build script requires the following software to be installed:
+ECHO.       - Subversion command-line client
+ECHO.       - Microsoft Visual Studio 2008
+ECHO.       - Microsoft HTML Help compiler
+ECHO.       - 7zip
+ECHO.
+ECHO.     You have to commit your work before using this script.
+ECHO.     Results will be in the 'SVN_Build' directory. Anything currently in
+ECHO.     the 'SVN_Build' directory may be overwritten.
+ECHO.
+ECHO.
+
+SET STUDIODIR=c:\Program Files (x86)\Microsoft Visual Studio 9.0
+SET HHWDIR=c:\Program Files (x86)\HTML Help Workshop
+SET SEVENZIPDIR=c:\Program Files (x86)\7-Zip
+
+CALL "%STUDIODIR%\Common7\Tools\vsvars32.bat"
+
+MKDIR "SVN_Build"
+
+svn revert "Source\Core\Properties\AssemblyInfo.cs" > NUL
+svn revert "Source\Plugins\BuilderModes\Properties\AssemblyInfo.cs" > NUL
+
+ECHO.
+ECHO Writing SVN log file...
+ECHO.
+IF EXIST "SVN_Build\log.xml" DEL /F /Q "SVN_Build\log.xml" > NUL
+svn log --xml -r HEAD:1 > "SVN_Build\log.xml"
+IF %ERRORLEVEL% NEQ 0 GOTO ERRORFAIL
+IF NOT EXIST "SVN_Build\log.xml" GOTO FILEFAIL
+
+ECHO.
+ECHO Compiling HTML Help file...
+ECHO.
+IF EXIST "Build\Refmanual.chm" DEL /F /Q "Build\Refmanual.chm" > NUL
+"%HHWDIR%\hhc" Help\Refmanual.hhp
+IF %ERRORLEVEL% NEQ 1 GOTO ERRORFAIL
+IF NOT EXIST "Build\Refmanual.chm" GOTO FILEFAIL
+
+ECHO.
+ECHO Looking up current repository revision numbers...
+ECHO.
+IF EXIST "setenv.bat" DEL /F /Q "setenv.bat" > NUL
+VersionFromSVN.exe "Source\Core\Properties\AssemblyInfo.cs" "Source\Plugins\BuilderModes\Properties\AssemblyInfo.cs" -O "setenv.bat"
+IF %ERRORLEVEL% NEQ 0 GOTO ERRORFAIL
+IF NOT EXIST "setenv.bat" GOTO FILEFAIL
+
+CALL "setenv.bat"
+DEL /F /Q "setenv.bat"
+
+ECHO.
+ECHO Compiling Doom Builder core...
+ECHO.
+IF EXIST "Build\Builder.exe" DEL /F /Q "Build\Builder.exe" > NUL
+msbuild "Source\Core\Builder.csproj" /t:Rebuild /p:Configuration=Release /p:Platform=x86 /v:minimal
+IF %ERRORLEVEL% NEQ 0 GOTO ERRORFAIL
+IF NOT EXIST "Build\Builder.exe" GOTO FILEFAIL
+
+ECHO.
+ECHO Setting /LARGEADDRESSAWARE flag...
+ECHO.
+"%STUDIODIR%\VC\bin\editbin.exe" /LARGEADDRESSAWARE "Build\Builder.exe"
+IF %ERRORLEVEL% NEQ 0 GOTO ERRORFAIL
+
+ECHO.
+ECHO Compiling Builder Effects plugin...
+ECHO.
+IF EXIST "Build\Plugins\BuilderEffects.dll" DEL /F /Q "Build\Plugins\BuilderEffects.dll" > NUL
+msbuild "Source\Plugins\BuilderEffects\BuilderEffects.csproj" /t:Rebuild /p:Configuration=Release /p:Platform=x86 /v:minimal
+IF %ERRORLEVEL% NEQ 0 GOTO ERRORFAIL
+IF NOT EXIST "Build\Plugins\BuilderEffects.dll" GOTO FILEFAIL
+
+ECHO.
+ECHO Compiling Builder Modes plugin...
+ECHO.
+IF EXIST "Build\Plugins\BuilderModes.dll" DEL /F /Q "Build\Plugins\BuilderModes.dll" > NUL
+msbuild "Source\Plugins\BuilderModes\BuilderModes.csproj" /t:Rebuild /p:Configuration=Release /p:Platform=x86 /v:minimal
+IF %ERRORLEVEL% NEQ 0 GOTO ERRORFAIL
+IF NOT EXIST "Build\Plugins\BuilderModes.dll" GOTO FILEFAIL
+
+ECHO.
+ECHO Compiling Color Picker plugin...
+ECHO.
+IF EXIST "Build\Plugins\ColorPicker.dll" DEL /F /Q "Build\Plugins\ColorPicker.dll" > NUL
+msbuild "Source\Plugins\ColorPicker\ColorPicker.csproj" /t:Rebuild /p:Configuration=Release /p:Platform=x86 /v:minimal
+IF %ERRORLEVEL% NEQ 0 GOTO ERRORFAIL
+IF NOT EXIST "Build\Plugins\ColorPicker.dll" GOTO FILEFAIL
+
+ECHO.
+ECHO Compiling Comments Panel plugin...
+ECHO.
+IF EXIST "Build\Plugins\CommentsPanel.dll" DEL /F /Q "Build\Plugins\CommentsPanel.dll" > NUL
+msbuild "Source\Plugins\CommentsPanel\CommentsPanel.csproj" /t:Rebuild /p:Configuration=Release /p:Platform=x86 /v:minimal
+IF %ERRORLEVEL% NEQ 0 GOTO ERRORFAIL
+IF NOT EXIST "Build\Plugins\CommentsPanel.dll" GOTO FILEFAIL
+
+ECHO.
+ECHO Compiling CopyPasteSectorProps plugin...
+ECHO.
+IF EXIST "Build\Plugins\CopyPasteSectorProps.dll" DEL /F /Q "Build\Plugins\CopyPasteSectorProps.dll" > NUL
+msbuild "Source\Plugins\CopyPasteSectorProps\CopyPasteSectorProperties.csproj" /t:Rebuild /p:Configuration=Release /p:Platform=x86 /v:minimal
+IF %ERRORLEVEL% NEQ 0 GOTO ERRORFAIL
+IF NOT EXIST "Build\Plugins\CopyPasteSectorProps.dll" GOTO FILEFAIL
+
+ECHO.
+ECHO Compiling Nodes Viewer plugin...
+ECHO.
+IF EXIST "Build\Plugins\NodesViewer.dll" DEL /F /Q "Build\Plugins\NodesViewer.dll" > NUL
+msbuild "Source\Plugins\NodesViewer\NodesViewer.csproj" /t:Rebuild /p:Configuration=Release /p:Platform=x86 /v:minimal
+IF %ERRORLEVEL% NEQ 0 GOTO ERRORFAIL
+IF NOT EXIST "Build\Plugins\NodesViewer.dll" GOTO FILEFAIL
+
+ECHO.
+ECHO Compiling Statistics plugin...
+ECHO.
+IF EXIST "Build\Plugins\Statistics.dll" DEL /F /Q "Build\Plugins\Statistics.dll" > NUL
+msbuild "Source\Plugins\Statistics\Statistics.csproj" /t:Rebuild /p:Configuration=Release /p:Platform=x86 /v:minimal
+IF %ERRORLEVEL% NEQ 0 GOTO ERRORFAIL
+IF NOT EXIST "Build\Plugins\Statistics.dll" GOTO FILEFAIL
+
+ECHO.
+ECHO Compiling Tag Explorer plugin...
+ECHO.
+IF EXIST "Build\Plugins\TagExplorer.dll" DEL /F /Q "Build\Plugins\TagExplorer.dll" > NUL
+msbuild "Source\Plugins\TagExplorer\TagExplorer.csproj" /t:Rebuild /p:Configuration=Release /p:Platform=x86 /v:minimal
+IF %ERRORLEVEL% NEQ 0 GOTO ERRORFAIL
+IF NOT EXIST "Build\Plugins\TagExplorer.dll" GOTO FILEFAIL
+
+ECHO.
+ECHO Compiling Tag Range plugin...
+ECHO.
+IF EXIST "Build\Plugins\TagRange.dll" DEL /F /Q "Build\Plugins\TagRange.dll" > NUL
+msbuild "Source\Plugins\TagRange\TagRange.csproj" /t:Rebuild /p:Configuration=Release /p:Platform=x86 /v:minimal
+IF %ERRORLEVEL% NEQ 0 GOTO ERRORFAIL
+IF NOT EXIST "Build\Plugins\TagRange.dll" GOTO FILEFAIL
+
+ECHO.
+ECHO Compiling Visplane Explorer plugin...
+ECHO.
+IF EXIST "Build\Plugins\VisplaneExplorer.dll" DEL /F /Q "Build\Plugins\VisplaneExplorer.dll" > NUL
+msbuild "Source\Plugins\VisplaneExplorer\VisplaneExplorer.csproj" /t:Rebuild /p:Configuration=Release /p:Platform=x86 /v:minimal
+IF %ERRORLEVEL% NEQ 0 GOTO ERRORFAIL
+IF NOT EXIST "Build\Plugins\VisplaneExplorer.dll" GOTO FILEFAIL
+
+ECHO.
+ECHO Packing release...
+ECHO.
+IF EXIST "SVN_Build\*.7z" DEL /F /Q "SVN_Build\*.7z" > NUL
+"%SEVENZIPDIR%\7z" a .\SVN_Build\gzdb.7z .\Build\* -xr!*.pdb -x!Setup
+IF %ERRORLEVEL% NEQ 0 GOTO PACKFAIL
+IF NOT EXIST .\SVN_Build\gzdb.7z GOTO FILEFAIL
+
+REN "SVN_Build\gzdb.7z" GZDoom_Builder-r%REVISIONNUMBER%.7z
+
+svn revert "Source\Core\Properties\AssemblyInfo.cs" > NUL
+svn revert "Source\Plugins\BuilderModes\Properties\AssemblyInfo.cs" > NUL
+
+ECHO.
+ECHO.     BUILD DONE !
+ECHO.
+ECHO.     Revision:  %REVISIONNUMBER%
+ECHO.
+PAUSE > NUL
+GOTO LEAVE
+
+:ERRORFAIL
+ECHO.
+ECHO.     BUILD FAILED (Tool returned error %ERRORLEVEL%)
+ECHO.
+PAUSE > NUL
+GOTO LEAVE
+
+:PACKFAIL
+ECHO.
+ECHO.     PACKAGING FAILED (7zip returned error %ERRORLEVEL%)
+ECHO.
+PAUSE > NUL
+GOTO LEAVE
+
+:FILEFAIL
+ECHO.
+ECHO.     BUILD FAILED (Output file was not built)
+ECHO.
+PAUSE > NUL
+GOTO LEAVE
+
+:LEAVE
diff --git a/Source/Core/GZBuilder/GZGeneral.cs b/Source/Core/GZBuilder/GZGeneral.cs
index bbc87fff7..76109c3ce 100644
--- a/Source/Core/GZBuilder/GZGeneral.cs
+++ b/Source/Core/GZBuilder/GZGeneral.cs
@@ -21,10 +21,6 @@ namespace CodeImp.DoomBuilder.GZBuilder
 		private static int[] acsSpecials = { 80, 81, 82, 83, 84, 85, 226 };
 		public static int[] ACS_SPECIALS { get { return acsSpecials; } }
 
-		//version
-		public const float Version = 1.14f;
-		public const char Revision = ' ';
-
 		public static void Init() {
 			//bind actions
 			General.Actions.BindMethods(typeof(GZGeneral));
diff --git a/Source/Core/General/General.cs b/Source/Core/General/General.cs
index 433b09aec..918dd9f5d 100644
--- a/Source/Core/General/General.cs
+++ b/Source/Core/General/General.cs
@@ -532,7 +532,6 @@ namespace CodeImp.DoomBuilder
 		internal static void Main(string[] args)
 		{
 			Uri localpath;
-			//Version thisversion;
 			
 			// Determine states
 			#if DEBUG
@@ -561,7 +560,6 @@ namespace CodeImp.DoomBuilder
 			
 			// Get a reference to this assembly
 			thisasm = Assembly.GetExecutingAssembly();
-			//thisversion = thisasm.GetName().Version;
 			
 			// Find application path
 			localpath = new Uri(Path.GetDirectoryName(thisasm.GetName().CodeBase));
@@ -584,8 +582,7 @@ namespace CodeImp.DoomBuilder
 			// Remove the previous log file and start logging
 			if(File.Exists(logfile)) File.Delete(logfile);
 			//mxd
-			General.WriteLogLine("GZDoom Builder " + GZBuilder.GZGeneral.Version + GZBuilder.GZGeneral.Revision + "startup");
-			//General.WriteLogLine("Doom Builder " + thisversion.Major + "." + thisversion.Minor + " startup");
+			General.WriteLogLine("GZDoom Builder " + Application.ProductVersion + " startup");
 			General.WriteLogLine("Application path:        " + apppath);
 			General.WriteLogLine("Temporary path:          " + temppath);
 			General.WriteLogLine("Local settings path:     " + settingspath);
diff --git a/Source/Core/Properties/AssemblyInfo.cs b/Source/Core/Properties/AssemblyInfo.cs
index aa6812627..af20111d8 100644
--- a/Source/Core/Properties/AssemblyInfo.cs
+++ b/Source/Core/Properties/AssemblyInfo.cs
@@ -1,5 +1,4 @@
 using System.Reflection;
-using System.Runtime.CompilerServices;
 using System.Runtime.InteropServices;
 
 // General Information about an assembly is controlled through the following 
@@ -10,7 +9,7 @@ using System.Runtime.InteropServices;
 [assembly: AssemblyConfiguration("")]
 [assembly: AssemblyCompany("CodeImp, MaxED")]
 [assembly: AssemblyProduct("GZDoom Builder")]
-[assembly: AssemblyCopyright("Copyright © 2007, 2012")]
+[assembly: AssemblyCopyright("Copyright © 2007, 2014")]
 [assembly: AssemblyTrademark("")]
 [assembly: AssemblyCulture("")]
 
@@ -29,4 +28,4 @@ using System.Runtime.InteropServices;
 //      Build Number
 //      Revision
 //
-[assembly: AssemblyVersion("2.1.2.1557")]
\ No newline at end of file
+[assembly: AssemblyVersion("1.14.0.1869")]
\ No newline at end of file
diff --git a/Source/Core/Windows/AboutForm.cs b/Source/Core/Windows/AboutForm.cs
index 8b311df79..6259e9983 100644
--- a/Source/Core/Windows/AboutForm.cs
+++ b/Source/Core/Windows/AboutForm.cs
@@ -32,7 +32,7 @@ namespace CodeImp.DoomBuilder.Windows
 			InitializeComponent();
 
 			// Show version
-			version.Text = "GZDoom Builder " + CodeImp.DoomBuilder.GZBuilder.GZGeneral.Version + CodeImp.DoomBuilder.GZBuilder.GZGeneral.Revision + " " + (General.DebugBuild ? "(debug)" : "");
+			version.Text = Application.ProductName + " v" + Application.ProductVersion + (General.DebugBuild ? " (debug)" : "");
 		}
 
 		// Launch Doom Builder website
@@ -56,7 +56,7 @@ namespace CodeImp.DoomBuilder.Windows
 		private void copyversion_Click(object sender, EventArgs e)
 		{
 			Clipboard.Clear();
-			Clipboard.SetText(CodeImp.DoomBuilder.GZBuilder.GZGeneral.Version.ToString() + CodeImp.DoomBuilder.GZBuilder.GZGeneral.Revision);
+			Clipboard.SetText(Application.ProductVersion);
 		}
 	}
 }
\ No newline at end of file
diff --git a/Source/Core/Windows/MainForm.cs b/Source/Core/Windows/MainForm.cs
index 284cec231..801b2ef78 100644
--- a/Source/Core/Windows/MainForm.cs
+++ b/Source/Core/Windows/MainForm.cs
@@ -362,7 +362,7 @@ namespace CodeImp.DoomBuilder.Windows
 			else
 			{
 				// Show normal caption
-				this.Text = Application.ProductName;
+				this.Text = Application.ProductName + " v" + Application.ProductVersion;
 			}
 
 			// Update the status bar
diff --git a/Source/Plugins/BuilderModes/IO/WavefrontExporter.cs b/Source/Plugins/BuilderModes/IO/WavefrontExporter.cs
index d0a21fc1e..8b668dd10 100644
--- a/Source/Plugins/BuilderModes/IO/WavefrontExporter.cs
+++ b/Source/Plugins/BuilderModes/IO/WavefrontExporter.cs
@@ -10,6 +10,7 @@ using CodeImp.DoomBuilder.Geometry;
 using CodeImp.DoomBuilder.Map;
 using CodeImp.DoomBuilder.Rendering;
 using CodeImp.DoomBuilder.Windows;
+using System.Windows.Forms;
 
 namespace CodeImp.DoomBuilder.BuilderModes.IO
 {
@@ -87,7 +88,7 @@ namespace CodeImp.DoomBuilder.BuilderModes.IO
 			//create mtl
 			StringBuilder mtl = new StringBuilder();
 			mtl.Append("# MTL for " + General.Map.FileTitle + ", map " + General.Map.Options.LevelName + Environment.NewLine);
-			mtl.Append("# Created by GZDoom Builder " + GZBuilder.GZGeneral.Version.ToString(CultureInfo.InvariantCulture) + Environment.NewLine + Environment.NewLine);
+			mtl.Append("# Created by GZDoom Builder " + Application.ProductVersion + Environment.NewLine + Environment.NewLine);
 
 			foreach(string s in settings.Textures) {
 				if(s == DEFAULT) continue;
@@ -149,7 +150,7 @@ namespace CodeImp.DoomBuilder.BuilderModes.IO
 
 			//add header
 			obj.Insert(0, "o " + General.Map.Options.LevelName + Environment.NewLine); //name
-			obj.Insert(0, "# Created by GZDoom Builder " + GZBuilder.GZGeneral.Version.ToString(CultureInfo.InvariantCulture) + Environment.NewLine + Environment.NewLine);
+			obj.Insert(0, "# Created by GZDoom Builder " + Application.ProductVersion + Environment.NewLine + Environment.NewLine);
 			obj.Insert(0, "# " + General.Map.FileTitle + ", map " + General.Map.Options.LevelName + Environment.NewLine);
 			data.Obj = obj.ToString();
 
diff --git a/Source/Plugins/BuilderModes/Properties/AssemblyInfo.cs b/Source/Plugins/BuilderModes/Properties/AssemblyInfo.cs
index 2510931fd..441d8ff1f 100644
--- a/Source/Plugins/BuilderModes/Properties/AssemblyInfo.cs
+++ b/Source/Plugins/BuilderModes/Properties/AssemblyInfo.cs
@@ -1,5 +1,4 @@
 using System.Reflection;
-using System.Runtime.CompilerServices;
 using System.Runtime.InteropServices;
 
 // General Information about an assembly is controlled through the following 
@@ -10,7 +9,7 @@ using System.Runtime.InteropServices;
 [assembly: AssemblyConfiguration("")]
 [assembly: AssemblyCompany("CodeImp, MaxED")]
 [assembly: AssemblyProduct("Doom Builder")]
-[assembly: AssemblyCopyright("Copyright ©  2007, 2012")]
+[assembly: AssemblyCopyright("Copyright ©  2007, 2014")]
 [assembly: AssemblyTrademark("")]
 [assembly: AssemblyCulture("")]
 
@@ -29,4 +28,4 @@ using System.Runtime.InteropServices;
 //      Build Number
 //      Revision
 //
-[assembly: AssemblyVersion("2.1.2.0")]
+[assembly: AssemblyVersion("1.14.0.0")]
diff --git a/Source/Plugins/ColorPicker/BuilderPlug.cs b/Source/Plugins/ColorPicker/BuilderPlug.cs
index 81a89d657..7ceb9be2f 100644
--- a/Source/Plugins/ColorPicker/BuilderPlug.cs
+++ b/Source/Plugins/ColorPicker/BuilderPlug.cs
@@ -1,17 +1,9 @@
-using System;
-using System.Collections.Generic;
-using System.Drawing;
-using System.Text;
+using System.Drawing;
 using System.Windows.Forms;
-
-using CodeImp.DoomBuilder;
-using CodeImp.DoomBuilder.Editing;
-using CodeImp.DoomBuilder.Map;
 using CodeImp.DoomBuilder.Windows;
 using CodeImp.DoomBuilder.Plugins;
 using CodeImp.DoomBuilder.Actions;
 using CodeImp.DoomBuilder.VisualModes;
-
 using CodeImp.DoomBuilder.ColorPicker.Windows;
 
 namespace CodeImp.DoomBuilder.ColorPicker
@@ -21,6 +13,8 @@ namespace CodeImp.DoomBuilder.ColorPicker
 		private static BuilderPlug me;
 		public static BuilderPlug Me { get { return me; } }
 
+		public override int MinimumRevision { get { return 1869; } }
+
 		public override string Name { get { return "Color Picker"; } }
 
 		private IColorPicker form;
@@ -29,11 +23,6 @@ namespace CodeImp.DoomBuilder.ColorPicker
 		private Point formLocation; //used to keep form's location constant
 
 		public override void OnInitialize() {
-			if (GZBuilder.GZGeneral.Version < 1.11f) {
-				General.ErrorLogger.Add(ErrorType.Error, "ColorPicker plugin: GZDoom Builder 1.11 or later required!");
-				return;
-			}
-			
 			base.OnInitialize();
 			me = this;
 
-- 
GitLab