mirror of
https://github.com/servo/servo.git
synced 2025-07-23 07:13:52 +01:00
Remove UWP / Hololens support
This commit is contained in:
parent
041d95e0f4
commit
c58d74fe62
97 changed files with 54 additions and 7084 deletions
|
@ -36,9 +36,6 @@ six == 1.15
|
|||
# For sending build notifications.
|
||||
notify-py == 0.3.42
|
||||
|
||||
# For formatting C++ files.
|
||||
clang-format ~= 16.0.0
|
||||
|
||||
# A few more requirements for tidy.
|
||||
voluptuous == 0.12.1
|
||||
PyYAML == 5.4
|
||||
|
|
|
@ -143,48 +143,6 @@ class MachCommands(CommandBase):
|
|||
|
||||
env['PKG_CONFIG_ALLOW_CROSS'] = "1"
|
||||
|
||||
if self.is_uwp_build:
|
||||
# Ensure libstd is ready for the new UWP target.
|
||||
check_call(["rustup", "component", "add", "rust-src"])
|
||||
|
||||
# Don't try and build a desktop port.
|
||||
libsimpleservo = True
|
||||
|
||||
arches = {
|
||||
"aarch64": {
|
||||
"angle": "arm64",
|
||||
"gst": "ARM64",
|
||||
"gst_root": "arm64",
|
||||
},
|
||||
"x86_64": {
|
||||
"angle": "x64",
|
||||
"gst": "X86_64",
|
||||
"gst_root": "x64",
|
||||
},
|
||||
}
|
||||
arch = arches.get(target_triple.split('-')[0])
|
||||
if not arch:
|
||||
print("Unsupported UWP target.")
|
||||
sys.exit(1)
|
||||
|
||||
# Ensure that the NuGet ANGLE package containing libEGL is accessible
|
||||
# to the Rust linker.
|
||||
servo.util.append_paths_to_env(env, "LIB", angle_root(target_triple, env))
|
||||
|
||||
# Don't want to mix non-UWP libraries with vendored UWP libraries.
|
||||
if "gstreamer" in env['LIB']:
|
||||
print("Found existing GStreamer library path in LIB. Please remove it.")
|
||||
sys.exit(1)
|
||||
|
||||
# Override any existing GStreamer installation with the vendored libraries.
|
||||
env["GSTREAMER_1_0_ROOT_" + arch['gst']] = path.join(
|
||||
servo.platform.windows.get_dependency_dir("gstreamer-uwp"), arch['gst_root']
|
||||
)
|
||||
env["PKG_CONFIG_PATH"] = path.join(
|
||||
servo.platform.windows.get_dependency_dir("gstreamer-uwp"),
|
||||
arch['gst_root'], "lib", "pkgconfig"
|
||||
)
|
||||
|
||||
if 'windows' in host:
|
||||
process = subprocess.Popen('("%s" %s > nul) && "python" -c "import os; print(repr(os.environ))"' %
|
||||
(os.path.join(vs_dirs['vcdir'], "Auxiliary", "Build", "vcvarsall.bat"), "x64"),
|
||||
|
@ -448,17 +406,15 @@ class MachCommands(CommandBase):
|
|||
for lib in libs:
|
||||
print("WARNING: could not find " + lib)
|
||||
|
||||
# UWP build has its own ANGLE library that it packages.
|
||||
if not self.is_uwp_build:
|
||||
print("Packaging EGL DLLs")
|
||||
egl_libs = ["libEGL.dll", "libGLESv2.dll"]
|
||||
if not package_generated_shared_libraries(egl_libs, build_path, servo_exe_dir):
|
||||
status = 1
|
||||
print("Packaging EGL DLLs")
|
||||
egl_libs = ["libEGL.dll", "libGLESv2.dll"]
|
||||
if not package_generated_shared_libraries(egl_libs, build_path, servo_exe_dir):
|
||||
status = 1
|
||||
|
||||
# copy needed gstreamer DLLs in to servo.exe dir
|
||||
if has_media_stack:
|
||||
print("Packaging gstreamer DLLs")
|
||||
if not package_gstreamer_dlls(env, servo_exe_dir, target_triple, self.is_uwp_build):
|
||||
if not package_gstreamer_dlls(env, servo_exe_dir, target_triple):
|
||||
status = 1
|
||||
|
||||
# UWP app packaging already bundles all required DLLs for us.
|
||||
|
@ -507,7 +463,7 @@ class MachCommands(CommandBase):
|
|||
return status
|
||||
|
||||
@Command('clean',
|
||||
description='Clean the target/ and python/_virtualenv[version]/ and support/hololens/ directories',
|
||||
description='Clean the target/ and python/_virtualenv[version]/ directories',
|
||||
category='build')
|
||||
@CommandArgument('--manifest-path',
|
||||
default=None,
|
||||
|
@ -526,43 +482,12 @@ class MachCommands(CommandBase):
|
|||
print('Removing virtualenv directory: %s' % virtualenv_path)
|
||||
shutil.rmtree(virtualenv_path)
|
||||
|
||||
self.clean_uwp()
|
||||
|
||||
opts = ["--manifest-path", manifest_path or path.join(self.context.topdir, "Cargo.toml")]
|
||||
if verbose:
|
||||
opts += ["-v"]
|
||||
opts += params
|
||||
return check_call(["cargo", "clean"] + opts, env=self.build_env(), verbose=verbose)
|
||||
|
||||
@Command('clean-uwp',
|
||||
description='Clean the support/hololens/ directory',
|
||||
category='build')
|
||||
def clean_uwp(self):
|
||||
uwp_artifacts = [
|
||||
"support/hololens/x64/",
|
||||
"support/hololens/ARM/",
|
||||
"support/hololens/ARM64/",
|
||||
"support/hololens/ServoApp/x64/",
|
||||
"support/hololens/ServoApp/ARM/",
|
||||
"support/hololens/ServoApp/ARM64/",
|
||||
"support/hololens/ServoApp/Generated Files/",
|
||||
"support/hololens/ServoApp/BundleArtifacts/",
|
||||
"support/hololens/ServoApp/support/",
|
||||
"support/hololens/ServoApp/Debug/",
|
||||
"support/hololens/ServoApp/Release/",
|
||||
"support/hololens/packages/",
|
||||
"support/hololens/AppPackages/",
|
||||
"support/hololens/ServoApp/ServoApp.vcxproj.user",
|
||||
]
|
||||
|
||||
for uwp_artifact in uwp_artifacts:
|
||||
artifact = path.join(self.get_top_dir(), uwp_artifact)
|
||||
if path.exists(artifact):
|
||||
if path.isdir(artifact):
|
||||
shutil.rmtree(artifact)
|
||||
else:
|
||||
os.remove(artifact)
|
||||
|
||||
def notify(self, title: str, message: str):
|
||||
"""Generate desktop notification when build is complete and the
|
||||
elapsed build time was longer than 30 seconds.
|
||||
|
@ -612,36 +537,6 @@ class MachCommands(CommandBase):
|
|||
notification.send(block=False)
|
||||
|
||||
|
||||
def angle_root(target, nuget_env):
|
||||
arch = {
|
||||
"aarch64": "arm64",
|
||||
"x86_64": "x64",
|
||||
}
|
||||
angle_arch = arch[target.split('-')[0]]
|
||||
|
||||
package_name = "ANGLE.WindowsStore.Servo"
|
||||
|
||||
import xml.etree.ElementTree as ET
|
||||
tree = ET.parse(os.path.join('support', 'hololens', 'ServoApp', 'packages.config'))
|
||||
root = tree.getroot()
|
||||
for package in root.iter('package'):
|
||||
if package.get('id') == package_name:
|
||||
package_version = package.get('version')
|
||||
break
|
||||
else:
|
||||
raise Exception("Couldn't locate ANGLE package")
|
||||
|
||||
angle_default_path = path.join(os.getcwd(), "support", "hololens", "packages",
|
||||
package_name + "." + package_version, "bin", "UAP", angle_arch)
|
||||
|
||||
# Nuget executable command
|
||||
nuget_app = path.join(os.getcwd(), "support", "hololens", "ServoApp.sln")
|
||||
if not os.path.exists(angle_default_path):
|
||||
check_call(['nuget.exe', 'restore', nuget_app], env=nuget_env)
|
||||
|
||||
return angle_default_path
|
||||
|
||||
|
||||
def otool(s):
|
||||
o = subprocess.Popen(['/usr/bin/otool', '-L', s], stdout=subprocess.PIPE)
|
||||
for line in map(lambda s: s.decode('ascii'), o.stdout):
|
||||
|
@ -757,7 +652,7 @@ def package_gstreamer_dylibs(cross_compilation_target, servo_bin):
|
|||
return True
|
||||
|
||||
|
||||
def package_gstreamer_dlls(env, servo_exe_dir, target, uwp):
|
||||
def package_gstreamer_dlls(env, servo_exe_dir, target):
|
||||
gst_root = servo.platform.get().gstreamer_root(cross_compilation_target=target)
|
||||
if not gst_root:
|
||||
print("Could not find GStreamer installation directory.")
|
||||
|
@ -775,48 +670,31 @@ def package_gstreamer_dlls(env, servo_exe_dir, target, uwp):
|
|||
"glib-2.0-0.dll",
|
||||
"gmodule-2.0-0.dll",
|
||||
"gobject-2.0-0.dll",
|
||||
"graphene-1.0-0.dll",
|
||||
"intl-8.dll",
|
||||
"libcrypto-1_1-x64.dll",
|
||||
"libgmp-10.dll",
|
||||
"libgnutls-30.dll",
|
||||
"libhogweed-4.dll",
|
||||
"libjpeg-8.dll",
|
||||
"libnettle-6.dll.",
|
||||
"libogg-0.dll",
|
||||
"libopus-0.dll",
|
||||
"libpng16-16.dll",
|
||||
"libssl-1_1-x64.dll",
|
||||
"libtasn1-6.dll",
|
||||
"libtheora-0.dll",
|
||||
"libtheoradec-1.dll",
|
||||
"libtheoraenc-1.dll",
|
||||
"libusrsctp-1.dll",
|
||||
"libvorbis-0.dll",
|
||||
"libvorbisenc-2.dll",
|
||||
"libwinpthread-1.dll",
|
||||
"nice-10.dll",
|
||||
"orc-0.4-0.dll",
|
||||
"swresample-3.dll",
|
||||
"z-1.dll",
|
||||
]
|
||||
|
||||
gst_dlls += windows_dlls(uwp)
|
||||
|
||||
if uwp:
|
||||
# These come from a more recent version of ffmpeg and
|
||||
# aren't present in the official GStreamer 1.16 release.
|
||||
gst_dlls += [
|
||||
"avresample-4.dll",
|
||||
"postproc-55.dll",
|
||||
"swscale-5.dll",
|
||||
"x264-157.dll",
|
||||
]
|
||||
else:
|
||||
# These are built with MinGW and are not yet compatible
|
||||
# with UWP's restrictions.
|
||||
gst_dlls += [
|
||||
"graphene-1.0-0.dll",
|
||||
"libcrypto-1_1-x64.dll",
|
||||
"libgmp-10.dll",
|
||||
"libgnutls-30.dll",
|
||||
"libhogweed-4.dll",
|
||||
"libjpeg-8.dll",
|
||||
"libnettle-6.dll.",
|
||||
"libogg-0.dll",
|
||||
"libopus-0.dll",
|
||||
"libpng16-16.dll",
|
||||
"libssl-1_1-x64.dll",
|
||||
"libtasn1-6.dll",
|
||||
"libtheora-0.dll",
|
||||
"libtheoradec-1.dll",
|
||||
"libtheoraenc-1.dll",
|
||||
"libusrsctp-1.dll",
|
||||
"libvorbis-0.dll",
|
||||
"libvorbisenc-2.dll",
|
||||
"libwinpthread-1.dll",
|
||||
"nice-10.dll",
|
||||
]
|
||||
] + windows_dlls()
|
||||
|
||||
missing = []
|
||||
for gst_lib in gst_dlls:
|
||||
|
@ -831,7 +709,7 @@ def package_gstreamer_dlls(env, servo_exe_dir, target, uwp):
|
|||
return False
|
||||
|
||||
# Only copy a subset of the available plugins.
|
||||
gst_dlls = windows_plugins(uwp)
|
||||
gst_dlls = windows_plugins()
|
||||
|
||||
gst_plugin_path_root = os.environ.get("GSTREAMER_PACKAGE_PLUGIN_PATH") or gst_root
|
||||
gst_plugin_path = path.join(gst_plugin_path_root, "lib", "gstreamer-1.0")
|
||||
|
@ -868,7 +746,7 @@ def package_msvc_dlls(servo_exe_dir, target, vcinstalldir, vs_version):
|
|||
"msvcp140.dll",
|
||||
"vcruntime140.dll",
|
||||
]
|
||||
if target_arch != "aarch64" and "uwp" not in target and vs_version in ("14.0", "15.0", "16.0"):
|
||||
if target_arch != "aarch64" and vs_version in ("14.0", "15.0", "16.0"):
|
||||
msvc_deps += ["api-ms-win-crt-runtime-l1-1-0.dll"]
|
||||
|
||||
# Check if it's Visual C++ Build Tools or Visual Studio 2015
|
||||
|
|
|
@ -205,7 +205,6 @@ class CommandBase(object):
|
|||
self.context = context
|
||||
self.features = []
|
||||
self.cross_compile_target = None
|
||||
self.is_uwp_build = False
|
||||
self.is_android_build = False
|
||||
|
||||
def get_env_bool(var, default):
|
||||
|
@ -510,11 +509,6 @@ class CommandBase(object):
|
|||
extra_path += [path.join(self.msvc_package_dir("llvm"), "bin")]
|
||||
env.setdefault("CC", "clang-cl.exe")
|
||||
env.setdefault("CXX", "clang-cl.exe")
|
||||
if self.is_uwp_build:
|
||||
env.setdefault("TARGET_CFLAGS", "")
|
||||
env.setdefault("TARGET_CXXFLAGS", "")
|
||||
env["TARGET_CFLAGS"] += " -DWINAPI_FAMILY=WINAPI_FAMILY_APP"
|
||||
env["TARGET_CXXFLAGS"] += " -DWINAPI_FAMILY=WINAPI_FAMILY_APP"
|
||||
|
||||
arch = effective_target.split('-')[0]
|
||||
vcpkg_arch = {
|
||||
|
@ -523,8 +517,6 @@ class CommandBase(object):
|
|||
"aarch64": "arm64-windows",
|
||||
}
|
||||
target_arch = vcpkg_arch[arch]
|
||||
if self.is_uwp_build:
|
||||
target_arch += "-uwp"
|
||||
openssl_base_dir = path.join(self.msvc_package_dir("openssl"), target_arch)
|
||||
|
||||
# Link openssl
|
||||
|
@ -674,11 +666,6 @@ class CommandBase(object):
|
|||
help='Build for Android. If --target is not specified, this '
|
||||
'will choose a default target architecture.',
|
||||
),
|
||||
CommandArgument(
|
||||
'--uwp',
|
||||
group="Cross Compilation",
|
||||
action='store_true',
|
||||
help='Build for HoloLens (x64)'),
|
||||
CommandArgument('--win-arm64', action='store_true', help="Use arm64 Windows target"),
|
||||
CommandArgumentGroup('Feature Selection'),
|
||||
CommandArgument(
|
||||
|
@ -725,9 +712,7 @@ class CommandBase(object):
|
|||
]
|
||||
|
||||
def configuration_decorator(self, *args, **kwargs):
|
||||
self.configure_cross_compilation(
|
||||
kwargs['target'], kwargs['android'],
|
||||
kwargs['uwp'], kwargs['win_arm64'])
|
||||
self.configure_cross_compilation(kwargs['target'], kwargs['android'], kwargs['win_arm64'])
|
||||
|
||||
self.features = kwargs.get("features", None) or []
|
||||
self.configure_media_stack(kwargs['media_stack'])
|
||||
|
@ -743,15 +728,8 @@ class CommandBase(object):
|
|||
self,
|
||||
cross_compile_target: Optional[str],
|
||||
android: Optional[str],
|
||||
uwp: Optional[str],
|
||||
win_arm64: Optional[str]):
|
||||
# Force the UWP-enabled target if the convenience UWP flags are passed.
|
||||
if uwp and not cross_compile_target:
|
||||
if win_arm64:
|
||||
cross_compile_target = 'aarch64-uwp-windows-msvc'
|
||||
else:
|
||||
cross_compile_target = 'x86_64-uwp-windows-msvc'
|
||||
|
||||
if android is None:
|
||||
android = self.config["build"]["android"]
|
||||
if android:
|
||||
|
@ -765,7 +743,6 @@ class CommandBase(object):
|
|||
self.setup_configuration_for_android_target(cross_compile_target)
|
||||
|
||||
self.cross_compile_target = cross_compile_target
|
||||
self.is_uwp_build = uwp or (cross_compile_target and "uwp" in cross_compile_target)
|
||||
self.is_android_build = (cross_compile_target and "android" in cross_compile_target)
|
||||
|
||||
if self.cross_compile_target:
|
||||
|
@ -783,7 +760,6 @@ class CommandBase(object):
|
|||
not self.cross_compile_target
|
||||
or ("armv7" in self.cross_compile_target and self.is_android_build)
|
||||
or "x86_64" in self.cross_compile_target
|
||||
or "uwp" in self.cross_compile_target
|
||||
):
|
||||
media_stack = "gstreamer"
|
||||
else:
|
||||
|
@ -825,10 +801,6 @@ class CommandBase(object):
|
|||
|
||||
features.append("native-bluetooth")
|
||||
|
||||
if self.is_uwp_build:
|
||||
features.append("no-wgl")
|
||||
features.append("uwp")
|
||||
|
||||
if with_layout_2020 or (self.config["build"]["layout-2020"] and not with_layout_2013):
|
||||
features.append("layout-2020")
|
||||
elif "layout-2020" not in features:
|
||||
|
@ -847,8 +819,6 @@ class CommandBase(object):
|
|||
if with_debug_assertions or self.config["build"]["debug-assertions"]:
|
||||
env['RUSTFLAGS'] = env.get('RUSTFLAGS', "") + " -C debug_assertions"
|
||||
|
||||
if self.is_uwp_build:
|
||||
cargo_args += ["-Z", "build-std"]
|
||||
return self.call_rustup_run(["cargo", command] + args + cargo_args, env=env, verbose=verbose)
|
||||
|
||||
def android_support_dir(self):
|
||||
|
@ -934,7 +904,6 @@ class CommandBase(object):
|
|||
check_call(["rustup", "component", "add", "--toolchain", toolchain, component])
|
||||
|
||||
needs_toolchain_install = self.cross_compile_target \
|
||||
and not self.is_uwp_build \
|
||||
and self.cross_compile_target.encode("utf-8") not in check_output(
|
||||
["rustup", "target", "list", "--installed", "--toolchain", toolchain]
|
||||
)
|
||||
|
|
|
@ -78,18 +78,12 @@ GSTREAMER_PLUGINS = [
|
|||
]
|
||||
|
||||
|
||||
def windows_dlls(uwp):
|
||||
def windows_dlls():
|
||||
libs = list(GSTREAMER_DYLIBS)
|
||||
NON_UWP_DYLIBS = [
|
||||
"gstnet",
|
||||
"gstsctp",
|
||||
]
|
||||
if uwp:
|
||||
libs = filter(lambda x: x not in NON_UWP_DYLIBS, libs)
|
||||
return [f"{lib}-1.0-0.dll" for lib in libs]
|
||||
|
||||
|
||||
def windows_plugins(uwp):
|
||||
def windows_plugins():
|
||||
# FIXME: We should support newer gstreamer versions here that replace
|
||||
# gstvideoconvert and gstvideoscale with gstvideoconvertscale.
|
||||
libs = [
|
||||
|
@ -98,25 +92,6 @@ def windows_plugins(uwp):
|
|||
"gstvideoscale",
|
||||
"gstwasapi"
|
||||
]
|
||||
NON_UWP_PLUGINS = [
|
||||
"gstnice",
|
||||
# gst-plugins-base
|
||||
"gstogg",
|
||||
"gstopengl",
|
||||
"gstopus",
|
||||
"gstrtp",
|
||||
"gsttheora",
|
||||
"gstvorbis",
|
||||
# gst-plugins-good
|
||||
"gstmatroska",
|
||||
"gstrtpmanager",
|
||||
"gstvpx",
|
||||
# gst-plugins-bad
|
||||
"gstdtls",
|
||||
"gstwebrtc",
|
||||
]
|
||||
if uwp:
|
||||
libs = filter(lambda x: x not in NON_UWP_PLUGINS, libs)
|
||||
return [f"{lib}.dll" for lib in libs]
|
||||
|
||||
|
||||
|
@ -156,7 +131,7 @@ def write_plugin_list(target):
|
|||
if "apple-" in target:
|
||||
plugins = [os.path.basename(x) for x in macos_plugins()]
|
||||
elif '-windows-' in target:
|
||||
plugins = windows_plugins('-uwp-' in target)
|
||||
plugins = windows_plugins()
|
||||
print('''/* This is a generated file. Do not modify. */
|
||||
|
||||
pub(crate) static GSTREAMER_PLUGINS: &[&'static str] = &[
|
||||
|
|
|
@ -12,7 +12,6 @@ from __future__ import absolute_import, print_function, unicode_literals
|
|||
from datetime import datetime
|
||||
from github import Github
|
||||
|
||||
import base64
|
||||
import hashlib
|
||||
import io
|
||||
import json
|
||||
|
@ -22,7 +21,6 @@ import shutil
|
|||
import subprocess
|
||||
import sys
|
||||
import tempfile
|
||||
import xml
|
||||
|
||||
from mach.decorators import (
|
||||
CommandArgument,
|
||||
|
@ -85,10 +83,6 @@ PACKAGES = {
|
|||
def packages_for_platform(platform):
|
||||
target_dir = get_target_dir()
|
||||
|
||||
if platform == "uwp":
|
||||
yield r'support\hololens\AppPackages\ServoApp\FirefoxReality.zip'
|
||||
return
|
||||
|
||||
for package in PACKAGES[platform]:
|
||||
yield path.join(target_dir, package)
|
||||
|
||||
|
@ -150,13 +144,8 @@ class PackageCommands(CommandBase):
|
|||
default=None,
|
||||
action='store_true',
|
||||
help='Create a local Maven repository')
|
||||
@CommandArgument('--uwp',
|
||||
default=None,
|
||||
action='append',
|
||||
help='Create an APPX package')
|
||||
@CommandArgument('--ms-app-store', default=None, action='store_true')
|
||||
def package(self, release=False, dev=False, android=None, target=None,
|
||||
flavor=None, maven=False, uwp=None, ms_app_store=False):
|
||||
flavor=None, maven=False):
|
||||
if android is None:
|
||||
android = self.config["build"]["android"]
|
||||
if target and android:
|
||||
|
@ -171,14 +160,10 @@ class PackageCommands(CommandBase):
|
|||
env = self.build_env()
|
||||
binary_path = self.get_binary_path(
|
||||
release, dev, target=target, android=android,
|
||||
simpleservo=uwp is not None
|
||||
)
|
||||
dir_to_root = self.get_top_dir()
|
||||
target_dir = path.dirname(binary_path)
|
||||
if uwp:
|
||||
vs_info = self.vs_dirs()
|
||||
build_uwp(uwp, dev, vs_info['msbuild'], ms_app_store)
|
||||
elif android:
|
||||
if android:
|
||||
android_target = self.config["android"]["target"]
|
||||
if "aarch64" in android_target:
|
||||
build_type = "Arm64"
|
||||
|
@ -698,100 +683,3 @@ class PackageCommands(CommandBase):
|
|||
update_brew(packages[0], timestamp)
|
||||
|
||||
return 0
|
||||
|
||||
|
||||
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.
|
||||
|
||||
if ms_app_store:
|
||||
return ["/p:AppxPackageSigningEnabled=false"]
|
||||
|
||||
def run_powershell_cmd(cmd):
|
||||
try:
|
||||
return (
|
||||
subprocess
|
||||
.check_output(['powershell.exe', '-NoProfile', '-Command', cmd])
|
||||
.decode('utf-8')
|
||||
)
|
||||
except subprocess.CalledProcessError:
|
||||
print("ERROR: PowerShell command failed: ", cmd)
|
||||
exit(1)
|
||||
|
||||
pfx = None
|
||||
if 'CODESIGN_CERT' in os.environ:
|
||||
pfx = os.environ['CODESIGN_CERT']
|
||||
|
||||
if pfx:
|
||||
open("servo.pfx", "wb").write(base64.b64decode(pfx))
|
||||
run_powershell_cmd('Import-PfxCertificate -FilePath .\\servo.pfx -CertStoreLocation Cert:\\CurrentUser\\My')
|
||||
os.remove("servo.pfx")
|
||||
|
||||
# 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()))
|
||||
if not certs:
|
||||
print("No certificate installed for publisher " + publisher)
|
||||
print("Creating and installing a temporary certificate")
|
||||
# PowerShell command that creates and install signing certificate for publisher
|
||||
cmd = '(New-SelfSignedCertificate -Type Custom -Subject ' + publisher + \
|
||||
' -FriendlyName "Allizom Signing Certificate (temporary)"' + \
|
||||
' -KeyUsage DigitalSignature -CertStoreLocation "Cert:\\CurrentUser\\My"' + \
|
||||
' -TextExtension @("2.5.29.37={text}1.3.6.1.5.5.7.3.3", "2.5.29.19={text}")).Thumbprint'
|
||||
thumbprint = run_powershell_cmd(cmd)
|
||||
elif len(certs) > 1:
|
||||
print("Warning: multiple signing certificate are installed for " + publisher)
|
||||
print("Warning: Using first one")
|
||||
thumbprint = certs[0]
|
||||
else:
|
||||
thumbprint = certs[0]
|
||||
return ["/p:AppxPackageSigningEnabled=true", "/p:PackageCertificateThumbprint=" + thumbprint]
|
||||
|
||||
|
||||
def build_uwp(platforms, dev, msbuild_dir, ms_app_store):
|
||||
if any(map(lambda p: p not in ['x64', 'x86', 'arm64'], platforms)):
|
||||
raise Exception("Unsupported appx platforms: " + str(platforms))
|
||||
if dev and len(platforms) > 1:
|
||||
raise Exception("Debug package with multiple architectures is unsupported")
|
||||
|
||||
if dev:
|
||||
Configuration = "Debug"
|
||||
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:
|
||||
template_contents = f.read()
|
||||
build_file = tempfile.NamedTemporaryFile(delete=False)
|
||||
build_file.write(
|
||||
template_contents
|
||||
.replace("%%BUILD_PLATFORMS%%", ';'.join(platforms))
|
||||
.replace("%%PACKAGE_PLATFORMS%%", '|'.join(platforms))
|
||||
.replace("%%CONFIGURATION%%", Configuration)
|
||||
.replace("%%SOLUTION%%", path.join(os.getcwd(), 'support', 'hololens', 'ServoApp.sln'))
|
||||
.encode('utf-8')
|
||||
)
|
||||
build_file.close()
|
||||
# Generate an appxbundle.
|
||||
msbuild_args = setup_uwp_signing(ms_app_store, publisher)
|
||||
subprocess.check_call([msbuild, "/m", build_file.name] + msbuild_args)
|
||||
os.unlink(build_file.name)
|
||||
|
||||
# Don't bother creating an archive that contains unsigned app packages.
|
||||
if not ms_app_store:
|
||||
print("Creating ZIP")
|
||||
out_dir = path.join(os.getcwd(), 'support', 'hololens', 'AppPackages', 'ServoApp')
|
||||
name = 'ServoApp_%s_%sTest' % (version, 'Debug_' if dev else '')
|
||||
artifacts_dir = path.join(out_dir, name)
|
||||
zip_path = path.join(out_dir, "FirefoxReality.zip")
|
||||
archive_deterministically(artifacts_dir, zip_path, prepend_path='servo/')
|
||||
print("Packaged Servo into " + zip_path)
|
||||
|
|
|
@ -25,14 +25,9 @@ class Base:
|
|||
def set_gstreamer_environment_variables_if_necessary(
|
||||
self, env: Dict[str, str], cross_compilation_target: Optional[str], check_installation=True
|
||||
):
|
||||
# Environment variables are not needed when cross-compiling on any
|
||||
# platform other than Windows. UWP doesn't support GStreamer. GStreamer
|
||||
# for Android is handled elsewhere.
|
||||
if cross_compilation_target and (
|
||||
not self.is_windows
|
||||
or "uwp" in cross_compilation_target
|
||||
or "android" in cross_compilation_target
|
||||
):
|
||||
# Environment variables are not needed when cross-compiling on any platform other
|
||||
# than Windows. GStreamer for Android is handled elsewhere.
|
||||
if cross_compilation_target and (not self.is_windows or "android" in cross_compilation_target):
|
||||
return
|
||||
|
||||
# We may not need to update environment variables if GStreamer is installed
|
||||
|
|
|
@ -22,8 +22,6 @@ DEPENDENCIES = {
|
|||
"llvm": "15.0.5",
|
||||
"moztools": "3.2",
|
||||
"openssl": "111.3.0+1.1.1c-vs2017-2019-09-18",
|
||||
"gstreamer-uwp": "1.16.0.5",
|
||||
"openxr-loader-uwp": "1.0",
|
||||
}
|
||||
|
||||
URL_BASE = "https://gstreamer.freedesktop.org/data/pkg/windows/1.16.0/"
|
||||
|
|
|
@ -36,10 +36,7 @@ from mach.decorators import (
|
|||
import servo.util
|
||||
import tidy
|
||||
|
||||
from servo.command_base import (
|
||||
CommandBase,
|
||||
call, check_call, check_output,
|
||||
)
|
||||
from servo.command_base import CommandBase, call, check_call
|
||||
from servo.util import delete
|
||||
from distutils.dir_util import copy_tree
|
||||
|
||||
|
@ -48,9 +45,6 @@ PROJECT_TOPLEVEL_PATH = os.path.abspath(os.path.join(SCRIPT_PATH, "..", ".."))
|
|||
WEB_PLATFORM_TESTS_PATH = os.path.join("tests", "wpt", "tests")
|
||||
SERVO_TESTS_PATH = os.path.join("tests", "wpt", "mozilla", "tests")
|
||||
|
||||
CLANGFMT_CPP_DIRS = ["support/hololens/"]
|
||||
CLANGFMT_VERSION = "15"
|
||||
|
||||
TEST_SUITES = OrderedDict([
|
||||
("wpt", {"kwargs": {"release": False},
|
||||
"paths": [path.abspath(WEB_PLATFORM_TESTS_PATH),
|
||||
|
@ -301,14 +295,10 @@ class MachCommands(CommandBase):
|
|||
self.install_rustfmt()
|
||||
rustfmt_failed = self.call_rustup_run(["cargo", "fmt", "--", "--check"])
|
||||
|
||||
print("Checking C++ files for tidiness...")
|
||||
env = self.build_env()
|
||||
clangfmt_failed = not run_clang_format(env, ["--dry-run", "--Werror"])
|
||||
|
||||
if rustfmt_failed or clangfmt_failed:
|
||||
if rustfmt_failed:
|
||||
print("Run `./mach fmt` to fix the formatting")
|
||||
|
||||
return tidy_failed or manifest_dirty or rustfmt_failed or clangfmt_failed
|
||||
return tidy_failed or manifest_dirty or rustfmt_failed
|
||||
|
||||
@Command('test-scripts',
|
||||
description='Run tests for all build and support scripts.',
|
||||
|
@ -414,12 +404,9 @@ class MachCommands(CommandBase):
|
|||
return wpt.manifestupdate.update(check_clean=False)
|
||||
|
||||
@Command('fmt',
|
||||
description='Format the Rust and CPP source files with rustfmt and clang-format',
|
||||
description='Format the Rust and CPP source files with rustfmt',
|
||||
category='testing')
|
||||
def format_code(self):
|
||||
env = self.build_env()
|
||||
run_clang_format(env, ['-i'])
|
||||
|
||||
self.install_rustfmt()
|
||||
return self.call_rustup_run(["cargo", "fmt"])
|
||||
|
||||
|
@ -613,20 +600,6 @@ class MachCommands(CommandBase):
|
|||
[run_file, "|".join(tests), bin_path, base_dir])
|
||||
|
||||
|
||||
def run_clang_format(env, args):
|
||||
gitfiles = check_output(
|
||||
['git', 'ls-files'] + CLANGFMT_CPP_DIRS,
|
||||
universal_newlines=True).splitlines()
|
||||
files = [line for line in gitfiles if line.endswith(".h") or line.endswith(".cpp")]
|
||||
clang_cmd = "clang-format.exe" if sys.platform == "win32" else "clang-format"
|
||||
|
||||
if not files:
|
||||
return True
|
||||
|
||||
returncode = call([clang_cmd] + args + files, env=env)
|
||||
return returncode == 0
|
||||
|
||||
|
||||
def create_parser_create():
|
||||
import argparse
|
||||
p = argparse.ArgumentParser()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue