Skip to content

Commit 7ea2d48

Browse files
authored
Merge branch 'master' into master
2 parents a52a019 + 3950442 commit 7ea2d48

File tree

3 files changed

+40
-13
lines changed

3 files changed

+40
-13
lines changed

README.md

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,20 @@ It works as a client-server. The client spawns a server if one is not running al
1111

1212
Sccache can also be used with local storage instead of remote.
1313

14+
---
15+
16+
Table of Contents (ToC)
17+
======================
18+
19+
* [Build Requirements](#build-requirements)
20+
* [Build](#build)
21+
* [Installation](#installation)
22+
* [Usage](#usage)
23+
* [Storage Options](#storage-options)
24+
* [Debugging](#debugging)
25+
* [Known Caveats](#known-caveats)
26+
27+
---
1428

1529
Build Requirements
1630
------------------
@@ -27,6 +41,8 @@ We recommend you install Rust via [Rustup](https://rustup.rs/). The generated bi
2741

2842
> $ cargo install
2943
44+
---
45+
3046
Usage
3147
-----
3248

@@ -48,10 +64,12 @@ Running `sccache --show-stats` will print a summary of cache statistics.
4864

4965
Some notes about using `sccache` with [Jenkins](https://jenkins.io) are [here](docs/Jenkins.md).
5066

67+
---
68+
5169
Storage Options
5270
---------------
5371

54-
Sccache defaults to using local disk storage. You can set the `SCCACHE_DIR` environment variable to change the disk cache location. By default it will use a sensible location for the current platform: `~/.cache/sccache` on Linux, `%LOCALAPPDATA%\Mozilla\sccache` on Windows, `~/Library/Caches/sccache` on OS X.
72+
Sccache defaults to using local disk storage. You can set the `SCCACHE_DIR` environment variable to change the disk cache location. By default it will use a sensible location for the current platform: `~/.cache/sccache` on Linux, `%LOCALAPPDATA%\Mozilla\sccache` on Windows, and `~/Library/Caches/sccache` on OS X.
5573

5674
If you want to use S3 storage for the sccache cache, you need to set the `SCCACHE_BUCKET` environment variable to the name of the S3 bucket to use. You can use `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY` to set the S3 credentials and if you need to override the default endpoint you can set `SCCACHE_ENDPOINT`. To connect to a minio storage for example you can set `SCCACHE_ENDPOINT=<ip>:<port>`.
5775

@@ -63,6 +81,8 @@ By default, SCCACHE on GCS will be read-only. To change this, set `SCCACHE_GCS_R
6381

6482
*Important:* The environment variables are only taken into account when the server starts, so only on the first run.
6583

84+
---
85+
6686
Debugging
6787
---------
6888

@@ -72,6 +92,7 @@ Alternately, you can run the server manually in foreground mode by running `SCCA
7292

7393
You can set the `SCCACHE_ERROR_LOG` environment variable to a path to cause the server process to redirect its standard error output there, in order to capture the output of unhandled panics. (The server sets `RUST_BACKTRACE=1` internally.)
7494

95+
---
7596

7697
Known caveats
7798
-------------

src/compiler/clang.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,12 +79,13 @@ impl CCompilerImpl for Clang {
7979
}
8080
}
8181

82-
static ARGS: [(ArgInfo, gcc::GCCArgAttribute); 7] = [
82+
static ARGS: [(ArgInfo, gcc::GCCArgAttribute); 8] = [
8383
take_arg!("--serialize-diagnostics", String, Separated, PassThrough),
8484
take_arg!("--target", String, Separated, PassThrough),
8585
take_arg!("-Xclang", String, Separated, PassThrough),
8686
flag!("-fcxx-modules", TooHard),
8787
flag!("-fmodules", TooHard),
88+
take_arg!("-gcc-toolchain", String, Separated, PassThrough),
8889
take_arg!("-include-pch", Path, CanBeSeparated, PreprocessorArgument),
8990
take_arg!("-target", String, Separated, PassThrough),
9091
];
@@ -145,6 +146,7 @@ mod test {
145146
parses!("-c", "foo.c", "-Xclang", "-load", "-Xclang", "moz-check", "-o", "foo.o");
146147
parses!("-c", "foo.c", "-B", "somewhere", "-o", "foo.o");
147148
parses!("-c", "foo.c", "-target", "x86_64-apple-darwin11", "-o", "foo.o");
149+
parses!("-c", "foo.c", "-gcc-toolchain", "somewhere", "-o", "foo.o");
148150
}
149151

150152
#[test]

src/compiler/rust.rs

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ pub struct RustHasher {
6464
parsed_args: ParsedArguments,
6565
}
6666

67-
#[derive(Debug, Clone)]
67+
#[derive(Debug, Clone, PartialEq)]
6868
pub struct ParsedArguments {
6969
/// The full commandline, with arguments and their values as pairs.
7070
arguments: Vec<(OsString, Option<OsString>)>,
@@ -323,7 +323,7 @@ static ARGS: [(ArgInfo, RustArgAttribute); 33] = [
323323
take_arg!("--cap-lints", Path, CanBeSeparated('='), PassThrough),
324324
take_arg!("--cfg", Path, CanBeSeparated('='), PassThrough),
325325
take_arg!("--codegen", Path, CanBeSeparated('='), CodeGen),
326-
take_arg!("--color", Path, CanBeSeparated('='), CodeGen),
326+
take_arg!("--color", Path, CanBeSeparated('='), PassThrough),
327327
take_arg!("--crate-name", String, CanBeSeparated('='), CrateName),
328328
take_arg!("--crate-type", String, CanBeSeparated('='), CrateType),
329329
take_arg!("--deny", Path, CanBeSeparated('='), PassThrough),
@@ -341,16 +341,16 @@ static ARGS: [(ArgInfo, RustArgAttribute); 33] = [
341341
take_arg!("--unpretty", String, CanBeSeparated('='), NotCompilation),
342342
flag!("--version", NotCompilation),
343343
take_arg!("--warn", Path, CanBeSeparated('='), PassThrough),
344-
take_arg!("-A", Path, CanBeSeparated('='), LinkPath),
345-
take_arg!("-C", Path, CanBeSeparated('='), CodeGen),
346-
take_arg!("-D", Path, CanBeSeparated('='), CodeGen),
347-
take_arg!("-F", Path, CanBeSeparated('='), CodeGen),
348-
take_arg!("-L", Path, CanBeSeparated('='), LinkPath),
344+
take_arg!("-A", String, CanBeSeparated, PassThrough),
345+
take_arg!("-C", String, CanBeSeparated, CodeGen),
346+
take_arg!("-D", String, CanBeSeparated, PassThrough),
347+
take_arg!("-F", String, CanBeSeparated, PassThrough),
348+
take_arg!("-L", Path, CanBeSeparated, LinkPath),
349349
flag!("-V", NotCompilation),
350-
take_arg!("-W", Path, CanBeSeparated('='), LinkPath),
351-
take_arg!("-Z", Path, CanBeSeparated('='), LinkPath),
352-
take_arg!("-l", Path, CanBeSeparated('='), LinkLibrary),
353-
take_arg!("-o", Path, CanBeSeparated('='), TooHard),
350+
take_arg!("-W", String, CanBeSeparated, PassThrough),
351+
take_arg!("-Z", String, CanBeSeparated, PassThrough),
352+
take_arg!("-l", Path, CanBeSeparated, LinkLibrary),
353+
take_arg!("-o", Path, CanBeSeparated, TooHard),
354354
];
355355

356356
fn parse_arguments(arguments: &[OsString], cwd: &Path) -> CompilerArguments<ParsedArguments>
@@ -759,6 +759,10 @@ mod test {
759759
assert!(h.dep_info.is_none());
760760
let h = parses!("--emit", "link", "foo.rs", "--out-dir=out", "--crate-name=foo");
761761
assert_eq!(h.output_dir.to_str(), Some("out"));
762+
assert_eq!(parses!("--emit", "link", "-C", "opt-level=1", "foo.rs",
763+
"--out-dir", "out", "--crate-name", "foo"),
764+
parses!("--emit=link", "-Copt-level=1", "foo.rs",
765+
"--out-dir=out", "--crate-name=foo"));
762766
let h = parses!("--emit", "link,dep-info", "foo.rs", "--out-dir", "out",
763767
"--crate-name", "my_crate",
764768
"-C", "extra-filename=-abcxyz");

0 commit comments

Comments
 (0)