mirror of
https://github.com/servo/servo.git
synced 2025-08-04 21:20:23 +01:00
style: Remove the ability to build Gecko without the bindgen feature.
This is not used for anything, as far as I can tell. Differential Revision: https://phabricator.services.mozilla.com/D38584
This commit is contained in:
parent
137044a3db
commit
66eae2fc81
3 changed files with 369 additions and 422 deletions
|
@ -16,8 +16,7 @@ path = "lib.rs"
|
||||||
doctest = false
|
doctest = false
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
gecko = ["style_traits/gecko", "fallible/known_system_malloc"]
|
gecko = ["style_traits/gecko", "fallible/known_system_malloc", "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", "crossbeam-channel", "to_shmem/servo", "servo_arc/servo"]
|
"servo_url", "string_cache", "crossbeam-channel", "to_shmem/servo", "servo_arc/servo"]
|
||||||
|
|
|
@ -4,13 +4,13 @@
|
||||||
|
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate lazy_static;
|
extern crate lazy_static;
|
||||||
#[cfg(feature = "bindgen")]
|
#[cfg(feature = "gecko")]
|
||||||
extern crate bindgen;
|
extern crate bindgen;
|
||||||
#[cfg(feature = "bindgen")]
|
#[cfg(feature = "gecko")]
|
||||||
extern crate log;
|
extern crate log;
|
||||||
#[cfg(feature = "bindgen")]
|
#[cfg(feature = "gecko")]
|
||||||
extern crate regex;
|
extern crate regex;
|
||||||
#[cfg(feature = "bindgen")]
|
#[cfg(feature = "gecko")]
|
||||||
extern crate toml;
|
extern crate toml;
|
||||||
extern crate walkdir;
|
extern crate walkdir;
|
||||||
|
|
||||||
|
|
|
@ -2,20 +2,7 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* 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/. */
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
mod common {
|
use super::PYTHON;
|
||||||
use std::env;
|
|
||||||
use std::path::PathBuf;
|
|
||||||
|
|
||||||
lazy_static! {
|
|
||||||
pub static ref OUTDIR_PATH: PathBuf =
|
|
||||||
PathBuf::from(env::var_os("OUT_DIR").unwrap()).join("gecko");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(feature = "bindgen")]
|
|
||||||
mod bindings {
|
|
||||||
use super::super::PYTHON;
|
|
||||||
use super::common::*;
|
|
||||||
use bindgen::{Builder, CodegenConfig};
|
use bindgen::{Builder, CodegenConfig};
|
||||||
use regex::Regex;
|
use regex::Regex;
|
||||||
use std::cmp;
|
use std::cmp;
|
||||||
|
@ -31,6 +18,10 @@ mod bindings {
|
||||||
use toml;
|
use toml;
|
||||||
use toml::value::Table;
|
use toml::value::Table;
|
||||||
|
|
||||||
|
lazy_static! {
|
||||||
|
static ref OUTDIR_PATH: PathBuf = PathBuf::from(env::var_os("OUT_DIR").unwrap()).join("gecko");
|
||||||
|
}
|
||||||
|
|
||||||
const STRUCTS_FILE: &'static str = "structs.rs";
|
const STRUCTS_FILE: &'static str = "structs.rs";
|
||||||
|
|
||||||
fn read_config(path: &PathBuf) -> Table {
|
fn read_config(path: &PathBuf) -> Table {
|
||||||
|
@ -294,9 +285,7 @@ mod bindings {
|
||||||
fn generate_structs() {
|
fn generate_structs() {
|
||||||
let builder = Builder::get_initial_builder()
|
let builder = Builder::get_initial_builder()
|
||||||
.enable_cxx_namespaces()
|
.enable_cxx_namespaces()
|
||||||
.with_codegen_config(
|
.with_codegen_config(CodegenConfig::TYPES | CodegenConfig::VARS | CodegenConfig::FUNCTIONS);
|
||||||
CodegenConfig::TYPES | CodegenConfig::VARS | CodegenConfig::FUNCTIONS,
|
|
||||||
);
|
|
||||||
let mut fixups = vec![];
|
let mut fixups = vec![];
|
||||||
let builder = BuilderWithConfig::new(builder, CONFIG["structs"].as_table().unwrap())
|
let builder = BuilderWithConfig::new(builder, CONFIG["structs"].as_table().unwrap())
|
||||||
.handle_common(&mut fixups)
|
.handle_common(&mut fixups)
|
||||||
|
@ -406,6 +395,8 @@ mod bindings {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn generate() {
|
pub fn generate() {
|
||||||
|
println!("cargo:rerun-if-changed=build_gecko.rs");
|
||||||
|
fs::create_dir_all(&*OUTDIR_PATH).unwrap();
|
||||||
setup_logging();
|
setup_logging();
|
||||||
generate_structs();
|
generate_structs();
|
||||||
generate_atoms();
|
generate_atoms();
|
||||||
|
@ -414,46 +405,3 @@ mod bindings {
|
||||||
println!("cargo:rerun-if-changed={}", path.to_str().unwrap());
|
println!("cargo:rerun-if-changed={}", path.to_str().unwrap());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(not(feature = "bindgen"))]
|
|
||||||
mod bindings {
|
|
||||||
use super::common::*;
|
|
||||||
use std::path::{Path, PathBuf};
|
|
||||||
use std::{env, fs, io};
|
|
||||||
|
|
||||||
/// Copy contents of one directory into another.
|
|
||||||
/// It currently only does a shallow copy.
|
|
||||||
fn copy_dir<P, Q, F>(from: P, to: Q, callback: F) -> io::Result<()>
|
|
||||||
where
|
|
||||||
P: AsRef<Path>,
|
|
||||||
Q: AsRef<Path>,
|
|
||||||
F: Fn(&Path),
|
|
||||||
{
|
|
||||||
let to = to.as_ref();
|
|
||||||
for entry in from.as_ref().read_dir()? {
|
|
||||||
let entry = entry?;
|
|
||||||
let path = entry.path();
|
|
||||||
callback(&path);
|
|
||||||
fs::copy(&path, to.join(entry.file_name()))?;
|
|
||||||
}
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn generate() {
|
|
||||||
let dir = PathBuf::from(env::var_os("CARGO_MANIFEST_DIR").unwrap()).join("gecko/generated");
|
|
||||||
println!("cargo:rerun-if-changed={}", dir.display());
|
|
||||||
copy_dir(&dir, &*OUTDIR_PATH, |path| {
|
|
||||||
println!("cargo:rerun-if-changed={}", path.display());
|
|
||||||
})
|
|
||||||
.expect("Fail to copy generated files to out dir");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn generate() {
|
|
||||||
use self::common::*;
|
|
||||||
use std::fs;
|
|
||||||
println!("cargo:rerun-if-changed=build_gecko.rs");
|
|
||||||
fs::create_dir_all(&*OUTDIR_PATH).unwrap();
|
|
||||||
bindings::generate();
|
|
||||||
}
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue