[tasque/transition: 38/213] Set up global constants definition for version number et al.



commit fa6a0a8ba0fe420c69628bed67b7b4cf5b955ff2
Author: Antonius Riha <antoniusriha gmail com>
Date:   Tue May 29 11:14:31 2012 +0200

    Set up global constants definition for version number et al.
    
    * Global constants are defined in GlobalDefines.cs.
    * GlobalDefines.cs is generated out of GlobalDefines.cs.in by MSBuild task in build.mdproj.
    * GlobalDefines.cs.in contains:
    	- Version: The program version number is managed in tasque.sln, which in turn hands the version number to its child project files, where it is stored as ReleaseVersion property. The value of ReleaseVersion in inserted into GlboalDefines.cs at build time.
    	- Datadir: TODO
    
    * Hooked up GlobalAssemblyInfo.cs and AssemblyInfo.cs with GlobalDefines.cs so that assembly contains up-to-date metadata (version number).
    
    * Removed old Defines.WIN32.cs, which is now superfluous

 build/CommonAssemblyInfo.cs    |   31 ++++++++++++++++++++++++++++++-
 build/GlobalDefines.cs         |   34 ++++++++++++++++++++++++++++++++++
 build/GlobalDefines.cs.in      |   35 +++++++++++++++++++++++++++++++++++
 build/build.mdproj             |   33 +++++++++++++++++++++++++++++++++
 src/RtmNet/RtmNet.csproj       |    3 +++
 src/libtasque/libtasque.csproj |    3 +++
 src/tasque/Application.cs      |    6 +++---
 src/tasque/Defines.WIN32.cs    |   40 ----------------------------------------
 src/tasque/GnomeApplication.cs |    4 ++--
 src/tasque/tasque.csproj       |    8 +++++---
 10 files changed, 148 insertions(+), 49 deletions(-)
---
diff --git a/build/CommonAssemblyInfo.cs b/build/CommonAssemblyInfo.cs
index fa1d88d..a054135 100644
--- a/build/CommonAssemblyInfo.cs
+++ b/build/CommonAssemblyInfo.cs
@@ -1,4 +1,31 @@
+// 
+// CommonAssemblyInfo.cs
+//  
+// Author:
+//       Antonius Riha <antoniusriha gmail com>
+// 
+// Copyright (c) 2012 Antonius Riha
+// 
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+// 
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
 using System.Reflection;
+using Tasque;
 
 // Information about this assembly is defined by the following attributes. 
 // Change them to the values specific to your project.
@@ -13,4 +40,6 @@ using System.Reflection;
 // The form "{Major}.{Minor}.*" will automatically update the build and revision,
 // and "{Major}.{Minor}.{Build}.*" will update just the revision.
 
-[assembly: AssemblyVersion("0.1.10.0")]
\ No newline at end of file
+// AssemblyVersion and AssemblyInformationalVersion are both set to the application version
+[assembly: AssemblyVersion(GlobalDefines.Version)]
+[assembly: AssemblyInformationalVersion(GlobalDefines.Version)]
diff --git a/build/GlobalDefines.cs b/build/GlobalDefines.cs
new file mode 100644
index 0000000..ce6c445
--- /dev/null
+++ b/build/GlobalDefines.cs
@@ -0,0 +1,34 @@
+// This file (GlobalDefines.cs) is automatically generated. Do not edit. (Edit GlobalDefines.cs.in instead.)
+//
+// GlobalDefines.cs
+//
+// Author:
+//       Antonius Riha <antoniusriha gmail com>
+//
+// Copyright (c) 2012 Antonius Riha
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+namespace Tasque {
+static class GlobalDefines {
+public const string Version = "0.1.10";
+public const string DataDir	= "@datadir@";
+public const string LocaleDir = "@datadir@/locale";
+public const string SoundDir = "@datadir@/tasque/sounds";
+}
+}
diff --git a/build/GlobalDefines.cs.in b/build/GlobalDefines.cs.in
new file mode 100644
index 0000000..2cdd842
--- /dev/null
+++ b/build/GlobalDefines.cs.in
@@ -0,0 +1,35 @@
+// This file (GlobalDefines.cs) is automatically generated. Do not edit. (Edit GlobalDefines.cs.in instead.)
+// 
+// GlobalDefines.cs
+//  
+// Author:
+//       Antonius Riha <antoniusriha gmail com>
+// 
+// Copyright (c) 2012 Antonius Riha
+// 
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+// 
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+namespace Tasque {
+	static class GlobalDefines {
+		public const string Version = "@version@";
+		public const string DataDir	= "@datadir@";
+		public const string LocaleDir = "@datadir@/locale";
+		public const string SoundDir = "@datadir@/tasque/sounds";
+	}
+}
\ No newline at end of file
diff --git a/build/build.mdproj b/build/build.mdproj
new file mode 100644
index 0000000..b9110c0
--- /dev/null
+++ b/build/build.mdproj
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003";>
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Default</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ItemType>GenericProject</ItemType>
+    <ProductVersion>10.0.0</ProductVersion>
+    <SchemaVersion>2.0</SchemaVersion>
+    <ProjectGuid>{7B2BA3AC-B9C7-4734-AF59-2750B5C3672B}</ProjectGuid>
+    <ReleaseVersion>0.1.10</ReleaseVersion>
+    <MSBuildCommunityTasksPath>./</MSBuildCommunityTasksPath>
+  </PropertyGroup>
+  <Import Project="lib\MSBuild.Community.Tasks.Targets" />
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Default|AnyCPU' ">
+    <OutputPath>.</OutputPath>
+  </PropertyGroup>
+  <ItemGroup>
+    <None Include="CommonAssemblyInfo.cs" />
+    <GlobalDefinesCsIn Include="GlobalDefines.cs.in" />
+  </ItemGroup>
+  <Target Name="Build" DependsOnTargets="PreBuild" />
+  <Target Name="PreBuild">
+    <Message Text="Setting up global definitions..." />
+    <ReadLinesFromFile File="@(GlobalDefinesCsIn)">
+      <Output TaskParameter="Lines" ItemName="GlobalDefinesIn" />
+    </ReadLinesFromFile>
+    <RegexReplace Input="@(GlobalDefinesIn)" Expression="@version@" Replacement="$(ReleaseVersion)">
+      <Output ItemName="GlobalDefines" TaskParameter="Output" />
+    </RegexReplace>
+    <WriteLinesToFile File="GlobalDefines.cs" Lines="@(GlobalDefines)" Overwrite="true" />
+    <Message Text="Finished." />
+  </Target>
+</Project>
diff --git a/src/RtmNet/RtmNet.csproj b/src/RtmNet/RtmNet.csproj
index dc8c798..f0194f1 100644
--- a/src/RtmNet/RtmNet.csproj
+++ b/src/RtmNet/RtmNet.csproj
@@ -82,6 +82,9 @@
     <Compile Include="..\..\build\CommonAssemblyInfo.cs">
       <Link>Properties\CommonAssemblyInfo.cs</Link>
     </Compile>
+    <Compile Include="..\..\build\GlobalDefines.cs">
+      <Link>Properties\GlobalDefines.cs</Link>
+    </Compile>
   </ItemGroup>
   <ItemGroup>
     <None Include="example_app.config" />
diff --git a/src/libtasque/libtasque.csproj b/src/libtasque/libtasque.csproj
index f5998d4..611e823 100644
--- a/src/libtasque/libtasque.csproj
+++ b/src/libtasque/libtasque.csproj
@@ -75,6 +75,9 @@
     <Compile Include="..\..\build\CommonAssemblyInfo.cs">
       <Link>Properties\CommonAssemblyInfo.cs</Link>
     </Compile>
+    <Compile Include="..\..\build\GlobalDefines.cs">
+      <Link>Properties\GlobalDefines.cs</Link>
+    </Compile>
   </ItemGroup>
   <ItemGroup>
     <Reference Include="gtk-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f">
diff --git a/src/tasque/Application.cs b/src/tasque/Application.cs
index 484617f..d9614e3 100644
--- a/src/tasque/Application.cs
+++ b/src/tasque/Application.cs
@@ -156,7 +156,7 @@ namespace Tasque
 			nativeApp = new GnomeApplication ();
 #endif
 			nativeApp.Initialize (
-				Defines.LocaleDir,
+				GlobalDefines.LocaleDir,
 				"Tasque",
 				"Tasque",
 				args);
@@ -580,8 +580,8 @@ namespace Tasque
 				translators = null;
 			
 			Gtk.AboutDialog about = new Gtk.AboutDialog ();
-			about.Name = "Tasque";
-			about.Version = Defines.Version;
+			about.ProgramName = "Tasque";
+			about.Version = GlobalDefines.Version;
 			about.Logo = Utilities.GetIcon("tasque-48", 48);
 			about.Copyright =
 				Catalog.GetString ("Copyright \xa9 2008 Novell, Inc.");
diff --git a/src/tasque/GnomeApplication.cs b/src/tasque/GnomeApplication.cs
index 96b56e2..30c6d2c 100644
--- a/src/tasque/GnomeApplication.cs
+++ b/src/tasque/GnomeApplication.cs
@@ -30,14 +30,14 @@ namespace Tasque
 		                        string process_name,
 		                        string [] args)
 		{
-			Mono.Unix.Catalog.Init ("tasque", Defines.LocaleDir);
+			Mono.Unix.Catalog.Init ("tasque", GlobalDefines.LocaleDir);
 			try {
 				SetProcessName (process_name);
 			} catch {} // Ignore exception if fail (not needed to run)
 
 			Gtk.Application.Init ();
 			program = new Gnome.Program (display_name,
-			                             Defines.Version,
+			                             GlobalDefines.Version,
 			                             Gnome.Modules.UI,
 			                             args);
 		}
diff --git a/src/tasque/tasque.csproj b/src/tasque/tasque.csproj
index 552955a..bffedf9 100644
--- a/src/tasque/tasque.csproj
+++ b/src/tasque/tasque.csproj
@@ -76,7 +76,8 @@
     <None Include="..\..\data\sounds\notify.wav">
       <Link>data\sounds\notify.wav</Link>
     </None>
-    <Compile Include="Defines.WIN32.cs" />
+  </ItemGroup>
+  <ItemGroup>
     <Compile Include="RemoteControl.cs" />
     <Compile Include="RemoteControlProxy.cs" />
     <Compile Include="GnomeApplication.cs" />
@@ -84,8 +85,9 @@
     <Compile Include="..\..\build\CommonAssemblyInfo.cs">
       <Link>Properties\CommonAssemblyInfo.cs</Link>
     </Compile>
-  </ItemGroup>
-  <ItemGroup>
+    <Compile Include="..\..\build\GlobalDefines.cs">
+      <Link>Properties\GlobalDefines.cs</Link>
+    </Compile>
     <Compile Include="AbstractTask.cs" />
     <Compile Include="AllCategory.cs" />
     <Compile Include="Application.cs" />



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]