9be56aa622
This PR straightly port over swc's target triple metadata (https://github.com/swc-project/swc/pull/4058) into next-swc, mainly for the tracking purpose of usages. ## Bug - [ ] Related issues linked using `fixes #number` - [ ] Integration tests added - [ ] Errors have helpful link attached, see `contributing.md` ## Feature - [x] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR. - [ ] Related issues linked using `fixes #number` - [ ] Integration tests added - [ ] Documentation added - [ ] Telemetry added. In case of a feature if it's used or not. - [ ] Errors have helpful link attached, see `contributing.md` ## Documentation / Examples - [ ] Make sure the linting passes by running `yarn lint`
23 lines
547 B
Rust
23 lines
547 B
Rust
use std::{
|
|
env,
|
|
fs::File,
|
|
io::{BufWriter, Write},
|
|
path::Path,
|
|
};
|
|
|
|
extern crate napi_build;
|
|
|
|
fn main() {
|
|
let out_dir = env::var("OUT_DIR").expect("Outdir should exist");
|
|
let dest_path = Path::new(&out_dir).join("triple.txt");
|
|
let mut f =
|
|
BufWriter::new(File::create(&dest_path).expect("Failed to create target triple text"));
|
|
write!(
|
|
f,
|
|
"{}",
|
|
env::var("TARGET").expect("Target should be specified")
|
|
)
|
|
.expect("Failed to write target triple text");
|
|
|
|
napi_build::setup();
|
|
}
|