mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Auto merge of #23676 - servo:check, r=Manishearth
Share more `./mach build` logic with mach check, doc, test-unit Fixes #23659 <!-- 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/23676) <!-- Reviewable:end -->
This commit is contained in:
commit
50033878a6
32 changed files with 268 additions and 302 deletions
|
@ -11,10 +11,10 @@ name = "canvas"
|
|||
path = "lib.rs"
|
||||
|
||||
[features]
|
||||
azure_backend = ["azure"]
|
||||
default = ["azure_backend"]
|
||||
canvas2d-azure = ["azure"]
|
||||
canvas2d-raqote = ["raqote"]
|
||||
default = ["canvas2d-azure"]
|
||||
webgl_backtrace = ["canvas_traits/webgl_backtrace"]
|
||||
raqote_backend = ["raqote"]
|
||||
no_wgl = ["offscreen_gl_context/no_wgl"]
|
||||
|
||||
[dependencies]
|
||||
|
|
20
components/canvas/build.rs
Normal file
20
components/canvas/build.rs
Normal file
|
@ -0,0 +1,20 @@
|
|||
/* 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 https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
fn main() {
|
||||
let azure = std::env::var_os("CARGO_FEATURE_CANVAS2D_AZURE").is_some();
|
||||
let raqote = std::env::var_os("CARGO_FEATURE_CANVAS2D_RAQOTE").is_some();
|
||||
|
||||
if !(azure || raqote) {
|
||||
error("Must enable one of the `canvas2d-azure` or `canvas2d-raqote` features.")
|
||||
}
|
||||
if azure && raqote {
|
||||
error("Must not enable both of the `canvas2d-azure` and `canvas2d-raqote` features.")
|
||||
}
|
||||
}
|
||||
|
||||
fn error(message: &str) {
|
||||
print!("\n\n Error: {}\n\n", message);
|
||||
std::process::exit(1)
|
||||
}
|
|
@ -281,92 +281,92 @@ pub trait GenericDrawTarget {
|
|||
|
||||
#[derive(Clone)]
|
||||
pub enum ExtendMode {
|
||||
#[cfg(feature = "azure_backend")]
|
||||
#[cfg(feature = "canvas2d-azure")]
|
||||
Azure(azure::azure_hl::ExtendMode),
|
||||
#[cfg(feature = "raqote_backend")]
|
||||
#[cfg(feature = "canvas2d-raqote")]
|
||||
Raqote(()),
|
||||
}
|
||||
|
||||
pub enum GradientStop {
|
||||
#[cfg(feature = "azure_backend")]
|
||||
#[cfg(feature = "canvas2d-azure")]
|
||||
Azure(azure::AzGradientStop),
|
||||
#[cfg(feature = "raqote_backend")]
|
||||
#[cfg(feature = "canvas2d-raqote")]
|
||||
Raqote(()),
|
||||
}
|
||||
|
||||
pub enum GradientStops {
|
||||
#[cfg(feature = "azure_backend")]
|
||||
#[cfg(feature = "canvas2d-azure")]
|
||||
Azure(azure::azure_hl::GradientStops),
|
||||
#[cfg(feature = "raqote_backend")]
|
||||
#[cfg(feature = "canvas2d-raqote")]
|
||||
Raqote(()),
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
pub enum Color {
|
||||
#[cfg(feature = "azure_backend")]
|
||||
#[cfg(feature = "canvas2d-azure")]
|
||||
Azure(azure::azure_hl::Color),
|
||||
#[cfg(feature = "raqote_backend")]
|
||||
#[cfg(feature = "canvas2d-raqote")]
|
||||
Raqote(()),
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
pub enum CompositionOp {
|
||||
#[cfg(feature = "azure_backend")]
|
||||
#[cfg(feature = "canvas2d-azure")]
|
||||
Azure(azure::azure_hl::CompositionOp),
|
||||
#[cfg(feature = "raqote_backend")]
|
||||
#[cfg(feature = "canvas2d-raqote")]
|
||||
Raqote(()),
|
||||
}
|
||||
|
||||
pub enum SurfaceFormat {
|
||||
#[cfg(feature = "azure_backend")]
|
||||
#[cfg(feature = "canvas2d-azure")]
|
||||
Azure(azure::azure_hl::SurfaceFormat),
|
||||
#[cfg(feature = "raqote_backend")]
|
||||
#[cfg(feature = "canvas2d-raqote")]
|
||||
Raqote(()),
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
pub enum SourceSurface {
|
||||
#[cfg(feature = "azure_backend")]
|
||||
#[cfg(feature = "canvas2d-azure")]
|
||||
Azure(azure::azure_hl::SourceSurface),
|
||||
#[cfg(feature = "raqote_backend")]
|
||||
#[cfg(feature = "canvas2d-raqote")]
|
||||
Raqote(()),
|
||||
}
|
||||
|
||||
pub enum Path {
|
||||
#[cfg(feature = "azure_backend")]
|
||||
#[cfg(feature = "canvas2d-azure")]
|
||||
Azure(azure::azure_hl::Path),
|
||||
#[cfg(feature = "raqote_backend")]
|
||||
#[cfg(feature = "canvas2d-raqote")]
|
||||
Raqote(()),
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
pub enum Pattern {
|
||||
#[cfg(feature = "azure_backend")]
|
||||
#[cfg(feature = "canvas2d-azure")]
|
||||
Azure(azure::azure_hl::Pattern),
|
||||
#[cfg(feature = "raqote_backend")]
|
||||
#[cfg(feature = "canvas2d-raqote")]
|
||||
Raqote(()),
|
||||
}
|
||||
|
||||
pub enum DrawSurfaceOptions {
|
||||
#[cfg(feature = "azure_backend")]
|
||||
#[cfg(feature = "canvas2d-azure")]
|
||||
Azure(azure::azure_hl::DrawSurfaceOptions),
|
||||
#[cfg(feature = "raqote_backend")]
|
||||
#[cfg(feature = "canvas2d-raqote")]
|
||||
Raqote(()),
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
pub enum DrawOptions {
|
||||
#[cfg(feature = "azure_backend")]
|
||||
#[cfg(feature = "canvas2d-azure")]
|
||||
Azure(azure::azure_hl::DrawOptions),
|
||||
#[cfg(feature = "raqote_backend")]
|
||||
#[cfg(feature = "canvas2d-raqote")]
|
||||
Raqote(()),
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
pub enum StrokeOptions<'a> {
|
||||
#[cfg(feature = "azure_backend")]
|
||||
#[cfg(feature = "canvas2d-azure")]
|
||||
Azure(azure::azure_hl::StrokeOptions<'a>),
|
||||
#[cfg(feature = "raqote_backend")]
|
||||
#[cfg(feature = "canvas2d-raqote")]
|
||||
Raqote(PhantomData<&'a ()>),
|
||||
}
|
||||
|
||||
|
@ -391,12 +391,12 @@ pub struct CanvasData<'a> {
|
|||
pub canvas_id: CanvasId,
|
||||
}
|
||||
|
||||
#[cfg(feature = "azure_backend")]
|
||||
#[cfg(feature = "canvas2d-azure")]
|
||||
fn create_backend() -> Box<dyn Backend> {
|
||||
Box::new(crate::azure_backend::AzureBackend)
|
||||
}
|
||||
|
||||
#[cfg(feature = "raqote_backend")]
|
||||
#[cfg(feature = "canvas2d-raqote")]
|
||||
fn create_backend() -> Box<dyn Backend> {
|
||||
Box::new(crate::raqote_backend::RaqoteBackend)
|
||||
}
|
||||
|
|
|
@ -7,10 +7,10 @@
|
|||
#[macro_use]
|
||||
extern crate log;
|
||||
|
||||
#[cfg(feature = "azure_backend")]
|
||||
#[cfg(feature = "canvas2d-azure")]
|
||||
mod azure_backend;
|
||||
|
||||
#[cfg(feature = "raqote_backend")]
|
||||
#[cfg(feature = "canvas2d-raqote")]
|
||||
mod raqote_backend;
|
||||
|
||||
pub mod canvas_data;
|
||||
|
|
|
@ -11,8 +11,8 @@ name = "constellation"
|
|||
path = "lib.rs"
|
||||
|
||||
[features]
|
||||
azure_backend = ["canvas/azure_backend"]
|
||||
raqote_backend = ["canvas/raqote_backend"]
|
||||
canvas2d-azure = ["canvas/canvas2d-azure"]
|
||||
canvas2d-raqote = ["canvas/canvas2d-raqote"]
|
||||
no_wgl = ["canvas/no_wgl"]
|
||||
|
||||
[dependencies]
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#![deny(unsafe_code)]
|
||||
#![cfg_attr(feature = "unstable", feature(conservative_impl_trait))]
|
||||
|
||||
#[macro_use]
|
||||
extern crate crossbeam_channel;
|
||||
|
|
|
@ -13,9 +13,6 @@ path = "lib.rs"
|
|||
test = false
|
||||
doctest = false
|
||||
|
||||
[features]
|
||||
unstable = ["packed_simd"]
|
||||
|
||||
[dependencies]
|
||||
app_units = "0.7"
|
||||
bitflags = "1.0"
|
||||
|
@ -31,7 +28,7 @@ log = "0.4"
|
|||
malloc_size_of = { path = "../malloc_size_of" }
|
||||
net_traits = {path = "../net_traits"}
|
||||
ordered-float = "1.0"
|
||||
packed_simd = {version = "0.3", optional = true}
|
||||
packed_simd = "0.3"
|
||||
range = {path = "../range"}
|
||||
serde = "1.0"
|
||||
servo_arc = {path = "../servo_arc"}
|
||||
|
|
|
@ -4,10 +4,7 @@
|
|||
|
||||
use app_units::Au;
|
||||
use euclid::Point2D;
|
||||
#[cfg(all(
|
||||
feature = "unstable",
|
||||
any(target_feature = "sse2", target_feature = "neon")
|
||||
))]
|
||||
#[cfg(any(target_feature = "sse2", target_feature = "neon"))]
|
||||
use packed_simd::u32x4;
|
||||
use range::{self, EachIndex, Range, RangeIndex};
|
||||
use std::cmp::{Ordering, PartialOrd};
|
||||
|
@ -75,7 +72,6 @@ pub type GlyphId = u32;
|
|||
// TODO: make this more type-safe.
|
||||
|
||||
const FLAG_CHAR_IS_SPACE: u32 = 0x40000000;
|
||||
#[cfg(feature = "unstable")]
|
||||
#[cfg(any(target_feature = "sse2", target_feature = "neon"))]
|
||||
const FLAG_CHAR_IS_SPACE_SHIFT: u32 = 30;
|
||||
const FLAG_IS_SIMPLE_GLYPH: u32 = 0x80000000;
|
||||
|
@ -625,7 +621,6 @@ impl<'a> GlyphStore {
|
|||
}
|
||||
|
||||
#[inline]
|
||||
#[cfg(feature = "unstable")]
|
||||
#[cfg(any(target_feature = "sse2", target_feature = "neon"))]
|
||||
fn advance_for_byte_range_simple_glyphs(
|
||||
&self,
|
||||
|
@ -644,7 +639,7 @@ impl<'a> GlyphStore {
|
|||
|
||||
for i in 0..num_simd_iterations {
|
||||
let offset = begin + i * 4;
|
||||
let v = u32x4::load_unaligned(&buf[offset..]);
|
||||
let v = u32x4::from_slice_unaligned(&buf[offset..]);
|
||||
let advance = (v & advance_mask) >> GLYPH_ADVANCE_SHIFT;
|
||||
let spaces = (v & space_flag_mask) >> FLAG_CHAR_IS_SPACE_SHIFT;
|
||||
simd_advance = simd_advance + advance;
|
||||
|
@ -672,10 +667,7 @@ impl<'a> GlyphStore {
|
|||
|
||||
/// When SIMD isn't available, fallback to the slow path.
|
||||
#[inline]
|
||||
#[cfg(not(all(
|
||||
feature = "unstable",
|
||||
any(target_feature = "sse2", target_feature = "neon")
|
||||
)))]
|
||||
#[cfg(not(any(target_feature = "sse2", target_feature = "neon")))]
|
||||
fn advance_for_byte_range_simple_glyphs(
|
||||
&self,
|
||||
range: &Range<ByteIndex>,
|
||||
|
@ -686,7 +678,6 @@ impl<'a> GlyphStore {
|
|||
|
||||
/// Used for SIMD.
|
||||
#[inline]
|
||||
#[cfg(feature = "unstable")]
|
||||
#[cfg(any(target_feature = "sse2", target_feature = "neon"))]
|
||||
#[allow(unsafe_code)]
|
||||
fn transmute_entry_buffer_to_u32_buffer(&self) -> &[u32] {
|
||||
|
|
|
@ -10,9 +10,6 @@ publish = false
|
|||
name = "layout_thread"
|
||||
path = "lib.rs"
|
||||
|
||||
[features]
|
||||
unstable = ["parking_lot/nightly"]
|
||||
|
||||
[dependencies]
|
||||
app_units = "0.7"
|
||||
atomic_refcell = "0.1"
|
||||
|
@ -36,7 +33,7 @@ malloc_size_of = { path = "../malloc_size_of" }
|
|||
metrics = {path = "../metrics"}
|
||||
msg = {path = "../msg"}
|
||||
net_traits = {path = "../net_traits"}
|
||||
parking_lot = "0.8"
|
||||
parking_lot = {version = "0.8", features = ["nightly"]}
|
||||
profile_traits = {path = "../profile_traits"}
|
||||
range = {path = "../range"}
|
||||
rayon = "1"
|
||||
|
|
|
@ -10,9 +10,6 @@ publish = false
|
|||
name = "profile"
|
||||
path = "lib.rs"
|
||||
|
||||
[features]
|
||||
unstable = ["servo_allocator"]
|
||||
|
||||
[dependencies]
|
||||
profile_traits = {path = "../profile_traits"}
|
||||
influent = "0.5"
|
||||
|
@ -33,4 +30,4 @@ regex = "1.1"
|
|||
|
||||
[target.'cfg(not(target_os = "windows"))'.dependencies]
|
||||
libc = "0.2"
|
||||
servo_allocator = {path = "../allocator", optional = true}
|
||||
servo_allocator = {path = "../allocator"}
|
||||
|
|
|
@ -389,14 +389,14 @@ mod system_reporter {
|
|||
use super::{JEMALLOC_HEAP_ALLOCATED_STR, SYSTEM_HEAP_ALLOCATED_STR};
|
||||
#[cfg(target_os = "linux")]
|
||||
use libc::c_int;
|
||||
#[cfg(all(feature = "unstable", not(target_os = "windows")))]
|
||||
#[cfg(not(target_os = "windows"))]
|
||||
use libc::{c_void, size_t};
|
||||
use profile_traits::mem::{Report, ReportKind, ReporterRequest};
|
||||
#[cfg(all(feature = "unstable", not(target_os = "windows")))]
|
||||
#[cfg(not(target_os = "windows"))]
|
||||
use std::ffi::CString;
|
||||
#[cfg(all(feature = "unstable", not(target_os = "windows")))]
|
||||
#[cfg(not(target_os = "windows"))]
|
||||
use std::mem::size_of;
|
||||
#[cfg(all(feature = "unstable", not(target_os = "windows")))]
|
||||
#[cfg(not(target_os = "windows"))]
|
||||
use std::ptr::null_mut;
|
||||
#[cfg(target_os = "macos")]
|
||||
use task_info::task_basic_info::{resident_size, virtual_size};
|
||||
|
@ -495,10 +495,10 @@ mod system_reporter {
|
|||
None
|
||||
}
|
||||
|
||||
#[cfg(all(feature = "unstable", not(target_os = "windows")))]
|
||||
#[cfg(not(target_os = "windows"))]
|
||||
use servo_allocator::jemalloc_sys::mallctl;
|
||||
|
||||
#[cfg(all(feature = "unstable", not(target_os = "windows")))]
|
||||
#[cfg(not(target_os = "windows"))]
|
||||
fn jemalloc_stat(value_name: &str) -> Option<usize> {
|
||||
// Before we request the measurement of interest, we first send an "epoch"
|
||||
// request. Without that jemalloc gives cached statistics(!) which can be
|
||||
|
@ -545,7 +545,7 @@ mod system_reporter {
|
|||
Some(value as usize)
|
||||
}
|
||||
|
||||
#[cfg(any(target_os = "windows", not(feature = "unstable")))]
|
||||
#[cfg(target_os = "windows")]
|
||||
fn jemalloc_stat(_value_name: &str) -> Option<usize> {
|
||||
None
|
||||
}
|
||||
|
|
|
@ -15,7 +15,6 @@ path = "lib.rs"
|
|||
[features]
|
||||
debugmozjs = ['js/debugmozjs']
|
||||
profilemozjs = ['js/profilemozjs']
|
||||
unstable = []
|
||||
unrooted_must_root_lint = ["script_plugins/unrooted_must_root_lint"]
|
||||
webidl_lint = ["script_plugins/webidl_lint"]
|
||||
default = ["unrooted_must_root_lint", "webidl_lint"]
|
||||
|
|
|
@ -69,10 +69,7 @@ pub trait IDLInterface {
|
|||
}
|
||||
|
||||
/// A trait to mark an IDL interface as deriving from another one.
|
||||
#[cfg_attr(
|
||||
feature = "unstable",
|
||||
rustc_on_unimplemented(message = "The IDL interface `{Self}` is not derived from `{T}`.")
|
||||
)]
|
||||
#[rustc_on_unimplemented(message = "The IDL interface `{Self}` is not derived from `{T}`.")]
|
||||
pub trait DerivedFrom<T: Castable>: Castable {}
|
||||
|
||||
impl<T: Float + ToJSValConvertible> ToJSValConvertible for Finite<T> {
|
||||
|
|
|
@ -330,13 +330,13 @@ impl<T: DomObject> Deref for Dom<T> {
|
|||
|
||||
unsafe impl<T: DomObject> JSTraceable for Dom<T> {
|
||||
unsafe fn trace(&self, trc: *mut JSTracer) {
|
||||
#[cfg(all(feature = "unstable", debug_assertions))]
|
||||
let trace_str = format!("for {} on heap", ::std::intrinsics::type_name::<T>());
|
||||
#[cfg(all(feature = "unstable", debug_assertions))]
|
||||
let trace_info = &trace_str[..];
|
||||
#[cfg(not(all(feature = "unstable", debug_assertions)))]
|
||||
let trace_info = "for DOM object on heap";
|
||||
|
||||
let trace_string;
|
||||
let trace_info = if cfg!(debug_assertions) {
|
||||
trace_string = format!("for {} on heap", ::std::intrinsics::type_name::<T>());
|
||||
&trace_string[..]
|
||||
} else {
|
||||
"for DOM object on heap"
|
||||
};
|
||||
trace_reflector(trc, trace_info, (*self.ptr.as_ptr()).reflector());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -938,10 +938,7 @@ impl WindowMethods for Window {
|
|||
|
||||
#[allow(unsafe_code)]
|
||||
fn Trap(&self) {
|
||||
#[cfg(feature = "unstable")]
|
||||
unsafe {
|
||||
::std::intrinsics::breakpoint()
|
||||
}
|
||||
unsafe { ::std::intrinsics::breakpoint() }
|
||||
}
|
||||
|
||||
#[allow(unsafe_code)]
|
||||
|
|
|
@ -2,11 +2,11 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#![cfg_attr(feature = "unstable", feature(core_intrinsics))]
|
||||
#![cfg_attr(feature = "unstable", feature(on_unimplemented))]
|
||||
#![feature(const_fn)]
|
||||
#![feature(core_intrinsics)]
|
||||
#![feature(drain_filter)]
|
||||
#![feature(inner_deref)]
|
||||
#![feature(on_unimplemented)]
|
||||
#![feature(plugin)]
|
||||
#![feature(type_alias_enum_variants)]
|
||||
#![deny(unsafe_code)]
|
||||
|
|
|
@ -32,14 +32,7 @@ macro_rules! task {
|
|||
pub trait TaskOnce: Send {
|
||||
#[allow(unsafe_code)]
|
||||
fn name(&self) -> &'static str {
|
||||
#[cfg(feature = "unstable")]
|
||||
unsafe {
|
||||
::std::intrinsics::type_name::<Self>()
|
||||
}
|
||||
#[cfg(not(feature = "unstable"))]
|
||||
{
|
||||
"(task name unknown)"
|
||||
}
|
||||
unsafe { ::std::intrinsics::type_name::<Self>() }
|
||||
}
|
||||
|
||||
fn run_once(self);
|
||||
|
|
|
@ -12,7 +12,8 @@ path = "lib.rs"
|
|||
crate-type = ["rlib"]
|
||||
|
||||
[features]
|
||||
azure_backend = ["canvas/azure_backend"]
|
||||
canvas2d-azure = ["canvas/canvas2d-azure"]
|
||||
canvas2d-raqote = ["canvas/canvas2d-raqote"]
|
||||
debugmozjs = ["script/debugmozjs"]
|
||||
energy-profiling = ["profile_traits/energy-profiling"]
|
||||
profilemozjs = ["script/profilemozjs"]
|
||||
|
@ -21,16 +22,10 @@ js_backtrace = ["script/js_backtrace"]
|
|||
max_log_level = ["log/release_max_level_info"]
|
||||
native-bluetooth = ["bluetooth/native-bluetooth"]
|
||||
no_wgl = ["canvas/no_wgl"]
|
||||
raqote_backend = ["canvas/raqote_backend"]
|
||||
uwp = ["servo_config/uwp"]
|
||||
webrender_debugger = ["webrender/debugger"]
|
||||
no_static_freetype = ["webrender/no_static_freetype"]
|
||||
oculusvr = ["webvr/oculusvr"]
|
||||
unstable = [
|
||||
"euclid/unstable",
|
||||
"profile/unstable",
|
||||
"script/unstable",
|
||||
]
|
||||
webdriver = ["webdriver_server"]
|
||||
webgl_backtrace = [
|
||||
"script/webgl_backtrace",
|
||||
|
|
|
@ -183,9 +183,8 @@ def linux_tidy_unit_docs():
|
|||
./mach build --dev
|
||||
./mach test-unit
|
||||
./mach package --dev
|
||||
./mach build --dev --features raqote_backend
|
||||
./mach build --dev --features canvas2d-raqote
|
||||
./mach build --dev --libsimpleservo
|
||||
./mach build --dev --no-default-features --features default-except-unstable
|
||||
./mach test-tidy --no-progress --self-test
|
||||
|
||||
./etc/memory_reports_over_time.py --test
|
||||
|
@ -194,12 +193,24 @@ def linux_tidy_unit_docs():
|
|||
./etc/ci/check_no_panic.sh
|
||||
|
||||
RUSTDOCFLAGS="--disable-minification" ./mach doc
|
||||
cd target/doc
|
||||
git init
|
||||
time git add .
|
||||
git -c user.name="Taskcluster" -c user.email="" \
|
||||
commit -q -m "Rebuild Servo documentation"
|
||||
git bundle create docs.bundle HEAD
|
||||
(
|
||||
cd target/doc
|
||||
git init
|
||||
git add .
|
||||
git -c user.name="Taskcluster" -c user.email="" \
|
||||
commit -q -m "Rebuild Servo documentation"
|
||||
git bundle create docs.bundle HEAD
|
||||
)
|
||||
|
||||
"""
|
||||
# Because `rustdoc` needs metadata of dependency crates,
|
||||
# `cargo doc` does almost all of the work that `cargo check` does.
|
||||
# Therefore, when running them in this order the second command does very little
|
||||
# and should finish quickly.
|
||||
# The reverse order would not increase the total amount of work to do,
|
||||
# but would reduce the amount of parallelism available.
|
||||
"""
|
||||
./mach check
|
||||
""")
|
||||
.with_artifacts("/repo/target/doc/docs.bundle")
|
||||
.find_or_create("docs." + CONFIG.task_id())
|
||||
|
|
|
@ -27,17 +27,15 @@ OriginalFilename = "servo.exe"
|
|||
ProductName = "Servo"
|
||||
|
||||
[features]
|
||||
azure_backend = ["libservo/azure_backend"]
|
||||
default = ["unstable", "default-except-unstable"]
|
||||
default-except-unstable = ["webdriver", "max_log_level"]
|
||||
canvas2d-azure = ["libservo/canvas2d-azure"]
|
||||
canvas2d-raqote = ["libservo/canvas2d-raqote"]
|
||||
default = ["webdriver", "max_log_level"]
|
||||
energy-profiling = ["libservo/energy-profiling"]
|
||||
debugmozjs = ["libservo/debugmozjs"]
|
||||
js_backtrace = ["libservo/js_backtrace"]
|
||||
max_log_level = ["log/release_max_level_info"]
|
||||
native-bluetooth = ["libservo/native-bluetooth"]
|
||||
profilemozjs = ["libservo/profilemozjs"]
|
||||
raqote_backend = ["libservo/raqote_backend"]
|
||||
unstable = ["libservo/unstable"]
|
||||
webdriver = ["libservo/webdriver"]
|
||||
webgl_backtrace = ["libservo/webgl_backtrace"]
|
||||
webrender_debugger = ["libservo/webrender_debugger"]
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
//!
|
||||
//! [glutin]: https://github.com/tomaka/glutin
|
||||
|
||||
#![cfg_attr(feature = "unstable", feature(core_intrinsics))]
|
||||
#![feature(core_intrinsics)]
|
||||
|
||||
#[cfg(not(target_os = "android"))]
|
||||
include!("main2.rs");
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
extern crate lazy_static;
|
||||
#[macro_use]
|
||||
extern crate log;
|
||||
#[cfg(all(feature = "unstable", any(target_os = "macos", target_os = "linux")))]
|
||||
#[cfg(any(target_os = "macos", target_os = "linux"))]
|
||||
#[macro_use]
|
||||
extern crate sig;
|
||||
|
||||
|
@ -42,13 +42,10 @@ pub mod platform {
|
|||
pub fn deinit() {}
|
||||
}
|
||||
|
||||
#[cfg(any(
|
||||
not(feature = "unstable"),
|
||||
not(any(target_os = "macos", target_os = "linux"))
|
||||
))]
|
||||
#[cfg(not(any(target_os = "macos", target_os = "linux")))]
|
||||
fn install_crash_handler() {}
|
||||
|
||||
#[cfg(all(feature = "unstable", any(target_os = "macos", target_os = "linux")))]
|
||||
#[cfg(any(target_os = "macos", target_os = "linux"))]
|
||||
fn install_crash_handler() {
|
||||
use backtrace::Backtrace;
|
||||
use libc::_exit;
|
||||
|
|
|
@ -13,8 +13,8 @@ test = false
|
|||
bench = false
|
||||
|
||||
[features]
|
||||
azure_backend = ["simpleservo/azure_backend"]
|
||||
raqote_backend = ["simpleservo/raqote_backend"]
|
||||
canvas2d-azure = ["simpleservo/canvas2d-azure"]
|
||||
canvas2d-raqote = ["simpleservo/canvas2d-raqote"]
|
||||
|
||||
[dependencies]
|
||||
libservo = { path = "../../components/servo", features = ["no_static_freetype"] }
|
||||
|
|
|
@ -26,9 +26,9 @@ libloading = "0.5"
|
|||
gl_generator = "0.11"
|
||||
|
||||
[features]
|
||||
azure_backend = ["libservo/azure_backend"]
|
||||
default = ["unstable", "default-except-unstable"]
|
||||
default-except-unstable = ["webdriver", "max_log_level"]
|
||||
canvas2d-azure = ["libservo/canvas2d-azure"]
|
||||
canvas2d-raqote = ["libservo/canvas2d-raqote"]
|
||||
default = ["webdriver", "max_log_level"]
|
||||
debugmozjs = ["libservo/debugmozjs"]
|
||||
energy-profiling = ["libservo/energy-profiling"]
|
||||
googlevr = ["libservo/googlevr"]
|
||||
|
@ -38,8 +38,6 @@ native-bluetooth = ["libservo/native-bluetooth"]
|
|||
no_static_freetype = ["libservo/no_static_freetype"]
|
||||
no_wgl = ["libservo/no_wgl"]
|
||||
oculusvr = ["libservo/oculusvr"]
|
||||
raqote_backend = ["libservo/raqote_backend"]
|
||||
webdriver = ["libservo/webdriver"]
|
||||
unstable = ["libservo/unstable"]
|
||||
uwp = ["libservo/uwp"]
|
||||
webgl_backtrace = ["libservo/webgl_backtrace"]
|
||||
|
|
|
@ -21,10 +21,10 @@ env_logger = "0.6"
|
|||
cbindgen = "0.8"
|
||||
|
||||
[features]
|
||||
azure_backend = ["simpleservo/azure_backend"]
|
||||
canvas2d-azure = ["simpleservo/canvas2d-azure"]
|
||||
canvas2d-raqote = ["simpleservo/canvas2d-raqote"]
|
||||
debugmozjs = ["simpleservo/debugmozjs"]
|
||||
default = ["unstable", "default-except-unstable"]
|
||||
default-except-unstable = ["webdriver", "max_log_level"]
|
||||
default = ["webdriver", "max_log_level"]
|
||||
energy-profiling = ["simpleservo/energy-profiling"]
|
||||
googlevr = ["simpleservo/googlevr"]
|
||||
js_backtrace = ["simpleservo/js_backtrace"]
|
||||
|
@ -32,8 +32,6 @@ max_log_level = ["simpleservo/max_log_level"]
|
|||
native-bluetooth = ["simpleservo/native-bluetooth"]
|
||||
no_wgl = ["simpleservo/no_wgl"]
|
||||
oculusvr = ["simpleservo/oculusvr"]
|
||||
raqote_backend = ["simpleservo/raqote_backend"]
|
||||
unstable = ["simpleservo/unstable"]
|
||||
uwp = ["simpleservo/uwp"]
|
||||
webdriver = ["simpleservo/webdriver"]
|
||||
webgl_backtrace = ["simpleservo/webgl_backtrace"]
|
||||
|
|
|
@ -26,17 +26,15 @@ simpleservo = { path = "../api" }
|
|||
cc = "1.0"
|
||||
|
||||
[features]
|
||||
azure_backend = ["simpleservo/azure_backend"]
|
||||
canvas2d-azure = ["simpleservo/canvas2d-azure"]
|
||||
canvas2d-raqote = ["simpleservo/canvas2d-raqote"]
|
||||
debugmozjs = ["simpleservo/debugmozjs"]
|
||||
default = ["unstable", "default-except-unstable"]
|
||||
default-except-unstable = ["webdriver", "max_log_level"]
|
||||
default = ["webdriver", "max_log_level"]
|
||||
energy-profiling = ["simpleservo/energy-profiling"]
|
||||
googlevr = ["simpleservo/googlevr"]
|
||||
js_backtrace = ["simpleservo/js_backtrace"]
|
||||
max_log_level = ["simpleservo/max_log_level"]
|
||||
native-bluetooth = ["simpleservo/native-bluetooth"]
|
||||
oculusvr = ["simpleservo/oculusvr"]
|
||||
raqote_backend = ["simpleservo/raqote_backend"]
|
||||
unstable = ["simpleservo/unstable"]
|
||||
webdriver = ["simpleservo/webdriver"]
|
||||
webgl_backtrace = ["simpleservo/webgl_backtrace"]
|
||||
|
|
|
@ -34,18 +34,6 @@ from servo.util import delete, download_bytes, download_file, extract, check_has
|
|||
|
||||
@CommandProvider
|
||||
class MachCommands(CommandBase):
|
||||
@Command('env',
|
||||
description='Print environment setup commands',
|
||||
category='bootstrap')
|
||||
def env(self):
|
||||
env = self.build_env()
|
||||
print("export RUSTFLAGS=%s" % env.get("RUSTFLAGS", ""))
|
||||
print("export PATH=%s" % env.get("PATH", ""))
|
||||
if sys.platform == "darwin":
|
||||
print("export DYLD_LIBRARY_PATH=%s" % env.get("DYLD_LIBRARY_PATH", ""))
|
||||
else:
|
||||
print("export LD_LIBRARY_PATH=%s" % env.get("LD_LIBRARY_PATH", ""))
|
||||
|
||||
@Command('bootstrap',
|
||||
description='Install required packages for building.',
|
||||
category='bootstrap')
|
||||
|
|
|
@ -146,9 +146,6 @@ class MachCommands(CommandBase):
|
|||
@Command('build',
|
||||
description='Build Servo',
|
||||
category='build')
|
||||
@CommandArgument('--target', '-t',
|
||||
default=None,
|
||||
help='Cross compile for given target platform')
|
||||
@CommandArgument('--release', '-r',
|
||||
action='store_true',
|
||||
help='Build in release mode')
|
||||
|
@ -158,25 +155,9 @@ class MachCommands(CommandBase):
|
|||
@CommandArgument('--jobs', '-j',
|
||||
default=None,
|
||||
help='Number of jobs to run in parallel')
|
||||
@CommandArgument('--features',
|
||||
default=None,
|
||||
help='Space-separated list of features to also build',
|
||||
nargs='+')
|
||||
@CommandArgument('--android',
|
||||
default=None,
|
||||
action='store_true',
|
||||
help='Build for Android')
|
||||
@CommandArgument('--magicleap',
|
||||
default=None,
|
||||
action='store_true',
|
||||
help='Build for Magic Leap')
|
||||
@CommandArgument('--no-package',
|
||||
action='store_true',
|
||||
help='For Android, disable packaging into a .apk after building')
|
||||
@CommandArgument('--debug-mozjs',
|
||||
default=None,
|
||||
action='store_true',
|
||||
help='Enable debug assertions in mozjs')
|
||||
@CommandArgument('--verbose', '-v',
|
||||
action='store_true',
|
||||
help='Print verbose output')
|
||||
|
@ -185,46 +166,14 @@ class MachCommands(CommandBase):
|
|||
help='Print very verbose output')
|
||||
@CommandArgument('params', nargs='...',
|
||||
help="Command-line arguments to be passed through to Cargo")
|
||||
@CommandArgument('--with-debug-assertions',
|
||||
default=None,
|
||||
action='store_true',
|
||||
help='Enable debug assertions in release')
|
||||
@CommandArgument('--libsimpleservo',
|
||||
default=None,
|
||||
action='store_true',
|
||||
help='Build the libsimpleservo library instead of the servo executable')
|
||||
@CommandArgument('--with-frame-pointer',
|
||||
default=None,
|
||||
action='store_true',
|
||||
help='Build with frame pointer enabled, used by the background hang monitor.')
|
||||
@CommandArgument('--with-raqote', default=None, action='store_true')
|
||||
@CommandArgument('--without-wgl', default=None, action='store_true')
|
||||
def build(self, target=None, release=False, dev=False, jobs=None,
|
||||
features=None, android=None, magicleap=None, no_package=False, verbose=False, very_verbose=False,
|
||||
debug_mozjs=False, params=None, with_debug_assertions=False,
|
||||
libsimpleservo=False, with_frame_pointer=False, with_raqote=False, without_wgl=False):
|
||||
|
||||
@CommandBase.build_like_command_arguments
|
||||
def build(self, release=False, dev=False, jobs=None, params=None,
|
||||
no_package=False, verbose=False, very_verbose=False,
|
||||
target=None, android=False, magicleap=False, libsimpleservo=False,
|
||||
features=None, **kwargs):
|
||||
opts = params or []
|
||||
|
||||
if android is None:
|
||||
android = self.config["build"]["android"]
|
||||
features = features or self.servo_features()
|
||||
|
||||
if target and android:
|
||||
print("Please specify either --target or --android.")
|
||||
sys.exit(1)
|
||||
|
||||
if android:
|
||||
target = self.config["android"]["target"]
|
||||
|
||||
if not magicleap:
|
||||
features += ["native-bluetooth"]
|
||||
|
||||
if magicleap and not target:
|
||||
target = "aarch64-linux-android"
|
||||
|
||||
if target and not android and not magicleap:
|
||||
android = self.handle_android_target(target)
|
||||
features = features or []
|
||||
target, android = self.pick_target_triple(target, android, magicleap)
|
||||
|
||||
target_path = base_path = self.get_target_dir()
|
||||
if android:
|
||||
|
@ -278,44 +227,13 @@ class MachCommands(CommandBase):
|
|||
check_call(["rustup" + BIN_SUFFIX, "target", "add",
|
||||
"--toolchain", self.toolchain(), target])
|
||||
|
||||
opts += ["--target", target]
|
||||
|
||||
env = self.build_env(target=target, is_build=True)
|
||||
self.ensure_bootstrapped(target=target)
|
||||
self.ensure_clobbered()
|
||||
|
||||
self.add_manifest_path(opts, android, libsimpleservo)
|
||||
|
||||
if debug_mozjs:
|
||||
features += ["debugmozjs"]
|
||||
|
||||
if with_frame_pointer:
|
||||
env['RUSTFLAGS'] = env.get('RUSTFLAGS', "") + " -C force-frame-pointers=yes"
|
||||
features += ["profilemozjs"]
|
||||
|
||||
if with_raqote:
|
||||
features += ["raqote_backend"]
|
||||
|
||||
if without_wgl:
|
||||
features += ["no_wgl"]
|
||||
|
||||
if self.config["build"]["webgl-backtrace"]:
|
||||
features += ["webgl-backtrace"]
|
||||
if self.config["build"]["dom-backtrace"]:
|
||||
features += ["dom-backtrace"]
|
||||
|
||||
if "raqote_backend" not in features:
|
||||
features += ["azure_backend"]
|
||||
|
||||
if features:
|
||||
opts += ["--features", "%s" % ' '.join(features)]
|
||||
|
||||
build_start = time()
|
||||
env["CARGO_TARGET_DIR"] = target_path
|
||||
|
||||
if with_debug_assertions:
|
||||
env['RUSTFLAGS'] = env.get('RUSTFLAGS', "") + " -C debug_assertions"
|
||||
|
||||
host = host_triple()
|
||||
if 'apple-darwin' in host and (not target or target == host):
|
||||
if 'CXXFLAGS' not in env:
|
||||
|
@ -612,7 +530,13 @@ class MachCommands(CommandBase):
|
|||
env.setdefault("CC", "clang")
|
||||
env.setdefault("CXX", "clang++")
|
||||
|
||||
status = self.call_rustup_run(["cargo", "build"] + opts, env=env, verbose=verbose)
|
||||
status = self.run_cargo_build_like_command(
|
||||
"build", opts, env=env, verbose=verbose,
|
||||
target=target, android=android, magicleap=magicleap, libsimpleservo=libsimpleservo,
|
||||
features=features, **kwargs
|
||||
)
|
||||
status = 0
|
||||
|
||||
elapsed = time() - build_start
|
||||
|
||||
# Do some additional things if the build succeeded
|
||||
|
@ -712,14 +636,11 @@ class MachCommands(CommandBase):
|
|||
print('Removing virtualenv directory: %s' % virtualenv_path)
|
||||
shutil.rmtree(virtualenv_path)
|
||||
|
||||
opts = []
|
||||
if manifest_path:
|
||||
opts += ["--manifest-path", manifest_path]
|
||||
opts = ["--manifest-path", manifest_path or path.join(self.context.topdir, "Cargo.toml")]
|
||||
if verbose:
|
||||
opts += ["-v"]
|
||||
opts += params
|
||||
return check_call(["cargo", "clean"] + opts,
|
||||
env=self.build_env(), cwd=self.ports_glutin_crate(), verbose=verbose)
|
||||
return check_call(["cargo", "clean"] + opts, env=self.build_env(), verbose=verbose)
|
||||
|
||||
|
||||
def package_gstreamer_dlls(servo_exe_dir, target):
|
||||
|
|
|
@ -28,6 +28,7 @@ from servo.util import download_file
|
|||
import urllib2
|
||||
from bootstrap import check_gstreamer_lib
|
||||
|
||||
from mach.decorators import CommandArgument
|
||||
from mach.registrar import Registrar
|
||||
import toml
|
||||
|
||||
|
@ -731,34 +732,130 @@ install them, let us know by filing a bug!")
|
|||
|
||||
return env
|
||||
|
||||
def ports_glutin_crate(self):
|
||||
return path.join(self.context.topdir, "ports", "glutin")
|
||||
@staticmethod
|
||||
def build_like_command_arguments(decorated_function):
|
||||
decorators = [
|
||||
CommandArgument(
|
||||
'--target', '-t',
|
||||
default=None,
|
||||
help='Cross compile for given target platform',
|
||||
),
|
||||
CommandArgument(
|
||||
'--android',
|
||||
default=None,
|
||||
action='store_true',
|
||||
help='Build for Android',
|
||||
),
|
||||
CommandArgument(
|
||||
'--magicleap',
|
||||
default=None,
|
||||
action='store_true',
|
||||
help='Build for Magic Leap',
|
||||
),
|
||||
CommandArgument(
|
||||
'--libsimpleservo',
|
||||
default=None,
|
||||
action='store_true',
|
||||
help='Build the libsimpleservo library instead of the servo executable',
|
||||
),
|
||||
CommandArgument(
|
||||
'--features',
|
||||
default=None,
|
||||
help='Space-separated list of features to also build',
|
||||
nargs='+',
|
||||
),
|
||||
CommandArgument(
|
||||
'--debug-mozjs',
|
||||
default=None,
|
||||
action='store_true',
|
||||
help='Enable debug assertions in mozjs',
|
||||
),
|
||||
CommandArgument(
|
||||
'--with-debug-assertions',
|
||||
default=None,
|
||||
action='store_true',
|
||||
help='Enable debug assertions in release',
|
||||
),
|
||||
CommandArgument(
|
||||
'--with-frame-pointer',
|
||||
default=None,
|
||||
action='store_true',
|
||||
help='Build with frame pointer enabled, used by the background hang monitor.',
|
||||
),
|
||||
CommandArgument('--with-raqote', default=None, action='store_true'),
|
||||
CommandArgument('--without-wgl', default=None, action='store_true'),
|
||||
]
|
||||
|
||||
def add_manifest_path(self, args, android=False, libsimpleservo=False):
|
||||
for decorator in decorators:
|
||||
decorated_function = decorator(decorated_function)
|
||||
return decorated_function
|
||||
|
||||
def pick_target_triple(self, target, android, magicleap):
|
||||
if android is None:
|
||||
android = self.config["build"]["android"]
|
||||
if target and android:
|
||||
assert self.handle_android_target(target)
|
||||
if android and not target:
|
||||
target = self.config["android"]["target"]
|
||||
if magicleap and not target:
|
||||
target = "aarch64-linux-android"
|
||||
if target and not android and not magicleap:
|
||||
android = self.handle_android_target(target)
|
||||
return target, android
|
||||
|
||||
def run_cargo_build_like_command(
|
||||
self, command, cargo_args,
|
||||
env=None, verbose=False,
|
||||
target=None, android=False, magicleap=False, libsimpleservo=False,
|
||||
features=None, debug_mozjs=False, with_debug_assertions=False,
|
||||
with_frame_pointer=False, with_raqote=False, without_wgl=False,
|
||||
):
|
||||
env = env or self.build_env()
|
||||
target, android = self.pick_target_triple(target, android, magicleap)
|
||||
|
||||
args = []
|
||||
if "--manifest-path" not in args:
|
||||
if libsimpleservo or android:
|
||||
manifest = self.ports_libsimpleservo_manifest(android)
|
||||
if android:
|
||||
api = "jniapi"
|
||||
else:
|
||||
api = "capi"
|
||||
port = path.join("libsimpleservo", api)
|
||||
else:
|
||||
manifest = self.ports_glutin_manifest()
|
||||
args.append("--manifest-path")
|
||||
args.append(manifest)
|
||||
port = "glutin"
|
||||
args += [
|
||||
"--manifest-path",
|
||||
path.join(self.context.topdir, "ports", port, "Cargo.toml"),
|
||||
]
|
||||
if target:
|
||||
args += ["--target", target]
|
||||
|
||||
def ports_glutin_manifest(self):
|
||||
return path.join(self.context.topdir, "ports", "glutin", "Cargo.toml")
|
||||
if features is None: # If we're passed a list, mutate it even if it's empty
|
||||
features = []
|
||||
if self.config["build"]["debug-mozjs"] or debug_mozjs:
|
||||
features.append("debugmozjs")
|
||||
if not magicleap:
|
||||
features.append("native-bluetooth")
|
||||
if with_raqote and "canvas2d-azure" not in features:
|
||||
features.append("canvas2d-raqote")
|
||||
elif "canvas2d-raqote" not in features:
|
||||
features.append("canvas2d-azure")
|
||||
if with_frame_pointer:
|
||||
env['RUSTFLAGS'] = env.get('RUSTFLAGS', "") + " -C force-frame-pointers=yes"
|
||||
features.append("profilemozjs")
|
||||
if without_wgl:
|
||||
features.append("no_wgl")
|
||||
if self.config["build"]["webgl-backtrace"]:
|
||||
features.append("webgl-backtrace")
|
||||
if self.config["build"]["dom-backtrace"]:
|
||||
features.append("dom-backtrace")
|
||||
if with_debug_assertions:
|
||||
env['RUSTFLAGS'] = env.get('RUSTFLAGS', "") + " -C debug_assertions"
|
||||
|
||||
def ports_libsimpleservo_manifest(self, android=False):
|
||||
if android:
|
||||
api = "jniapi"
|
||||
else:
|
||||
api = "capi"
|
||||
return path.join(self.context.topdir, "ports", "libsimpleservo", api, "Cargo.toml")
|
||||
assert "--features" not in cargo_args
|
||||
args += ["--features", " ".join(features)]
|
||||
|
||||
def servo_features(self):
|
||||
"""Return a list of optional features to enable for the Servo crate"""
|
||||
features = []
|
||||
if self.config["build"]["debug-mozjs"]:
|
||||
features += ["debugmozjs"]
|
||||
return features
|
||||
return self.call_rustup_run(["cargo", command] + args + cargo_args, env=env, verbose=verbose)
|
||||
|
||||
def android_support_dir(self):
|
||||
return path.join(self.context.topdir, "support", "android")
|
||||
|
|
|
@ -31,7 +31,14 @@ from servo.util import get_static_rust_lang_org_dist, get_urlopen_kwargs
|
|||
|
||||
@CommandProvider
|
||||
class MachCommands(CommandBase):
|
||||
def run_cargo(self, params, check=False):
|
||||
@Command('check',
|
||||
description='Run "cargo check"',
|
||||
category='devenv')
|
||||
@CommandArgument(
|
||||
'params', default=None, nargs='...',
|
||||
help="Command-line arguments to be passed through to cargo check")
|
||||
@CommandBase.build_like_command_arguments
|
||||
def check(self, params, **kwargs):
|
||||
if not params:
|
||||
params = []
|
||||
|
||||
|
@ -39,40 +46,17 @@ class MachCommands(CommandBase):
|
|||
self.ensure_clobbered()
|
||||
env = self.build_env()
|
||||
|
||||
if check:
|
||||
params = ['check'] + params
|
||||
|
||||
self.add_manifest_path(params)
|
||||
|
||||
build_start = time()
|
||||
status = self.call_rustup_run(["cargo"] + params, env=env)
|
||||
status = self.run_cargo_build_like_command("check", params, env=env, **kwargs)
|
||||
elapsed = time() - build_start
|
||||
|
||||
notify_build_done(self.config, elapsed, status == 0)
|
||||
|
||||
if check and status == 0:
|
||||
if status == 0:
|
||||
print('Finished checking, binary NOT updated. Consider ./mach build before ./mach run')
|
||||
|
||||
return status
|
||||
|
||||
@Command('cargo',
|
||||
description='Run Cargo',
|
||||
category='devenv')
|
||||
@CommandArgument(
|
||||
'params', default=None, nargs='...',
|
||||
help="Command-line arguments to be passed through to Cargo")
|
||||
def cargo(self, params):
|
||||
return self.run_cargo(params)
|
||||
|
||||
@Command('check',
|
||||
description='Run "cargo check"',
|
||||
category='devenv')
|
||||
@CommandArgument(
|
||||
'params', default=None, nargs='...',
|
||||
help="Command-line arguments to be passed through to cargo check")
|
||||
def check(self, params):
|
||||
return self.run_cargo(params, check=True)
|
||||
|
||||
@Command('cargo-update',
|
||||
description='Same as update-cargo',
|
||||
category='devenv')
|
||||
|
|
|
@ -236,7 +236,8 @@ class PostBuildCommands(CommandBase):
|
|||
@CommandArgument(
|
||||
'params', nargs='...',
|
||||
help="Command-line arguments to be passed through to cargo doc")
|
||||
def doc(self, params):
|
||||
@CommandBase.build_like_command_arguments
|
||||
def doc(self, params, **kwargs):
|
||||
env = os.environ.copy()
|
||||
env["RUSTUP_TOOLCHAIN"] = self.toolchain()
|
||||
rustc_path = check_output(["rustup" + BIN_SUFFIX, "which", "rustc"], env=env)
|
||||
|
@ -264,11 +265,7 @@ class PostBuildCommands(CommandBase):
|
|||
else:
|
||||
copy2(full_name, destination)
|
||||
|
||||
params += ["--features", "azure_backend"]
|
||||
|
||||
returncode = self.call_rustup_run(
|
||||
["cargo", "doc", "--manifest-path", self.ports_glutin_manifest()] + params,
|
||||
env=self.build_env())
|
||||
returncode = self.run_cargo_build_like_command("doc", params, **kwargs)
|
||||
if returncode:
|
||||
return returncode
|
||||
|
||||
|
|
|
@ -214,7 +214,8 @@ class MachCommands(CommandBase):
|
|||
help="Run in bench mode")
|
||||
@CommandArgument('--nocapture', default=False, action="store_true",
|
||||
help="Run tests with nocapture ( show test stdout )")
|
||||
def test_unit(self, test_name=None, package=None, bench=False, nocapture=False):
|
||||
@CommandBase.build_like_command_arguments
|
||||
def test_unit(self, test_name=None, package=None, bench=False, nocapture=False, **kwargs):
|
||||
if test_name is None:
|
||||
test_name = []
|
||||
|
||||
|
@ -277,22 +278,18 @@ class MachCommands(CommandBase):
|
|||
# in to the servo.exe build dir, so just point PATH to that.
|
||||
env["PATH"] = "%s%s%s" % (path.dirname(self.get_binary_path(False, False)), os.pathsep, env["PATH"])
|
||||
|
||||
features = self.servo_features()
|
||||
if len(packages) > 0 or len(in_crate_packages) > 0:
|
||||
args = ["cargo", "bench" if bench else "test", "--manifest-path", self.ports_glutin_manifest()]
|
||||
args = []
|
||||
for crate in packages:
|
||||
args += ["-p", "%s_tests" % crate]
|
||||
for crate in in_crate_packages:
|
||||
args += ["-p", crate]
|
||||
args += test_patterns
|
||||
|
||||
if features:
|
||||
args += ["--features", "%s" % ' '.join(features)]
|
||||
|
||||
if nocapture:
|
||||
args += ["--", "--nocapture"]
|
||||
|
||||
err = self.call_rustup_run(args, env=env)
|
||||
err = self.run_cargo_build_like_command("bench" if bench else "test", args, env=env, **kwargs)
|
||||
if err is not 0:
|
||||
return err
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue