2020-01-02 15:13:47 -05:00
|
|
|
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
|
2019-09-02 17:07:11 -04:00
|
|
|
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-10-04 20:28:51 -04:00
|
|
|
let root_names = vec![c.join("js/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-10-04 20:28:51 -04:00
|
|
|
let root_names = vec![c.join("js/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();
|
|
|
|
}
|