xref: /aosp_15_r20/external/bazelbuild-rules_rust/examples/env_locations/build.rs (revision d4726bddaa87cc4778e7472feed243fa4b6c267f)
1 use std::{env, fs};
2 
main()3 fn main() {
4     // our source file should be readable
5     let path = env::var("SOURCE_FILE").unwrap();
6     let generated_data = fs::read_to_string(&path).unwrap();
7     assert_eq!(generated_data, "source\n");
8 
9     // our generated data file should be readable
10     let path = env::var("GENERATED_DATA").unwrap();
11     let generated_data = fs::read_to_string(&path).unwrap();
12     assert_eq!(generated_data, "hello\n");
13 
14     // and we should be able to read (and thus execute) our tool
15     let path = env::var("SOME_TOOL").unwrap();
16     assert!(!fs::read(&path).unwrap().is_empty());
17 }
18