From 438d0221e981650d153953b9bcdcc2c9c948f24f Mon Sep 17 00:00:00 2001 From: Michael Curran Date: Thu, 1 Sep 2016 15:58:03 +1000 Subject: [PATCH] Provide programmatic version information in all of our executables and dlls. Provide proper version information in all executables and dlls: year, major, minor, build. Build is conveyed to scons via a version_build argument. AppVeyor uses its own build number for this. Issue #6204. PR #6205. --- appveyor.yml | 1 + launcher/nvdaLauncher.nsi | 2 +- nvdaHelper/archBuild_sconscript | 13 +++++++++++++ nvdaHelper/client/sconscript | 1 + nvdaHelper/local/sconscript | 1 + nvdaHelper/nvda.rc.subst | 19 +++++++++++++++++++ nvdaHelper/remote/sconscript | 1 + nvdaHelper/remoteLoader/sconscript | 2 +- .../vbufBackends/adobeAcrobat/sconscript | 1 + nvdaHelper/vbufBackends/adobeFlash/sconscript | 1 + nvdaHelper/vbufBackends/gecko_ia2/sconscript | 1 + .../lotusNotesRichText/sconscript | 1 + nvdaHelper/vbufBackends/mshtml/sconscript | 1 + nvdaHelper/vbufBackends/webKit/sconscript | 1 + sconstruct | 12 +++++++++--- source/setup.py | 8 ++++---- source/versionInfo.py | 8 ++++++-- uninstaller/uninst.nsi | 4 ++-- 18 files changed, 65 insertions(+), 13 deletions(-) create mode 100644 nvdaHelper/nvda.rc.subst diff --git a/appveyor.yml b/appveyor.yml index 29ed50060b3..07a4430d3d7 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -63,6 +63,7 @@ build_script: } $sconsArgs += ' publisher="NV Access"' $sconsArgs += " certFile=appveyor\authenticode.pfx certTimestampServer=http://timestamp.digicert.com" + $sconsArgs += " version_build=$env:APPVEYOR_BUILD_NUMBER" # We use cmd to run scons because PowerShell throws exceptions if warnings get dumped to stderr. # It's possible to work around this, but the workarounds have annoying side effects. Set-AppveyorBuildVariable "sconsArgs" $sconsArgs diff --git a/launcher/nvdaLauncher.nsi b/launcher/nvdaLauncher.nsi index 4dc4aa0439b..d1ae05da404 100644 --- a/launcher/nvdaLauncher.nsi +++ b/launcher/nvdaLauncher.nsi @@ -13,7 +13,7 @@ ReserveFile "${NSISDIR}\Plugins\banner.dll" ReserveFile "..\miscDeps\launcher\nvda_logo.wav" Name "NVDA" -VIProductVersion "0.0.0.0" ;Needs to be here so other version info shows up +VIProductVersion "${VERSION_YEAR}.${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_BUILD}" ;Needs to be here so other version info shows up VIAddVersionKey "ProductName" "NVDA" VIAddVersionKey "LegalCopyright" "${COPYRIGHT}" VIAddVersionKey "FileDescription" "NVDA launcher file" diff --git a/nvdaHelper/archBuild_sconscript b/nvdaHelper/archBuild_sconscript index af7e5ab4ea5..dbdca86fc43 100644 --- a/nvdaHelper/archBuild_sconscript +++ b/nvdaHelper/archBuild_sconscript @@ -65,6 +65,19 @@ env.Append(LINKFLAGS='/OPT:REF') #having symbols usually turns this off but we h Export('env') +import versionInfo +projectRCSubstDict={ + '%version_year%':env['version_year'], + '%version_major%':env['version_major'], + '%version_minor%':env['version_minor'], + '%version_build%':env['version_build'], + '%copyright%':env['copyright'], + '%publisher%':env['publisher'], + '%version%':env['version'], + '%productName%':"%s (%s)"%(versionInfo.name,versionInfo.longName), +} +env['projectResFile']=env.RES(env.Substfile('nvda.rc.subst',SUBST_DICT=projectRCSubstDict)) + acrobatAccessRPCStubs=env.SConscript('acrobatAccess_sconscript') Export('acrobatAccessRPCStubs') if TARGET_ARCH=='x86': diff --git a/nvdaHelper/client/sconscript b/nvdaHelper/client/sconscript index e4d94d1b9c0..df84e632396 100644 --- a/nvdaHelper/client/sconscript +++ b/nvdaHelper/client/sconscript @@ -33,6 +33,7 @@ clientLibName="nvdaControllerClient%s"%('64' if env['TARGET_ARCH']=='x86_64' els clientLib=env.SharedLibrary( target=clientLibName, source=[ + env['projectResFile'], "client.cpp", winIPCUtilsObj, controllerRPCClientSource, diff --git a/nvdaHelper/local/sconscript b/nvdaHelper/local/sconscript index 8814fa18e35..78992d3d3f4 100644 --- a/nvdaHelper/local/sconscript +++ b/nvdaHelper/local/sconscript @@ -70,6 +70,7 @@ displayModelRPCHeader,displayModelRPCClientSource=env.MSRPCStubs( localLib=env.SharedLibrary( target="nvdaHelperLocal", source=[ + env['projectResFile'], "nvdaHelperLocal.cpp", "beeps.cpp", vbufRPCClientSource, diff --git a/nvdaHelper/nvda.rc.subst b/nvdaHelper/nvda.rc.subst new file mode 100644 index 00000000000..c2eef05c861 --- /dev/null +++ b/nvdaHelper/nvda.rc.subst @@ -0,0 +1,19 @@ +1 VERSIONINFO + FILEVERSION %version_year%,%version_major%,%version_minor%,%version_build% + PRODUCTVERSION %version_year%,%version_major%,%version_minor%,%version_build% +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "CompanyName", "%publisher%" + VALUE "LegalCopyright", "%copyright%" + VALUE "ProductName", "%productName%" + VALUE "ProductVersion", "%version%" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END diff --git a/nvdaHelper/remote/sconscript b/nvdaHelper/remote/sconscript index aa9121b7fea..de4998c5a7a 100644 --- a/nvdaHelper/remote/sconscript +++ b/nvdaHelper/remote/sconscript @@ -75,6 +75,7 @@ ia2utilsObj=env.Object("./ia2utils","../common/ia2utils.cpp") remoteLib=env.SharedLibrary( target="nvdaHelperRemote", source=[ + env['projectResFile'], "injection.cpp", "log.cpp", "inProcess.cpp", diff --git a/nvdaHelper/remoteLoader/sconscript b/nvdaHelper/remoteLoader/sconscript index 466a066ce46..79c7b649d94 100644 --- a/nvdaHelper/remoteLoader/sconscript +++ b/nvdaHelper/remoteLoader/sconscript @@ -19,7 +19,7 @@ env.Append(LINKFLAGS='/subsystem:windows') remoteLoaderProgram=env.Program( target='nvdaHelperRemoteLoader', - source=['loader.cpp'], + source=[env['projectResFile'],'loader.cpp'], LIBS=[remoteLib[2],'kernel32'], ) diff --git a/nvdaHelper/vbufBackends/adobeAcrobat/sconscript b/nvdaHelper/vbufBackends/adobeAcrobat/sconscript index 3034f8d89e9..9e67df73a77 100644 --- a/nvdaHelper/vbufBackends/adobeAcrobat/sconscript +++ b/nvdaHelper/vbufBackends/adobeAcrobat/sconscript @@ -21,6 +21,7 @@ Import([ adobeAcrobatBackendLib=env.SharedLibrary( target="VBufBackend_adobeAcrobat", source=[ + env['projectResFile'], "adobeAcrobat.cpp", env.Object('_acrobatAccess_i',acrobatAccessRPCStubs[2]), ], diff --git a/nvdaHelper/vbufBackends/adobeFlash/sconscript b/nvdaHelper/vbufBackends/adobeFlash/sconscript index 88254cf70a5..ec313698453 100644 --- a/nvdaHelper/vbufBackends/adobeFlash/sconscript +++ b/nvdaHelper/vbufBackends/adobeFlash/sconscript @@ -20,6 +20,7 @@ Import([ adobeFlashBackendLib=env.SharedLibrary( target="VBufBackend_adobeFlash", source=[ + env['projectResFile'], "adobeFlash.cpp", ], LIBS=[ diff --git a/nvdaHelper/vbufBackends/gecko_ia2/sconscript b/nvdaHelper/vbufBackends/gecko_ia2/sconscript index dc002bcc9cc..09f637c79e3 100644 --- a/nvdaHelper/vbufBackends/gecko_ia2/sconscript +++ b/nvdaHelper/vbufBackends/gecko_ia2/sconscript @@ -23,6 +23,7 @@ ia2utilsObj=env.Object("./ia2utils","../../common/ia2utils.cpp") geckoBackendLib=env.SharedLibrary( target="VBufBackend_gecko_ia2", source=[ + env['projectResFile'], "gecko_ia2.cpp", ia2utilsObj, env.Object('_ia2_i',ia2RPCStubs[3]), diff --git a/nvdaHelper/vbufBackends/lotusNotesRichText/sconscript b/nvdaHelper/vbufBackends/lotusNotesRichText/sconscript index 4b572ee9473..8a8f11b1402 100644 --- a/nvdaHelper/vbufBackends/lotusNotesRichText/sconscript +++ b/nvdaHelper/vbufBackends/lotusNotesRichText/sconscript @@ -20,6 +20,7 @@ Import([ lotusNotesRichTextBackendLib=env.SharedLibrary( target="VBufBackend_lotusNotesRichText", source=[ + env['projectResFile'], "lotusNotesRichText.cpp", ], LIBS=[ diff --git a/nvdaHelper/vbufBackends/mshtml/sconscript b/nvdaHelper/vbufBackends/mshtml/sconscript index 99c0e281481..23aef35b28c 100644 --- a/nvdaHelper/vbufBackends/mshtml/sconscript +++ b/nvdaHelper/vbufBackends/mshtml/sconscript @@ -20,6 +20,7 @@ Import([ mshtmlBackendLib=env.SharedLibrary( target="VBufBackend_mshtml", source=[ + env['projectResFile'], "mshtml.cpp", "node.cpp", ], diff --git a/nvdaHelper/vbufBackends/webKit/sconscript b/nvdaHelper/vbufBackends/webKit/sconscript index 7d86ec4cfb5..ee4cea91a19 100644 --- a/nvdaHelper/vbufBackends/webKit/sconscript +++ b/nvdaHelper/vbufBackends/webKit/sconscript @@ -20,6 +20,7 @@ Import([ webKitBackendLib=env.SharedLibrary( target="VBufBackend_webKit", source=[ + env['projectResFile'], "webKit.cpp", ], LIBS=[ diff --git a/sconstruct b/sconstruct index 2a11b4fa5bb..e5a1aee9e27 100755 --- a/sconstruct +++ b/sconstruct @@ -61,6 +61,7 @@ keyCommandsLangBlacklist=set([]) vars = Variables() vars.Add("version", "The version of this build", versionInfo.version) +vars.Add("version_build", "A unique number for this build.", "0") vars.Add(BoolVariable("release", "Whether this is a release version", False)) vars.Add("publisher", "The publisher of this build", versionInfo.publisher) vars.Add("updateVersionType", "The version type for which to check for updates", versionInfo.updateVersionType or "") @@ -91,7 +92,11 @@ if len(unknown)>0: env['ENV']['PYTHONPATH']=Dir('#miscDeps/python').abspath env["copyright"]=versionInfo.copyright +env['version_year']=versionInfo.version_year +env['version_major']=versionInfo.version_major +env['version_minor']=versionInfo.version_minor version = env["version"] +version_build = env["version_build"] release = env["release"] publisher = env["publisher"] certFile = env["certFile"] @@ -195,7 +200,8 @@ def NVDADistGenerator(target, source, env, for_signature): 'version = {version!r}\r\n' 'publisher = {publisher!r}\r\n' 'updateVersionType = {updateVersionType!r}\r\n' - .format(version=version, publisher=publisher, updateVersionType=updateVersionType))] + 'version_build = {version_build!r}\r\n' + .format(version=version, publisher=publisher, updateVersionType=updateVersionType,version_build=version_build))] buildCmd = ["cd", source[0].path, "&&", sys.executable] @@ -265,7 +271,7 @@ env["BUILDERS"]["ZipArchive"] = Builder(action=ZipArchiveAction) uninstFile=File("dist/uninstall.exe") uninstGen = env.Command(File("uninstaller/uninstGen.exe"), "uninstaller/uninst.nsi", [[makensis, "/V2", - "/DVERSION=$version", '/DPUBLISHER="$publisher"','/DCOPYRIGHT="$copyright"', + "/DVERSION=$version", '/DPUBLISHER="$publisher"','/DCOPYRIGHT="$copyright"','/DVERSION_YEAR="$version_year"','/DVERSION_MAJOR="$version_major"','/DVERSION_MINOR="$version_minor"','/DVERSION_BUILD="$version_build"', "/DUNINSTEXE=%s"%uninstFile.abspath, "/DINSTEXE=${TARGET.abspath}", "$SOURCE"]]) @@ -282,7 +288,7 @@ env.Clean([dist], buildDir) launcher = env.Command(outputDir.File("%s.exe" % outFilePrefix), ["launcher/nvdaLauncher.nsi", dist], [[makensis, "/V2", - "/DVERSION=$version", '/DPUBLISHER="$publisher"','/DCOPYRIGHT="$copyright"', + "/DVERSION=$version", '/DPUBLISHER="$publisher"','/DCOPYRIGHT="$copyright"','/DVERSION_YEAR="$version_year"','/DVERSION_MAJOR="$version_major"','/DVERSION_MINOR="$version_minor"','/DVERSION_BUILD="$version_build"', "/DNVDADistDir=${SOURCES[1].abspath}", "/DLAUNCHEREXE=${TARGET.abspath}", "$SOURCE"]]) if certFile: diff --git a/source/setup.py b/source/setup.py index dca41e1b9f9..ecc4820e38f 100755 --- a/source/setup.py +++ b/source/setup.py @@ -171,7 +171,7 @@ def getRecursiveDataFiles(dest,source,excludes=()): "dest_base":"nvda_noUIAccess", "uac_info": ("asInvoker", False), "icon_resources":[(1,"images/nvda.ico")], - "version":"0.0.0.0", + "version":"%s.%s.%s.%s"%(version_year,version_major,version_minor,version_build), "description":"NVDA application", "product_version":version, "copyright":copyright, @@ -181,7 +181,7 @@ def getRecursiveDataFiles(dest,source,excludes=()): { "script": "nvda_slave.pyw", "icon_resources": [(1,"images/nvda.ico")], - "version": "0.0.0.0", + "version":"%s.%s.%s.%s"%(version_year,version_major,version_minor,version_build), "description": name, "product_version": version, "copyright": copyright, @@ -192,7 +192,7 @@ def getRecursiveDataFiles(dest,source,excludes=()): # uiAccess will be enabled at runtime if appropriate. "uac_info": ("asInvoker", False), "icon_resources": [(1,"images/nvda.ico")], - "version": "0.0.0.0", + "version":"%s.%s.%s.%s"%(version_year,version_major,version_minor,version_build), "description": "NVDA Ease of Access proxy", "product_version": version, "copyright": copyright, @@ -202,7 +202,7 @@ def getRecursiveDataFiles(dest,source,excludes=()): service=[{ "modules": ["nvda_service"], "icon_resources": [(1, "images/nvda.ico")], - "version": "0.0.0.0", + "version":"%s.%s.%s.%s"%(version_year,version_major,version_minor,version_build), "description": "NVDA service", "product_version": version, "copyright": copyright, diff --git a/source/versionInfo.py b/source/versionInfo.py index 4ef24d5a1e5..a01da75c42e 100644 --- a/source/versionInfo.py +++ b/source/versionInfo.py @@ -31,11 +31,15 @@ def _updateVersionFromVCS(): # Otherwise, py2exe will break. name="NVDA" longName=_("NonVisual Desktop Access") -version="2016.4dev" +version_year=2016 +version_major=4 +version_minor=0 +version_build=0 +version="%s.%s.%sdev"%(version_year,version_major,version_minor) publisher="unknown" updateVersionType=None try: - from _buildVersion import version, publisher, updateVersionType + from _buildVersion import version, publisher, updateVersionType, version_build except ImportError: _updateVersionFromVCS() description=_("A free and open source screen reader for Microsoft Windows") diff --git a/uninstaller/uninst.nsi b/uninstaller/uninst.nsi index f38b9cbb2c8..5ab1f4a9608 100644 --- a/uninstaller/uninst.nsi +++ b/uninstaller/uninst.nsi @@ -16,10 +16,10 @@ RequestExecutionLevel user ReserveFile "..\miscDeps\uninstaller\UAC.dll" Name "${appName}" -VIProductVersion "0.0.0.0" ;Needs to be here so other version info shows up +VIProductVersion "${VERSION_YEAR}.${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_BUILD}" ;Needs to be here so other version info shows up VIAddVersionKey "ProductName" "${appName}" VIAddVersionKey "LegalCopyright" "${COPYRIGHT}" -VIAddVersionKey "FileDescription" "${appName} installer" +VIAddVersionKey "FileDescription" "${appName} uninstaller" VIAddVersionKey "ProductVersion" "${VERSION}" ;Minimal installer to generate uninstaller