Skip to content

Commit 7757260

Browse files
committed
Add exceptions to tidy
We've decided that these deps are okay.
1 parent 626cf3a commit 7757260

File tree

2 files changed

+42
-9
lines changed

2 files changed

+42
-9
lines changed

src/tools/rustbook/src/main.rs

+18-7
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
//
111
extern crate mdbook;
212
#[macro_use]
313
extern crate clap;
@@ -11,19 +21,21 @@ use clap::{App, ArgMatches, SubCommand, AppSettings};
1121

1222
use mdbook::MDBook;
1323

14-
const NAME: &'static str = "rustbook";
15-
1624
fn main() {
17-
// Create a list of valid arguments and sub-commands
18-
let matches = App::new(NAME)
25+
let d_message = "-d, --dest-dir=[dest-dir]
26+
'The output directory for your book{n}(Defaults to ./book when omitted)'";
27+
let dir_message = "[dir]
28+
'A directory for your book{n}(Defaults to Current Directory when omitted)'";
29+
30+
let matches = App::new("rustbook")
1931
.about("Build a book with mdBook")
2032
.author("Steve Klabnik <[email protected]>")
2133
.version(&*format!("v{}", crate_version!()))
2234
.setting(AppSettings::SubcommandRequired)
2335
.subcommand(SubCommand::with_name("build")
2436
.about("Build the book from the markdown files")
25-
.arg_from_usage("-d, --dest-dir=[dest-dir] 'The output directory for your book{n}(Defaults to ./book when omitted)'")
26-
.arg_from_usage("[dir] 'A directory for your book{n}(Defaults to Current Directory when omitted)'"))
37+
.arg_from_usage(d_message)
38+
.arg_from_usage(dir_message))
2739
.get_matches();
2840

2941
// Check which subcomamnd the user ran...
@@ -76,4 +88,3 @@ fn get_book_dir(args: &ArgMatches) -> PathBuf {
7688
env::current_dir().unwrap()
7789
}
7890
}
79-

src/tools/tidy/src/deps.rs

+24-2
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,38 @@ use std::io::Read;
1515
use std::path::Path;
1616

1717
static LICENSES: &'static [&'static str] = &[
18-
"MIT/Apache-2.0"
18+
"MIT/Apache-2.0",
19+
"Apache-2.0/MIT",
20+
"MIT OR Apache-2.0",
21+
"MIT",
22+
"Unlicense/MIT",
23+
];
24+
25+
/// These MPL licensed projects are acceptable, but only these.
26+
static EXCEPTIONS: &'static [&'static str] = &[
27+
"mdbook",
28+
"pest",
29+
"thread-id",
1930
];
2031

2132
pub fn check(path: &Path, bad: &mut bool) {
2233
let path = path.join("vendor");
2334
assert!(path.exists(), "vendor directory missing");
2435
let mut saw_dir = false;
25-
for dir in t!(path.read_dir()) {
36+
'next_path: for dir in t!(path.read_dir()) {
2637
saw_dir = true;
2738
let dir = t!(dir);
39+
40+
// skip our exceptions
41+
for exception in EXCEPTIONS {
42+
if dir.path()
43+
.to_str()
44+
.unwrap()
45+
.contains(&format!("src/vendor/{}", exception)) {
46+
continue 'next_path;
47+
}
48+
}
49+
2850
let toml = dir.path().join("Cargo.toml");
2951
if !check_license(&toml) {
3052
*bad = true;

0 commit comments

Comments
 (0)