aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com
diff options
context:
space:
mode:
authorGravatar Michael Staib <mstaib@google.com>2015-05-28 23:10:27 +0000
committerGravatar Lukacs Berki <lberki@google.com>2015-05-29 10:54:33 +0000
commit1ae987e689f78ae5941e93f1a3ee1323630051cf (patch)
tree05dec90f5359bb478a7d21582eaecf82f6a616c0 /src/main/java/com
parent5cafe1354fa070d09837a5ba38d08bbcbb87e0c9 (diff)
Add options for Android compilation with Jack.
This sets up the Android configuration flags, but they aren't used yet. All implementations of Jack support in other rules use isJackSanityChecked() to determine whether the --sanity-checks flags should be set to 'on'; isJackUsedForDexing() specifically guards the final step in AndroidBinary, determining whether the ordinary Java compilation process or the Jack process is used to build the final classes.dex. -- MOS_MIGRATED_REVID=94712246
Diffstat (limited to 'src/main/java/com')
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/android/AndroidConfiguration.java31
1 files changed, 31 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 90da6e8f35..a048bcad1e 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
@@ -100,6 +100,18 @@ public class AndroidConfiguration extends BuildConfiguration.Fragment {
+ "android_binary rules.")
public List<String> fatApkCpus;
+ @Option(name = "experimental_android_use_jack_for_dexing",
+ defaultValue = "false",
+ category = "semantics",
+ help = "Switches to the Jack and Jill toolchain for dexing instead of javac and dx.")
+ public boolean useJackForDexing;
+
+ @Option(name = "experimental_android_jack_sanity_checks",
+ defaultValue = "false",
+ category = "semantics",
+ help = "Enables sanity checks for Jack and Jill compilation.")
+ public boolean jackSanityChecks;
+
@Override
public void addAllLabels(Multimap<String, Label> labelMap) {
if (proguard != null) {
@@ -198,6 +210,8 @@ public class AndroidConfiguration extends BuildConfiguration.Fragment {
private final String cpu;
private final boolean fatApk;
private final Label proguard;
+ private final boolean useJackForDexing;
+ private final boolean jackSanityChecks;
AndroidConfiguration(Options options, Label sdk, Label incrementalStubApplication,
Label incrementalSplitStubApplication, Label resourcesProcessor, Label aarGenerator) {
@@ -211,6 +225,8 @@ public class AndroidConfiguration extends BuildConfiguration.Fragment {
this.cpu = options.cpu;
this.fatApk = !options.fatApkCpus.isEmpty();
this.proguard = options.proguard;
+ this.useJackForDexing = options.useJackForDexing;
+ this.jackSanityChecks = options.jackSanityChecks;
}
@Override
@@ -259,6 +275,21 @@ public class AndroidConfiguration extends BuildConfiguration.Fragment {
return fatApk;
}
+ /**
+ * Returns true if Jack should be used in place of javac/dx for Android compilation.
+ */
+ public boolean isJackUsedForDexing() {
+ return useJackForDexing;
+ }
+
+ /**
+ * Returns true if Jack sanity checks should be enabled. Only relevant if isJackUsedForDexing()
+ * also returns true.
+ */
+ public boolean isJackSanityChecked() {
+ return jackSanityChecks;
+ }
+
@Override
public void addGlobalMakeVariables(ImmutableMap.Builder<String, String> globalMakeEnvBuilder) {
globalMakeEnvBuilder.put("ANDROID_CPU", cpu);