Permalink
Browse files

Refactoring build scripts for automation

  • Loading branch information...
1 parent a233677 commit 6b4812debdfc662de2548396f1d59e85ef09667f @cbas cbas committed Aug 8, 2010
View
8 Host/build_host.bat
@@ -11,10 +11,10 @@ CALL "%VS100COMNTOOLS%\vsvars32.bat"
IF %ERRORLEVEL% NEQ 0 ECHO Error: Cannot set environment build variables. && EXIT /B 1
:: Set meta information
-ECHO #define FILEVER %VERSION_MAJOR%,%VERSION_MINOR%,%BUILD_NUMBER%,0 > ".\Source\VersionNo.h"
-ECHO #define PRODUCTVER %VERSION_MAJOR%,%VERSION_MINOR%,%BUILD_NUMBER%,0 >> ".\Source\VersionNo.h"
-ECHO #define FILEVERSTR "%VERSION_MAJOR%,%VERSION_MINOR%,%BUILD_NUMBER%,0\0" >> ".\Source\VersionNo.h"
-ECHO #define PRODUCTVERSTR "%VERSION_MAJOR%,%VERSION_MINOR%,%BUILD_NUMBER%,0\0" >> ".\Source\VersionNo.h"
+ECHO #define FILEVER %VERSION_MAJOR%,%VERSION_MINOR%,%VERSION_BUILD%,0 > ".\Source\VersionNo.h"
+ECHO #define PRODUCTVER %VERSION_MAJOR%,%VERSION_MINOR%,%VERSION_BUILD%,0 >> ".\Source\VersionNo.h"
+ECHO #define FILEVERSTR "%VERSION_MAJOR%,%VERSION_MINOR%,%VERSION_BUILD%,0\0" >> ".\Source\VersionNo.h"
+ECHO #define PRODUCTVERSTR "%VERSION_MAJOR%,%VERSION_MINOR%,%VERSION_BUILD%,0\0" >> ".\Source\VersionNo.h"
ECHO #define COMMENTS "%HOST_COMMENTS%" >> ".\Source\VersionNo.h"
ECHO #define COMPANY "%HOST_COMPANY%" >> ".\Source\VersionNo.h"
View
4 Installer/Appcaster/build_feed.bat
@@ -17,11 +17,11 @@ CScript.exe appcaster.wsf ^
/location:"%APPCAST_FEED_URL%" ^
/history:"%HUDSON_URL%" ^
/arguments:"/passive LAUNCHAPP=yes" ^
- /changes:"Development build" ^
+ /changes:"%APPCAST_TRACK% track" ^
/info:"%APPCAST_INFO_URL%" ^
/mime:application/x-msi ^
/size:"%APPCAST_LOCAL_FILE%" ^
- /track:development ^
+ /track:%APPCAST_TRACK% ^
/version:"%VERSION%" ^
/url:"%APPCAST_DOWNLOAD_URL%"
View
14 Installer/WiX/build_msi.bat
@@ -12,15 +12,15 @@ IF NOT DEFINED BUILD_CONFIG CALL "..\..\build_config.bat"
:: C:\Program Files (x86)\Windows Installer XML v3.5\bin
ECHO Creating temporary copy...
-:: The XCOPY command is deprecated since Vista and replaced by ROBOCOPY.
-:: MKDIR "Temp"
-:: XCOPY "../../Client" "./Temp" /E /EXCLUDE:filter.txt
-ROBOCOPY "../../Client" "./Temp" /MIR /XF ".gitignore" "pandion.pdb" "pandiond.exe" "pandiond.pdb" /NFL /NDL /NJH
-IF ERRORLEVEL 8 ECHO Error: Cannot create temporary copy && EXIT /B 1
+ROBOCOPY "../../Client" "./Temp" /MIR /XF ".gitignore" "*.pdb" "*_debug.exe" /E /NJH /NJS /NS /NC /NFL /NDL
+IF %ERRORLEVEL% GEQ 8 ECHO Error: Cannot create temporary copy && EXIT /B 1
+IF EXIST ".\Temp\%JOB_NAME_SAFE%.exe" DEL /F /Q ".\Temp\%JOB_NAME_SAFE%.exe"
+IF EXIST ".\Temp\Host.exe" RENAME ".\Temp\Host.exe" "%JOB_NAME_SAFE%.exe"
+IF NOT EXIST ".\Temp\%JOB_NAME_SAFE%.exe" ECHO Error: Cannot include Host.exe && EXIT /B 1
:: Inject the build number into the installed files.
-ECHO Build number %BUILD_NUMBER%
-ECHO %BUILD_NUMBER% > "./Temp/settings/build.txt"
+ECHO Build number %VERSION_BUILD%
+ECHO %VERSION_BUILD% > "./Temp/settings/build.txt"
:: Generate a list of files as a component group.
ECHO Harvesting components...
View
4 Installer/WiX/filter.txt
@@ -1,4 +0,0 @@
-.gitignore
-pandion.pdb
-pandiond.exe
-pandiond.pdb
View
28 Installer/WiX/version.wxs
@@ -8,34 +8,24 @@
<!--
These properties are shown in the installer UI, add/remove programs, ...
-->
- <?define AppHelpLink="http://pandion.im/support" ?>
- <?define AppUrlInfoAbout="http://pandion.im/about" ?>
- <?define Manufacturer="Pandion Team" ?>
- <?define Name="Pandion" ?>
+ <?define AppHelpLink="$(env.MSI_HELP_URL)" ?>
+ <?define AppUrlInfoAbout="$(env.MSI_INFO_URL)" ?>
+ <?define Manufacturer="$(env.MSI_MANUFACTURER)" ?>
+ <?define Name="$(env.JOB_NAME)" ?>
<!--
Used for file and directory names. Cannot contain \ / : * ? " < > |
-->
- <?define SafeName="Pandion" ?>
+ <?define SafeName="$(env.JOB_NAME_SAFE)" ?>
<!--
- Must be two digits in the 0-255 range separated by a period.
+ Must be three digits in the 0-255 range separated by a period.
Windows Installer checks the first three numbers when comparing versions.
- The third number is set below as the build number and must be in the 0-65535 range.
-->
- <?define BaseVersion="$(env.VERSION_MAJOR).$(env.VERSION_MINOR)" ?>
-
- <!--
- Hudson continuous integration adds a sequence identifier to the version number.
- -->
- <?ifdef env.BUILD_NUMBER ?>
- <?define Version="$(var.BaseVersion).$(env.BUILD_NUMBER)" ?>
- <?else?>
- <?define Version="$(var.BaseVersion).0" ?>
- <?endif?>
+ <?define Version="$(env.VERSION)" ?>
<!--
Unique for each application to prevent update conflicts.
-->
- <?define UpgradeCode="{9F661F94-F17F-4F5C-B1C8-2955C85C8FE9}" ?>
-</Include>
+ <?define UpgradeCode="$(env.MSI_GUID)" ?>
+</Include>
View
51 build_config.bat
@@ -5,27 +5,40 @@
@ECHO OFF
SET BUILD_CONFIG=1
-:: Versioning settings
-SET VERSION_MAJOR=2
-SET VERSION_MINOR=6
+:: Notes:
+:: - Hudson parametrized builds can specify these options automatically.
+:: - All settings can be overridden by setting them before this script is executed.
+:: - The safe job name is used for files and directories so it cannot contain \ / : * ? " < > |
+:: - The build number defaults to 0 if unspecified through the command line or Hudson.
-:: Hudson sets its environment variables but defaults are provided for manual builds.
-IF NOT DEFINED BUILD_NUMBER SET BUILD_NUMBER=0
-IF NOT DEFINED HUDSON_URL SET HUDSON_URL=http://build.pandion.im/
+:: Name and Version
IF NOT DEFINED JOB_NAME SET JOB_NAME=Pandion
+IF NOT DEFINED JOB_NAME_SAFE SET JOB_NAME_SAFE=Pandion
+IF NOT DEFINED VERSION_MAJOR SET VERSION_MAJOR=2
+IF NOT DEFINED VERSION_MINOR SET VERSION_MINOR=6
+IF NOT DEFINED VERSION_BUILD IF DEFINED BUILD_NUMBER SET VERSION_BUILD=%BUILD_NUMBER%
+IF NOT DEFINED VERSION_BUILD SET VERSION_BUILD=0
+
+:: Hudson
+IF NOT DEFINED HUDSON_URL SET HUDSON_URL=http://build.pandion.im/
-:: Host settings
-SET HOST_COMMENTS=http://pandion.im/
-SET HOST_COMPANY=%JOB_NAME%
-SET HOST_DESCRIPTION=%JOB_NAME% Instant Messenger
-SET HOST_COPYRIGHT=%JOB_NAME%
+:: VC++
+IF NOT DEFINED HOST_COMMENTS SET HOST_COMMENTS=http://pandion.im/
+IF NOT DEFINED HOST_COMPANY SET HOST_COMPANY=%JOB_NAME%
+IF NOT DEFINED HOST_DESCRIPTION SET HOST_DESCRIPTION=%JOB_NAME% Instant Messenger
+IF NOT DEFINED HOST_COPYRIGHT SET HOST_COPYRIGHT=%JOB_NAME%
-:: WiX settings
-SET VERSION=%VERSION_MAJOR%.%VERSION_MINOR%.%BUILD_NUMBER%
-SET PACKAGE=%JOB_NAME%_%VERSION%.msi
+:: WiX
+IF NOT DEFINED VERSION SET VERSION=%VERSION_MAJOR%.%VERSION_MINOR%.%VERSION_BUILD%
+IF NOT DEFINED PACKAGE SET PACKAGE=%JOB_NAME%_%VERSION%.msi
+IF NOT DEFINED MSI_GUID SET MSI_GUID={9F661F94-F17F-4F5C-B1C8-2955C85C8FE9}
+IF NOT DEFINED MSI_HELP_URL SET MSI_HELP_URL=http://pandion.im/support
+IF NOT DEFINED MSI_INFO_URL SET MSI_INFO_URL=http://pandion.im/about
+IF NOT DEFINED MSI_MANUFACTURER SET MSI_MANUFACTURER=%JOB_NAME%
-:: Appcast settings
-SET APPCAST_LOCAL_FILE=../WiX/%PACKAGE%
-SET APPCAST_DOWNLOAD_URL=http://downloads.sourceforge.net/project/pandion/builds/%PACKAGE%
-SET APPCAST_INFO_URL=%HUDSON_URL%job/%JOB_NAME%/%BUILD_NUMBER%/changes
-SET APPCAST_FEED_URL=http://feeds.feedburner.com/pandionupdates
+:: Appcaster
+IF NOT DEFINED APPCAST_LOCAL_FILE SET APPCAST_LOCAL_FILE=../WiX/%PACKAGE%
+IF NOT DEFINED APPCAST_DOWNLOAD_URL SET APPCAST_DOWNLOAD_URL=http://downloads.sourceforge.net/project/pandion/builds/%PACKAGE%
+IF NOT DEFINED APPCAST_INFO_URL SET APPCAST_INFO_URL=%HUDSON_URL%job/%JOB_NAME%/%VERSION_BUILD%/changes
+IF NOT DEFINED APPCAST_FEED_URL SET APPCAST_FEED_URL=http://feeds.feedburner.com/pandionupdates
+IF NOT DEFINED APPCAST_TRACK SET APPCAST_TRACK=development

0 comments on commit 6b4812d

Please sign in to comment.