aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/rules/android/AndroidSemantics.java
diff options
context:
space:
mode:
authorGravatar Lukacs Berki <lberki@google.com>2015-05-19 09:28:06 +0000
committerGravatar Lukacs Berki <lberki@google.com>2015-05-19 09:34:35 +0000
commit89c2799dd890e6b93e2c3ddc63c54fddd988ea78 (patch)
tree8c2951c5e065ccc4c73755102851c36958f067a3 /src/main/java/com/google/devtools/build/lib/rules/android/AndroidSemantics.java
parentd3461dba46b50719e238939946048cd1ca12755a (diff)
Move the source code of the Android rules to the Bazel tree.
This is mostly a "[] mv", except for the extra constant that specifies the location of the Android SDK and moving the $zip attribute. They are minor enough to be included in this CL. Tested by creating a Bazel tree, compiling it and verifying that the Android classes are in libblaze.jar. I also eyeballed the source as a final check that nothing sensitive gets leaked. -- MOS_MIGRATED_REVID=93971892
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/rules/android/AndroidSemantics.java')
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/android/AndroidSemantics.java70
1 files changed, 70 insertions, 0 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/android/AndroidSemantics.java b/src/main/java/com/google/devtools/build/lib/rules/android/AndroidSemantics.java
new file mode 100644
index 0000000000..9af02cec88
--- /dev/null
+++ b/src/main/java/com/google/devtools/build/lib/rules/android/AndroidSemantics.java
@@ -0,0 +1,70 @@
+// Copyright 2015 Google Inc. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+package com.google.devtools.build.lib.rules.android;
+
+import com.google.common.collect.ImmutableList;
+import com.google.devtools.build.lib.actions.Artifact;
+import com.google.devtools.build.lib.analysis.RuleConfiguredTargetBuilder;
+import com.google.devtools.build.lib.analysis.RuleContext;
+import com.google.devtools.build.lib.rules.java.JavaCommon;
+import com.google.devtools.build.lib.rules.java.JavaCompilationArtifacts;
+import com.google.devtools.build.lib.rules.java.JavaSemantics;
+import com.google.devtools.build.lib.rules.java.JavaTargetAttributes;
+
+/**
+ * Pluggable semantics for Android rules.
+ *
+ * <p>A new instance of this class is created for each configured target, therefore, it is allowed
+ * to keep state.
+ */
+public interface AndroidSemantics {
+ /**
+ * Adds transitive info providers for {@code android_binary} and {@code android_library} rules.
+ */
+ void addTransitiveInfoProviders(RuleConfiguredTargetBuilder builder,
+ RuleContext ruleContext, JavaCommon javaCommon, AndroidCommon androidCommon,
+ Artifact jarWithAllClasses, ResourceApk resourceApk, Artifact zipAlignedApk,
+ Iterable<Artifact> apksUnderTest);
+
+ /**
+ * Returns the manifest to be used when compiling a given rule.
+ */
+ ApplicationManifest getManifestForRule(RuleContext ruleContext);
+
+ /**
+ * Returns the name of the file in which the file names of native dependencies are listed.
+ */
+ String getNativeDepsFileName();
+
+ /**
+ * Returns the command line options to be used when compiling Java code for {@code android_*}
+ * rules.
+ *
+ * <p>These will come after the default options specified by the toolchain and the ones in the
+ * {@code javacopts} attribute.
+ */
+ ImmutableList<String> getJavacArguments();
+
+ /**
+ * JVM arguments to be passed to the command line of dx.
+ */
+ ImmutableList<String> getDxJvmArguments();
+
+ /**
+ * Add coverage instrumentation to the Java compilation of an Android binary.
+ */
+ void addCoverageSupport(RuleContext ruleContext, AndroidCommon common,
+ JavaSemantics javaSemantics, boolean forAndroidTest,
+ JavaTargetAttributes.Builder attributes, JavaCompilationArtifacts.Builder artifactsBuilder);
+}