Skip to content

Commit 5367da9

Browse files
committed
Support building UWP with native UWP rustc target.
1 parent 723df4a commit 5367da9

File tree

11 files changed

+791
-761
lines changed

11 files changed

+791
-761
lines changed

.cargo/config

+6
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,14 @@ ar = "aarch64-linux-gnu-ar"
2525
[target.x86_64-pc-windows-msvc]
2626
linker = "lld-link.exe"
2727

28+
[target.x86_64-uwp-windows-msvc]
29+
linker = "lld-link.exe"
30+
2831
[target.i686-pc-windows-msvc]
2932
linker = "lld-link.exe"
3033

3134
[target.aarch64-pc-windows-msvc]
3235
linker = "lld-link.exe"
36+
37+
[target.aarch64-uwp-windows-msvc]
38+
linker = "lld-link.exe"

Cargo.lock

+36-7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

-1
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,3 @@ opt-level = 3
2929
mio = { git = "https://github.com/servo/mio.git", branch = "servo" }
3030
rand_os = { git = "https://github.com/servo/rand", branch = "servo-rand_os-0.1.3-uwp" }
3131
rand_core = { git = "https://github.com/servo/rand", branch = "servo-rand_os-0.1.3-uwp" }
32-

Xargo.toml

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[target.x86_64-uwp-windows-msvc.dependencies]
2+
std = { features = ["panic-unwind"] }
3+
4+
# https://github.com/rust-lang/rust/issues/65313
5+
[target.aarch64-uwp-windows-msvc.dependencies]
6+
std = {}
7+

etc/taskcluster/decision_task.py

+7-7
Original file line numberDiff line numberDiff line change
@@ -390,8 +390,8 @@ def windows_arm64():
390390
windows_build_task("UWP dev build", arch="arm64", package=False)
391391
.with_treeherder("Windows arm64")
392392
.with_script(
393-
"python mach build --dev --uwp --win-arm64",
394-
"python mach package --dev --target aarch64-pc-windows-msvc --uwp=arm64",
393+
"python mach build --dev --target=aarch64-uwp-windows-msvc",
394+
"python mach package --dev --target aarch64-uwp-windows-msvc --uwp=arm64",
395395
)
396396
.with_artifacts(appx_artifact(debug=True))
397397
.find_or_create("build.windows_uwp_arm64_dev." + CONFIG.task_id())
@@ -403,8 +403,8 @@ def windows_uwp_x64():
403403
windows_build_task("UWP dev build", package=False)
404404
.with_treeherder("Windows x64")
405405
.with_script(
406-
"mach build --dev --uwp",
407-
"mach package --dev --uwp=x64",
406+
"python mach build --dev --target=x86_64-uwp-windows-msvc",
407+
"python mach package --dev --target=x86_64-uwp-windows-msvc --uwp=x64",
408408
)
409409
.with_artifacts(appx_artifact(debug=True))
410410
.find_or_create("build.windows_uwp_x64_dev." + CONFIG.task_id())
@@ -418,9 +418,9 @@ def uwp_nightly():
418418
.with_features("taskclusterProxy")
419419
.with_scopes("secrets:get:project/servo/s3-upload-credentials")
420420
.with_script(
421-
"mach build --release --uwp",
422-
"python mach build --release --uwp --win-arm64",
423-
"mach package --release --uwp=x64 --uwp=arm64",
421+
"python mach build --release --target=x86_64-uwp-windows-msvc",
422+
"python mach build --release --target=aarch64-uwp-windows-msvc",
423+
"mach package --release --target=x86_64-uwp-windows-msvc --uwp=x64 --uwp=arm64",
424424
"mach upload-nightly uwp --secret-from-taskcluster",
425425
)
426426
.with_artifacts(appx_artifact(debug=False))

python/servo/build_commands.py

+10-11
Original file line numberDiff line numberDiff line change
@@ -164,17 +164,18 @@ class MachCommands(CommandBase):
164164
@CommandArgument('--very-verbose', '-vv',
165165
action='store_true',
166166
help='Print very verbose output')
167-
@CommandArgument('--win-arm64', action='store_true', help="Use arm64 Windows target")
168167
@CommandArgument('params', nargs='...',
169168
help="Command-line arguments to be passed through to Cargo")
170169
@CommandBase.build_like_command_arguments
171170
def build(self, release=False, dev=False, jobs=None, params=None,
172171
no_package=False, verbose=False, very_verbose=False,
173-
target=None, android=False, magicleap=False, libsimpleservo=False, uwp=False,
174-
features=None, win_arm64=False, **kwargs):
172+
target=None, android=False, magicleap=False, libsimpleservo=False,
173+
features=None, **kwargs):
175174
opts = params or []
176175
features = features or []
176+
177177
target, android = self.pick_target_triple(target, android, magicleap)
178+
uwp = target and 'uwp' in target
178179

179180
target_path = base_path = self.get_target_dir()
180181
if android:
@@ -220,14 +221,8 @@ def build(self, release=False, dev=False, jobs=None, params=None,
220221
if very_verbose:
221222
opts += ["-vv"]
222223

223-
if win_arm64:
224-
if target:
225-
print("Can't specify explicit --target value with --win-arm64.")
226-
sys.exit(1)
227-
target = "aarch64-pc-windows-msvc"
228-
229224
if target:
230-
if self.config["tools"]["use-rustup"]:
225+
if self.config["tools"]["use-rustup"] and not uwp:
231226
# 'rustup target add' fails if the toolchain is not installed at all.
232227
self.call_rustup_run(["rustc", "--version"])
233228

@@ -265,6 +260,10 @@ def build(self, release=False, dev=False, jobs=None, params=None,
265260
env['PKG_CONFIG_ALLOW_CROSS'] = "1"
266261

267262
if uwp:
263+
# Ensure libstd is ready for the new UWP target.
264+
check_call(["rustup", "component", "add", "rust-src"])
265+
env['RUST_SYSROOT'] = path.expanduser('~\\.xargo')
266+
268267
# Don't try and build a desktop port.
269268
libsimpleservo = True
270269

@@ -943,7 +942,7 @@ def package_msvc_dlls(servo_exe_dir, target, vcinstalldir, vs_version):
943942
"msvcp140.dll",
944943
"vcruntime140.dll",
945944
]
946-
if target_arch != "aarch64" and vs_version in ("14.0", "15.0", "16.0"):
945+
if target_arch != "aarch64" and "uwp" not in target and vs_version in ("14.0", "15.0", "16.0"):
947946
msvc_deps += ["api-ms-win-crt-runtime-l1-1-0.dll"]
948947

949948
# Check if it's Visual C++ Build Tools or Visual Studio 2015

python/servo/command_base.py

+5-6
Original file line numberDiff line numberDiff line change
@@ -634,6 +634,7 @@ def build_env(self, hosts_file_path=None, target=None, is_build=False, test_unit
634634
extra_path += [path.join(self.msvc_package_dir("llvm"), "bin")]
635635
extra_path += [path.join(self.msvc_package_dir("ninja"), "bin")]
636636
extra_path += [self.msvc_package_dir("nuget")]
637+
extra_path += [path.join(self.msvc_package_dir("xargo"))]
637638

638639
arch = (target or host_triple()).split('-')[0]
639640
vcpkg_arch = {
@@ -821,11 +822,6 @@ def build_like_command_arguments(decorated_function):
821822
action='store_true',
822823
help='Build with frame pointer enabled, used by the background hang monitor.',
823824
),
824-
CommandArgument(
825-
'--uwp',
826-
default=None,
827-
action='store_true',
828-
help='Build for HoloLens (x64)'),
829825
CommandArgument('--with-raqote', default=None, action='store_true'),
830826
CommandArgument('--with-layout-2020', default=None, action='store_true'),
831827
CommandArgument('--without-wgl', default=None, action='store_true'),
@@ -912,7 +908,10 @@ def run_cargo_build_like_command(
912908
assert "--features" not in cargo_args
913909
args += ["--features", " ".join(features)]
914910

915-
return self.call_rustup_run(["cargo", command] + args + cargo_args, env=env, verbose=verbose)
911+
if target and 'uwp' in target:
912+
return call(["xargo", command] + args + cargo_args, env=env, verbose=verbose)
913+
else:
914+
return self.call_rustup_run(["cargo", command] + args + cargo_args, env=env, verbose=verbose)
916915

917916
def android_support_dir(self):
918917
return path.join(self.context.topdir, "support", "android")

python/servo/packages.py

+1
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,5 @@
1111
"openssl": "111.3.0+1.1.1c-vs2017-2019-09-18",
1212
"gstreamer-uwp": "1.16.0.5",
1313
"openxr-loader-uwp": "1.0",
14+
"xargo": "v0.3.16",
1415
}

support/hololens/ServoApp/Package.appxmanifest

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,4 @@
4040
<Capability Name="codeGeneration" />
4141
<Capability Name="privateNetworkClientServer" />
4242
</Capabilities>
43-
</Package>
43+
</Package>

0 commit comments

Comments
 (0)