Skip to content

Commit

Permalink
Don’t rely on $CARGO_TARGET_DIR in build scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonSapin committed Sep 30, 2019
1 parent 5c60023 commit d2c299a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
2 changes: 0 additions & 2 deletions components/script/build.rs
Expand Up @@ -17,13 +17,11 @@ fn main() {


let style_out_dir = PathBuf::from(env::var_os("DEP_SERVO_STYLE_CRATE_OUT_DIR").unwrap()); let style_out_dir = PathBuf::from(env::var_os("DEP_SERVO_STYLE_CRATE_OUT_DIR").unwrap());
let out_dir = PathBuf::from(env::var_os("OUT_DIR").unwrap()); let out_dir = PathBuf::from(env::var_os("OUT_DIR").unwrap());
let target_dir = PathBuf::from(env::var_os("CARGO_TARGET_DIR").unwrap());


let status = Command::new(find_python()) let status = Command::new(find_python())
.arg("dom/bindings/codegen/run.py") .arg("dom/bindings/codegen/run.py")
.arg(style_out_dir.join("css-properties.json")) .arg(style_out_dir.join("css-properties.json"))
.arg(&out_dir) .arg(&out_dir)
.arg(target_dir.join("doc").join("servo"))
.status() .status()
.unwrap(); .unwrap();
if !status.success() { if !status.success() {
Expand Down
10 changes: 5 additions & 5 deletions components/script/dom/bindings/codegen/run.py
Expand Up @@ -11,15 +11,16 @@ def main():
os.chdir(os.path.join(os.path.dirname(__file__))) os.chdir(os.path.join(os.path.dirname(__file__)))
sys.path[0:0] = ["./parser", "./ply"] sys.path[0:0] = ["./parser", "./ply"]


css_properties_json, out_dir, doc_servo = sys.argv[1:] css_properties_json, out_dir = sys.argv[1:]
doc_servo = "../../../../../target/doc/servo"
webidls_dir = "../../webidls" webidls_dir = "../../webidls"
config_file = "Bindings.conf" config_file = "Bindings.conf"


import WebIDL import WebIDL
from Configuration import Configuration from Configuration import Configuration
from CodegenRust import CGBindingRoot from CodegenRust import CGBindingRoot


parser = WebIDL.Parser(make_dir(out_dir, "cache")) parser = WebIDL.Parser(make_dir(os.path.join(out_dir, "cache")))
webidls = [name for name in os.listdir(webidls_dir) if name.endswith(".webidl")] webidls = [name for name in os.listdir(webidls_dir) if name.endswith(".webidl")]
for webidl in webidls: for webidl in webidls:
filename = os.path.join(webidls_dir, webidl) filename = os.path.join(webidls_dir, webidl)
Expand All @@ -29,7 +30,7 @@ def main():
add_css_properties_attributes(css_properties_json, parser) add_css_properties_attributes(css_properties_json, parser)
parser_results = parser.finish() parser_results = parser.finish()
config = Configuration(config_file, parser_results) config = Configuration(config_file, parser_results)
make_dir(out_dir, "Bindings") make_dir(os.path.join(out_dir, "Bindings"))


for name, filename in [ for name, filename in [
("PrototypeList", "PrototypeList.rs"), ("PrototypeList", "PrototypeList.rs"),
Expand All @@ -54,8 +55,7 @@ def main():
f.write(module) f.write(module)




def make_dir(out_dir, nested=""): def make_dir(path):
path = os.path.join(out_dir, nested)
if not os.path.exists(path): if not os.path.exists(path):
os.makedirs(path) os.makedirs(path)
return path return path
Expand Down

0 comments on commit d2c299a

Please sign in to comment.