2019-09-02 17:07:11 -04:00
|
|
|
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
|
|
|
|
use std::env;
|
|
|
|
use std::path::PathBuf;
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
// To debug snapshot issues uncomment:
|
|
|
|
// deno_typescript::trace_serializer();
|
|
|
|
|
2019-09-15 18:36:27 -04:00
|
|
|
println!(
|
|
|
|
"cargo:rustc-env=TS_VERSION={}",
|
|
|
|
deno_typescript::ts_version()
|
|
|
|
);
|
|
|
|
|
2019-09-02 17:07:11 -04:00
|
|
|
let c = PathBuf::from(env::var_os("CARGO_MANIFEST_DIR").unwrap());
|
|
|
|
let o = PathBuf::from(env::var_os("OUT_DIR").unwrap());
|
|
|
|
|
2019-09-15 18:36:27 -04:00
|
|
|
let root_names = vec![c.join("main.ts")];
|
2019-09-02 17:07:11 -04:00
|
|
|
let bundle = o.join("CLI_SNAPSHOT.js");
|
|
|
|
let state = deno_typescript::compile_bundle(&bundle, root_names).unwrap();
|
|
|
|
assert!(bundle.exists());
|
|
|
|
deno_typescript::mksnapshot_bundle(&bundle, state).unwrap();
|
|
|
|
|
2019-09-15 18:36:27 -04:00
|
|
|
let root_names = vec![c.join("compiler.ts")];
|
2019-09-02 17:07:11 -04:00
|
|
|
let bundle = o.join("COMPILER_SNAPSHOT.js");
|
|
|
|
let state = deno_typescript::compile_bundle(&bundle, root_names).unwrap();
|
|
|
|
assert!(bundle.exists());
|
|
|
|
deno_typescript::mksnapshot_bundle_ts(&bundle, state).unwrap();
|
|
|
|
}
|