Auto merge of #24198 - jdm:xargo-uwp3, r=SimonSapin

Build UWP with native UWP rustc target

<!-- Reviewable:start -->
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/24198)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2019-10-12 16:08:48 -04:00 committed by GitHub
commit eee2c895f4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 959 additions and 929 deletions

View file

@ -25,8 +25,14 @@ ar = "aarch64-linux-gnu-ar"
[target.x86_64-pc-windows-msvc]
linker = "lld-link.exe"
[target.x86_64-uwp-windows-msvc]
linker = "lld-link.exe"
[target.i686-pc-windows-msvc]
linker = "lld-link.exe"
[target.aarch64-pc-windows-msvc]
linker = "lld-link.exe"
[target.aarch64-uwp-windows-msvc]
linker = "lld-link.exe"

59
Cargo.lock generated
View file

@ -150,9 +150,8 @@ dependencies = [
[[package]]
name = "autocfg"
version = "0.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0e49efa51329a5fd37e7c79db4621af617cd4e3e5bc224939808d076077077bf"
version = "0.1.6"
source = "git+https://github.com/servo/autocfg?branch=rustflags#d040e25ff6c129189306011f6a0ff210e08227a0"
[[package]]
name = "azure"
@ -185,9 +184,9 @@ dependencies = [
[[package]]
name = "backtrace"
version = "0.3.35"
version = "0.3.38"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1371048253fa3bac6704bfd6bbfc922ee9bdcee8881330d40f308b81cc5adc55"
checksum = "690a62be8920ccf773ee00ef0968649b0e724cda8bd5b12286302b4ae955fdf5"
dependencies = [
"backtrace-sys",
"cfg-if",
@ -502,11 +501,12 @@ dependencies = [
[[package]]
name = "cc"
version = "1.0.35"
version = "1.0.45"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5e5f3fee5eeb60324c2781f1e41286bdee933850fff9b3c672587fed5ec58c83"
checksum = "4fc9a35e1f4290eb9e5fc54ba6cf40671ed2a2514c3eeb2b2a908dda2ea5a1be"
dependencies = [
"rayon",
"jobserver",
"num_cpus",
]
[[package]]
@ -1467,6 +1467,17 @@ version = "0.2.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b900c08c1939860ce8b54dc6a89e26e00c04c380fd0e09796799bd7f12861e05"
[[package]]
name = "getrandom"
version = "0.1.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "473a1265acc8ff1e808cd0a1af8cee3c2ee5200916058a2ca113c29f2d903571"
dependencies = [
"cfg-if",
"libc",
"wasi",
]
[[package]]
name = "gfx"
version = "0.0.1"
@ -2358,6 +2369,17 @@ version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8eaf4bc02d17cbdd7ff4c7438cafcdf7fb9a4613313ad11b4f8fefe7d3fa0130"
[[package]]
name = "jobserver"
version = "0.1.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f2b1d42ef453b30b7387e113da1c83ab1605d90c5b4e0eb8e96d016ed3b8c160"
dependencies = [
"getrandom",
"libc",
"log",
]
[[package]]
name = "jpeg-decoder"
version = "0.1.14"
@ -3075,7 +3097,7 @@ dependencies = [
[[package]]
name = "mozjs"
version = "0.12.1"
source = "git+https://github.com/servo/rust-mozjs#bc44e221420a42ccb77b54911f60ca102cba143b"
source = "git+https://github.com/servo/rust-mozjs#0832eb778689143cd9f2f3967fac912f7096a466"
dependencies = [
"cc",
"lazy_static",
@ -3088,7 +3110,7 @@ dependencies = [
[[package]]
name = "mozjs_sys"
version = "0.67.1"
source = "git+https://github.com/servo/mozjs?rev=dd175ee73a179ce218286c4be4ab80e1a75348be#dd175ee73a179ce218286c4be4ab80e1a75348be"
source = "git+https://github.com/servo/mozjs?rev=59065889ec7726b767d70b8702b43b4e4776cbfe#59065889ec7726b767d70b8702b43b4e4776cbfe"
dependencies = [
"bindgen",
"cc",
@ -5710,6 +5732,12 @@ dependencies = [
"urlencoding",
]
[[package]]
name = "wasi"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b89c3ce4ce14bdc6fb6beaf9ec7928ca331de5df7e5ea278375642a2f478570d"
[[package]]
name = "wayland-client"
version = "0.21.13"
@ -5965,9 +5993,8 @@ dependencies = [
[[package]]
name = "winapi"
version = "0.3.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f10e386af2b13e47c89e7236a7a14a086791a2b88ebad6df9bf42040195cf770"
version = "0.3.8"
source = "git+https://github.com/servo/winapi-rs?branch=patch-1#f85c3541bbb331fea8918ac070accfb4ab613e7b"
dependencies = [
"winapi-i686-pc-windows-gnu",
"winapi-x86_64-pc-windows-gnu",
@ -5976,8 +6003,7 @@ dependencies = [
[[package]]
name = "winapi-i686-pc-windows-gnu"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
source = "git+https://github.com/servo/winapi-rs?branch=patch-1#f85c3541bbb331fea8918ac070accfb4ab613e7b"
[[package]]
name = "winapi-util"
@ -5991,8 +6017,7 @@ dependencies = [
[[package]]
name = "winapi-x86_64-pc-windows-gnu"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
source = "git+https://github.com/servo/winapi-rs?branch=patch-1#f85c3541bbb331fea8918ac070accfb4ab613e7b"
[[package]]
name = "wincolor"

View file

@ -29,4 +29,7 @@ opt-level = 3
mio = { git = "https://github.com/servo/mio.git", branch = "servo" }
rand_os = { git = "https://github.com/servo/rand", branch = "servo-rand_os-0.1.3-uwp" }
rand_core = { git = "https://github.com/servo/rand", branch = "servo-rand_os-0.1.3-uwp" }
# https://github.com/cuviper/autocfg/pull/10
autocfg = { git = "https://github.com/servo/autocfg", branch = "rustflags" }
# https://github.com/retep998/winapi-rs/pull/816
winapi = { git = "https://github.com/servo/winapi-rs", branch = "patch-1" }

7
Xargo.toml Normal file
View file

@ -0,0 +1,7 @@
[target.x86_64-uwp-windows-msvc.dependencies]
std = { features = ["panic-unwind"] }
# https://github.com/rust-lang/rust/issues/65313
[target.aarch64-uwp-windows-msvc.dependencies]
std = {}

View file

@ -390,8 +390,8 @@ def windows_arm64():
windows_build_task("UWP dev build", arch="arm64", package=False)
.with_treeherder("Windows arm64")
.with_script(
"python mach build --dev --uwp --win-arm64",
"python mach package --dev --target aarch64-pc-windows-msvc --uwp=arm64",
"python mach build --dev --target=aarch64-uwp-windows-msvc",
"python mach package --dev --target aarch64-uwp-windows-msvc --uwp=arm64",
)
.with_artifacts(appx_artifact(debug=True))
.find_or_create("build.windows_uwp_arm64_dev." + CONFIG.task_id())
@ -403,8 +403,8 @@ def windows_uwp_x64():
windows_build_task("UWP dev build", package=False)
.with_treeherder("Windows x64")
.with_script(
"mach build --dev --uwp",
"mach package --dev --uwp=x64",
"python mach build --dev --target=x86_64-uwp-windows-msvc",
"python mach package --dev --target=x86_64-uwp-windows-msvc --uwp=x64",
)
.with_artifacts(appx_artifact(debug=True))
.find_or_create("build.windows_uwp_x64_dev." + CONFIG.task_id())
@ -418,9 +418,9 @@ def uwp_nightly():
.with_features("taskclusterProxy")
.with_scopes("secrets:get:project/servo/s3-upload-credentials")
.with_script(
"mach build --release --uwp",
"python mach build --release --uwp --win-arm64",
"mach package --release --uwp=x64 --uwp=arm64",
"python mach build --release --target=x86_64-uwp-windows-msvc",
"python mach build --release --target=aarch64-uwp-windows-msvc",
"mach package --release --target=x86_64-uwp-windows-msvc --uwp=x64 --uwp=arm64",
"mach upload-nightly uwp --secret-from-taskcluster",
)
.with_artifacts(appx_artifact(debug=False))

View file

@ -164,17 +164,18 @@ class MachCommands(CommandBase):
@CommandArgument('--very-verbose', '-vv',
action='store_true',
help='Print very verbose output')
@CommandArgument('--win-arm64', action='store_true', help="Use arm64 Windows target")
@CommandArgument('params', nargs='...',
help="Command-line arguments to be passed through to Cargo")
@CommandBase.build_like_command_arguments
def build(self, release=False, dev=False, jobs=None, params=None,
no_package=False, verbose=False, very_verbose=False,
target=None, android=False, magicleap=False, libsimpleservo=False, uwp=False,
features=None, win_arm64=False, **kwargs):
target=None, android=False, magicleap=False, libsimpleservo=False,
features=None, **kwargs):
opts = params or []
features = features or []
target, android = self.pick_target_triple(target, android, magicleap)
uwp = target and 'uwp' in target
target_path = base_path = self.get_target_dir()
if android:
@ -220,14 +221,8 @@ class MachCommands(CommandBase):
if very_verbose:
opts += ["-vv"]
if win_arm64:
if target:
print("Can't specify explicit --target value with --win-arm64.")
sys.exit(1)
target = "aarch64-pc-windows-msvc"
if target:
if self.config["tools"]["use-rustup"]:
if self.config["tools"]["use-rustup"] and not uwp:
# 'rustup target add' fails if the toolchain is not installed at all.
self.call_rustup_run(["rustc", "--version"])
@ -265,6 +260,10 @@ class MachCommands(CommandBase):
env['PKG_CONFIG_ALLOW_CROSS'] = "1"
if uwp:
# Ensure libstd is ready for the new UWP target.
check_call(["rustup", "component", "add", "rust-src"])
env['RUST_SYSROOT'] = path.expanduser('~\\.xargo')
# Don't try and build a desktop port.
libsimpleservo = True
@ -943,7 +942,7 @@ def package_msvc_dlls(servo_exe_dir, target, vcinstalldir, vs_version):
"msvcp140.dll",
"vcruntime140.dll",
]
if target_arch != "aarch64" and vs_version in ("14.0", "15.0", "16.0"):
if target_arch != "aarch64" and "uwp" not in target 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

View file

@ -634,6 +634,7 @@ install them, let us know by filing a bug!")
extra_path += [path.join(self.msvc_package_dir("llvm"), "bin")]
extra_path += [path.join(self.msvc_package_dir("ninja"), "bin")]
extra_path += [self.msvc_package_dir("nuget")]
extra_path += [path.join(self.msvc_package_dir("xargo"))]
arch = (target or host_triple()).split('-')[0]
vcpkg_arch = {
@ -821,11 +822,6 @@ install them, let us know by filing a bug!")
action='store_true',
help='Build with frame pointer enabled, used by the background hang monitor.',
),
CommandArgument(
'--uwp',
default=None,
action='store_true',
help='Build for HoloLens (x64)'),
CommandArgument('--with-raqote', default=None, action='store_true'),
CommandArgument('--with-layout-2020', default=None, action='store_true'),
CommandArgument('--without-wgl', default=None, action='store_true'),
@ -912,7 +908,10 @@ install them, let us know by filing a bug!")
assert "--features" not in cargo_args
args += ["--features", " ".join(features)]
return self.call_rustup_run(["cargo", command] + args + cargo_args, env=env, verbose=verbose)
if target and 'uwp' in target:
return call(["xargo", command] + args + cargo_args, env=env, verbose=verbose)
else:
return self.call_rustup_run(["cargo", command] + args + cargo_args, env=env, verbose=verbose)
def android_support_dir(self):
return path.join(self.context.topdir, "support", "android")

View file

@ -11,4 +11,5 @@ WINDOWS_MSVC = {
"openssl": "111.3.0+1.1.1c-vs2017-2019-09-18",
"gstreamer-uwp": "1.16.0.5",
"openxr-loader-uwp": "1.0",
"xargo": "v0.3.16",
}

View file

@ -40,4 +40,4 @@
<Capability Name="codeGeneration" />
<Capability Name="privateNetworkClientServer" />
</Capabilities>
</Package>
</Package>

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff