Commit graph

163 commits

Author SHA1 Message Date
Emilio Cobos Álvarez
a7636010ee style: Remove a redundant use statement. 2019-04-12 12:20:06 +02:00
Emilio Cobos Álvarez
ff41f82720 style: Fix Gecko and Servo builds, and appease tidy. 2019-03-27 14:29:28 +01:00
Emilio Cobos Álvarez
f637d93fc1 style: Remove bindings.rs.
I kept it building the most straight-forward way possible (pub use) because it
seems to me that bindings is not a bad name, and we should probably move
structs.rs to be bindings.rs rather than the other way around.

But that's a different bug in any case, need to think more about it.

Differential Revision: https://phabricator.services.mozilla.com/D24713
2019-03-27 14:29:27 +01:00
Emilio Cobos Álvarez
ecda72a5fd style: Cleanup refcounted types.
And make the handling of ComputedStyle more similar to these.

Differential Revision: https://phabricator.services.mozilla.com/D24703
2019-03-27 14:29:26 +01:00
Emilio Cobos Álvarez
02bc29a11b style: Simplify Owned FFI types.
And make them actually sound. We're defining functions on Rust-land that get
structs as arguments, but declaring them in C++ as getting pointers.

This is another step in order to be able to autogenerate ServoBindings.h and
remove bindings.rs altogether.

We remove FooOwned in favor of Owned<Foo>, which is generated via cbindgen.

It'd be good to actually mark Owned and such as MOZ_MUST_USE_TYPE, so I sent
https://github.com/eqrion/cbindgen/pull/307 for that.

Differential Revision: https://phabricator.services.mozilla.com/D24681
2019-03-27 14:29:25 +01:00
Emilio Cobos Álvarez
14b176019c style: Simplify a bit our generated bindings by getting rid of FooBorrowed and FooBorrowedMut.
This reduces a lot the boilerplate that's needed in order to add simple binding
functions.

This starts using &Foo and Option<&Foo> instead, and as a result we need to
remove the servo_function_signatures test, which is a bit unfortunate.

I think it's worth though, this causes problems on some platforms (see bug
1534844), and messing up the functions signature is not something that I've ever
seen (other than bug 1308234, which already had all the FooBorrowed mess which
I'm removing).

Also, cbindgen understands references and Option<&Foo>, so it will be the way to
go in the future.

After this patch we can also remove HasSimpleFFI, but I've kept it for now since
I still use it in a few places, and this patch is quite big on its own.

Differential Revision: https://phabricator.services.mozilla.com/D24092
2019-03-27 14:29:19 +01:00
Emilio Cobos Álvarez
8929087d83 style: Update the Rust target version for bindgen.
This brings us alignas support and also associated constants for bitfield enums.

Differential Revision: https://phabricator.services.mozilla.com/D15334
2019-01-07 00:32:50 +01:00
Simon Sapin
be69f9c3e6 Rustfmt has changed its default style :/ 2018-12-28 13:17:47 +01:00
Jan Andre Ikenmeyer
1d6fe65401
Update MPL license to https (part 4) 2018-11-19 14:47:27 +01:00
Pyfisch
9e92eb205a Reorder imports 2018-11-06 22:35:07 +01:00
Pyfisch
cb07debcb6 Format remaining files 2018-11-06 22:30:31 +01:00
Boris Chiou
33b2514198
style: Drop "mozilla" prefix in cbindgen_types in ServoBindings.toml.
A minor update to drop the redundant "mozilla" namespace prefix in
`cbindgen_types` array.

Depends on D10305

Differential Revision: https://phabricator.services.mozilla.com/D10325
2018-11-05 12:31:02 +01:00
Boris Chiou
b00bbb3be7
style: Add a special list for cbindgen types to avoid generating redundant rust types.
We will blacklist this type and add a module raw line to map the gecko
type to its rust type (as an alias).

Differential Revision: https://phabricator.services.mozilla.com/D10303
2018-11-05 12:30:18 +01:00
Benjamin Bouvier
ecb9de4acd
style: Apply rustfmt on build_gecko.rs.
Bug: 1499359
Reviewed-by: emilio
2018-10-19 00:38:58 +02:00
Benjamin Bouvier
ff34daa384
style: Remove unused HashMap import and remove namespacing around Table.
Bug: 1499359
Reviewed-by: emilio
2018-10-19 00:38:36 +02:00
Benjamin Bouvier
170909fc31
style: Share bindgen flags globally.
Bug: 1495669
Reviewed-by: emilio,froydnj
2018-10-19 00:37:30 +02:00
Cameron McCormack
d960db340c
style: Part 11: Move Gecko borrowed FFI types to a separate header file.
Differential Revision: https://phabricator.services.mozilla.com/D8653
2018-10-19 00:36:59 +02:00
Cameron McCormack
89e4d6c049
style: Move list of Servo Boxed types to a separate header file.
Differential Revision: https://phabricator.services.mozilla.com/D8652
2018-10-19 00:36:49 +02:00
Cameron McCormack
52d054ab5f
style: Add comments to ServoBindingTypes.h
Differential Revision: https://phabricator.services.mozilla.com/D8650
2018-10-19 00:36:40 +02:00
chansuke
8dab4d659a
Format style component. 2018-09-09 16:24:45 +02:00
Emilio Cobos Álvarez
1254cbf313
style: Update style build script for bindgen changes. 2018-09-03 14:11:02 +02:00
Emilio Cobos Álvarez
489e224cb6
style: Don't print rerun-if-changed files until binding generation has succeeded.
Otherwise they may clobber useful output.

Differential Revision: https://phabricator.services.mozilla.com/D2783
2018-08-08 01:37:37 +02:00
Xidorn Quan
0d0c6bd29e
style: Use RUSTFMT env in stylo build script.
Bug: 1471486
Reviewed-by: emilio
MozReview-Commit-ID: JOg0xkmG5Yx
2018-07-01 00:07:01 +02:00
Xidorn Quan
91be6c31c3
style: Not copy generated binding files into dist.
Bug: 1455623
Reviewed-by: emilio
MozReview-Commit-ID: GBnkmwjDS8Y
2018-04-28 10:26:04 +02:00
Xidorn Quan
cfffff33a0
style: Generate nsCSSPropertyID.h from data file directly.
Bug: 1454831
Reviewed-by: emilio
MozReview-Commit-ID: CcX2uzgjWFo
2018-04-28 10:26:02 +02:00
Bobby Holley
c99bcdd4b8 Run rustfmt on selectors, servo_arc, and style.
This was generated with:

./mach cargo fmt --package selectors &&
./mach cargo fmt --package servo_arc &&
./mach cargo fmt --package style

Using rustfmt 0.4.1-nightly (a4462d1 2018-03-26)
2018-04-10 17:35:15 -07:00
Bastien Orivel
8d738a5048 Fix style/build_gecko.rs for log 0.4 2018-03-28 23:08:01 +02:00
Bastien Orivel
2bd99317fb Update toml to 0.4 2018-03-13 10:24:11 +01:00
Emilio Cobos Álvarez
4295bef063
style: Make the generated bindings really be formatted.
TOOLTOOL_DIR isn't passed down to the rust scripts it seems, per:

  https://treeherder.mozilla.org/#/jobs?repo=try&revision=46854db239166ab3a43d36c7a954debb56968eab
2018-03-11 20:14:47 +01:00
Emilio Cobos Álvarez
e08e0704a2
Reland #20160 since it just needed a revendor that didn't happen automatically. 2018-03-02 14:42:45 +01:00
Gecko Backout
59cb14b71b Backed out changeset 39a71f4c9d94 for build bustages at make[4]: *** [force-cargo-library-build] Error 101 on a CLOSED TREE
Backs out https://github.com/servo/servo/pull/20160
2018-03-02 12:47:51 +00:00
Emilio Cobos Álvarez
c04fc0a269
style: Rustfmt bindings on automation, and locally under an env variable.
Bug: 1432153
Reviewed-by: xidorn
MozReview-Commit-ID: HJ9J5NtYVk2
2018-03-01 16:44:04 +01:00
Emilio Cobos Álvarez
b1c580754a
style: Disable rustfmt for now.
Tons of people have broken rustfmts that cause build errors. Let's not force
them to update it for now.
2018-01-23 17:28:12 +01:00
Emilio Cobos Álvarez
08412647db
Update bindgen.
Bug: 1432134
Reviewed-by: SimonSapin
MozReview-Commit-ID: GXHw7KcCLN9
2018-01-22 13:40:23 +01:00
Emilio Cobos Álvarez
b721215a00
style: Update bindgen to 0.31.3.
Constified enums are default now. I think I want to introduce an option to
bindgen to allow setting the default enum behavior, but it doesn't need to block
this.

The ServoBindings.toml changes are somewhat hacky, but that's because of
https://github.com/rust-lang-nursery/rust-bindgen/issues/1125.

Also, the fixups now need to account for whitespace, since quote generates stuff
like root :: nsString, and we don't rustfmt the bindings if there's no rustfmt
installed.

Bug: 1412486
Reviewed-by: xidorn
MozReview-Commit-ID: EY5eNnCiTIw
2017-10-31 20:09:18 +01: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
Xidorn Quan
23d9d12430 Only generate structs file for the current build 2017-10-05 15:29:32 +11:00
Simon Sapin
fc5fd8853e Fix running cargo test -p stylo_test from repo root
… in order to add it to Rust CI though
https://github.com/rust-lang/rust/blob/master/src/tools/cargotest/main.rs
2017-09-15 16:36:47 +02:00
Emilio Cobos Álvarez
86f4e22fc2
stylo: Don't add boundary characters to the fixups specified in ServoBindings.toml
This allows adjusting the fixups for the patches in bug 1393230 when using
libclang 3.9.
2017-09-07 15:37:43 +02:00
Ralph Giles
ec49c4d8c8 Better bindgen error message when files are missing.
This is only slightly more informative because it doesn't give
the filename, but I think it's an improvement on the simple
unwrap() panic when we try to read a file which isn't there.

See also [Gecko bug 1368083](https://bugzilla.mozilla.org/show_bug.cgi?id=1368083).
2017-07-07 22:49:45 -07:00
Ralph Giles
8db2775ba6 Read bindgen flags from a generated file.
Bindgen needs some build-specific flags, like the -isysroot
passed to clang for the C++ compilation. Try to read
these from $objdir/layout/style/bindgen.toml which is
created by the Firefox build system, and merge them
into the config.

See also [Gecko bug 1368083](https://bugzilla.mozilla.org/show_bug.cgi?id=1368083).
2017-07-07 22:48:55 -07:00
Emilio Cobos Álvarez
e8db09766d
style: Update bindgen. 2017-06-21 01:27:14 +02:00
Xidorn Quan
f123b26e6c Move config info from build_gecko.rs to a toml file in gecko. 2017-05-19 11:08:35 +10:00
Ravi Shankar
3011c7cadc Add bindings for setting grid nsTArrays 2017-05-18 21:59:28 +05:30
Nathan Froyd
0371a62172 fix general cross compilation
Use the CARGO_CFG_* environment variables for everything instead of
`cfg!`.

Fixes #16879.
2017-05-17 11:13:10 -04:00
Nathan Froyd
96a03d93b6 fix windows cross-compilation
Similar to the Linux case, we were checking the host's pointer width,
rather than the target's pointer width.
2017-05-17 10:17:40 -04:00
Nathan Froyd
536154475c fix linux cross-compilation, take 2
We were using `cfg!(target_arch)` checks, which are not correct, as
those check the architecture of the compiled build script, not the clang
target.
2017-05-17 10:17:40 -04:00
bors-servo
0388e11db2 Auto merge of #16880 - froydnj:bindgen-informative-failure, r=emilio
provide more information when bindgen fails

Providing the flags we passed into clang can be informative for double-checking that we set everything up correctly.

- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [ ] These changes fix #__ (github issue number if applicable).

<!-- 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/16880)
<!-- Reviewable:end -->
2017-05-16 07:19:53 -05:00
Xidorn Quan
11ac1e894e Add basic integration of @counter-style. 2017-05-16 14:42:33 +10:00
Emilio Cobos Álvarez
1e0edf4909
Bug 1364412: Expose pseudo-element flags, and properly reject pseudos in non-UA sheets. r=bholley
MozReview-Commit-ID: KYC1ywfI7Lg
Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
2017-05-16 02:53:43 +02:00