aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools
diff options
context:
space:
mode:
authorGravatar Googler <noreply@google.com>2017-08-16 16:29:53 +0200
committerGravatar Irina Iancu <elenairina@google.com>2017-08-17 09:52:40 +0200
commitd631886781dd930fe2ebb5f37e4f356d7f6b380f (patch)
tree3e3a072a6b067318fd25cbfcb3b5ba54df4c80d7 /src/main/java/com/google/devtools
parent8f46f94c32b6e0536030bf209146f8ef3ba6222e (diff)
Add flag to fail when android_resources targets are encountered
As part of the migration away from android_resources, add a flag that causes failures if android_resources is encountered. This makes it easier to test that all android_resources targets have been removed without actually breaking any builds. RELNOTES: none PiperOrigin-RevId: 165437983
Diffstat (limited to 'src/main/java/com/google/devtools')
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/android/AndroidConfiguration.java16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/android/AndroidConfiguration.java b/src/main/java/com/google/devtools/build/lib/rules/android/AndroidConfiguration.java
index 0ce599e980..2b4291ea9e 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/android/AndroidConfiguration.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/android/AndroidConfiguration.java
@@ -697,6 +697,16 @@ public class AndroidConfiguration extends BuildConfiguration.Fragment {
)
public boolean useManifestFromResourceApk;
+ @Option(
+ name = "experimental_android_allow_android_resources",
+ defaultValue = "true",
+ documentationCategory = OptionDocumentationCategory.UNDOCUMENTED,
+ effectTags = {OptionEffectTag.LOADING_AND_ANALYSIS},
+ help = "For use in testing before migrating away from android_resources. If false, will"
+ + " fail when android_resources rules are encountered"
+ )
+ public boolean allowAndroidResources;
+
@Override
public FragmentOptions getHost(boolean fallback) {
Options host = (Options) super.getHost(fallback);
@@ -776,6 +786,7 @@ public class AndroidConfiguration extends BuildConfiguration.Fragment {
private final boolean throwOnResourceConflict;
private final boolean useParallelDex2Oat;
private final boolean useManifestFromResourceApk;
+ private final boolean allowAndroidResources;
AndroidConfiguration(Options options) throws InvalidConfigurationException {
@@ -813,6 +824,7 @@ public class AndroidConfiguration extends BuildConfiguration.Fragment {
this.throwOnResourceConflict = options.throwOnResourceConflict;
this.useParallelDex2Oat = options.useParallelDex2Oat;
this.useManifestFromResourceApk = options.useManifestFromResourceApk;
+ this.allowAndroidResources = options.allowAndroidResources;
if (!dexoptsSupportedInIncrementalDexing.contains("--no-locals")) {
// TODO(bazel-team): Still needed? See DexArchiveAspect
@@ -945,6 +957,10 @@ public class AndroidConfiguration extends BuildConfiguration.Fragment {
return useManifestFromResourceApk;
}
+ public boolean allowAndroidResources() {
+ return this.allowAndroidResources;
+ }
+
@Override
public void addGlobalMakeVariables(ImmutableMap.Builder<String, String> globalMakeEnvBuilder) {
globalMakeEnvBuilder.put("ANDROID_CPU", cpu);