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 nvaccess#6204. PR nvaccess#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
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion launcher/nvdaLauncher.nsi
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
13 changes: 13 additions & 0 deletions nvdaHelper/archBuild_sconscript
Original file line number Diff line number Diff line change
Expand Up @@ -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':
Expand Down
1 change: 1 addition & 0 deletions nvdaHelper/client/sconscript
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions nvdaHelper/local/sconscript
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ displayModelRPCHeader,displayModelRPCClientSource=env.MSRPCStubs(
localLib=env.SharedLibrary(
target="nvdaHelperLocal",
source=[
env['projectResFile'],
"nvdaHelperLocal.cpp",
"beeps.cpp",
vbufRPCClientSource,
Expand Down
19 changes: 19 additions & 0 deletions nvdaHelper/nvda.rc.subst
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion nvdaHelper/remoteLoader/sconscript
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
)

Expand Down
1 change: 1 addition & 0 deletions nvdaHelper/vbufBackends/adobeAcrobat/sconscript
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ Import([
adobeAcrobatBackendLib=env.SharedLibrary(
target="VBufBackend_adobeAcrobat",
source=[
env['projectResFile'],
"adobeAcrobat.cpp",
env.Object('_acrobatAccess_i',acrobatAccessRPCStubs[2]),
],
Expand Down
1 change: 1 addition & 0 deletions nvdaHelper/vbufBackends/adobeFlash/sconscript
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ Import([
adobeFlashBackendLib=env.SharedLibrary(
target="VBufBackend_adobeFlash",
source=[
env['projectResFile'],
"adobeFlash.cpp",
],
LIBS=[
Expand Down
1 change: 1 addition & 0 deletions nvdaHelper/vbufBackends/gecko_ia2/sconscript
Original file line number Diff line number Diff line change
Expand Up @@ -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]),
Expand Down
1 change: 1 addition & 0 deletions nvdaHelper/vbufBackends/lotusNotesRichText/sconscript
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ Import([
lotusNotesRichTextBackendLib=env.SharedLibrary(
target="VBufBackend_lotusNotesRichText",
source=[
env['projectResFile'],
"lotusNotesRichText.cpp",
],
LIBS=[
Expand Down
1 change: 1 addition & 0 deletions nvdaHelper/vbufBackends/mshtml/sconscript
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ Import([
mshtmlBackendLib=env.SharedLibrary(
target="VBufBackend_mshtml",
source=[
env['projectResFile'],
"mshtml.cpp",
"node.cpp",
],
Expand Down
1 change: 1 addition & 0 deletions nvdaHelper/vbufBackends/webKit/sconscript
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ Import([
webKitBackendLib=env.SharedLibrary(
target="VBufBackend_webKit",
source=[
env['projectResFile'],
"webKit.cpp",
],
LIBS=[
Expand Down
12 changes: 9 additions & 3 deletions sconstruct
Original file line number Diff line number Diff line change
Expand Up @@ -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 "")
Expand Down Expand Up @@ -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"]
Expand Down Expand Up @@ -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]
Expand Down Expand Up @@ -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"]])
Expand All @@ -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:
Expand Down
8 changes: 4 additions & 4 deletions source/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand Down
8 changes: 6 additions & 2 deletions source/versionInfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
4 changes: 2 additions & 2 deletions uninstaller/uninst.nsi
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 438d022

Please sign in to comment.