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
|
||||
|
||||
[features]
|
||||
gecko = ["style_traits/gecko", "fallible/known_system_malloc"]
|
||||
use_bindgen = ["bindgen", "regex", "toml"]
|
||||
gecko = ["style_traits/gecko", "fallible/known_system_malloc", "bindgen", "regex", "toml"]
|
||||
servo = ["serde", "style_traits/servo", "servo_atoms", "servo_config", "html5ever",
|
||||
"cssparser/serde", "encoding_rs", "malloc_size_of/servo", "arrayvec/use_union",
|
||||
"servo_url", "string_cache", "crossbeam-channel", "to_shmem/servo", "servo_arc/servo"]
|
||||
|
|
|
@ -4,13 +4,13 @@
|
|||
|
||||
#[macro_use]
|
||||
extern crate lazy_static;
|
||||
#[cfg(feature = "bindgen")]
|
||||
#[cfg(feature = "gecko")]
|
||||
extern crate bindgen;
|
||||
#[cfg(feature = "bindgen")]
|
||||
#[cfg(feature = "gecko")]
|
||||
extern crate log;
|
||||
#[cfg(feature = "bindgen")]
|
||||
#[cfg(feature = "gecko")]
|
||||
extern crate regex;
|
||||
#[cfg(feature = "bindgen")]
|
||||
#[cfg(feature = "gecko")]
|
||||
extern crate toml;
|
||||
extern crate walkdir;
|
||||
|
||||
|
|
|
@ -2,20 +2,7 @@
|
|||
* 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/. */
|
||||
|
||||
mod common {
|
||||
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 super::PYTHON;
|
||||
use bindgen::{Builder, CodegenConfig};
|
||||
use regex::Regex;
|
||||
use std::cmp;
|
||||
|
@ -31,6 +18,10 @@ mod bindings {
|
|||
use toml;
|
||||
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";
|
||||
|
||||
fn read_config(path: &PathBuf) -> Table {
|
||||
|
@ -294,9 +285,7 @@ mod bindings {
|
|||
fn generate_structs() {
|
||||
let builder = Builder::get_initial_builder()
|
||||
.enable_cxx_namespaces()
|
||||
.with_codegen_config(
|
||||
CodegenConfig::TYPES | CodegenConfig::VARS | CodegenConfig::FUNCTIONS,
|
||||
);
|
||||
.with_codegen_config(CodegenConfig::TYPES | CodegenConfig::VARS | CodegenConfig::FUNCTIONS);
|
||||
let mut fixups = vec![];
|
||||
let builder = BuilderWithConfig::new(builder, CONFIG["structs"].as_table().unwrap())
|
||||
.handle_common(&mut fixups)
|
||||
|
@ -406,6 +395,8 @@ mod bindings {
|
|||
}
|
||||
|
||||
pub fn generate() {
|
||||
println!("cargo:rerun-if-changed=build_gecko.rs");
|
||||
fs::create_dir_all(&*OUTDIR_PATH).unwrap();
|
||||
setup_logging();
|
||||
generate_structs();
|
||||
generate_atoms();
|
||||
|
@ -414,46 +405,3 @@ mod bindings {
|
|||
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