diff --git a/CASA-auth-token/server-java/package/windows/server-java_msi/Makefile.am b/CASA-auth-token/server-java/package/windows/server-java_msi/Makefile.am index a21344f8..11fc461f 100644 --- a/CASA-auth-token/server-java/package/windows/server-java_msi/Makefile.am +++ b/CASA-auth-token/server-java/package/windows/server-java_msi/Makefile.am @@ -45,6 +45,8 @@ devenv: $(TARGET_FILE): devenv @rm -f $(LOG_FILE) $@ + echo [======== Updating msi numbers========] + "../../../tools/w32/VersionVDProj/bin/VersionVDProj.exe" -msi server-java_msi.vdproj version=$(VERSION) @CMD='"$(VSINSTALLDIR)/Common7/IDE/devenv.exe" server-java_msi.sln /build $(TARGET_CFG) /project $(PACKAGE) /out $(LOG_FILE)'; \ echo $$CMD; \ if eval $$CMD; then \ diff --git a/CASA-auth-token/server-java/tools/w32/VersionVDProj/App.cs b/CASA-auth-token/server-java/tools/w32/VersionVDProj/App.cs new file mode 100644 index 00000000..40577c7d --- /dev/null +++ b/CASA-auth-token/server-java/tools/w32/VersionVDProj/App.cs @@ -0,0 +1,105 @@ +/*********************************************************************** + * + * Copyright (C) 2005-2006 Novell, Inc. All Rights Reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; version 2.1 + * of the License. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, Novell, Inc. + * + * To contact Novell about this file by physical or electronic mail, + * you may find current contact information at www.novell.com. + * + ***********************************************************************/ + +// +// copyright 2003 Don Kackman - mailto:dkackman_2000@yahoo.com +// +// no warranty expressed or implied +// use however you'd like +// +using System; + +namespace VersionVDProj +{ + /// + /// This is the class that has the Main method. This class is responsible for parsing command line + /// arguments and dispatching them to the correct classes + /// + class App + { + /// + /// The main entry point for the application. + /// + [STAThread] + static int Main(string[] args) + { + if ( args.Length != 0 ) + { + try + { + ArgumentParser arguments = new ArgumentParser( args ); + VDProjectVersioner versioner = null; + + switch ( arguments.Command ) + { + case "msi": + versioner = new MSIProjectVersioner( arguments.ProjectFile ); + break; + case "msm": + versioner = new MSMProjectVersioner( arguments.ProjectFile ); + break; + default: + throw new Exception( string.Format( "Unrecognized command {0}", arguments.Command ) ); + } + + versioner.UpdateFile( arguments.Options ); + return 0; + } + catch ( Exception e ) + { + Console.WriteLine( "ERROR" ); + Console.WriteLine( e.Message ); + return 1; + } + } + + // with no arguments show the usage + ShowUsage(); + return 0; + } + + private static void ShowUsage() + { + Console.WriteLine( "VersionVDProj -msi version= [package=]" ); + Console.WriteLine( "\t[product=] [upgrade=]" ); + Console.WriteLine( "The -msi switch is used for updating MSI installer projects" ); + Console.WriteLine( "" ); + Console.WriteLine( " is the path to the vdproj file (without braces)" ); + Console.WriteLine( " is the version to use in format #.#.# (without braces)" ); + Console.WriteLine( " Optional package guid (if not specified will be auto-generated)" ); + Console.WriteLine( " Optional product guid (if not specified will be set to the" ); + Console.WriteLine( "\tsame value used to set the package guid)" ); + Console.WriteLine( " Optional upgrade guid (if not specified the upgrade code will" ); + Console.WriteLine( "\tnot be modified)" ); + Console.WriteLine( "" ); + Console.WriteLine( "VersionVDProj -msm version= [signature=]" ); + Console.WriteLine( "The -msm switch is used for updating merge module projects" ); + Console.WriteLine( "" ); + Console.WriteLine( " is the path to the vdproj file (without braces)" ); + Console.WriteLine( " is the version to use in format #.#.# (without braces)" ); + Console.WriteLine( " Optional unique id for the merge module (if not specified a guid" ); + Console.WriteLine( "\tbased signature will be auto-generated)" ); + Console.WriteLine( "" ); + Console.WriteLine( "Named arguments can be specified in any order" ); + } + } +} diff --git a/CASA-auth-token/server-java/tools/w32/VersionVDProj/App.ico b/CASA-auth-token/server-java/tools/w32/VersionVDProj/App.ico new file mode 100644 index 00000000..3a5525fd Binary files /dev/null and b/CASA-auth-token/server-java/tools/w32/VersionVDProj/App.ico differ diff --git a/CASA-auth-token/server-java/tools/w32/VersionVDProj/ArgumentParser.cs b/CASA-auth-token/server-java/tools/w32/VersionVDProj/ArgumentParser.cs new file mode 100644 index 00000000..3ad2e449 --- /dev/null +++ b/CASA-auth-token/server-java/tools/w32/VersionVDProj/ArgumentParser.cs @@ -0,0 +1,82 @@ +/*********************************************************************** + * + * Copyright (C) 2005-2006 Novell, Inc. All Rights Reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; version 2.1 + * of the License. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, Novell, Inc. + * + * To contact Novell about this file by physical or electronic mail, + * you may find current contact information at www.novell.com. + * + ***********************************************************************/ + +using System; +using System.IO; +using System.Collections; + +namespace VersionVDProj +{ + /// + /// Summary description for ArgumentParser. + /// + public class ArgumentParser + { + public readonly Hashtable Options; + public readonly string Command; + public readonly FileInfo ProjectFile; + + public ArgumentParser( string[] args ) + { + Options = new Hashtable(); + + if ( args.Length < 2 ) + throw new Exception( "Wrong number of arguments" ); + + Command = ParseCommand( args[0] ); + ProjectFile = ParseFileName( args[1] ); + + for ( int i = 2; i < args.Length; i++ ) + ParseArgument( args[i] ); + } + + private string ParseCommand( string command ) + { + if ( command.Substring( 0, 1 ) != "-" ) + throw new Exception( string.Format( "Unrecognized command {0}", command ) ); + + return command.Substring( 1 ).ToLower(); + } + + private FileInfo ParseFileName( string path ) + { + FileInfo file = new FileInfo( path ); + if ( !file.Exists ) + throw new Exception( string.Format( "The file {0} could not be found", path ) ); + + return file; + } + + private void ParseArgument( string arg ) + { + int eqPos = arg.IndexOf( '=', 0 ); + + if ( eqPos == -1 ) + throw new Exception( string.Format( "The argument {0} is not in the format NAME=VALUE", arg ) ); + + string name = arg.Substring( 0, eqPos ); + string val = arg.Substring( eqPos + 1 ); + + Options.Add( name.ToLower(), val ); + } + } +} diff --git a/CASA-auth-token/server-java/tools/w32/VersionVDProj/AssemblyInfo.cs b/CASA-auth-token/server-java/tools/w32/VersionVDProj/AssemblyInfo.cs new file mode 100644 index 00000000..c5fedddf --- /dev/null +++ b/CASA-auth-token/server-java/tools/w32/VersionVDProj/AssemblyInfo.cs @@ -0,0 +1,86 @@ +/*********************************************************************** + * + * Copyright (C) 2005-2006 Novell, Inc. All Rights Reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; version 2.1 + * of the License. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, Novell, Inc. + * + * To contact Novell about this file by physical or electronic mail, + * you may find current contact information at www.novell.com. + * + ***********************************************************************/ + +// +// copyright 2003 Don Kackman - mailto:dkackman_2000@yahoo.com +// +// no warranty expressed or implied +// use however you'd like +// +using System.Reflection; +using System.Runtime.CompilerServices; + +// +// 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("Deployment Project Versioning Tool")] +[assembly: AssemblyDescription("Updates the version and guid of Visual Studio.Net deployment projects")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("")] +[assembly: AssemblyCopyright("2003 Don Kackman")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// +// 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 Revision and Build Numbers +// by using the '*' as shown below: + +[assembly: AssemblyVersion("1.0.*")] + +// +// In order to sign your assembly you must specify a key to use. Refer to the +// Microsoft .NET Framework documentation for more information on assembly signing. +// +// Use the attributes below to control which key is used for signing. +// +// Notes: +// (*) If no key is specified, the assembly is not signed. +// (*) KeyName refers to a key that has been installed in the Crypto Service +// Provider (CSP) on your machine. KeyFile refers to a file which contains +// a key. +// (*) If the KeyFile and the KeyName values are both specified, the +// following processing occurs: +// (1) If the KeyName can be found in the CSP, that key is used. +// (2) If the KeyName does not exist and the KeyFile does exist, the key +// in the KeyFile is installed into the CSP and used. +// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility. +// When specifying the KeyFile, the location of the KeyFile should be +// relative to the project output directory which is +// %Project Directory%\obj\. For example, if your KeyFile is +// located in the project directory, you would specify the AssemblyKeyFile +// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")] +// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework +// documentation for more information on this. +// +[assembly: AssemblyDelaySign(false)] +[assembly: AssemblyKeyFile("")] +[assembly: AssemblyKeyName("")] diff --git a/CASA-auth-token/server-java/tools/w32/VersionVDProj/MSIProjectVersioner.cs b/CASA-auth-token/server-java/tools/w32/VersionVDProj/MSIProjectVersioner.cs new file mode 100644 index 00000000..86df039c --- /dev/null +++ b/CASA-auth-token/server-java/tools/w32/VersionVDProj/MSIProjectVersioner.cs @@ -0,0 +1,93 @@ +/*********************************************************************** + * + * Copyright (C) 2005-2006 Novell, Inc. All Rights Reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; version 2.1 + * of the License. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, Novell, Inc. + * + * To contact Novell about this file by physical or electronic mail, + * you may find current contact information at www.novell.com. + * + ***********************************************************************/ + +// +// copyright 2003 Don Kackman - mailto:dkackman_2000@yahoo.com +// +// no warranty expressed or implied +// use however you'd like +// +using System; +using System.IO; +using System.Collections; + +namespace VersionVDProj +{ + /// + /// Class that updates the version info of MSI projects + /// + public class MSIProjectVersioner : VDProjectVersioner + { + private readonly static Guid MSI_PROJECT_TYPE = new Guid( "{978C614F-708E-4E1A-B201-565925725DBA}" ); + + private Guid productCode = Guid.Empty; + private Guid packageCode = Guid.Empty; + private Guid upgradeCode = Guid.Empty; + /// + /// createas a new instance of the class + /// + /// the project file + public MSIProjectVersioner( FileInfo file ) : base( file, MSI_PROJECT_TYPE ) + { + + } + + protected override void SetOptions( Hashtable options ) + { + // get the package code - generate if not specified + if ( options.Contains("packagecode") ) + packageCode = new Guid( options["packagecode"].ToString() ); + else + packageCode = Guid.NewGuid(); + + // get the product code - set to package code if not specified + if ( options.Contains("productcode") ) + productCode = new Guid( options["productcode"].ToString() ); + else + productCode = packageCode; + + // get the upgrade code - leave empty if not specified + if ( options.Contains("upgradecode") ) + upgradeCode = new Guid( options["upgradecode"].ToString() ); + } + + protected override string TranslateLine( string line ) + { + // look for the properties we are interested in changing + // if we find them, replace the old value with the new and return the new line string + // otherwise just return the line string + if ( line.IndexOf( "\"ProductVersion\"" ) != -1 ) + line = ReplaceValue( line, "ProductVersion", version.ThreePartVersion ); + + else if ( productCode != Guid.Empty && line.IndexOf( "\"ProductCode\"" ) != -1 ) + line = ReplaceValue( line, "ProductCode", "{" + productCode.ToString().ToUpper() + "}" ); + + else if ( packageCode != Guid.Empty && line.IndexOf( "\"PackageCode\"" ) != -1 ) + line = ReplaceValue( line, "PackageCode", "{" + packageCode.ToString().ToUpper() + "}" ); + + else if ( upgradeCode != Guid.Empty && line.IndexOf( "\"UpgradeCode\"" ) != -1 ) + line = ReplaceValue( line, "UpgradeCode", "{" + upgradeCode.ToString().ToUpper() + "}" ); + + return line; + } + } +} diff --git a/CASA-auth-token/server-java/tools/w32/VersionVDProj/MSMProjectVersioner.cs b/CASA-auth-token/server-java/tools/w32/VersionVDProj/MSMProjectVersioner.cs new file mode 100644 index 00000000..01adff84 --- /dev/null +++ b/CASA-auth-token/server-java/tools/w32/VersionVDProj/MSMProjectVersioner.cs @@ -0,0 +1,76 @@ +/*********************************************************************** + * + * Copyright (C) 2005-2006 Novell, Inc. All Rights Reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; version 2.1 + * of the License. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, Novell, Inc. + * + * To contact Novell about this file by physical or electronic mail, + * you may find current contact information at www.novell.com. + * + ***********************************************************************/ +// +// copyright 2003 Don Kackman - mailto:dkackman_2000@yahoo.com +// +// no warranty expressed or implied +// use however you'd like +// + +using System; +using System.IO; +using System.Collections; + +namespace VersionVDProj +{ + /// + /// Class that updates the version info of merge module projects + /// + public class MSMProjectVersioner : VDProjectVersioner + { + private readonly static Guid MSM_PROJECT_TYPE = new Guid( "{DD7A5B58-C2F9-40FF-B2EF-0773356FB978}" ); + + private string signature; + + /// + /// createas a new instance of the class + /// + /// the project file + public MSMProjectVersioner( FileInfo file ) : base( file, MSM_PROJECT_TYPE ) + { + } + + protected override void SetOptions( Hashtable options ) + { + // get the signature - generate if not specified + if ( options.Contains( "signature" ) ) + signature = options[signature].ToString(); + else + signature = "MergeModule." + Guid.NewGuid().ToString().ToUpper().Replace( "-", "" ); + } + + protected override string TranslateLine( string line ) + { + // look for the properties we are interested in changing + // if we find them, replace the old value with the new and return the new line string + // otherwise just return the line string + if ( line.IndexOf( "\"Version\"" ) != -1 ) + line = ReplaceValue( line, "Version", version.FourPartVersion ); + + // module signature cannot have dashes + else if ( line.IndexOf( "\"ModuleSignature\"" ) != -1 ) + line = ReplaceValue( line, "ModuleSignature", signature ); + + return line; + } + } +} diff --git a/CASA-auth-token/server-java/tools/w32/VersionVDProj/README b/CASA-auth-token/server-java/tools/w32/VersionVDProj/README new file mode 100644 index 00000000..b4c63c7b --- /dev/null +++ b/CASA-auth-token/server-java/tools/w32/VersionVDProj/README @@ -0,0 +1,21 @@ +This is a command line utility that updates the version and GUID of VS.NET project files. + +The source for this tool has been downloaded from the following site. + +http://www.codeproject.com/dotnet/VersionVDProj.asp#xx1436860xx + +The copy right associated with this tool is as followings: + +//////////////////////////////////////////////////////////////// +// copyright 2003 Don Kackman - mailto:dkackman_2000@yahoo.com +// +// no warranty expressed or implied +// use however you'd like +//////////////////////////////////////////////////////////////// + + +4/14/2006 + +10/18/2006 change MSI_PROJECT_TYPE to work with VS 2006 + + diff --git a/CASA-auth-token/server-java/tools/w32/VersionVDProj/VersionVDProj.csproj b/CASA-auth-token/server-java/tools/w32/VersionVDProj/VersionVDProj.csproj new file mode 100644 index 00000000..4f848ea1 --- /dev/null +++ b/CASA-auth-token/server-java/tools/w32/VersionVDProj/VersionVDProj.csproj @@ -0,0 +1,133 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/CASA-auth-token/server-java/tools/w32/VersionVDProj/bin/VersionVDProj.exe b/CASA-auth-token/server-java/tools/w32/VersionVDProj/bin/VersionVDProj.exe new file mode 100755 index 00000000..a5233e57 Binary files /dev/null and b/CASA-auth-token/server-java/tools/w32/VersionVDProj/bin/VersionVDProj.exe differ diff --git a/CASA-auth-token/server-java/tools/w32/VersionVDProj/bin/VersionVDProj.pdb b/CASA-auth-token/server-java/tools/w32/VersionVDProj/bin/VersionVDProj.pdb new file mode 100644 index 00000000..105161d1 Binary files /dev/null and b/CASA-auth-token/server-java/tools/w32/VersionVDProj/bin/VersionVDProj.pdb differ