Commit graph

41 commits

Author SHA1 Message Date
sagudev
4d4f94936f
script: copy include! files from script_bindings to script's OUT_DIR (#36384)
copy generated `include!`d files from script_bindings's OUT_DIR, to
script's OUT_DIR to allow Rust Analyzer to load them.
This is done to bypass limitation of Rust Analyzer:
https://github.com/rust-lang/rust-analyzer/issues/17040

Also build script will now be rerun only when there are actual changes
to concrete bindings due to emitted `cargo::rerun-if-changed` (not for
each change in script crate).

Testing: It compiles so it works, I tested manually and RA now works as
expected (although we need to from type alias to concrete union-types
definitions)
Fixes:
https://servo.zulipchat.com/#narrow/channel/263398-general/topic/rust-analyzer.20failed.20to.20include.20codes.20in.20script_bindings

---------

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
2025-04-08 19:22:24 +00:00
Josh Matthews
af8d7c2de7
script: Move code generation and webidl files to new script_bindings crate. (#35157)
Signed-off-by: Josh Matthews <josh@joshmatthews.net>
2025-01-24 20:47:43 +00:00
Simon Wülker
9f4787f006
Remove workaround for fixed ICE (#35069)
Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
2025-01-19 04:13:17 +00:00
Josh Matthews
c94d909a86
script: Limit public exports. (#34915)
* script: Restrict reexport visibility of DOM types.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* script: Mass pub->pub(crate) conversion.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* script: Hide existing dead code warnings.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* Formatting.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* Fix clippy warnings.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* Formatting.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* Fix unit tests.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* Fix clippy.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* More formatting.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

---------

Signed-off-by: Josh Matthews <josh@joshmatthews.net>
2025-01-10 08:19:19 +00:00
Nico Burns
deb819f233
Upgrade rustc to 1.83 (#34793)
* Upgrade rustc to 1.83

Signed-off-by: Nico Burns <nico@nicoburns.com>

* Fix crown (change copied from linked clippy function)

Signed-off-by: Nico Burns <nico@nicoburns.com>

* Fix named lifetime lint

Signed-off-by: Nico Burns <nico@nicoburns.com>

* Bump shell.nix

Signed-off-by: Nico Burns <nico@nicoburns.com>

* Fix non-local impl warnings

Signed-off-by: Nico Burns <nico@nicoburns.com>

* Format with 1.83 formatting changes

Signed-off-by: Nico Burns <nico@nicoburns.com>

* Fix manual non-local impl

Signed-off-by: Nico Burns <nico@nicoburns.com>

* More fixes for crown

Signed-off-by: Nico Burns <nico@nicoburns.com>

* Fix tidy

Signed-off-by: Nico Burns <nico@nicoburns.com>

* Fix needless_return lints

Signed-off-by: Nico Burns <nico@nicoburns.com>

* Fix doc comment lint

Signed-off-by: Nico Burns <nico@nicoburns.com>

* Fix missing wait lint

Signed-off-by: Nico Burns <nico@nicoburns.com>

* Allow needless_lifetimes lint

Signed-off-by: Nico Burns <nico@nicoburns.com>

* more doc comments

Signed-off-by: Nico Burns <nico@nicoburns.com>

* More needless_returns

Signed-off-by: Nico Burns <nico@nicoburns.com>

* is_empty lint

Signed-off-by: Nico Burns <nico@nicoburns.com>

* Fix needless_lifetime lints

Signed-off-by: Nico Burns <nico@nicoburns.com>

* fix div_ceil lint

Signed-off-by: Nico Burns <nico@nicoburns.com>

* Allow non-minimal bool

Signed-off-by: Nico Burns <nico@nicoburns.com>

* Non-local impl in constellation

Signed-off-by: Nico Burns <nico@nicoburns.com>

* Missing wait in constellation

Signed-off-by: Nico Burns <nico@nicoburns.com>

* fmt

Signed-off-by: Nico Burns <nico@nicoburns.com>

* remove useless lints table

Signed-off-by: Nico Burns <nico@nicoburns.com>

* Fixup comments

Signed-off-by: Nico Burns <nico@nicoburns.com>

* Allow non-local definition in sandboxing code to simplify feature flagging

Signed-off-by: Nico Burns <nico@nicoburns.com>

* Remove wait calls and allow zombie_processes lint

Signed-off-by: Nico Burns <nico@nicoburns.com>

---------

Signed-off-by: Nico Burns <nico@nicoburns.com>
2025-01-01 09:38:28 +00:00
Samson
96006daf6e
use rerun-if-changed in script/build.rs (#33502)
* use rerun-if-changed in script/build.rs

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>

* handle rerun on changes in webidl.py

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>

* Address comment nit

Signed-off-by: Martin Robinson <mrobinson@igalia.com>

---------

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
2024-09-30 11:31:05 +00:00
Gae24
f986160ed4
fix many clippy warnings (#33510)
Signed-off-by: Gae24 <96017547+Gae24@users.noreply.github.com>
2024-09-21 13:58:31 +00:00
Jonathan Schwender
637770600f
libservo: Improve finding python (#33385)
* libservo: Improve finding python

Servo is built in a virtual environment, which sets `VIRTUAL_ENV` to
the base path of the venv.
PYTHON3 is only set if mach or the user set it.

Additional changes:

- Use Path / var_os for Paths instead of strings.
 In General using Path APIs is preferable, since in rare cases
 valid paths may not be valid utf-8.
- Don't search for python 3.8 anymore, since
  we require a newer version anyway.
- Don't add the .exe suffix anymore, since
  Command::new() will take care of that.

Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
Signed-off-by: Jonathan Schwender <jonathan.schwender@huawei.com>

* script: Improve finding python

Synchronize `find_python` in scripts build.rs with the version in
libservo.

Signed-off-by: Jonathan Schwender <jonathan.schwender@huawei.com>

* Apply suggestions from code review

Co-authored-by: Martin Robinson <mrobinson@igalia.com>
Signed-off-by: Jonathan Schwender <55576758+jschwe@users.noreply.github.com>
Signed-off-by: Jonathan Schwender <jonathan.schwender@huawei.com>

* Fix finding venv python on windows

- On Windows the venv scripts and python binaries are in the
  `Scripts` subdirectory instead of `bin`.
- We shouldn't check if the executable in the venv binary dir
  exists, since the actual file could have a `.exe` suffix.
  We don't need to consider the `.exe` suffix for the filename,
  since `Command` will handle that for us.
  We also anyway check the validity of the candidate file, by
  running `$candidate --version`.

Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>

---------

Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
Signed-off-by: Jonathan Schwender <jonathan.schwender@huawei.com>
Signed-off-by: Jonathan Schwender <55576758+jschwe@users.noreply.github.com>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
2024-09-12 02:21:41 +00:00
Samson
58f170c97a
Update python detection in codegen (#31873)
* Update python detection in codegen

* Update build.rs
2024-03-26 10:14:06 +00:00
eri
3a5ca785d3
clippy: fix warnings in various modules in components (#31568)
* clippy: fix warnings in various modules in components

* fix: unit tests

* fix: build on android

* fix: all samplers use new_boxed
2024-03-08 14:28:04 +00:00
Samson
aad2dccc9c
Strict import formatting (grouping and granularity) (#30325)
* strict imports formatting

* Reformat all imports
2023-09-11 19:16:54 +00:00
Vincent Ricard
a627dde0d0 Port some code to Python3 2021-02-18 09:35:46 -05:00
Josh Matthews
0148cc5cf9
Update error message. 2020-05-04 11:52:49 -04:00
Josh Matthews
39fff93bef
Use PYTHON2 variable for script's codegen. 2020-05-04 11:52:22 -04:00
Anthony Ramine
785a344e32 Update rand to 0.7 (fixes #24448) 2019-10-23 15:34:48 +02:00
Simon Sapin
d2c299a6c7 Don’t rely on $CARGO_TARGET_DIR in build scripts 2019-09-30 11:20:41 +02:00
Simon Sapin
5c60023cb8 WebIDL codegen: Replace cmake with a single Python script
When playing around with Cargo’s new timing visualization:
https://internals.rust-lang.org/t/exploring-crate-graph-build-times-with-cargo-build-ztimings/10975/21

… I was surprised to see the `script` crate’s build script take 76 seconds.
I did not expect WebIDL bindings generation to be *that* computationally
intensive.

It turns out almost all of this time is overhead. The build script uses CMake
to generate bindings for each WebIDL file in parallel, but that causes a lot
of work to be repeated 366 times:

* Starting up a Python VM
* Importing (parts of) the Python standard library
* Importing ~16k lines of our Python code
* Recompiling the latter to bytecode, since we used `python -B` to disable
  writing `.pyc` file
* Deserializing with `cPickle` and recreating in memory the results
  of parsing all WebIDL files

----

This commit remove the use of CMake and cPickle for the `script` crate.
Instead, all WebIDL bindings generation is done sequentially
in a single Python process. This takes 2 to 3 seconds.
2019-09-27 13:53:19 +02:00
marmeladema
6c26518f61 Remove usage of various unsafe keyword 2019-08-09 00:43:28 +01:00
Simon Sapin
0215d09ccb Generate apis.html and css-properties.json for docs as part of crates’ build scripts
… rather than as an extra step after `cargo doc`.
This helps always using the correct set of CSS properties
(for layout 2013 v.s. 2020).
2019-07-30 08:37:33 +02:00
Simon Sapin
ddb4e369dd Stylo: replace product={gecko,servo} with engine={gecko,servo-2013,servo-2020}
Renaming the variable helped make sure I looked at every use.
2019-07-29 17:37:03 +02:00
Simon Sapin
f1300bb98b Auto-generate CSSStyleDeclaration.webidl for CSS properties based on the style crate 2019-07-29 17:37:03 +02:00
marmeladema
6e4caf1153 DefineDOMInterfaceMethod now takes a SafeJSContext instead of a JSContext
as first argument.
2019-07-24 08:18:22 +01:00
Josh Matthews
0d831117ec Remove restrictions on cross-compiling on Windows. 2019-05-24 22:32:34 -04:00
bors-servo
b4a2d60b25
Auto merge of #23211 - jdm:win-cross, r=SimonSapin
Add Windows x86 build job.

This will make it easier to start working on Hololens embedding work without having to deal with a broken build first.

---
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] There are tests for these changes

<!-- 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/23211)
<!-- Reviewable:end -->
2019-04-26 08:55:28 -04:00
Josh Matthews
57d241fce5 Add Windows x86 build job. 2019-04-26 08:54:24 -04:00
Josh Matthews
c038ba4c7c Force the use of clang-cl.exe for Windows builds. 2019-04-25 10:55:16 -04:00
Jan Andre Ikenmeyer
a1a14459c1
Update MPL license to https (part 3) 2018-11-19 14:47:12 +01:00
Simon Sapin
9f977c5287 Remove useless use crate_name; imports.
A `crate_name::foo` path always works in 2018
2018-11-08 09:29:52 +01:00
Simon Sapin
2012be4a8b cargo fix --edition-idioms 2018-11-08 09:28:00 +01:00
Pyfisch
cb07debcb6 Format remaining files 2018-11-06 22:30:31 +01:00
Oliver Scherer
47364f64ef Add a workaround for a rustc ICE 2018-10-22 19:15:25 +02:00
chansuke
c37a345dc9 Format script component 2018-09-19 17:40:47 -04:00
Matt Brubeck
c169f52b25 Use env::var_os to read paths from the environment
This avoids unnecessary UTF-8 validation on OsStrings that we just pass
back to the OS.
2017-10-20 09:03:21 -07:00
Clément DAVID
c5fe235112 order derivable traits lists
Ignoring :
 - **generated**.rs
 - python/tidy/servo_tidy_tests/rust_tidy.rs
2017-08-23 21:38:44 +02:00
UK992
a5ce6304b1 Fix hardcoded path to link.exe 2017-02-03 13:33:37 +01:00
Simon Sapin
0b9ff576e0 script codegen: Avoid modifying in-place a generated file. 2017-01-19 17:13:35 +01:00
Simon Sapin
71fb02953c Remove usage of phf_macros.
It’s a compiler plugin that uses unstable compiler APIs
that are not on a path to stabilization.

With this changes, there is one less thing that might break
when we update the compiler. For example:
https://github.com/sfackler/rust-phf/pull/101
2017-01-18 17:25:59 +01:00
Vladimir Vukicevic
5bbec7469d Native MSVC windows build, convert to cmake 2016-08-17 09:50:51 -04:00
Josh Matthews
015a52b149 Generate multiple DOM bindings in parallel. 2016-07-22 12:18:14 -04:00
Simon Sapin
fef279a8f5 Fix build scripts warnings. 2015-03-18 21:53:48 +01:00
Simon Sapin
d5dd1d658e Upgrade to rustc ba2f13ef0 2015-02-04 2015-02-11 14:48:34 -08:00