Bug 1567333 - Remove the ability to build Gecko without the bindgen feature. r=heycam

This is not used for anything, as far as I can tell.

Differential Revision: https://phabricator.services.mozilla.com/D38584

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Emilio Cobos Álvarez 2019-07-18 23:39:14 +00:00
parent 7d5fb9e021
commit 2c808051d3
9 changed files with 371 additions and 432 deletions

View File

@ -16,8 +16,7 @@ path = "lib.rs"
doctest = false
[features]
gecko = ["nsstring", "style_traits/gecko", "fallible/known_system_malloc"]
use_bindgen = ["bindgen", "regex", "toml"]
gecko = ["nsstring", "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"]

View File

@ -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;

View File

@ -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();
}

View File

@ -9,7 +9,6 @@ name = "geckoservo"
path = "lib.rs"
[features]
bindgen = ["style/use_bindgen"]
gecko_debug = ["style/gecko_debug", "nsstring/gecko_debug"]
gecko_profiler = ["style/gecko_profiler"]
gecko_refcount_logging = ["style/gecko_refcount_logging", "servo_arc/gecko_refcount_logging"]

View File

@ -6,8 +6,6 @@ license = "MPL-2.0"
description = "Testing code for libgkrust"
[features]
bindgen = ["gkrust-shared/bindgen"]
servo = ["gkrust-shared/servo"]
quantum_render = ["gkrust-shared/quantum_render"]
cubeb-remoting = ["gkrust-shared/cubeb-remoting"]
cubeb_coreaudio_rust = ["gkrust-shared/cubeb_coreaudio_rust"]

View File

@ -6,8 +6,6 @@ license = "MPL-2.0"
description = "Rust code for libxul"
[features]
bindgen = ["gkrust-shared/bindgen"]
servo = ["gkrust-shared/servo"]
quantum_render = ["gkrust-shared/quantum_render"]
webrender_debugger = ["gkrust-shared/webrender_debugger"]
cubeb-remoting = ["gkrust-shared/cubeb-remoting"]

View File

@ -4,7 +4,7 @@
# 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/.
gkrust_features = ['servo', 'bindgen']
gkrust_features = []
if CONFIG['MOZ_DEBUG']:
gkrust_features += [

View File

@ -6,7 +6,7 @@ license = "MPL-2.0"
description = "Shared Rust code for libxul"
[dependencies]
geckoservo = { path = "../../../../servo/ports/geckolib", optional = true }
geckoservo = { path = "../../../../servo/ports/geckolib" }
kvstore = { path = "../../../components/kvstore" }
lmdb-rkv-sys = { version = "0.8.4", features = ["mdb_idl_logn_9"] }
mp4parse_capi = { path = "../../../../media/mp4parse-rust/mp4parse_capi" }
@ -47,8 +47,6 @@ rustc_version = "0.2"
[features]
default = []
bindgen = ["geckoservo/bindgen"]
servo = ["geckoservo"]
quantum_render = ["webrender_bindings"]
webrender_debugger = ["webrender_bindings/webrender_debugger"]
cubeb-remoting = ["cubeb-sys", "audioipc-client", "audioipc-server"]

View File

@ -4,7 +4,6 @@
#![cfg_attr(feature = "oom_with_hook", feature(alloc_error_hook))]
#[cfg(feature="servo")]
extern crate geckoservo;
extern crate kvstore;