Auto merge of #20819 - servo:fourchette, r=jdm

Remove unused build targets

<!-- 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/20819)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2018-05-19 06:22:21 -04:00 committed by GitHub
commit b0cb92176a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
33 changed files with 14 additions and 82156 deletions

68
Cargo.lock generated
View file

@ -584,24 +584,6 @@ dependencies = [
"syn 0.11.11 (registry+https://github.com/rust-lang/crates.io-index)", "syn 0.11.11 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]]
name = "cstr"
version = "0.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"cstr-macros 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
"procedural-masquerade 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "cstr-macros"
version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"procedural-masquerade 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"syn 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]] [[package]]
name = "darling" name = "darling"
version = "0.4.0" version = "0.4.0"
@ -991,25 +973,6 @@ dependencies = [
"winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]]
name = "geckoservo"
version = "0.0.1"
dependencies = [
"atomic_refcell 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"cssparser 0.23.2 (registry+https://github.com/rust-lang/crates.io-index)",
"cstr 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.39 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
"malloc_size_of 0.0.1",
"nsstring 0.1.0",
"parking_lot 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)",
"selectors 0.19.0",
"servo_arc 0.1.1",
"smallvec 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
"style 0.0.1",
"style_traits 0.0.1",
]
[[package]] [[package]]
name = "getopts" name = "getopts"
version = "0.2.14" version = "0.2.14"
@ -1976,13 +1939,6 @@ dependencies = [
"serde 1.0.37 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.37 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]]
name = "nsstring"
version = "0.1.0"
dependencies = [
"bitflags 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]] [[package]]
name = "num" name = "num"
version = "0.1.37" version = "0.1.37"
@ -3042,7 +2998,6 @@ dependencies = [
"malloc_size_of 0.0.1", "malloc_size_of 0.0.1",
"malloc_size_of_derive 0.0.1", "malloc_size_of_derive 0.0.1",
"matches 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "matches 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"nsstring 0.1.0",
"num-integer 0.1.34 (registry+https://github.com/rust-lang/crates.io-index)", "num-integer 0.1.34 (registry+https://github.com/rust-lang/crates.io-index)",
"num-traits 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)",
"num_cpus 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "num_cpus 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -3122,27 +3077,6 @@ dependencies = [
"webrender_api 0.57.2 (git+https://github.com/servo/webrender)", "webrender_api 0.57.2 (git+https://github.com/servo/webrender)",
] ]
[[package]]
name = "stylo_tests"
version = "0.0.1"
dependencies = [
"atomic_refcell 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"cssparser 0.23.2 (registry+https://github.com/rust-lang/crates.io-index)",
"cstr 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"env_logger 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.17.2 (registry+https://github.com/rust-lang/crates.io-index)",
"geckoservo 0.0.1",
"libc 0.2.39 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
"malloc_size_of 0.0.1",
"regex 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"selectors 0.19.0",
"size_of_test 0.0.1",
"smallvec 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
"style 0.0.1",
"style_traits 0.0.1",
]
[[package]] [[package]]
name = "swapper" name = "swapper"
version = "0.1.0" version = "0.1.0"
@ -3860,8 +3794,6 @@ dependencies = [
"checksum crossbeam-utils 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "2760899e32a1d58d5abb31129f8fae5de75220bc2176e77ff7c627ae45c918d9" "checksum crossbeam-utils 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "2760899e32a1d58d5abb31129f8fae5de75220bc2176e77ff7c627ae45c918d9"
"checksum cssparser 0.23.2 (registry+https://github.com/rust-lang/crates.io-index)" = "8a807ac3ab7a217829c2a3b65732b926b2befe6a35f33b4bf8b503692430f223" "checksum cssparser 0.23.2 (registry+https://github.com/rust-lang/crates.io-index)" = "8a807ac3ab7a217829c2a3b65732b926b2befe6a35f33b4bf8b503692430f223"
"checksum cssparser-macros 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "079adec4af52bb5275eadd004292028c79eb3c5f5b4ee8086a36d4197032f6df" "checksum cssparser-macros 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "079adec4af52bb5275eadd004292028c79eb3c5f5b4ee8086a36d4197032f6df"
"checksum cstr 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "bc6b738cea084b0bf479106e0089d58d8c3dbc35d1fef3c485e19e20ea47d252"
"checksum cstr-macros 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "0472c17c83d3ec1af32fb6ee2b3ad56ae0b6e69355d63d1d30602055c34324a8"
"checksum darling 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2a78af487e4eb8f4421a1770687b328af6bb4494ca93435210678c6eea875c11" "checksum darling 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2a78af487e4eb8f4421a1770687b328af6bb4494ca93435210678c6eea875c11"
"checksum darling_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b315f49c7b6db3708bca6e6913c194581a44ec619b7a39e131d4dd63733a3698" "checksum darling_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b315f49c7b6db3708bca6e6913c194581a44ec619b7a39e131d4dd63733a3698"
"checksum darling_macro 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "eb69a38fdeaeaf3db712e1df170de67ee9dfc24fb88ca3e9d21e703ec25a4d8e" "checksum darling_macro 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "eb69a38fdeaeaf3db712e1df170de67ee9dfc24fb88ca3e9d21e703ec25a4d8e"

View file

@ -2,9 +2,6 @@
members = [ members = [
"ports/servo", "ports/servo",
"tests/unit/*", "tests/unit/*",
"ports/geckolib",
"ports/geckolib/tests",
] ]
default-members = [ default-members = [
"ports/servo", "ports/servo",

View file

@ -16,13 +16,13 @@ path = "lib.rs"
doctest = false doctest = false
[features] [features]
gecko = ["nsstring", "num_cpus", gecko = ["num_cpus",
"style_traits/gecko", "fallible/known_system_malloc"] "style_traits/gecko", "fallible/known_system_malloc"]
use_bindgen = ["bindgen", "regex", "toml"] use_bindgen = ["bindgen", "regex", "toml"]
servo = ["serde", "style_traits/servo", "servo_atoms", "servo_config", "html5ever", servo = ["serde", "style_traits/servo", "servo_atoms", "servo_config", "html5ever",
"cssparser/serde", "encoding_rs", "malloc_size_of/servo", "arrayvec/use_union", "cssparser/serde", "encoding_rs", "malloc_size_of/servo", "arrayvec/use_union",
"servo_url", "string_cache"] "servo_url", "string_cache"]
gecko_debug = ["nsstring/gecko_debug"] gecko_debug = []
[dependencies] [dependencies]
app_units = "0.6" app_units = "0.6"
@ -46,7 +46,6 @@ log = "0.4"
malloc_size_of = { path = "../malloc_size_of" } malloc_size_of = { path = "../malloc_size_of" }
malloc_size_of_derive = { path = "../malloc_size_of_derive" } malloc_size_of_derive = { path = "../malloc_size_of_derive" }
matches = "0.1" matches = "0.1"
nsstring = {path = "../../support/gecko/nsstring", optional = true}
num_cpus = {version = "1.1.0", optional = true} num_cpus = {version = "1.1.0", optional = true}
num-integer = "0.1.32" num-integer = "0.1.32"
num-traits = "0.1.32" num-traits = "0.1.32"

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -59,8 +59,6 @@
* mach * mach
* A command-line tool to help with developer tasks. * A command-line tool to help with developer tasks.
* ports * ports
* geckolib
* A static library to be linked into Gecko for the Stylo project.
* glutin * glutin
* Embedding implementation for the `glutin` windowing library. * Embedding implementation for the `glutin` windowing library.
* python * python

View file

@ -8,4 +8,4 @@ set -o errexit
set -o nounset set -o nounset
set -o pipefail set -o pipefail
rm -rf target/{debug,release,doc,geckolib} rm -rf target/{debug,release,doc}

View file

@ -1,6 +0,0 @@
<!doctype html>
<title>Geckolib, a subset of Servos style system for Stylo project.</title>
<meta http-equiv=refresh content="0;url=geckoservo/index.html">
Documentation for Geckolib, a subset of Servos style system for Stylo project.
Start with <a href="geckoservo/index.html">the <code>geckoservo</code> crate</a>

View file

@ -1 +0,0 @@
1.24.0

View file

@ -1,26 +0,0 @@
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
with Files("**"):
BUG_COMPONENT = ("Firefox", "General")
with Files("components/style/**"):
BUG_COMPONENT = ("Core", "CSS Parsing and Computation")
with Files("components/style_derive/**"):
BUG_COMPONENT = ("Core", "CSS Parsing and Computation")
with Files("components/style_traits/**"):
BUG_COMPONENT = ("Core", "CSS Parsing and Computation")
with Files("components/selectors/**"):
BUG_COMPONENT = ("Core", "CSS Parsing and Computation")
with Files("ports/geckolib/**"):
BUG_COMPONENT = ("Core", "CSS Parsing and Computation")
with Files("tests/unit/style/**"):
BUG_COMPONENT = ("Core", "CSS Parsing and Computation")

View file

@ -1,29 +0,0 @@
[package]
name = "geckoservo"
version = "0.0.1"
authors = ["The Servo Project Developers"]
license = "MPL-2.0"
[lib]
name = "geckoservo"
path = "lib.rs"
crate-type = ["staticlib", "rlib"]
[features]
bindgen = ["style/use_bindgen"]
gecko_debug = ["style/gecko_debug"]
[dependencies]
atomic_refcell = "0.1"
cssparser = "0.23.0"
cstr = "0.1.2"
libc = "0.2"
log = {version = "0.4", features = ["release_max_level_info"]}
malloc_size_of = {path = "../../components/malloc_size_of"}
nsstring = {path = "../../support/gecko/nsstring"}
parking_lot = "0.5"
selectors = {path = "../../components/selectors"}
servo_arc = {path = "../../components/servo_arc"}
smallvec = "0.6"
style = {path = "../../components/style", features = ["gecko"]}
style_traits = {path = "../../components/style_traits"}

View file

@ -1,436 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
//! Wrapper around Gecko's CSS error reporting mechanism.
#![allow(unsafe_code)]
use cssparser::{CowRcStr, serialize_identifier, ToCss};
use cssparser::{SourceLocation, ParseError, ParseErrorKind, Token, BasicParseErrorKind};
use selectors::parser::SelectorParseErrorKind;
use std::ffi::CStr;
use std::ptr;
use style::error_reporting::{ParseErrorReporter, ContextualParseError};
use style::gecko_bindings::bindings::{Gecko_CreateCSSErrorReporter, Gecko_DestroyCSSErrorReporter};
use style::gecko_bindings::bindings::Gecko_ReportUnexpectedCSSError;
use style::gecko_bindings::structs::{Loader, StyleSheet as DomStyleSheet, nsIURI};
use style::gecko_bindings::structs::ErrorReporter as GeckoErrorReporter;
use style::gecko_bindings::structs::URLExtraData as RawUrlExtraData;
use style::stylesheets::UrlExtraData;
use style_traits::{StyleParseErrorKind, ValueParseErrorKind};
pub type ErrorKind<'i> = ParseErrorKind<'i, StyleParseErrorKind<'i>>;
/// Wrapper around an instance of Gecko's CSS error reporter.
pub struct ErrorReporter(*mut GeckoErrorReporter);
impl ErrorReporter {
/// Create a new instance of the Gecko error reporter.
pub fn new(
sheet: *mut DomStyleSheet,
loader: *mut Loader,
extra_data: *mut RawUrlExtraData,
) -> Self {
unsafe {
let url = extra_data.as_ref()
.map(|d| d.mBaseURI.raw::<nsIURI>())
.unwrap_or(ptr::null_mut());
ErrorReporter(Gecko_CreateCSSErrorReporter(sheet, loader, url))
}
}
}
impl Drop for ErrorReporter {
fn drop(&mut self) {
unsafe {
Gecko_DestroyCSSErrorReporter(self.0);
}
}
}
enum ErrorString<'a> {
Snippet(CowRcStr<'a>),
Ident(CowRcStr<'a>),
UnexpectedToken(Token<'a>),
}
impl<'a> ErrorString<'a> {
fn into_str(self) -> CowRcStr<'a> {
match self {
ErrorString::Snippet(s) => s,
ErrorString::UnexpectedToken(t) => t.to_css_string().into(),
ErrorString::Ident(i) => {
let mut s = String::new();
serialize_identifier(&i, &mut s).unwrap();
s.into()
}
}
}
}
#[derive(Debug)]
enum Action {
Nothing,
Skip,
Drop,
}
trait ErrorHelpers<'a> {
fn error_data(self) -> (CowRcStr<'a>, ErrorKind<'a>);
fn error_params(self) -> ErrorParams<'a>;
fn to_gecko_message(&self) -> (Option<&'static CStr>, &'static CStr, Action);
}
fn extract_error_param<'a>(err: ErrorKind<'a>) -> Option<ErrorString<'a>> {
Some(match err {
ParseErrorKind::Basic(BasicParseErrorKind::UnexpectedToken(t)) => {
ErrorString::UnexpectedToken(t)
}
ParseErrorKind::Basic(BasicParseErrorKind::AtRuleInvalid(i)) |
ParseErrorKind::Custom(StyleParseErrorKind::UnsupportedAtRule(i)) => {
let mut s = String::from("@");
serialize_identifier(&i, &mut s).unwrap();
ErrorString::Snippet(s.into())
}
ParseErrorKind::Custom(StyleParseErrorKind::OtherInvalidValue(property)) => {
ErrorString::Snippet(property)
}
ParseErrorKind::Custom(
StyleParseErrorKind::SelectorError(
SelectorParseErrorKind::UnexpectedIdent(ident)
)
) => {
ErrorString::Ident(ident)
}
ParseErrorKind::Custom(StyleParseErrorKind::UnknownProperty(property)) => {
ErrorString::Ident(property)
}
ParseErrorKind::Custom(
StyleParseErrorKind::UnexpectedTokenWithinNamespace(token)
) => {
ErrorString::UnexpectedToken(token)
}
_ => return None,
})
}
struct ErrorParams<'a> {
prefix_param: Option<ErrorString<'a>>,
main_param: Option<ErrorString<'a>>,
}
/// If an error parameter is present in the given error, return it. Additionally return
/// a second parameter if it exists, for use in the prefix for the eventual error message.
fn extract_error_params<'a>(err: ErrorKind<'a>) -> Option<ErrorParams<'a>> {
let (main, prefix) = match err {
ParseErrorKind::Custom(StyleParseErrorKind::InvalidColor(property, token)) |
ParseErrorKind::Custom(StyleParseErrorKind::InvalidFilter(property, token)) => {
(Some(ErrorString::Snippet(property.into())), Some(ErrorString::UnexpectedToken(token)))
}
ParseErrorKind::Custom(
StyleParseErrorKind::MediaQueryExpectedFeatureName(ident)
) => {
(Some(ErrorString::Ident(ident)), None)
}
ParseErrorKind::Custom(
StyleParseErrorKind::ExpectedIdentifier(token)
) |
ParseErrorKind::Custom(
StyleParseErrorKind::ValueError(ValueParseErrorKind::InvalidColor(token))
) => {
(Some(ErrorString::UnexpectedToken(token)), None)
}
ParseErrorKind::Custom(StyleParseErrorKind::SelectorError(err)) => match err {
SelectorParseErrorKind::UnexpectedTokenInAttributeSelector(t) |
SelectorParseErrorKind::BadValueInAttr(t) |
SelectorParseErrorKind::ExpectedBarInAttr(t) |
SelectorParseErrorKind::NoQualifiedNameInAttributeSelector(t) |
SelectorParseErrorKind::InvalidQualNameInAttr(t) |
SelectorParseErrorKind::ExplicitNamespaceUnexpectedToken(t) |
SelectorParseErrorKind::PseudoElementExpectedIdent(t) |
SelectorParseErrorKind::NoIdentForPseudo(t) |
SelectorParseErrorKind::ClassNeedsIdent(t) |
SelectorParseErrorKind::PseudoElementExpectedColon(t) => {
(None, Some(ErrorString::UnexpectedToken(t)))
}
SelectorParseErrorKind::ExpectedNamespace(namespace) => {
(None, Some(ErrorString::Ident(namespace)))
}
SelectorParseErrorKind::UnsupportedPseudoClassOrElement(p) => {
(None, Some(ErrorString::Ident(p)))
}
SelectorParseErrorKind::EmptySelector |
SelectorParseErrorKind::DanglingCombinator => {
(None, None)
}
SelectorParseErrorKind::EmptyNegation => {
(None, Some(ErrorString::Snippet(")".into())))
}
err => match extract_error_param(ParseErrorKind::Custom(StyleParseErrorKind::SelectorError(err))) {
Some(e) => (Some(e), None),
None => return None,
}
},
err => match extract_error_param(err) {
Some(e) => (Some(e), None),
None => return None,
}
};
Some(ErrorParams {
main_param: main,
prefix_param: prefix,
})
}
impl<'a> ErrorHelpers<'a> for ContextualParseError<'a> {
fn error_data(self) -> (CowRcStr<'a>, ErrorKind<'a>) {
match self {
ContextualParseError::UnsupportedPropertyDeclaration(s, err) |
ContextualParseError::UnsupportedFontFaceDescriptor(s, err) |
ContextualParseError::UnsupportedFontFeatureValuesDescriptor(s, err) |
ContextualParseError::InvalidKeyframeRule(s, err) |
ContextualParseError::InvalidFontFeatureValuesRule(s, err) |
ContextualParseError::UnsupportedKeyframePropertyDeclaration(s, err) |
ContextualParseError::InvalidRule(s, err) |
ContextualParseError::UnsupportedRule(s, err) |
ContextualParseError::UnsupportedViewportDescriptorDeclaration(s, err) |
ContextualParseError::UnsupportedCounterStyleDescriptorDeclaration(s, err) |
ContextualParseError::InvalidMediaRule(s, err) |
ContextualParseError::UnsupportedValue(s, err) => {
(s.into(), err.kind)
}
ContextualParseError::InvalidCounterStyleWithoutSymbols(s) |
ContextualParseError::InvalidCounterStyleNotEnoughSymbols(s) => {
(s.into(), ParseErrorKind::Custom(StyleParseErrorKind::UnspecifiedError.into()))
}
ContextualParseError::InvalidCounterStyleWithoutAdditiveSymbols |
ContextualParseError::InvalidCounterStyleExtendsWithSymbols |
ContextualParseError::InvalidCounterStyleExtendsWithAdditiveSymbols => {
("".into(), ParseErrorKind::Custom(StyleParseErrorKind::UnspecifiedError.into()))
}
}
}
fn error_params(self) -> ErrorParams<'a> {
let (s, error) = self.error_data();
extract_error_params(error).unwrap_or_else(|| ErrorParams {
main_param: Some(ErrorString::Snippet(s)),
prefix_param: None
})
}
fn to_gecko_message(&self) -> (Option<&'static CStr>, &'static CStr, Action) {
let (msg, action): (&CStr, Action) = match *self {
ContextualParseError::UnsupportedPropertyDeclaration(
_, ParseError { kind: ParseErrorKind::Basic(BasicParseErrorKind::UnexpectedToken(_)), .. }
) |
ContextualParseError::UnsupportedPropertyDeclaration(
_, ParseError { kind: ParseErrorKind::Basic(BasicParseErrorKind::AtRuleInvalid(_)), .. }
) => {
(cstr!("PEParseDeclarationDeclExpected"), Action::Skip)
}
ContextualParseError::UnsupportedPropertyDeclaration(
_, ParseError { kind: ParseErrorKind::Custom(ref err), .. }
) => {
match *err {
StyleParseErrorKind::InvalidColor(_, _) => {
return (Some(cstr!("PEColorNotColor")),
cstr!("PEValueParsingError"), Action::Drop)
}
StyleParseErrorKind::InvalidFilter(_, _) => {
return (Some(cstr!("PEExpectedNoneOrURLOrFilterFunction")),
cstr!("PEValueParsingError"), Action::Drop)
}
StyleParseErrorKind::OtherInvalidValue(_) => {
(cstr!("PEValueParsingError"), Action::Drop)
}
_ => (cstr!("PEUnknownProperty"), Action::Drop)
}
}
ContextualParseError::UnsupportedPropertyDeclaration(..) =>
(cstr!("PEUnknownProperty"), Action::Drop),
ContextualParseError::UnsupportedFontFaceDescriptor(..) =>
(cstr!("PEUnknownFontDesc"), Action::Skip),
ContextualParseError::InvalidKeyframeRule(..) =>
(cstr!("PEKeyframeBadName"), Action::Nothing),
ContextualParseError::UnsupportedKeyframePropertyDeclaration(..) =>
(cstr!("PEBadSelectorKeyframeRuleIgnored"), Action::Nothing),
ContextualParseError::InvalidRule(
_, ParseError { kind: ParseErrorKind::Custom(
StyleParseErrorKind::UnexpectedTokenWithinNamespace(_)
), .. }
) => {
(cstr!("PEAtNSUnexpected"), Action::Nothing)
}
ContextualParseError::InvalidRule(
_, ParseError { kind: ParseErrorKind::Basic(BasicParseErrorKind::AtRuleInvalid(_)), .. }
) |
ContextualParseError::InvalidRule(
_, ParseError { kind: ParseErrorKind::Custom(
StyleParseErrorKind::UnsupportedAtRule(_)
), .. }
) => {
(cstr!("PEUnknownAtRule"), Action::Nothing)
}
ContextualParseError::InvalidRule(_, ref err) => {
let prefix = match err.kind {
ParseErrorKind::Custom(StyleParseErrorKind::SelectorError(ref err)) => match *err {
SelectorParseErrorKind::UnexpectedTokenInAttributeSelector(_) => {
Some(cstr!("PEAttSelUnexpected"))
}
SelectorParseErrorKind::ExpectedBarInAttr(_) => {
Some(cstr!("PEAttSelNoBar"))
}
SelectorParseErrorKind::BadValueInAttr(_) => {
Some(cstr!("PEAttSelBadValue"))
}
SelectorParseErrorKind::NoQualifiedNameInAttributeSelector(_) => {
Some(cstr!("PEAttributeNameOrNamespaceExpected"))
}
SelectorParseErrorKind::InvalidQualNameInAttr(_) => {
Some(cstr!("PEAttributeNameExpected"))
}
SelectorParseErrorKind::ExplicitNamespaceUnexpectedToken(_) => {
Some(cstr!("PETypeSelNotType"))
}
SelectorParseErrorKind::ExpectedNamespace(_) => {
Some(cstr!("PEUnknownNamespacePrefix"))
}
SelectorParseErrorKind::EmptySelector => {
Some(cstr!("PESelectorGroupNoSelector"))
}
SelectorParseErrorKind::DanglingCombinator => {
Some(cstr!("PESelectorGroupExtraCombinator"))
}
SelectorParseErrorKind::UnsupportedPseudoClassOrElement(_) => {
Some(cstr!("PEPseudoSelUnknown"))
}
SelectorParseErrorKind::PseudoElementExpectedColon(_) => {
Some(cstr!("PEPseudoSelEndOrUserActionPC"))
}
SelectorParseErrorKind::NoIdentForPseudo(_) => {
Some(cstr!("PEPseudoClassArgNotIdent"))
}
SelectorParseErrorKind::PseudoElementExpectedIdent(_) => {
Some(cstr!("PEPseudoSelBadName"))
}
SelectorParseErrorKind::ClassNeedsIdent(_) => {
Some(cstr!("PEClassSelNotIdent"))
}
SelectorParseErrorKind::EmptyNegation => {
Some(cstr!("PENegationBadArg"))
}
_ => None,
},
_ => None,
};
return (prefix, cstr!("PEBadSelectorRSIgnored"), Action::Nothing);
}
ContextualParseError::InvalidMediaRule(_, ref err) => {
let err: &CStr = match err.kind {
ParseErrorKind::Custom(StyleParseErrorKind::ExpectedIdentifier(..)) => {
cstr!("PEGatherMediaNotIdent")
},
ParseErrorKind::Custom(StyleParseErrorKind::MediaQueryExpectedFeatureName(..)) => {
cstr!("PEMQExpectedFeatureName")
},
ParseErrorKind::Custom(StyleParseErrorKind::MediaQueryExpectedFeatureValue) => {
cstr!("PEMQExpectedFeatureValue")
},
ParseErrorKind::Custom(StyleParseErrorKind::RangedExpressionWithNoValue) => {
cstr!("PEMQNoMinMaxWithoutValue")
},
_ => {
cstr!("PEDeclDropped")
},
};
(err, Action::Nothing)
}
ContextualParseError::UnsupportedRule(..) =>
(cstr!("PEDeclDropped"), Action::Nothing),
ContextualParseError::UnsupportedViewportDescriptorDeclaration(..) |
ContextualParseError::UnsupportedCounterStyleDescriptorDeclaration(..) |
ContextualParseError::InvalidCounterStyleWithoutSymbols(..) |
ContextualParseError::InvalidCounterStyleNotEnoughSymbols(..) |
ContextualParseError::InvalidCounterStyleWithoutAdditiveSymbols |
ContextualParseError::InvalidCounterStyleExtendsWithSymbols |
ContextualParseError::InvalidCounterStyleExtendsWithAdditiveSymbols |
ContextualParseError::UnsupportedFontFeatureValuesDescriptor(..) |
ContextualParseError::InvalidFontFeatureValuesRule(..) =>
(cstr!("PEUnknownAtRule"), Action::Skip),
ContextualParseError::UnsupportedValue(_, ParseError { ref kind, .. }) => {
match *kind {
ParseErrorKind::Custom(
StyleParseErrorKind::ValueError(
ValueParseErrorKind::InvalidColor(..)
)
) => (cstr!("PEColorNotColor"), Action::Nothing),
_ => {
// Not the best error message, since we weren't parsing
// a declaration, just a value. But we don't produce
// UnsupportedValue errors other than InvalidColors
// currently.
debug_assert!(false, "should use a more specific error message");
(cstr!("PEDeclDropped"), Action::Nothing)
}
}
}
};
(None, msg, action)
}
}
impl ErrorReporter {
pub fn report(&self, location: SourceLocation, error: ContextualParseError) {
let (pre, name, action) = error.to_gecko_message();
let suffix = match action {
Action::Nothing => ptr::null(),
Action::Skip => cstr!("PEDeclSkipped").as_ptr(),
Action::Drop => cstr!("PEDeclDropped").as_ptr(),
};
let params = error.error_params();
let param = params.main_param;
let pre_param = params.prefix_param;
let param = param.map(|p| p.into_str());
let pre_param = pre_param.map(|p| p.into_str());
let param_ptr = param.as_ref().map_or(ptr::null(), |p| p.as_ptr());
let pre_param_ptr = pre_param.as_ref().map_or(ptr::null(), |p| p.as_ptr());
// The CSS source text is unused and will be removed in bug 1381188.
let source = "";
unsafe {
Gecko_ReportUnexpectedCSSError(self.0,
name.as_ptr() as *const _,
param_ptr as *const _,
param.as_ref().map_or(0, |p| p.len()) as u32,
pre.map_or(ptr::null(), |p| p.as_ptr()) as *const _,
pre_param_ptr as *const _,
pre_param.as_ref().map_or(0, |p| p.len()) as u32,
suffix as *const _,
source.as_ptr() as *const _,
source.len() as u32,
location.line,
location.column);
}
}
}
impl ParseErrorReporter for ErrorReporter {
fn report_error(
&self,
_url: &UrlExtraData,
location: SourceLocation,
error: ContextualParseError
) {
self.report(location, error)
}
}

File diff suppressed because it is too large Load diff

View file

@ -1,25 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
extern crate cssparser;
#[macro_use] extern crate cstr;
extern crate libc;
#[macro_use] extern crate log;
extern crate malloc_size_of;
extern crate nsstring;
extern crate selectors;
extern crate servo_arc;
extern crate smallvec;
#[macro_use] extern crate style;
extern crate style_traits;
mod error_reporter;
#[allow(non_snake_case)]
pub mod glue;
mod stylesheet_loader;
// FIXME(bholley): This should probably go away once we harmonize the allocators.
#[no_mangle]
pub extern "C" fn je_malloc_usable_size(_: *const ::libc::c_void) -> ::libc::size_t { 0 }

View file

@ -1,141 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use cssparser::SourceLocation;
use nsstring::nsCString;
use servo_arc::Arc;
use style::context::QuirksMode;
use style::error_reporting::NullReporter;
use style::gecko::data::GeckoStyleSheet;
use style::gecko::global_style_data::GLOBAL_STYLE_DATA;
use style::gecko_bindings::bindings;
use style::gecko_bindings::bindings::Gecko_LoadStyleSheet;
use style::gecko_bindings::structs::{Loader, LoaderReusableStyleSheets};
use style::gecko_bindings::structs::{StyleSheet as DomStyleSheet, SheetLoadData, SheetLoadDataHolder};
use style::gecko_bindings::structs::URLExtraData;
use style::gecko_bindings::sugar::ownership::FFIArcHelpers;
use style::gecko_bindings::sugar::refptr::RefPtr;
use style::media_queries::MediaList;
use style::parser::ParserContext;
use style::shared_lock::{Locked, SharedRwLock};
use style::stylesheets::{ImportRule, Origin, StylesheetLoader as StyleStylesheetLoader};
use style::stylesheets::StylesheetContents;
use style::stylesheets::import_rule::ImportSheet;
use style::values::CssUrl;
pub struct StylesheetLoader(*mut Loader, *mut DomStyleSheet, *mut SheetLoadData, *mut LoaderReusableStyleSheets);
impl StylesheetLoader {
pub fn new(
loader: *mut Loader,
parent: *mut DomStyleSheet,
parent_load_data: *mut SheetLoadData,
reusable_sheets: *mut LoaderReusableStyleSheets,
) -> Self {
StylesheetLoader(loader, parent, parent_load_data, reusable_sheets)
}
}
impl StyleStylesheetLoader for StylesheetLoader {
fn request_stylesheet(
&self,
url: CssUrl,
source_location: SourceLocation,
_context: &ParserContext,
lock: &SharedRwLock,
media: Arc<Locked<MediaList>>,
) -> Arc<Locked<ImportRule>> {
// After we get this raw pointer ImportRule will be moved into a lock and Arc
// and so the Arc<Url> pointer inside will also move,
// but the Url it points to or the allocating backing the String inside that Url wont,
// so this raw pointer will still be valid.
let child_sheet = unsafe {
Gecko_LoadStyleSheet(self.0,
self.1,
self.2,
self.3,
url.for_ffi(),
media.into_strong())
};
debug_assert!(!child_sheet.is_null(),
"Import rules should always have a strong sheet");
let sheet = unsafe { GeckoStyleSheet::from_addrefed(child_sheet) };
let stylesheet = ImportSheet::new(sheet);
Arc::new(lock.wrap(ImportRule { url, source_location, stylesheet }))
}
}
pub struct AsyncStylesheetParser {
load_data: RefPtr<SheetLoadDataHolder>,
extra_data: RefPtr<URLExtraData>,
bytes: nsCString,
origin: Origin,
quirks_mode: QuirksMode,
line_number_offset: u32,
}
impl AsyncStylesheetParser {
pub fn new(
load_data: RefPtr<SheetLoadDataHolder>,
extra_data: RefPtr<URLExtraData>,
bytes: nsCString,
origin: Origin,
quirks_mode: QuirksMode,
line_number_offset: u32,
) -> Self {
AsyncStylesheetParser {
load_data,
extra_data,
bytes,
origin,
quirks_mode,
line_number_offset,
}
}
pub fn parse(self) {
let global_style_data = &*GLOBAL_STYLE_DATA;
let input: &str = unsafe { (*self.bytes).as_str_unchecked() };
// Note: Parallel CSS parsing doesn't report CSS errors. When errors
// are being logged, Gecko prevents the parallel parsing path from
// running.
let sheet = Arc::new(StylesheetContents::from_str(
input, self.extra_data.clone(), self.origin,
&global_style_data.shared_lock, Some(&self), &NullReporter,
self.quirks_mode.into(), self.line_number_offset)
);
unsafe {
bindings::Gecko_StyleSheet_FinishAsyncParse(self.load_data.get(), sheet.into_strong());
}
}
}
impl StyleStylesheetLoader for AsyncStylesheetParser {
fn request_stylesheet(
&self,
url: CssUrl,
source_location: SourceLocation,
_context: &ParserContext,
lock: &SharedRwLock,
media: Arc<Locked<MediaList>>,
) -> Arc<Locked<ImportRule>> {
let stylesheet = ImportSheet::new_pending(self.origin, self.quirks_mode);
let rule = Arc::new(lock.wrap(ImportRule { url: url.clone(), source_location, stylesheet }));
unsafe {
bindings::Gecko_LoadStyleSheetAsync(
self.load_data.get(),
url.for_ffi(),
media.into_strong(),
rule.clone().into_strong()
);
}
rule
}
}

View file

@ -1,31 +0,0 @@
[package]
name = "stylo_tests"
version = "0.0.1"
authors = ["The Servo Project Developers"]
license = "MPL-2.0"
build = "build.rs"
[lib]
name = "stylo_tests"
path = "lib.rs"
doctest = false
[dependencies]
atomic_refcell = "0.1"
cssparser = "0.23.0"
cstr = "0.1.2"
env_logger = { version = "0.5", default-features = false }
euclid = "0.17"
geckoservo = {path = "../../../ports/geckolib"}
libc = "0.2"
log = {version = "0.4", features = ["release_max_level_info"]}
malloc_size_of = {path = "../../../components/malloc_size_of"}
selectors = {path = "../../../components/selectors"}
size_of_test = {path = "../../../components/size_of_test"}
smallvec = "0.6"
style_traits = {path = "../../../components/style_traits"}
style = {path = "../../../components/style", features = ["gecko"]}
[build-dependencies]
regex = "0.2"

View file

@ -1,94 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
extern crate regex;
use regex::Regex;
use std::env;
use std::fs::File;
use std::io::{BufRead, BufReader, Write};
use std::path::Path;
fn main() {
// https://github.com/rust-lang/cargo/issues/3544
let style_out_dir = env::var_os("DEP_FOR SOME REASON THE LINKS KEY IS REQUIRED \
TO PASS DATA AROUND BETWEEN BUILD SCRIPTS_OUT_DIR").unwrap();
let root_path = Path::new("../../../");
let bindings_file = Path::new(&style_out_dir).join("gecko/bindings.rs");
let glue_file = root_path.join("ports/geckolib/glue.rs");
println!("cargo:rerun-if-changed=build.rs");
println!("cargo:rerun-if-changed={}", glue_file.display());
println!("cargo:rerun-if-changed={}", bindings_file.display());
let env_out_dir = env::var("OUT_DIR").unwrap();
let out_dir = Path::new(&env_out_dir);
{
let output = out_dir.join("check_bindings.rs");
let r = BufReader::new(File::open(bindings_file).unwrap());
let mut w = File::create(output).unwrap();
w.write_all(b"fn assert_types() {\n").unwrap();
let matcher = Regex::new(r"fn\s*Servo_([a-zA-Z0-9_]+)\s*\(").unwrap();
for line in r.lines() {
let s = line.unwrap();
for cap in matcher.captures_iter(&s) {
// This causes a mismatch in old libclangs (the ones that are
// used in linux32 mozilla-central) because it generates:
//
// *const nsTArray<*const RawServoStyleSet>
//
// Instead of:
//
// *const nsTArray<RawServoStyleSetBorrowed>
//
// Which is not a problem, but would cause this to not compile.
//
// Skip this until libclang is updated there.
//
// Also skip Servo_Element_IsDisplayContents because we
// forward-declare it in Element.h without the type bindgen uses
// to replace it by a reference, and it depends on the include
// order in ServoBindings.h. We have the same problem for
// ComputedStyle_{AddRef / Release}, we just don't hit it
// because they're included later...
if &cap[1] == "InvalidateStyleForDocStateChanges" ||
&cap[1] == "Element_IsDisplayContents"
{
continue;
}
w.write_all(format!(" [ Servo_{0}, bindings::Servo_{0} ];\n", &cap[1]).as_bytes()).unwrap();
}
}
w.write_all(b"}\n").unwrap();
}
{
let output = out_dir.join("glue.rs");
let r = BufReader::new(File::open(glue_file).unwrap());
let mut w = File::create(output).unwrap();
w.write_all(b"pub use style::gecko::arc_types::*;\n").unwrap();
for line in r.lines() {
let s = line.unwrap().replace("pub extern \"C\" fn", "pub unsafe extern \"C\" fn");
w.write_all(s.as_bytes()).unwrap();
w.write_all(b"\n").unwrap();
}
}
File::create(out_dir.join("bindings.rs"))
.unwrap()
.write_all(format!("include!(concat!({:?}, \"/gecko/structs.rs\"));",
style_out_dir).as_bytes())
.unwrap();
if env::var_os("MOZ_SRC").is_some() {
println!("cargo:rustc-cfg=linking_with_gecko")
}
}

View file

@ -1,37 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
// Disable this entire crate on Windows when Gecko symbols are not available
// as linking would fail:
// https://github.com/rust-lang/rust/pull/44603#issuecomment-338807312
//
// On Linux and OS X linking succeeds anyway.
// Presumably these symbol declarations dont need to be resolved
// as theyre not used in any code called from this crate.
#![cfg(any(linking_with_gecko, not(windows)))]
extern crate atomic_refcell;
extern crate cssparser;
#[macro_use] extern crate cstr;
extern crate geckoservo;
#[macro_use] extern crate log;
extern crate malloc_size_of;
extern crate selectors;
extern crate smallvec;
#[macro_use] extern crate size_of_test;
#[macro_use] extern crate style;
extern crate style_traits;
#[cfg(target_pointer_width = "64")]
mod size_of;
mod specified_values;
mod servo_function_signatures;
use style::*;
#[allow(dead_code, improper_ctypes)]
mod bindings {
include!(concat!(env!("OUT_DIR"), "/bindings.rs"));
}

View file

@ -1,26 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#![allow(unused)]
use self::glue::*;
use style::gecko_bindings::bindings;
use style::gecko_properties::*;
include!(concat!(env!("OUT_DIR"), "/check_bindings.rs"));
#[path = "../../../ports/geckolib/error_reporter.rs"]
mod error_reporter;
#[path = "../../../ports/geckolib/stylesheet_loader.rs"]
mod stylesheet_loader;
#[allow(non_snake_case, unused_unsafe, private_no_mangle_fns)]
mod glue {
// this module pretends to be glue.rs, with the safe functions swapped for unsafe ones. This is
// a hack to compensate for the fact that `fn` types cannot coerce to `unsafe fn` types. The
// imports are populated with the same things so the type assertion should be equivalent
use geckoservo::*;
include!(concat!(env!("OUT_DIR"), "/glue.rs"));
}

View file

@ -1,51 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use selectors;
use servo_arc::Arc;
use style;
use style::applicable_declarations::ApplicableDeclarationBlock;
use style::data::{ElementData, ElementStyles};
use style::gecko::selector_parser::{self, SelectorImpl};
use style::properties::ComputedValues;
use style::rule_tree::{RuleNode, StrongRuleNode};
use style::values::computed;
use style::values::specified;
size_of_test!(size_of_selector, selectors::parser::Selector<SelectorImpl>, 8);
size_of_test!(size_of_pseudo_element, selector_parser::PseudoElement, 24);
size_of_test!(size_of_component, selectors::parser::Component<SelectorImpl>, 32);
size_of_test!(size_of_pseudo_class, selector_parser::NonTSPseudoClass, 24);
// The size of this is critical to performance on the bloom-basic microbenchmark.
// When iterating over a large Rule array, we want to be able to fast-reject
// selectors (with the inline hashes) with as few cache misses as possible.
size_of_test!(test_size_of_rule, style::stylist::Rule, 32);
// Large pages generate tens of thousands of ComputedValues.
size_of_test!(test_size_of_cv, ComputedValues, 248);
size_of_test!(test_size_of_option_arc_cv, Option<Arc<ComputedValues>>, 8);
size_of_test!(test_size_of_option_rule_node, Option<StrongRuleNode>, 8);
size_of_test!(test_size_of_element_styles, ElementStyles, 16);
size_of_test!(test_size_of_element_data, ElementData, 24);
size_of_test!(test_size_of_property_declaration, style::properties::PropertyDeclaration, 32);
size_of_test!(test_size_of_application_declaration_block, ApplicableDeclarationBlock, 16);
size_of_test!(test_size_of_rule_node, RuleNode, 72);
// This is huge, but we allocate it on the stack and then never move it,
// we only pass `&mut SourcePropertyDeclaration` references around.
size_of_test!(test_size_of_parsed_declaration, style::properties::SourcePropertyDeclaration, 608);
size_of_test!(test_size_of_computed_image, computed::image::Image, 32);
size_of_test!(test_size_of_specified_image, specified::image::Image, 32);
// FIXME(bz): These can shrink if we move the None_ value inside the
// enum instead of paying an extra word for the Either discriminant.
size_of_test!(test_size_of_computed_image_layer, computed::image::ImageLayer, 32);
size_of_test!(test_size_of_specified_image_layer, specified::image::ImageLayer, 32);

View file

@ -128,18 +128,15 @@ class MachCommands(CommandBase):
help='Keep up to this many most recent nightlies') help='Keep up to this many most recent nightlies')
def clean_nightlies(self, force=False, keep=None): def clean_nightlies(self, force=False, keep=None):
default_toolchain = self.default_toolchain() default_toolchain = self.default_toolchain()
geckolib_toolchain = self.geckolib_toolchain()
print("Current Rust version for Servo: {}".format(default_toolchain)) print("Current Rust version for Servo: {}".format(default_toolchain))
print("Current Rust version for geckolib: {}".format(geckolib_toolchain))
old_toolchains = [] old_toolchains = []
keep = int(keep) keep = int(keep)
for toolchain_file in ['rust-toolchain', 'geckolib-rust-toolchain']: stdout = subprocess.check_output(['git', 'log', '--format=%H', 'rust-toolchain'])
stdout = subprocess.check_output(['git', 'log', '--format=%H', toolchain_file]) for i, commit_hash in enumerate(stdout.split(), 1):
for i, commit_hash in enumerate(stdout.split(), 1): if i > keep:
if i > keep: toolchain = subprocess.check_output(
toolchain = subprocess.check_output( ['git', 'show', '%s:rust-toolchain' % commit_hash])
['git', 'show', '%s:%s' % (commit_hash, toolchain_file)]) old_toolchains.append(toolchain.strip())
old_toolchains.append(toolchain.strip())
removing_anything = False removing_anything = False
stdout = subprocess.check_output(['rustup', 'toolchain', 'list']) stdout = subprocess.check_output(['rustup', 'toolchain', 'list'])

View file

@ -386,49 +386,6 @@ class MachCommands(CommandBase):
print("Build %s in %s" % ("Completed" if status == 0 else "FAILED", format_duration(elapsed))) print("Build %s in %s" % ("Completed" if status == 0 else "FAILED", format_duration(elapsed)))
return status return status
@Command('build-geckolib',
description='Build a static library of components used by Gecko',
category='build')
@CommandArgument('--jobs', '-j',
default=None,
help='Number of jobs to run in parallel')
@CommandArgument('--verbose', '-v',
action='store_true',
help='Print verbose output')
@CommandArgument('--release', '-r',
action='store_true',
help='Build in release mode')
def build_geckolib(self, jobs=None, verbose=False, release=False):
self.set_use_geckolib_toolchain()
self.ensure_bootstrapped()
self.ensure_clobbered()
env = self.build_env(is_build=True, geckolib=True)
ret = None
opts = ["-p", "geckoservo"]
features = []
if jobs is not None:
opts += ["-j", jobs]
if verbose:
opts += ["-v"]
if release:
opts += ["--release"]
if features:
opts += ["--features", ' '.join(features)]
build_start = time()
ret = self.call_rustup_run(["cargo", "build"] + opts, env=env, verbose=verbose)
elapsed = time() - build_start
# Generate Desktop Notification if elapsed-time > some threshold value
notify_build_done(self.config, elapsed)
print("GeckoLib build completed in %s" % format_duration(elapsed))
return ret
@Command('clean', @Command('clean',
description='Clean the build directory.', description='Clean the build directory.',
category='build') category='build')

View file

@ -285,27 +285,10 @@ class CommandBase(object):
# Set default android target # Set default android target
self.handle_android_target("armv7-linux-androideabi") self.handle_android_target("armv7-linux-androideabi")
self.set_use_geckolib_toolchain(False)
_use_geckolib_toolchain = False
_geckolib_toolchain = None
_default_toolchain = None _default_toolchain = None
def set_use_geckolib_toolchain(self, use_geckolib_toolchain=True):
self._use_geckolib_toolchain = use_geckolib_toolchain
def toolchain(self): def toolchain(self):
if self._use_geckolib_toolchain: return self.default_toolchain()
return self.geckolib_toolchain()
else:
return self.default_toolchain()
def geckolib_toolchain(self):
if self._geckolib_toolchain is None:
filename = path.join(self.context.topdir, "geckolib-rust-toolchain")
with open(filename) as f:
self._geckolib_toolchain = f.read().strip()
return self._geckolib_toolchain
def default_toolchain(self): def default_toolchain(self):
if self._default_toolchain is None: if self._default_toolchain is None:
@ -474,7 +457,7 @@ class CommandBase(object):
bin_folder = path.join(destination_folder, "PFiles", "Mozilla research", "Servo Tech Demo") bin_folder = path.join(destination_folder, "PFiles", "Mozilla research", "Servo Tech Demo")
return path.join(bin_folder, "servo{}".format(BIN_SUFFIX)) return path.join(bin_folder, "servo{}".format(BIN_SUFFIX))
def build_env(self, hosts_file_path=None, target=None, is_build=False, geckolib=False, test_unit=False): def build_env(self, hosts_file_path=None, target=None, is_build=False, test_unit=False):
"""Return an extended environment dictionary.""" """Return an extended environment dictionary."""
env = os.environ.copy() env = os.environ.copy()
if sys.platform == "win32" and type(env['PATH']) == unicode: if sys.platform == "win32" and type(env['PATH']) == unicode:
@ -593,10 +576,7 @@ class CommandBase(object):
env['GIT_INFO'] = '-'.join(git_info) env['GIT_INFO'] = '-'.join(git_info)
if geckolib: if self.config["build"]["thinlto"]:
geckolib_build_path = path.join(self.context.topdir, "target", "geckolib").encode("UTF-8")
env["CARGO_TARGET_DIR"] = geckolib_build_path
elif self.config["build"]["thinlto"]:
env['RUSTFLAGS'] += " -Z thinlto" env['RUSTFLAGS'] += " -Z thinlto"
return env return env
@ -607,9 +587,6 @@ class CommandBase(object):
def servo_manifest(self): def servo_manifest(self):
return path.join(self.context.topdir, "ports", "servo", "Cargo.toml") return path.join(self.context.topdir, "ports", "servo", "Cargo.toml")
def geckolib_manifest(self):
return path.join(self.context.topdir, "ports", "geckolib", "Cargo.toml")
def servo_features(self): def servo_features(self):
"""Return a list of optional features to enable for the Servo crate""" """Return a list of optional features to enable for the Servo crate"""
features = [] features = []

View file

@ -28,29 +28,17 @@ from servo.util import STATIC_RUST_LANG_ORG_DIST, URLOPEN_KWARGS
@CommandProvider @CommandProvider
class MachCommands(CommandBase): class MachCommands(CommandBase):
def run_cargo(self, params, geckolib=False, check=False): def run_cargo(self, params, check=False):
if not params: if not params:
params = [] params = []
self.ensure_bootstrapped() self.ensure_bootstrapped()
self.ensure_clobbered() self.ensure_clobbered()
env = self.build_env(geckolib=geckolib) env = self.build_env()
if check: if check:
params = ['check'] + params params = ['check'] + params
if geckolib:
# for c in $(cargo --list | tail -$(($(cargo --list | wc -l) - 1))); do
# (cargo help $c 2>&1 | grep "\\--package" >/dev/null 2>&1) && echo $c
# done
if params and params[0] in [
'bench', 'build', 'check', 'clean', 'doc', 'fmt', 'pkgid',
'run', 'rustc', 'rustdoc', 'test', 'update',
]:
params[1:1] = ['--package', 'geckoservo']
self.set_use_geckolib_toolchain()
build_start = time() build_start = time()
status = self.call_rustup_run(["cargo"] + params, env=env) status = self.call_rustup_run(["cargo"] + params, env=env)
elapsed = time() - build_start elapsed = time() - build_start
@ -71,15 +59,6 @@ class MachCommands(CommandBase):
def cargo(self, params): def cargo(self, params):
return self.run_cargo(params) return self.run_cargo(params)
@Command('cargo-geckolib',
description='Run Cargo with the same compiler version and root crate as build-geckolib',
category='devenv')
@CommandArgument(
'params', default=None, nargs='...',
help="Command-line arguments to be passed through to Cargo")
def cargo_geckolib(self, params):
return self.run_cargo(params, geckolib=True)
@Command('check', @Command('check',
description='Run "cargo check"', description='Run "cargo check"',
category='devenv') category='devenv')
@ -89,15 +68,6 @@ class MachCommands(CommandBase):
def check(self, params): def check(self, params):
return self.run_cargo(params, check=True) return self.run_cargo(params, check=True)
@Command('check-geckolib',
description='Run "cargo check" with the same compiler version and root crate as build-geckolib',
category='devenv')
@CommandArgument(
'params', default=None, nargs='...',
help="Command-line arguments to be passed through to cargo check")
def check_geckolib(self, params):
return self.run_cargo(params, check=True, geckolib=True)
@Command('cargo-update', @Command('cargo-update',
description='Same as update-cargo', description='Same as update-cargo',
category='devenv') category='devenv')
@ -212,22 +182,6 @@ class MachCommands(CommandBase):
self.ensure_bootstrapped() self.ensure_bootstrapped()
return self.call_rustup_run(["rustc"] + params, env=self.build_env()) return self.call_rustup_run(["rustc"] + params, env=self.build_env())
@Command('rustc-geckolib',
description='Run the Rust compiler with the same compiler version and root crate as build-geckolib',
category='devenv')
@CommandArgument(
'params', default=None, nargs='...',
help="Command-line arguments to be passed through to rustc")
def rustc_geckolib(self, params):
if params is None:
params = []
self.set_use_geckolib_toolchain()
self.ensure_bootstrapped()
env = self.build_env(geckolib=True)
return self.call_rustup_run(["rustc"] + params, env=env)
@Command('grep', @Command('grep',
description='`git grep` for selected directories.', description='`git grep` for selected directories.',
category='devenv') category='devenv')

View file

@ -295,28 +295,6 @@ class MachCommands(CommandBase):
if err is not 0: if err is not 0:
return err return err
@Command('test-stylo',
description='Run stylo unit tests',
category='testing')
@CommandArgument('test_name', nargs=argparse.REMAINDER,
help="Only run tests that match this pattern or file path")
@CommandArgument('--release', default=False, action="store_true",
help="Run with a release build of servo")
def test_stylo(self, release=False, test_name=None):
self.set_use_geckolib_toolchain()
self.ensure_bootstrapped()
env = self.build_env()
env["RUST_BACKTRACE"] = "1"
env["CARGO_TARGET_DIR"] = path.join(self.context.topdir, "target", "geckolib").encode("UTF-8")
args = (
["cargo", "test", "--manifest-path", self.geckolib_manifest(), "-p", "stylo_tests"] +
(["--release"] if release else []) +
(test_name or [])
)
return self.call_rustup_run(args, env=env)
@Command('test-content', @Command('test-content',
description='Run the content tests', description='Run the content tests',
category='testing') category='testing')

View file

@ -490,7 +490,6 @@ def check_rust(file_name, lines):
if not file_name.endswith(".rs") or \ if not file_name.endswith(".rs") or \
file_name.endswith(".mako.rs") or \ file_name.endswith(".mako.rs") or \
file_name.endswith(os.path.join("style", "build.rs")) or \ file_name.endswith(os.path.join("style", "build.rs")) or \
file_name.endswith(os.path.join("geckolib", "build.rs")) or \
file_name.endswith(os.path.join("unit", "style", "stylesheets.rs")): file_name.endswith(os.path.join("unit", "style", "stylesheets.rs")):
raise StopIteration raise StopIteration

View file

@ -55,11 +55,6 @@ files = [
"./components/style/properties/helpers/animated_properties.mako.rs", "./components/style/properties/helpers/animated_properties.mako.rs",
# Helper macro where actually a pseudo-element per line makes sense. # Helper macro where actually a pseudo-element per line makes sense.
"./components/style/gecko/non_ts_pseudo_class_list.rs", "./components/style/gecko/non_ts_pseudo_class_list.rs",
# Generated and upstream code combined with our own. Could use cleanup
"./components/style/gecko/generated/bindings.rs",
"./components/style/gecko/generated/pseudo_element_definition.rs",
"./components/style/gecko/generated/structs.rs",
"./components/style/gecko/generated/atom_macro.rs",
"./resources/hsts_preload.json", "./resources/hsts_preload.json",
"./tests/wpt/metadata/MANIFEST.json", "./tests/wpt/metadata/MANIFEST.json",
"./support/android/openssl.sh", "./support/android/openssl.sh",

View file

@ -1,13 +0,0 @@
[package]
name = "nsstring"
version = "0.1.0"
authors = ["nobody@mozilla.com"]
license = "MPL-2.0"
description = "Rust bindings to xpcom string types"
[features]
gecko_debug = []
[dependencies]
bitflags = "1.0"

File diff suppressed because it is too large Load diff

View file

@ -32,7 +32,6 @@ mod parsing;
mod properties; mod properties;
mod rule_tree; mod rule_tree;
mod size_of; mod size_of;
#[path = "../../../ports/geckolib/tests/specified_values.rs"]
mod specified_values; mod specified_values;
mod str; mod str;
mod stylesheets; mod stylesheets;