servo: Merge #7448 - Re-export crates needed to use the Servo Rust API (from meh:servo-reexport); r=jdm

This helps out on using the Servo API from a Rust project.

Right now I have to explicitly declare all the crates contained in `components` to use them.

Unsure about re-exporting `euclid`, `url` and `layers`, but they are required to use the API and it helps out avoiding version-collisions if you happen to use the wrong version in your own project.

Source-Repo: https://github.com/servo/servo
Source-Revision: a4d5c8ce4ade329ec61b4d211c5bc7499d1df095
This commit is contained in:
meh 2015-08-31 19:45:20 -06:00
parent 7f352ddb9a
commit b4a671f320
4 changed files with 98 additions and 27 deletions

View File

@ -4,13 +4,18 @@ version = "0.0.1"
dependencies = [
"android_glue 0.0.2",
"bitflags 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"canvas 0.0.1",
"canvas_traits 0.0.1",
"compositing 0.0.1",
"devtools 0.0.1",
"devtools_traits 0.0.1",
"env_logger 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"gfx 0.0.1",
"gfx_tests 0.0.1",
"gleam 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
"glutin_app 0.0.1",
"layers 0.1.0 (git+https://github.com/servo/rust-layers)",
"layout 0.0.1",
"libc 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
"msg 0.0.1",
@ -22,6 +27,8 @@ dependencies = [
"profile_traits 0.0.1",
"script 0.0.1",
"script_tests 0.0.1",
"script_traits 0.0.1",
"style 0.0.1",
"style_tests 0.0.1",
"time 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)",
"url 0.2.37 (registry+https://github.com/rust-lang/crates.io-index)",

View File

@ -41,9 +41,10 @@ git = "https://github.com/servo/rust-png"
features = [ "serde-serialization" ]
[features]
default = ["glutin_app", "window"]
default = ["glutin_app", "window", "webdriver"]
window = ["glutin_app/window"]
headless = ["glutin_app/headless"]
webdriver = ["webdriver_server"]
# Uncomment to profile on Linux:
#
@ -77,17 +78,30 @@ path = "../util"
[dependencies.script]
path = "../script"
[dependencies.script_traits]
path = "../script_traits"
[dependencies.layout]
path = "../layout"
[dependencies.gfx]
path = "../gfx"
[dependencies.style]
path = "../style"
[dependencies.canvas]
path = "../canvas"
[dependencies.canvas_traits]
path = "../canvas_traits"
[dependencies.devtools]
path = "../devtools"
[dependencies.webdriver_server]
path = "../webdriver_server"
path = "../webdriver_server"
optional = true
[dependencies.devtools_traits]
path = "../devtools_traits"
@ -104,6 +118,15 @@ optional = true
version = "0.2"
features = [ "serde_serialization" ]
[dependencies.euclid]
version = "0.1"
[dependencies.layers]
git = "https://github.com/servo/rust-layers"
[dependencies.gleam]
version = "0.1"
[dependencies]
env_logger = "0.3"
time = "0.1.12"

View File

@ -17,22 +17,67 @@
// The `Browser` is fed events from a generic type that implements the
// `WindowMethods` trait.
extern crate compositing;
extern crate devtools;
extern crate devtools_traits;
extern crate net;
extern crate net_traits;
extern crate msg;
extern crate profile;
extern crate profile_traits;
#[macro_use]
extern crate util;
extern crate script;
extern crate layout;
extern crate gfx;
extern crate util as _util;
mod export {
extern crate compositing;
extern crate devtools;
extern crate devtools_traits;
extern crate net;
extern crate net_traits;
extern crate msg;
extern crate profile;
extern crate profile_traits;
extern crate script;
extern crate script_traits;
extern crate layout;
extern crate gfx;
extern crate style;
extern crate canvas;
extern crate canvas_traits;
extern crate euclid;
extern crate url;
extern crate layers;
extern crate gleam;
}
extern crate libc;
#[cfg(feature = "webdriver")]
extern crate webdriver_server;
#[cfg(feature = "webdriver")]
fn webdriver(port: u16, constellation: msg::constellation_msg::ConstellationChan) {
webdriver_server::start_server(port, constellation.clone());
}
#[cfg(not(feature = "webdriver"))]
fn webdriver(_port: u16, _constellation: msg::constellation_msg::ConstellationChan) { }
pub use _util as util;
pub use export::compositing;
pub use export::devtools;
pub use export::devtools_traits;
pub use export::net;
pub use export::net_traits;
pub use export::msg;
pub use export::profile;
pub use export::profile_traits;
pub use export::script;
pub use export::script_traits;
pub use export::layout;
pub use export::gfx;
pub use export::style;
pub use export::canvas;
pub use export::canvas_traits;
pub use export::euclid;
pub use export::url;
pub use export::layers;
pub use export::gleam::gl;
use compositing::CompositorEventListener;
use compositing::windowing::WindowEvent;
@ -110,9 +155,11 @@ impl Browser {
devtools_chan,
supports_clipboard);
if let Some(port) = opts.webdriver_port {
webdriver_server::start_server(port, constellation_chan.clone());
};
if cfg!(feature = "webdriver") {
if let Some(port) = opts.webdriver_port {
webdriver(port, constellation_chan.clone());
}
}
// The compositor coordinates with the client window to create the final
// rendered page and display it somewhere.

View File

@ -19,13 +19,7 @@
// The Servo engine
extern crate servo;
// Window graphics compositing and message dispatch
extern crate compositing;
// Servo networking
extern crate net;
extern crate net_traits;
// Servo common utilitiess
extern crate util;
// The window backed by glutin
extern crate glutin_app as app;
extern crate time;
@ -35,11 +29,11 @@ extern crate env_logger;
#[macro_use]
extern crate android_glue;
use compositing::windowing::WindowEvent;
use net_traits::hosts;
use servo::Browser;
use servo::compositing::windowing::WindowEvent;
use servo::net_traits::hosts;
use servo::util::opts;
use std::rc::Rc;
use util::opts;
#[cfg(target_os="android")]
use std::borrow::ToOwned;