Skip to content

Commit c69ca7a

Browse files
Merge #1216
1216: Improve build times by caching `cargo install` artifacts for diesel, clippy, and rustfmt r=carols10cents The primary change is to set `CARGO_TARGET_DIR=target` which instructs `cargo install` to use the target/ directory which is cached between builds on travis. This is only available on recent nightlies so I've bumped clippy and rustfmt versions. Unfortunately, `ring v0.11.0` does not compile on recent nightlies and upstream provides no support for older versions. Therefore I've added a patch section to use a git repo that incorporates the fix and a few other cleanups. This issue would have broken the build soon anyway when rust 1.24 goes into beta. A few other changes: * only `npm install` on the stable job * removed travis-cargo which appears to be unused * removed rustfmt configuration options that were removed upstream
2 parents b4d49ac + c8cd197 commit c69ca7a

31 files changed

+144
-192
lines changed

.rustfmt.toml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,4 @@
1-
fn_args_layout = "Block"
2-
array_layout = "Block"
3-
control_style = "Rfc"
4-
where_style = "Rfc"
5-
generics_indent = "Block"
6-
fn_call_style = "Block"
71
combine_control_expr = true
8-
fn_args_paren_newline = false
92
max_width = 100
103
error_on_line_overflow = false
114
write_mode = "Overwrite"

.travis.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,7 @@ before_install:
2121
- nvm install 8
2222

2323
install:
24-
- pip install 'travis-cargo<0.2' --user && export PATH=$HOME/.local/bin:$PATH
25-
- npm install
26-
- cargo install --force diesel_cli --vers 0.16.0 --debug --no-default-features --features postgres && export PATH=$HOME/.cargo/bin:$PATH
24+
- cargo install --force diesel_cli --vers 1.0.0 --no-default-features --features postgres && export PATH=$HOME/.cargo/bin:$PATH
2725

2826
before_script:
2927
- diesel database setup
@@ -44,16 +42,17 @@ matrix:
4442
allow_failures:
4543
- rust: nightly
4644
include:
47-
- rust: nightly-2017-11-07
45+
- rust: nightly-2017-12-28
4846
script:
49-
- cargo install --force rustfmt-nightly --vers 0.2.15
50-
- cargo install --force clippy --vers 0.0.169
47+
- cargo install --force rustfmt-nightly --vers 0.3.4
5148
- cargo fmt -- --write-mode=diff
49+
- cargo install --force clippy --vers 0.0.177
5250
- cargo clippy
5351
- rust: stable
5452
script:
5553
- cargo build
5654
- cargo test
55+
- npm install
5756
- npm test
5857
- rust: beta
5958
script:
@@ -68,6 +67,7 @@ env:
6867
global:
6968
- DATABASE_URL=postgres://postgres:@localhost/cargo_registry_test
7069
- TEST_DATABASE_URL=postgres://postgres:@localhost/cargo_registry_test
70+
- CARGO_TARGET_DIR=target
7171

7272
notifications:
7373
email:

Cargo.lock

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,3 +84,7 @@ tokio-service = "0.1"
8484
dotenv = "0.10"
8585
diesel = { version = "1.0.0-beta1", features = ["postgres"] }
8686
diesel_migrations = { version = "1.0.0-beta1", features = ["postgres"] }
87+
88+
# Remove once cookie depends on ring >= 0.13.0
89+
[patch.crates-io]
90+
ring = { git = "https://github.com/SergioBenitez/ring", branch = "v0.11" }

src/badge.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,12 @@ pub enum Badge {
2929
repository: String,
3030
branch: Option<String>,
3131
},
32-
IsItMaintainedIssueResolution { repository: String },
33-
IsItMaintainedOpenIssues { repository: String },
32+
IsItMaintainedIssueResolution {
33+
repository: String,
34+
},
35+
IsItMaintainedOpenIssues {
36+
repository: String,
37+
},
3438
Codecov {
3539
repository: String,
3640
branch: Option<String>,
@@ -41,7 +45,9 @@ pub enum Badge {
4145
branch: Option<String>,
4246
service: Option<String>,
4347
},
44-
Maintenance { status: MaintenanceStatus },
48+
Maintenance {
49+
status: MaintenanceStatus,
50+
},
4551
}
4652

4753
#[derive(Debug, PartialEq, Clone, Copy, Deserialize, Serialize)]

src/bin/delete-crate.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,7 @@ fn delete(conn: &PgConnection) {
3939
let krate = Crate::by_name(&name).first::<Crate>(conn).unwrap();
4040
print!(
4141
"Are you sure you want to delete {} ({}) [y/N]: ",
42-
name,
43-
krate.id
42+
name, krate.id
4443
);
4544
io::stdout().flush().unwrap();
4645
let mut line = String::new();

src/bin/delete-version.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,7 @@ fn delete(conn: &PgConnection) {
5050
.unwrap();
5151
print!(
5252
"Are you sure you want to delete {}#{} ({}) [y/N]: ",
53-
name,
54-
version,
55-
v.id
53+
name, version, v.id
5654
);
5755
io::stdout().flush().unwrap();
5856
let mut line = String::new();

src/bin/render-readmes.rs

Lines changed: 10 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,7 @@ fn main() {
132132
let config = config.clone();
133133
version.record_readme_rendering(&conn).expect(&format!(
134134
"[{}-{}] Couldn't record rendering time",
135-
krate_name,
136-
version.num
135+
krate_name, version.num
137136
));
138137
let handle = thread::spawn(move || {
139138
println!("[{}-{}] Rendering README...", krate_name, version.num);
@@ -155,8 +154,7 @@ fn main() {
155154
)
156155
.expect(&format!(
157156
"[{}-{}] Couldn't upload file to S3",
158-
krate_name,
159-
version.num
157+
krate_name, version.num
160158
));
161159
});
162160
tasks.push(handle);
@@ -182,8 +180,7 @@ fn get_readme(config: &Config, version: &Version, krate_name: &str) -> Option<St
182180
let date = Utc::now().to_rfc2822();
183181
let url = Url::parse(&location).expect(&format!(
184182
"[{}-{}] Couldn't parse crate URL",
185-
krate_name,
186-
version.num
183+
krate_name, version.num
187184
));
188185

189186
let mut headers = List::new();
@@ -206,9 +203,7 @@ fn get_readme(config: &Config, version: &Version, krate_name: &str) -> Option<St
206203
if let Err(err) = req.perform() {
207204
println!(
208205
"[{}-{}] Unable to fetch crate: {}",
209-
krate_name,
210-
version.num,
211-
err
206+
krate_name, version.num, err
212207
);
213208
return None;
214209
}
@@ -217,31 +212,26 @@ fn get_readme(config: &Config, version: &Version, krate_name: &str) -> Option<St
217212
let response = String::from_utf8_lossy(&response);
218213
println!(
219214
"[{}-{}] Failed to get a 200 response: {}",
220-
krate_name,
221-
version.num,
222-
response
215+
krate_name, version.num, response
223216
);
224217
return None;
225218
}
226219
let reader = Cursor::new(response);
227220
let reader = GzDecoder::new(reader).expect(&format!(
228221
"[{}-{}] Invalid gzip header",
229-
krate_name,
230-
version.num
222+
krate_name, version.num
231223
));
232224
let mut archive = Archive::new(reader);
233225
let mut entries = archive.entries().expect(&format!(
234226
"[{}-{}] Invalid tar archive entries",
235-
krate_name,
236-
version.num
227+
krate_name, version.num
237228
));
238229
let manifest: Manifest = {
239230
let path = format!("{}-{}/Cargo.toml", krate_name, version.num);
240231
let contents = find_file_by_path(&mut entries, Path::new(&path), version, krate_name);
241232
toml::from_str(&contents).expect(&format!(
242233
"[{}-{}] Syntax error in manifest file",
243-
krate_name,
244-
version.num
234+
krate_name, version.num
245235
))
246236
};
247237
if manifest.package.readme.is_none() {
@@ -265,8 +255,7 @@ fn get_readme(config: &Config, version: &Version, krate_name: &str) -> Option<St
265255
manifest.package.repository.as_ref().map(|e| &**e),
266256
).expect(&format!(
267257
"[{}-{}] Couldn't render README",
268-
krate_name,
269-
version.num
258+
krate_name, version.num
270259
))
271260
};
272261
return Some(rendered);
@@ -315,8 +304,7 @@ fn find_file_by_path<R: Read>(
315304
let mut contents = String::new();
316305
file.read_to_string(&mut contents).expect(&format!(
317306
"[{}-{}] Couldn't read file contents",
318-
krate_name,
319-
version.num
307+
krate_name, version.num
320308
));
321309
contents
322310
}

src/bin/transfer-crates.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,7 @@ fn transfer(conn: &PgConnection) {
6464

6565
println!(
6666
"Are you sure you want to transfer crates from {} to {}",
67-
from.gh_login,
68-
to.gh_login
67+
from.gh_login, to.gh_login
6968
);
7069
get_confirm("continue");
7170

src/boot/categories.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,9 @@ fn categories_from_toml(
5757
let mut result = vec![];
5858

5959
for (slug, details) in categories {
60-
let details = details.as_table().chain_error(|| {
61-
internal(&format_args!("category {} was not a TOML table", slug))
62-
})?;
60+
let details = details
61+
.as_table()
62+
.chain_error(|| internal(&format_args!("category {} was not a TOML table", slug)))?;
6363

6464
let category = Category::from_parent(
6565
slug,

0 commit comments

Comments
 (0)