Add default.toml and modify the build system for it

This commit is contained in:
Nick Cameron 2015-05-23 15:28:41 +12:00
parent 910ca80710
commit aa6f7e8d3c
4 changed files with 46 additions and 0 deletions

14
Cargo.lock generated
View file

@ -4,6 +4,7 @@ version = "0.0.1"
dependencies = [
"diff 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"strings 0.0.1 (git+https://github.com/nrc/strings.rs.git)",
"toml 0.1.20 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@ -11,8 +12,21 @@ name = "diff"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "rustc-serialize"
version = "0.3.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "strings"
version = "0.0.1"
source = "git+https://github.com/nrc/strings.rs.git#551331d01911b7e8da056a4a019eb367cfaf03bd"
[[package]]
name = "toml"
version = "0.1.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"rustc-serialize 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)",
]

View file

@ -7,6 +7,7 @@ description = "Tool to find and fix Rust formatting issues"
repository = "https://github.com/nick29581/rustfmt"
readme = "README.md"
license = "Apache-2.0/MIT"
build = "build.rs"
[dependencies.strings]
strings = "0.0.1"
@ -14,3 +15,4 @@ git = "https://github.com/nrc/strings.rs.git"
[dev-dependencies]
diff = "0.1.0"
toml = "0.1.20"

28
build.rs Normal file
View file

@ -0,0 +1,28 @@
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// Build script. Just copies default.toml from the src to the target dir.
use std::env;
use std::path::{Path, PathBuf};
fn main() {
let in_file = Path::new("src/default.toml");
let manifest_dir = env::var("CARGO_MANIFEST_DIR").unwrap();
let profile = env::var("PROFILE").unwrap();
let mut out_file = PathBuf::new();
out_file.push(manifest_dir);
out_file.push("target");
out_file.push(profile);
out_file.push("default.toml");
std::fs::copy(in_file, out_file).unwrap();
}

2
src/default.toml Normal file
View file

@ -0,0 +1,2 @@
max-width = 100
ideal-width = 80