Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

parse-datetime: removed generate_constants logic from build.rs #1376

Merged
merged 1 commit into from
Mar 11, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 3 additions & 16 deletions sources/parse-datetime/build.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// Automatically generate README.md from rustdoc.

use std::env;
use std::fs::{self, File};
use std::fs::File;
use std::io::Write;
use std::path::{Path, PathBuf};
use std::path::PathBuf;

fn generate_readme() {
fn main() {
// Check for environment variable "SKIP_README". If it is set,
// skip README generation
if env::var_os("SKIP_README").is_some() {
Expand All @@ -30,16 +30,3 @@ fn generate_readme() {
let mut readme = File::create("README.md").unwrap();
readme.write_all(content.as_bytes()).unwrap();
}

fn generate_constants() {
let out_dir = env::var("OUT_DIR").unwrap();
let arch = env::var("CARGO_CFG_TARGET_ARCH").unwrap();
let contents = format!("const ARCH: &str = \"{}\";", arch);
let path = Path::new(&out_dir).join("constants.rs");
fs::write(path, contents).unwrap();
}

fn main() {
generate_readme();
generate_constants();
}