Skip to content

Commit

Permalink
Provide programmatic version information in all of our executables an…
Browse files Browse the repository at this point in the history
…d 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.
  • Loading branch information
michaelDCurran authored and jcsteh committed Sep 1, 2016
1 parent 7654d37 commit 438d022
Show file tree
Hide file tree
Showing 18 changed files with 65 additions and 13 deletions.
1 change: 1 addition & 0 deletions appveyor.yml
Expand Up @@ -63,6 +63,7 @@ build_script:
} }
$sconsArgs += ' publisher="NV Access"' $sconsArgs += ' publisher="NV Access"'
$sconsArgs += " certFile=appveyor\authenticode.pfx certTimestampServer=http://timestamp.digicert.com" $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. # 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. # It's possible to work around this, but the workarounds have annoying side effects.
Set-AppveyorBuildVariable "sconsArgs" $sconsArgs Set-AppveyorBuildVariable "sconsArgs" $sconsArgs
Expand Down
2 changes: 1 addition & 1 deletion launcher/nvdaLauncher.nsi
Expand Up @@ -13,7 +13,7 @@ ReserveFile "${NSISDIR}\Plugins\banner.dll"
ReserveFile "..\miscDeps\launcher\nvda_logo.wav" ReserveFile "..\miscDeps\launcher\nvda_logo.wav"


Name "NVDA" 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 "ProductName" "NVDA"
VIAddVersionKey "LegalCopyright" "${COPYRIGHT}" VIAddVersionKey "LegalCopyright" "${COPYRIGHT}"
VIAddVersionKey "FileDescription" "NVDA launcher file" VIAddVersionKey "FileDescription" "NVDA launcher file"
Expand Down
13 changes: 13 additions & 0 deletions nvdaHelper/archBuild_sconscript
Expand Up @@ -65,6 +65,19 @@ env.Append(LINKFLAGS='/OPT:REF') #having symbols usually turns this off but we h


Export('env') 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') acrobatAccessRPCStubs=env.SConscript('acrobatAccess_sconscript')
Export('acrobatAccessRPCStubs') Export('acrobatAccessRPCStubs')
if TARGET_ARCH=='x86': if TARGET_ARCH=='x86':
Expand Down
1 change: 1 addition & 0 deletions nvdaHelper/client/sconscript
Expand Up @@ -33,6 +33,7 @@ clientLibName="nvdaControllerClient%s"%('64' if env['TARGET_ARCH']=='x86_64' els
clientLib=env.SharedLibrary( clientLib=env.SharedLibrary(
target=clientLibName, target=clientLibName,
source=[ source=[
env['projectResFile'],
"client.cpp", "client.cpp",
winIPCUtilsObj, winIPCUtilsObj,
controllerRPCClientSource, controllerRPCClientSource,
Expand Down
1 change: 1 addition & 0 deletions nvdaHelper/local/sconscript
Expand Up @@ -70,6 +70,7 @@ displayModelRPCHeader,displayModelRPCClientSource=env.MSRPCStubs(
localLib=env.SharedLibrary( localLib=env.SharedLibrary(
target="nvdaHelperLocal", target="nvdaHelperLocal",
source=[ source=[
env['projectResFile'],
"nvdaHelperLocal.cpp", "nvdaHelperLocal.cpp",
"beeps.cpp", "beeps.cpp",
vbufRPCClientSource, vbufRPCClientSource,
Expand Down
19 changes: 19 additions & 0 deletions 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
1 change: 1 addition & 0 deletions nvdaHelper/remote/sconscript
Expand Up @@ -75,6 +75,7 @@ ia2utilsObj=env.Object("./ia2utils","../common/ia2utils.cpp")
remoteLib=env.SharedLibrary( remoteLib=env.SharedLibrary(
target="nvdaHelperRemote", target="nvdaHelperRemote",
source=[ source=[
env['projectResFile'],
"injection.cpp", "injection.cpp",
"log.cpp", "log.cpp",
"inProcess.cpp", "inProcess.cpp",
Expand Down
2 changes: 1 addition & 1 deletion nvdaHelper/remoteLoader/sconscript
Expand Up @@ -19,7 +19,7 @@ env.Append(LINKFLAGS='/subsystem:windows')


remoteLoaderProgram=env.Program( remoteLoaderProgram=env.Program(
target='nvdaHelperRemoteLoader', target='nvdaHelperRemoteLoader',
source=['loader.cpp'], source=[env['projectResFile'],'loader.cpp'],
LIBS=[remoteLib[2],'kernel32'], LIBS=[remoteLib[2],'kernel32'],
) )


Expand Down
1 change: 1 addition & 0 deletions nvdaHelper/vbufBackends/adobeAcrobat/sconscript
Expand Up @@ -21,6 +21,7 @@ Import([
adobeAcrobatBackendLib=env.SharedLibrary( adobeAcrobatBackendLib=env.SharedLibrary(
target="VBufBackend_adobeAcrobat", target="VBufBackend_adobeAcrobat",
source=[ source=[
env['projectResFile'],
"adobeAcrobat.cpp", "adobeAcrobat.cpp",
env.Object('_acrobatAccess_i',acrobatAccessRPCStubs[2]), env.Object('_acrobatAccess_i',acrobatAccessRPCStubs[2]),
], ],
Expand Down
1 change: 1 addition & 0 deletions nvdaHelper/vbufBackends/adobeFlash/sconscript
Expand Up @@ -20,6 +20,7 @@ Import([
adobeFlashBackendLib=env.SharedLibrary( adobeFlashBackendLib=env.SharedLibrary(
target="VBufBackend_adobeFlash", target="VBufBackend_adobeFlash",
source=[ source=[
env['projectResFile'],
"adobeFlash.cpp", "adobeFlash.cpp",
], ],
LIBS=[ LIBS=[
Expand Down
1 change: 1 addition & 0 deletions nvdaHelper/vbufBackends/gecko_ia2/sconscript
Expand Up @@ -23,6 +23,7 @@ ia2utilsObj=env.Object("./ia2utils","../../common/ia2utils.cpp")
geckoBackendLib=env.SharedLibrary( geckoBackendLib=env.SharedLibrary(
target="VBufBackend_gecko_ia2", target="VBufBackend_gecko_ia2",
source=[ source=[
env['projectResFile'],
"gecko_ia2.cpp", "gecko_ia2.cpp",
ia2utilsObj, ia2utilsObj,
env.Object('_ia2_i',ia2RPCStubs[3]), env.Object('_ia2_i',ia2RPCStubs[3]),
Expand Down
1 change: 1 addition & 0 deletions nvdaHelper/vbufBackends/lotusNotesRichText/sconscript
Expand Up @@ -20,6 +20,7 @@ Import([
lotusNotesRichTextBackendLib=env.SharedLibrary( lotusNotesRichTextBackendLib=env.SharedLibrary(
target="VBufBackend_lotusNotesRichText", target="VBufBackend_lotusNotesRichText",
source=[ source=[
env['projectResFile'],
"lotusNotesRichText.cpp", "lotusNotesRichText.cpp",
], ],
LIBS=[ LIBS=[
Expand Down
1 change: 1 addition & 0 deletions nvdaHelper/vbufBackends/mshtml/sconscript
Expand Up @@ -20,6 +20,7 @@ Import([
mshtmlBackendLib=env.SharedLibrary( mshtmlBackendLib=env.SharedLibrary(
target="VBufBackend_mshtml", target="VBufBackend_mshtml",
source=[ source=[
env['projectResFile'],
"mshtml.cpp", "mshtml.cpp",
"node.cpp", "node.cpp",
], ],
Expand Down
1 change: 1 addition & 0 deletions nvdaHelper/vbufBackends/webKit/sconscript
Expand Up @@ -20,6 +20,7 @@ Import([
webKitBackendLib=env.SharedLibrary( webKitBackendLib=env.SharedLibrary(
target="VBufBackend_webKit", target="VBufBackend_webKit",
source=[ source=[
env['projectResFile'],
"webKit.cpp", "webKit.cpp",
], ],
LIBS=[ LIBS=[
Expand Down
12 changes: 9 additions & 3 deletions sconstruct
Expand Up @@ -61,6 +61,7 @@ keyCommandsLangBlacklist=set([])


vars = Variables() vars = Variables()
vars.Add("version", "The version of this build", versionInfo.version) 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(BoolVariable("release", "Whether this is a release version", False))
vars.Add("publisher", "The publisher of this build", versionInfo.publisher) 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 "") vars.Add("updateVersionType", "The version type for which to check for updates", versionInfo.updateVersionType or "")
Expand Down Expand Up @@ -91,7 +92,11 @@ if len(unknown)>0:
env['ENV']['PYTHONPATH']=Dir('#miscDeps/python').abspath env['ENV']['PYTHONPATH']=Dir('#miscDeps/python').abspath


env["copyright"]=versionInfo.copyright 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 = env["version"]
version_build = env["version_build"]
release = env["release"] release = env["release"]
publisher = env["publisher"] publisher = env["publisher"]
certFile = env["certFile"] certFile = env["certFile"]
Expand Down Expand Up @@ -195,7 +200,8 @@ def NVDADistGenerator(target, source, env, for_signature):
'version = {version!r}\r\n' 'version = {version!r}\r\n'
'publisher = {publisher!r}\r\n' 'publisher = {publisher!r}\r\n'
'updateVersionType = {updateVersionType!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, "&&", buildCmd = ["cd", source[0].path, "&&",
sys.executable] sys.executable]
Expand Down Expand Up @@ -265,7 +271,7 @@ env["BUILDERS"]["ZipArchive"] = Builder(action=ZipArchiveAction)
uninstFile=File("dist/uninstall.exe") uninstFile=File("dist/uninstall.exe")
uninstGen = env.Command(File("uninstaller/uninstGen.exe"), "uninstaller/uninst.nsi", uninstGen = env.Command(File("uninstaller/uninstGen.exe"), "uninstaller/uninst.nsi",
[[makensis, "/V2", [[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, "/DUNINSTEXE=%s"%uninstFile.abspath,
"/DINSTEXE=${TARGET.abspath}", "/DINSTEXE=${TARGET.abspath}",
"$SOURCE"]]) "$SOURCE"]])
Expand All @@ -282,7 +288,7 @@ env.Clean([dist], buildDir)


launcher = env.Command(outputDir.File("%s.exe" % outFilePrefix), ["launcher/nvdaLauncher.nsi", dist], launcher = env.Command(outputDir.File("%s.exe" % outFilePrefix), ["launcher/nvdaLauncher.nsi", dist],
[[makensis, "/V2", [[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}", "/DNVDADistDir=${SOURCES[1].abspath}", "/DLAUNCHEREXE=${TARGET.abspath}",
"$SOURCE"]]) "$SOURCE"]])
if certFile: if certFile:
Expand Down
8 changes: 4 additions & 4 deletions source/setup.py
Expand Up @@ -171,7 +171,7 @@ def getRecursiveDataFiles(dest,source,excludes=()):
"dest_base":"nvda_noUIAccess", "dest_base":"nvda_noUIAccess",
"uac_info": ("asInvoker", False), "uac_info": ("asInvoker", False),
"icon_resources":[(1,"images/nvda.ico")], "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", "description":"NVDA application",
"product_version":version, "product_version":version,
"copyright":copyright, "copyright":copyright,
Expand All @@ -181,7 +181,7 @@ def getRecursiveDataFiles(dest,source,excludes=()):
{ {
"script": "nvda_slave.pyw", "script": "nvda_slave.pyw",
"icon_resources": [(1,"images/nvda.ico")], "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, "description": name,
"product_version": version, "product_version": version,
"copyright": copyright, "copyright": copyright,
Expand All @@ -192,7 +192,7 @@ def getRecursiveDataFiles(dest,source,excludes=()):
# uiAccess will be enabled at runtime if appropriate. # uiAccess will be enabled at runtime if appropriate.
"uac_info": ("asInvoker", False), "uac_info": ("asInvoker", False),
"icon_resources": [(1,"images/nvda.ico")], "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", "description": "NVDA Ease of Access proxy",
"product_version": version, "product_version": version,
"copyright": copyright, "copyright": copyright,
Expand All @@ -202,7 +202,7 @@ def getRecursiveDataFiles(dest,source,excludes=()):
service=[{ service=[{
"modules": ["nvda_service"], "modules": ["nvda_service"],
"icon_resources": [(1, "images/nvda.ico")], "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", "description": "NVDA service",
"product_version": version, "product_version": version,
"copyright": copyright, "copyright": copyright,
Expand Down
8 changes: 6 additions & 2 deletions source/versionInfo.py
Expand Up @@ -31,11 +31,15 @@ def _updateVersionFromVCS():
# Otherwise, py2exe will break. # Otherwise, py2exe will break.
name="NVDA" name="NVDA"
longName=_("NonVisual Desktop Access") 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" publisher="unknown"
updateVersionType=None updateVersionType=None
try: try:
from _buildVersion import version, publisher, updateVersionType from _buildVersion import version, publisher, updateVersionType, version_build
except ImportError: except ImportError:
_updateVersionFromVCS() _updateVersionFromVCS()
description=_("A free and open source screen reader for Microsoft Windows") description=_("A free and open source screen reader for Microsoft Windows")
Expand Down
4 changes: 2 additions & 2 deletions uninstaller/uninst.nsi
Expand Up @@ -16,10 +16,10 @@ RequestExecutionLevel user
ReserveFile "..\miscDeps\uninstaller\UAC.dll" ReserveFile "..\miscDeps\uninstaller\UAC.dll"


Name "${appName}" 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 "ProductName" "${appName}"
VIAddVersionKey "LegalCopyright" "${COPYRIGHT}" VIAddVersionKey "LegalCopyright" "${COPYRIGHT}"
VIAddVersionKey "FileDescription" "${appName} installer" VIAddVersionKey "FileDescription" "${appName} uninstaller"
VIAddVersionKey "ProductVersion" "${VERSION}" VIAddVersionKey "ProductVersion" "${VERSION}"


;Minimal installer to generate uninstaller ;Minimal installer to generate uninstaller
Expand Down

0 comments on commit 438d022

Please sign in to comment.