aboutsummaryrefslogtreecommitdiffstats
path: root/python/servo/command_base.py
Commit message (Collapse)AuthorAgeFilesLines
* No extern crate test/tidy & better RUSTFLAGS handling in mach (#30328)Samson2023-09-101-4/+5
| | | | | | | | | | | * Remove unused extern crate rustflag * Remove tidy check alphabetical order of extern crates rustfmt's reorder_imports already does that * fix * better RUSTFLAGS handling
* Update mozjs and use moztools infra (#30292)Samson2023-09-051-5/+0
|
* Let WPT commands take the --legacy-layout argument (#30239)Martin Robinson2023-08-301-1/+0
| | | This also prints a better message when starting tests.
* Always dummy (#30240)Samson2023-08-301-5/+5
|
* Rename ports/winit package to servoshell (#30163)Atbrakhi2023-08-281-1/+1
| | | | | * rename winit package to servoshell * revert previous changes and rename only package
* Get LLVM from chocolatey (#30140)Martin Robinson2023-08-211-6/+3
| | | | | | | | | | | | LLVM is the largest package that we get from servo-build-deps, so installing it via chocolatey should reduce the amount of data that we transfer from that source. In addition, it's one less dependency that we have to manage. It also seems that installing LLVM to the default location with choco means that we no longer have to set the LIBCLANG_PATH environment variable for bindgen. Co-authored-by: Mukilan Thiyagarajan <mukilan@igalia.com>
* Use system lld on NixOS instead of rust-lld (#30123)Mukilan Thiyagarajan2023-08-181-1/+1
| | | | | | | | | | | | | | | | The -Zgcc-ld=lld flag makes rust use the rust-lld linker that is distributed as part of rust toolchain. However, this flag doesn't work on nixos correctly as 1) rust-lld needs to be patched to have the correct rpath to find libz.so 2) the bin/gcc-ld/ld.lld wrapper which calls rust-lld also needs to be patched to use the correct dynamic loader 3) rust-lld doesn't respect NIX_LDFLAGS which contains the additional search path derived from buildInputs. The system linkers on nixos are wrapped so that NIX_LDFLAGS is added as the rpath to the final binary. Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
* Clean up the environment variables set for mozjs (#30106)Martin Robinson2023-08-161-23/+8
| | | | mozjs from the repository now has a simplified interface for setting these.
* Remove gold config option and use lld on Linux (#30100)Martin Robinson2023-08-151-3/+5
| | | | | | | | | | | | | | | | There are a few motivations for this change: 1. lld is demonstrably faster than gold, but is really only stable on Linux at the moment. There's a good chance that it will be ready for all platforms soon though. 2. Most people do not have gold installed on MacOS and Windows. You'd have to do this manually through homebrew. I think it's a safe assumption that this probably won't be slowing things down much on those platforms. 3. We need to remove all configuration of the build that happens while running `./mach build` if we ever hope to make `cargo build` equivalent to the mach build. This unlocks static configuration of the rustflags. One of the big blockers for proper `cargo build` support.
* Make `native-bluetooth` a default feature (#30097)Martin Robinson2023-08-141-2/+0
| | | This features is turned on unconditionally by `./mach build`.
* Make the `--release`/`--dev` more consistent and less surprising (#30091)Martin Robinson2023-08-141-111/+127
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There were some issues with the way that the `--release` and `--dev` arguments were handled in mach commands. - Not all commands accepted them in the same way. For instance `./mach test-wpt` didn't really accept them at all. - If you did not pass either of them, mach would try to guess which build you meant. This guess was often quite surprising as it wasn't printed and it depended on the state of the your target directory, which is difficult to remember. - The `dev` profile is colloquially called a "debug" profile and some commands accepted `-d` or `--debug...` like arguments, but `--debug` with `./mach run` meant run in a debugger. It was easy to mix this up. This change: - Centralizes where build type argument processing happens. Now it the same shared decorator in CommandBase. - Uses a `BuildType` enum instead of passing around two different booleans. This reduces the error checking for situations where both are true. - Be much less clever about guessing what build to use. Now if you don't specify a build type, `--dev` is chosen. I think this behavior matches cargo. - Makes it so that `./mach test-wpt` accepts the exact same arguments and has the same behavior as other commands. In addition, the suite correct for `test-wpt` is removed. There are only two suites now and it's quite unlikely that people will confuse WPT tests for rust unit tests.
* Switch to rustls and webpki-roots (#30025)Martin Robinson2023-08-081-21/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change replaces OpenSSL with rustls and also the manually curated CA certs file with webpki-roots (effectively the same thing, but as a crate). Generally speaking the design of the network stack is the same. Changes: - Code around certificate overrides needed to be refactored to work with rustls so the various thread-safe list of certificates is refactored into `CertificateErrorOverrideManager` - hyper-rustls takes care of setting ALPN protocols for HTTP requests, so for WebSockets this is moved to the WebSocket code. - The safe set of cypher suites is chosen, which seem to correspond to the "Modern" configuration from [1]. This can be adjusted later. - Instead of passing a string of PEM CA certificates around, an enum is used that includes parsed Certificates (or the default which reads them from webpki-roots). - Code for starting up an SSL server for testing is cleaned up a little, due to the fact that the certificates need to be overriden explicitly now. This is due to the fact that the `webpki` crate is more stringent with self-signed certificates than SSL (CA certificates cannot used as end-entity certificates). [2] 1. https://wiki.mozilla.org/Security/Server_Side_TLS 2. https://github.com/briansmith/webpki/issues/114 Fixes #7888. Fixes #13749. Fixes #26835. Fixes #29291.
* Fix the docs build (#30058)Martin Robinson2023-08-021-5/+5
| | | | | | Type inference was incorrectly inferring that our `check_output()` helper was returning `str` when in reality, it returns `bytes`. This fixes the caller that was no longer decoding those bytes and fixes the type annotation on the function.
* Make rustup a requirement and switch to `rust-toolchain.toml` (#30056)Martin Robinson2023-08-011-49/+13
| | | | | | | | | | | | | | This change makes rustup a requirement for building Servo with `./mach` and switches to the newer `rust-toolchain.toml` format. The goal here is to make mach builds more similar to non-mach builds. - The new format allows listing the required components, removing some of the complexity from our mach scripts. - This means we must raise the required version of rustup to 1.23. The current version is 1.26. - We no longer wrap every call to cargo and rustc in "rustup run" calls as both cargo and rustc will take care of installing and using all necessary components specified in `rust-toolchain.toml` when run inside the project directory.
* Embed git hash using vergen instead of mach (#30030)Martin Robinson2023-07-281-36/+0
| | | | | | Embed the git hash into the servo binary using vergen instead of using custom Python code in mach. The benefit here is ones less difference between a normal cargo run and building via mach in addition to removing a bunch of code.
* Run unit tests with both layout 2013 and layout 2020 (#30032)Oriol Brufau2023-07-271-1/+0
| | | | | | | | Since #29950, unit tests were only running with the legacy layout, and there was no way to run them for layout 2020. This patch makes './mach test-unit' run unit tests for both. Also doing some changes so that the layout 2020 floats.rs tests compile.
* Make the choice of layout runtime settingMartin Robinson2023-07-061-9/+0
| | | | Co-authored-by: Samson <16504129+sagudev@users.noreply.github.com>
* Auto merge of #29970 - mrobinson:remove-uwp, r=jdmbors-servo2023-07-051-32/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Remove UWP / Hololens support <!-- Please describe your changes on the following line: --> --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: --> - [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 they remove a feature. <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
| * Remove UWP / Hololens supportMartin Robinson2023-07-051-32/+1
| |
* | Collect android build setup into two methodsMartin Robinson2023-07-051-38/+198
|/ | | | | | | | | | This is small refactor which tries to isolate all of the Android setup into a couple methods, so that it is easier to reason about in the scripts. This doesn't change any behavior but does fix a few small linting errors in the existing code. Note: The Android build is currently broken and this change doesn't fix it. It shouldn't break it any more though.
* Windows bootstrap supportMartin Robinson2023-07-031-10/+2
|
* Update mozangleMartin Robinson2023-07-011-3/+1
| | | | | This should allow servo to take advantage of faster compilation speeds on Windows.
* Update mozangle, cc, and cmakeMartin Robinson2023-06-301-6/+6
| | | | | | | | | This also moves some environment variable configuration to the shared `build_env()` method, because previously clang was only being chosen for running `./mach build` and not `./mach test-unit` which was leading to rebuilds and thus build failures when running `test-unit`. I guess the cmake crate does not expect the compiler to change between subsequent runs.
* Auto merge of #29917 - mrobinson:more-environment-cleanup, r=jdmbors-servo2023-06-241-24/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Clean up environment variables in `command_base.py` - The `HOST_FILE` setting is completely unused by the code. - Remove some likely Python 2 compatibility code. - Remove things pertaining to Ubuntu 16.04 which is EOL. - Remove a workaround for MacOS which no longer applies. <!-- Please describe your changes on the following line: --> --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: --> - [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 they mostly remove dead build script code. <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
| * Clean up environment variables inn `command_base.py`Martin Robinson2023-06-221-24/+1
| | | | | | | | | | | | | | - The `HOST_FILE` setting is completely unused by the code. - Remove some likely Python 2 compatibility code. - Remove things pertaining to Ubuntu 16.04 which is EOL. - Remove a workaround for MacOS which no longer applies.
* | Update command_base.pySamson2023-06-241-1/+1
| | | | | | Fixup for https://github.com/servo/servo/pull/29912#issuecomment-1605347271
* | Don't explicitly disable gold on WindowsMartin Robinson2023-06-221-2/+1
|/ | | | | This seems to be working fine now on CI, so I think we can remove this workaround.
* Simplify the build instructionsMartin Robinson2023-06-211-2/+2
| | | | | | | | | - Add a chocolatey configuration that installs all dependencies and split the instructions into a normal and manual installation section. In addition fix a warning print statement for the Windows build that would trigger a Python exception. - Simplify the build instructions in the README and move all manual setup details to: https://github.com/servo/servo/wiki/Building
* Clean up rustdoc runMartin Robinson2023-06-201-7/+3
| | | | | | | | | 1. The options specified in `rustdoc-with-private` are essentially the default now so we can remove this script. 2. `./mach browse-doc` is redundant with `./mach doc --open` which uses the underlying cargo functionality to browse the documentation. Fixes #29888.
* Use layout 2020 by defaultMukilan Thiyagarajan2023-06-081-1/+1
| | | | Signed-off-by: Mukilan Thiyagarajan <me@mukilan.in>
* Auto merge of #29811 - mrobinson:remove-more-python-2, r=jdmbors-servo2023-05-291-25/+0
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Remove more Python 2 compatibility code - os.environ is always `str` in Python 3. - The only string type is `str` so we can stop using `six.str_types`. - `iteritems()` isn't necessary because dicts have the `items()` method. <!-- Please describe your changes on the following line: --> --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: --> - [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 they do not change behavior. <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
| * Remove more Python 2 compatibility codeMartin Robinson2023-05-291-25/+0
| | | | | | | | | | | | - os.environ is always `str` in Python 3. - The only string type is `str` so we can stop using `six.str_types`. - `iteritems()` isn't necessary because dicts have the `items()` method.
* | Auto merge of #29807 - sagudev:pyfail, r=mrobinsonbors-servo2023-05-291-1/+1
|\ \ | |/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Propagate status on `build_like_command_arguments` As observed in #29805 --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] These changes fix #29806 <!-- Either: --> - [ ] There are tests for these changes OR - [ ] These changes do not require tests because ___ <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
| * Propagate status on `build_like_command_arguments`sagudev2023-05-291-1/+1
| |
* | Do not pass features when running `./mach test-unit`Martin Robinson2023-05-291-4/+3
|/
* Only check the GStreamer installation when buildingMartin Robinson2023-05-271-3/+4
| | | | | | | | | Instead of always checking whether GStreamer is installed in mach's `build_env`, only do this when actually building. Also, use the instance variable to find features and look for the "media-gstreamer" feature instead of looking for !"media-dummy." Fixes #29797.
* Clean up cross-compilation and featuresMartin Robinson2023-05-251-68/+124
| | | | | | | | | | | | Integrate cross-compilation and media-stack handling into the `build_like_command_arguments` decorator. This removes a lot of repetition in the code and standardizes how targets are selected for all similar commands. Now cross compilation targets, feature flags, and helper variables are stored in the CommandBase instance. This also avoids having to continuously pass these arguments down to functions called by the commands.
* Implement `bootstrap-gstreamer` for all platformsMartin Robinson2023-05-251-110/+17
| | | | | | | | | | | | | | | | | | This change makes it so that the Platform classes can now handle installing GStreamer dependencies and properly setting up the environment including when cross-compiling. For Windows and Linux is now installed into `target/dependencies/gstreamer` when not installed system-wide. In addition: 1. Creating and moving existing environment path append helpers to `util.py`. 2. Combining the `set_run_env` and `build_dev` functions and moving some outside code into them so that it can be shared. Now code that used to call `set_run_env` calls `build_dev` and then `os.environ.update(...)`. 3. Adding Python typing information in many places. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* Apply some review fixesmichaelgrigoryan252023-05-221-0/+5
|
* Removed MagicLeap occurrences from Python filesmichaelgrigoryan252023-05-221-14/+5
|
* Remove `magicleap` command from command_base.pymichaelgrigoryan252023-05-221-6/+0
|
* Start organizing platform-specific Python codeMartin Robinson2023-05-191-20/+17
| | | | | | This starts to split platform-specific Python code into its own module, which should help to tidy up our mach commands and make things more reusable.
* Consume official GStreamer binaries on MacOSMukilan Thiyagarajan2023-05-121-7/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This PR re-enables support for the gstreamer mediastack in macOS by consuming the official binary '.pkg' files from gstreamer.freedesktop.org To maintain symmetry with other platforms, the '.pkg' files are uploaded to servo-build-deps and fetched from there using the new script 'etc/install_macos_gstreamer.sh'. Unlike the Homebrew version, the official GStreamer is distributed as a 'relocatable' framework i.e the dylibs all have @rpath-relative install names and also link to other dylibs using @rpath relative path. To address this difference the 'servo' binary needs to be patched with 'install_name_tool' to add an LC_RPATH command that sets the relative paths that the dynamic linker should search when trying to satify dependencies. In Servo's case, this will be a path relative to the 'servo' binary itself i.e '@executable_path/lib/' The additional 'lib' is due to a flaw in the gstreamer packaging where the install names of some of the dylibs have the prefix '@rpath/lib' and some of them just have '@rpath'. This PR also fixes a couple of issues present in the `mach build` process on MacOS: 1. `mach build` process was not copying transitive dependencies of servo binary but only the first level dylibs 2. `mach build` process didn't patch the links to dylibs in servo binary (and dependencies). This meant though (some) dylibs were copied to local path, the binary still loaded the dylibs from system GStreamer installation i.e homebrew instead of the copieds dylibs The build and runtime dependencies in etc/homebrew/Brewfile and etc/homebrew/Brewfile-build have also been removed in This PR. Signed-off-by: Mukilan Thiyagarajan <me@mukilan.in>
* Use resolver v2sagudev2023-05-071-24/+26
|
* Replace usage of six.moves.urllib with urllibMartin Robinson2023-04-101-14/+15
| | | | | | Also organize some of the imports. Now that Servo only uses Python 3, this module is unnecessary. This is part of the gradual migration to using only Python 3.
* Have all mach command accept "--with-layout-2020" and "--layout-2020"Martin Robinson2023-04-071-2/+2
| | | | | | Some command accepted one and some the other. This changes makes them all accept both so it's no longer necessary to remember which uses which.
* Fix simpleservo binary check on macosYuri Witte2021-09-121-1/+6
|
* Fix deprecated gzipfile constructor argument.Josh Matthews2021-05-031-1/+1
|
* Auto merge of #27865 - servo:github-actions-dev, r=jdmbors-servo2021-03-111-0/+8
|\ | | | | | | Add Github Actions workflow for mac/linux/windows builds
| * Ensure clang-cl is always used in windows builds.Josh Matthews2021-02-261-0/+8
| |