Remove version number from generated UWP archive.

This commit is contained in:
Josh Matthews 2020-04-17 11:32:36 -04:00
parent 0491933fb0
commit 699cf5b29b

View file

@ -70,7 +70,7 @@ PACKAGES = {
r'target\release\msi\Servo.zip',
],
'uwp': [
r'support\hololens\AppPackages\ServoApp\ServoApp_1.0.0.0_Test.zip',
r'support\hololens\AppPackages\ServoApp\FirefoxReality.zip',
],
}
@ -743,7 +743,7 @@ class PackageCommands(CommandBase):
return 0
def setup_uwp_signing(ms_app_store):
def setup_uwp_signing(ms_app_store, publisher):
# App package needs to be signed. If we find a certificate that has been installed
# already, we use it. Otherwise we create and install a temporary certificate.
@ -766,11 +766,6 @@ def setup_uwp_signing(ms_app_store):
run_powershell_cmd('Import-PfxCertificate -FilePath .\servo.pfx -CertStoreLocation Cert:\CurrentUser\My')
os.remove("servo.pfx")
# Parse appxmanifest to find the publisher name
manifest_file = path.join(os.getcwd(), 'support', 'hololens', 'ServoApp', 'Package.appxmanifest')
manifest = xml.etree.ElementTree.parse(manifest_file)
namespace = "{http://schemas.microsoft.com/appx/manifest/foundation/windows10}"
publisher = manifest.getroot().find(namespace + "Identity").attrib["Publisher"]
# Powershell command that lists all certificates for publisher
cmd = '(dir cert: -Recurse | Where-Object {$_.Issuer -eq "' + publisher + '"}).Thumbprint'
certs = list(set(run_powershell_cmd(cmd).splitlines()))
@ -806,6 +801,14 @@ def build_uwp(platforms, dev, msbuild_dir, ms_app_store):
else:
Configuration = "Release"
# Parse appxmanifest to find the publisher name and version
manifest_file = path.join(os.getcwd(), 'support', 'hololens', 'ServoApp', 'Package.appxmanifest')
manifest = xml.etree.ElementTree.parse(manifest_file)
namespace = "{http://schemas.microsoft.com/appx/manifest/foundation/windows10}"
identity = manifest.getroot().find(namespace + "Identity")
publisher = identity.attrib["Publisher"]
version = identity.attrib["Version"]
msbuild = path.join(msbuild_dir, "msbuild.exe")
build_file_template = path.join('support', 'hololens', 'package.msbuild')
with open(build_file_template) as f:
@ -820,14 +823,14 @@ def build_uwp(platforms, dev, msbuild_dir, ms_app_store):
)
build_file.close()
# Generate an appxbundle.
msbuild_args = setup_uwp_signing(ms_app_store)
msbuild_args = setup_uwp_signing(ms_app_store, publisher)
subprocess.check_call([msbuild, "/m", build_file.name] + msbuild_args)
os.unlink(build_file.name)
print("Creating ZIP")
out_dir = path.join(os.getcwd(), 'support', 'hololens', 'AppPackages', 'ServoApp')
name = 'ServoApp_1.0.0.0_%sTest' % ('Debug_' if dev else '')
name = 'ServoApp_%s_%sTest' % (version, 'Debug_' if dev else '')
artifacts_dir = path.join(out_dir, name)
zip_path = path.join(out_dir, name + ".zip")
zip_path = path.join(out_dir, "FirefoxReality.zip")
archive_deterministically(artifacts_dir, zip_path, prepend_path='servo/')
print("Packaged Servo into " + zip_path)