Auto merge of #24185 - jdm:uwp-native-build, r=asajeffrey

Fix many WACK errors

These changes ensure that all native dependencies are built with the compiler flags that will prevent forbidden API uses. They also incorporate a fork of rand_os that backports UWP support from more recent rand releases. This is necessary in the short term to avoid having to wait for the entire ecosystem to migrate to the most recent rand release.

Depends on https://github.com/servo/mozjs/pull/200 and https://github.com/servo/rust-mozjs/pull/471.

---
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes do not require tests because no windows WACK tests

<!-- 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/24185)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2019-09-20 11:22:02 -04:00 committed by GitHub
commit b3c2bed84b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 30 additions and 21 deletions

38
Cargo.lock generated
View file

@ -2571,7 +2571,7 @@ dependencies = [
"layout_thread_2020 0.0.1", "layout_thread_2020 0.0.1",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"media 0.0.1", "media 0.0.1",
"mozangle 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", "mozangle 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)",
"msg 0.0.1", "msg 0.0.1",
"net 0.0.1", "net 0.0.1",
"net_traits 0.0.1", "net_traits 0.0.1",
@ -2932,7 +2932,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]] [[package]]
name = "mozangle" name = "mozangle"
version = "0.2.5" version = "0.2.7"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"cc 1.0.35 (registry+https://github.com/rust-lang/crates.io-index)", "cc 1.0.35 (registry+https://github.com/rust-lang/crates.io-index)",
@ -2944,20 +2944,20 @@ dependencies = [
[[package]] [[package]]
name = "mozjs" name = "mozjs"
version = "0.12.0" version = "0.12.0"
source = "git+https://github.com/servo/rust-mozjs#92136c0b9a1efba2eb18b4400669278705816027" source = "git+https://github.com/servo/rust-mozjs#a09f2a8b877e6f584e65c41f1711422bfbcc4332"
dependencies = [ dependencies = [
"cc 1.0.35 (registry+https://github.com/rust-lang/crates.io-index)", "cc 1.0.35 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"mozjs_sys 0.67.0 (git+https://github.com/servo/mozjs?rev=2bf4912a6ff1f5ea333afb1cb53dfe9361157b14)", "mozjs_sys 0.67.0 (git+https://github.com/servo/mozjs?rev=9ad6d4b2b5478521b7731c700c8f56e25597e520)",
"num-traits 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
name = "mozjs_sys" name = "mozjs_sys"
version = "0.67.0" version = "0.67.0"
source = "git+https://github.com/servo/mozjs?rev=2bf4912a6ff1f5ea333afb1cb53dfe9361157b14#2bf4912a6ff1f5ea333afb1cb53dfe9361157b14" source = "git+https://github.com/servo/mozjs?rev=9ad6d4b2b5478521b7731c700c8f56e25597e520#9ad6d4b2b5478521b7731c700c8f56e25597e520"
dependencies = [ dependencies = [
"bindgen 0.49.2 (registry+https://github.com/rust-lang/crates.io-index)", "bindgen 0.49.2 (registry+https://github.com/rust-lang/crates.io-index)",
"cc 1.0.35 (registry+https://github.com/rust-lang/crates.io-index)", "cc 1.0.35 (registry+https://github.com/rust-lang/crates.io-index)",
@ -3588,11 +3588,11 @@ dependencies = [
"autocfg 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "autocfg 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)",
"rand_chacha 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "rand_chacha 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "rand_core 0.4.2 (git+https://github.com/servo/rand?branch=servo-rand_os-0.1.3-uwp)",
"rand_hc 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "rand_hc 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"rand_isaac 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "rand_isaac 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"rand_jitter 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "rand_jitter 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
"rand_os 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "rand_os 0.1.3 (git+https://github.com/servo/rand?branch=servo-rand_os-0.1.3-uwp)",
"rand_pcg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "rand_pcg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"rand_xorshift 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "rand_xorshift 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
@ -3612,13 +3612,13 @@ name = "rand_core"
version = "0.3.1" version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "rand_core 0.4.2 (git+https://github.com/servo/rand?branch=servo-rand_os-0.1.3-uwp)",
] ]
[[package]] [[package]]
name = "rand_core" name = "rand_core"
version = "0.4.2" version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "git+https://github.com/servo/rand?branch=servo-rand_os-0.1.3-uwp#13b836653183635c0bae3171a63f6faaf6d41809"
[[package]] [[package]]
name = "rand_hc" name = "rand_hc"
@ -3642,19 +3642,19 @@ version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)",
"rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "rand_core 0.4.2 (git+https://github.com/servo/rand?branch=servo-rand_os-0.1.3-uwp)",
"winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
name = "rand_os" name = "rand_os"
version = "0.1.3" version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "git+https://github.com/servo/rand?branch=servo-rand_os-0.1.3-uwp#13b836653183635c0bae3171a63f6faaf6d41809"
dependencies = [ dependencies = [
"cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", "cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
"fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)",
"rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "rand_core 0.4.2 (git+https://github.com/servo/rand?branch=servo-rand_os-0.1.3-uwp)",
"rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
@ -3665,7 +3665,7 @@ version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"autocfg 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "autocfg 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "rand_core 0.4.2 (git+https://github.com/servo/rand?branch=servo-rand_os-0.1.3-uwp)",
] ]
[[package]] [[package]]
@ -3928,7 +3928,7 @@ dependencies = [
"mime 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)", "mime 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)",
"mime_guess 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "mime_guess 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
"mitochondria 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "mitochondria 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"mozangle 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", "mozangle 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)",
"mozjs 0.12.0 (git+https://github.com/servo/rust-mozjs)", "mozjs 0.12.0 (git+https://github.com/servo/rust-mozjs)",
"msg 0.0.1", "msg 0.0.1",
"net_traits 0.0.1", "net_traits 0.0.1",
@ -4476,7 +4476,7 @@ dependencies = [
"lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)",
"rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "rand_core 0.4.2 (git+https://github.com/servo/rand?branch=servo-rand_os-0.1.3-uwp)",
"rand_isaac 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "rand_isaac 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"uuid 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)", "uuid 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
@ -6117,9 +6117,9 @@ dependencies = [
"checksum miow 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "396aa0f2003d7df8395cb93e09871561ccc3e785f0acb369170e8cc74ddf9226" "checksum miow 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "396aa0f2003d7df8395cb93e09871561ccc3e785f0acb369170e8cc74ddf9226"
"checksum mitochondria 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9de3eca27871df31c33b807f834b94ef7d000956f57aa25c5aed9c5f0aae8f6f" "checksum mitochondria 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9de3eca27871df31c33b807f834b94ef7d000956f57aa25c5aed9c5f0aae8f6f"
"checksum moite_moite 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "eeb5a94c61e12e2cfc16ee3e2b6eca8f126a43c888586626337544a7e824a1af" "checksum moite_moite 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "eeb5a94c61e12e2cfc16ee3e2b6eca8f126a43c888586626337544a7e824a1af"
"checksum mozangle 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "0643469d6622a4ffae6a74f13e78a32bfa1406fe8a63010b3fbf2946797fdac7" "checksum mozangle 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "75a61b5a06b6f362eb45590ddf2643c255768a7039bcde1dc70320b97e7f9651"
"checksum mozjs 0.12.0 (git+https://github.com/servo/rust-mozjs)" = "<none>" "checksum mozjs 0.12.0 (git+https://github.com/servo/rust-mozjs)" = "<none>"
"checksum mozjs_sys 0.67.0 (git+https://github.com/servo/mozjs?rev=2bf4912a6ff1f5ea333afb1cb53dfe9361157b14)" = "<none>" "checksum mozjs_sys 0.67.0 (git+https://github.com/servo/mozjs?rev=9ad6d4b2b5478521b7731c700c8f56e25597e520)" = "<none>"
"checksum msdos_time 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "aad9dfe950c057b1bfe9c1f2aa51583a8468ef2a5baba2ebbe06d775efeb7729" "checksum msdos_time 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "aad9dfe950c057b1bfe9c1f2aa51583a8468ef2a5baba2ebbe06d775efeb7729"
"checksum muldiv 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "451a9a05d2a32c566c897835e0ea95cf79ed2fdfe957924045a1721a36c9980f" "checksum muldiv 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "451a9a05d2a32c566c897835e0ea95cf79ed2fdfe957924045a1721a36c9980f"
"checksum net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)" = "42550d9fb7b6684a6d404d9fa7250c2eb2646df731d1c06afc06dcee9e1bcf88" "checksum net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)" = "42550d9fb7b6684a6d404d9fa7250c2eb2646df731d1c06afc06dcee9e1bcf88"
@ -6177,11 +6177,11 @@ dependencies = [
"checksum rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)" = "6d71dacdc3c88c1fde3885a3be3fbab9f35724e6ce99467f7d9c5026132184ca" "checksum rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)" = "6d71dacdc3c88c1fde3885a3be3fbab9f35724e6ce99467f7d9c5026132184ca"
"checksum rand_chacha 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "556d3a1ca6600bfcbab7c7c91ccb085ac7fbbcd70e008a98742e7847f4f7bcef" "checksum rand_chacha 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "556d3a1ca6600bfcbab7c7c91ccb085ac7fbbcd70e008a98742e7847f4f7bcef"
"checksum rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b" "checksum rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b"
"checksum rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9c33a3c44ca05fa6f1807d8e6743f3824e8509beca625669633be0acbdf509dc" "checksum rand_core 0.4.2 (git+https://github.com/servo/rand?branch=servo-rand_os-0.1.3-uwp)" = "<none>"
"checksum rand_hc 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7b40677c7be09ae76218dc623efbf7b18e34bced3f38883af07bb75630a21bc4" "checksum rand_hc 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7b40677c7be09ae76218dc623efbf7b18e34bced3f38883af07bb75630a21bc4"
"checksum rand_isaac 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ded997c9d5f13925be2a6fd7e66bf1872597f759fd9dd93513dd7e92e5a5ee08" "checksum rand_isaac 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ded997c9d5f13925be2a6fd7e66bf1872597f759fd9dd93513dd7e92e5a5ee08"
"checksum rand_jitter 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "7b9ea758282efe12823e0d952ddb269d2e1897227e464919a554f2a03ef1b832" "checksum rand_jitter 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "7b9ea758282efe12823e0d952ddb269d2e1897227e464919a554f2a03ef1b832"
"checksum rand_os 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "7b75f676a1e053fc562eafbb47838d67c84801e38fc1ba459e8f180deabd5071" "checksum rand_os 0.1.3 (git+https://github.com/servo/rand?branch=servo-rand_os-0.1.3-uwp)" = "<none>"
"checksum rand_pcg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "abf9b09b01790cfe0364f52bf32995ea3c39f4d2dd011eac241d2914146d0b44" "checksum rand_pcg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "abf9b09b01790cfe0364f52bf32995ea3c39f4d2dd011eac241d2914146d0b44"
"checksum rand_xorshift 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cbf7e9e623549b0e21f6e97cf8ecf247c1a8fd2e8a992ae265314300b2455d5c" "checksum rand_xorshift 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cbf7e9e623549b0e21f6e97cf8ecf247c1a8fd2e8a992ae265314300b2455d5c"
"checksum raqote 0.6.5-alpha.0 (git+https://github.com/jrmuizel/raqote)" = "<none>" "checksum raqote 0.6.5-alpha.0 (git+https://github.com/jrmuizel/raqote)" = "<none>"

View file

@ -28,3 +28,6 @@ opt-level = 3
# Those are here to dedupe winapi since mio is still using winapi 0.2. # Those are here to dedupe winapi since mio is still using winapi 0.2.
mio = { git = "https://github.com/servo/mio.git", branch = "servo" } mio = { git = "https://github.com/servo/mio.git", branch = "servo" }
iovec = { git = "https://github.com/servo/iovec.git", branch = "servo" } iovec = { git = "https://github.com/servo/iovec.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" }

View file

@ -20,6 +20,7 @@ webidl_lint = ["script_plugins/webidl_lint"]
default = ["unrooted_must_root_lint", "webidl_lint"] default = ["unrooted_must_root_lint", "webidl_lint"]
webgl_backtrace = ["backtrace", "canvas_traits/webgl_backtrace"] webgl_backtrace = ["backtrace", "canvas_traits/webgl_backtrace"]
js_backtrace = ["backtrace"] js_backtrace = ["backtrace"]
uwp = ["js/uwp"]
[build-dependencies] [build-dependencies]
cmake = "0.1" cmake = "0.1"
@ -27,7 +28,7 @@ phf_codegen = "0.7"
phf_shared = "0.7" phf_shared = "0.7"
serde_json = "1.0" serde_json = "1.0"
[target.'cfg(any(target_os = "macos", target_os = "linux", target_os = "windows"))'.dependencies] [target.'cfg(target_os = "linux")'.dependencies]
tinyfiledialogs = "3.0" tinyfiledialogs = "3.0"
[dependencies] [dependencies]

View file

@ -25,7 +25,7 @@ layout-2020 = ["layout_thread_2020"]
max_log_level = ["log/release_max_level_info"] max_log_level = ["log/release_max_level_info"]
native-bluetooth = ["bluetooth/native-bluetooth"] native-bluetooth = ["bluetooth/native-bluetooth"]
no_wgl = ["canvas/no_wgl"] no_wgl = ["canvas/no_wgl"]
uwp = ["servo_config/uwp"] uwp = ["servo_config/uwp", "script/uwp"]
webrender_debugger = ["webrender/debugger"] webrender_debugger = ["webrender/debugger"]
no_static_freetype = ["webrender/no_static_freetype"] no_static_freetype = ["webrender/no_static_freetype"]
oculusvr = ["webvr/oculusvr"] oculusvr = ["webvr/oculusvr"]

View file

@ -618,6 +618,11 @@ class MachCommands(CommandBase):
if sys.platform == "win32": if sys.platform == "win32":
env.setdefault("CC", "clang-cl.exe") env.setdefault("CC", "clang-cl.exe")
env.setdefault("CXX", "clang-cl.exe") env.setdefault("CXX", "clang-cl.exe")
if uwp:
env.setdefault("CFLAGS", "")
env.setdefault("CXXFLAGS", "")
env["CFLAGS"] += " -DWINAPI_FAMILY=WINAPI_FAMILY_APP"
env["CXXFLAGS"] += " -DWINAPI_FAMILY=WINAPI_FAMILY_APP"
else: else:
env.setdefault("CC", "clang") env.setdefault("CC", "clang")
env.setdefault("CXX", "clang++") env.setdefault("CXX", "clang++")