Introduce a `--no-cache` option that will ignore the `[cache]` in .buckconfig. Summary: We have gotten some reports of errors with bad caching in the wild. Users are currently working around these by running `buck clean`. We would prefer it if they ran with `--no-cache` to verify that a corrupted build cache is the true cause of their problems. To introduce `--no-cache`, we have to defer the construction of the `ArtifactCache` until after the `AbstractCommandOptions` are instantiated, as we have to know whether the user passed `--no-cache` before trying to create the `ArtifactCache`. To that end, this diff introduces the concept of an `ArtifactCacheFactory`, which makes it possible to defer the construction of the `ArtifactCache`. Previously, the `ArtifactCache` was constructed for all Buck commands. Now, for commands like `buck clean`, the `ArtifactCache` should never need to be created. This diff renames `AbstractCommandRunner.runCommandWithOptions()` to `AbstractCommandRunner.runCommandWithOptionsInternal()`, and then reimplements `runCommandWithOptions()` to invoke `runCommandWithOptionsInternal()`. This is done to guarantee that `this.options` is set in `AbstractCommandRunner` before `runCommandWithOptionsInternal()` is invoked. The `options` field must be set so that `getArtifactCache()` does not fail a precondition check. Many of the unit tests in the `com.facebook.buck.cli` package injected their own `ArtifactCache` for testing purposes. An `InstanceArtifactCacheFactory` is introduced in this diff to facilitate that injection. Test Plan: Updated DefaultJavaLibraryRuleIntegrationTest to verify `--no-cache`.
Buck is an Android build tool. To see what Buck can do for you, check out the documentation at http://facebook.github.io/buck/.
To build Buck, run the following:
git clone git@github.com:facebook/buck.git cd buck ant ./bin/buck --help
Apache License 2.0