aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar lberki <lberki@google.com>2017-07-18 10:35:52 +0200
committerGravatar Klaus Aehlig <aehlig@google.com>2017-07-18 11:41:22 +0200
commitf49468c9e65483b93fa3c956f66f5503eb3211cd (patch)
treec10b2b1bfdf50d15a63615bdc5022b01897e85c0
parent52b4f68592df562dd9f1e28208a1bde72b86a721 (diff)
Add an undocumented option to remove the separation between the bin and genfiles directories.
RELNOTES: None. PiperOrigin-RevId: 162325236
-rw-r--r--src/main/java/com/google/devtools/build/lib/analysis/config/BuildConfiguration.java20
-rw-r--r--src/test/java/com/google/devtools/build/lib/analysis/config/BuildConfigurationTest.java10
2 files changed, 29 insertions, 1 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/analysis/config/BuildConfiguration.java b/src/main/java/com/google/devtools/build/lib/analysis/config/BuildConfiguration.java
index 3997cc36db..b20982503f 100644
--- a/src/main/java/com/google/devtools/build/lib/analysis/config/BuildConfiguration.java
+++ b/src/main/java/com/google/devtools/build/lib/analysis/config/BuildConfiguration.java
@@ -464,6 +464,16 @@ public final class BuildConfiguration implements BuildEvent {
*/
public static class Options extends FragmentOptions implements Cloneable {
@Option(
+ name = "experimental_separate_genfiles_directory",
+ defaultValue = "true",
+ category = "semantics",
+ documentationCategory = OptionDocumentationCategory.UNDOCUMENTED,
+ effectTags = { OptionEffectTag.AFFECTS_OUTPUTS },
+ help = "Whether to have a separate genfiles directory or fold it into the bin directory"
+ )
+
+ public boolean separateGenfilesDirectory;
+ @Option(
name = "define",
converter = Converters.AssignmentConverter.class,
defaultValue = "",
@@ -1134,6 +1144,7 @@ public final class BuildConfiguration implements BuildEvent {
host.useDynamicConfigurations = useDynamicConfigurations;
host.commandLineBuildVariables = commandLineBuildVariables;
host.enforceConstraints = enforceConstraints;
+ host.separateGenfilesDirectory = separateGenfilesDirectory;
if (fallback) {
// In the fallback case, we have already tried the target options and they didn't work, so
@@ -1294,6 +1305,8 @@ public final class BuildConfiguration implements BuildEvent {
private final Root testlogsDirectoryForMainRepository;
private final Root middlemanDirectoryForMainRepository;
+ private final boolean separateGenfilesDirectory;
+
// Cache this value for quicker access. We don't cache it inside BuildOptions because BuildOptions
// is mutable, so a cached value there could fall out of date when it's updated.
private final boolean actionsEnabled;
@@ -1519,6 +1532,7 @@ public final class BuildConfiguration implements BuildEvent {
this.buildOptions = buildOptions.clone();
this.actionsEnabled = buildOptions.enableActions();
this.options = buildOptions.get(Options.class);
+ this.separateGenfilesDirectory = options.separateGenfilesDirectory;
this.mainRepositoryName = RepositoryName.createFromValidStrippedName(repositoryName);
this.dynamicTransitionMapper = dynamicTransitionMapper;
@@ -2234,6 +2248,10 @@ public final class BuildConfiguration implements BuildEvent {
}
public Root getGenfilesDirectory(RepositoryName repositoryName) {
+ if (!separateGenfilesDirectory) {
+ return getBinDirectory(repositoryName);
+ }
+
return repositoryName.isMain() || repositoryName.equals(mainRepositoryName)
? genfilesDirectoryForMainRepository
: OutputDirectory.GENFILES.getRoot(
@@ -2558,7 +2576,7 @@ public final class BuildConfiguration implements BuildEvent {
return options.useLLVMCoverageMapFormat;
}
- /** If false, AnalysisEnviroment doesn't register any actions created by the ConfiguredTarget. */
+ /** If false, AnalysisEnvironment doesn't register any actions created by the ConfiguredTarget. */
public boolean isActionsEnabled() {
return actionsEnabled;
}
diff --git a/src/test/java/com/google/devtools/build/lib/analysis/config/BuildConfigurationTest.java b/src/test/java/com/google/devtools/build/lib/analysis/config/BuildConfigurationTest.java
index b9fcc2f39b..1c07a8cec4 100644
--- a/src/test/java/com/google/devtools/build/lib/analysis/config/BuildConfigurationTest.java
+++ b/src/test/java/com/google/devtools/build/lib/analysis/config/BuildConfigurationTest.java
@@ -429,4 +429,14 @@ public class BuildConfigurationTest extends ConfigurationTestCase {
"| //skylark:two.bzl",
"`-- //skylark:one.bzl"));
}
+
+ @Test
+ public void testNoSeparateGenfilesDirectory() throws Exception {
+ BuildConfiguration target = create("--noexperimental_separate_genfiles_directory");
+ BuildConfiguration host = createHost("--noexperimental_separate_genfiles_directory");
+ assertThat(target.getGenfilesDirectory(RepositoryName.MAIN))
+ .isEqualTo(target.getBinDirectory(RepositoryName.MAIN));
+ assertThat(host.getGenfilesDirectory(RepositoryName.MAIN))
+ .isEqualTo(host.getBinDirectory(RepositoryName.MAIN));
+ }
}