aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/rules/android/AndroidLibraryBaseRule.java
diff options
context:
space:
mode:
authorGravatar Googler <noreply@google.com>2017-06-26 22:20:30 +0200
committerGravatar Marcel Hlopko <hlopko@google.com>2017-06-27 10:06:58 +0200
commite2b1a0ceaffae93f5ec8b9b3204588ec591fc182 (patch)
treed215fae013fa9f88cd70e0d5e7a2b6611e94a23a /src/main/java/com/google/devtools/build/lib/rules/android/AndroidLibraryBaseRule.java
parente73f881b66e5540051f92f8ffab5570b6856fea8 (diff)
Add idl_preprocessed field to android_library.
RELNOTES: Add idl_preprocessed attribute to android_library, so that preprocessed aidl files can be passed to android_library for compiling PiperOrigin-RevId: 160185474
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/rules/android/AndroidLibraryBaseRule.java')
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/android/AndroidLibraryBaseRule.java64
1 files changed, 48 insertions, 16 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/android/AndroidLibraryBaseRule.java b/src/main/java/com/google/devtools/build/lib/rules/android/AndroidLibraryBaseRule.java
index 1badc11f0d..72d2ded8b5 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/android/AndroidLibraryBaseRule.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/android/AndroidLibraryBaseRule.java
@@ -69,9 +69,10 @@ public final class AndroidLibraryBaseRule implements RuleDefinition {
deprecated soon; try not to rely on it.
</p>
<!-- #END_BLAZE_RULE.ATTRIBUTE --> */
- .add(attr("srcs", LABEL_LIST)
- .direct_compile_time_input()
- .allowedFileTypes(JavaSemantics.JAVA_SOURCE, JavaSemantics.SOURCE_JAR))
+ .add(
+ attr("srcs", LABEL_LIST)
+ .direct_compile_time_input()
+ .allowedFileTypes(JavaSemantics.JAVA_SOURCE, JavaSemantics.SOURCE_JAR))
/* <!-- #BLAZE_RULE(android_library).ATTRIBUTE(deps) -->
The list of other libraries to link against.
Permitted library types are: <code>android_library</code>,
@@ -79,7 +80,9 @@ public final class AndroidLibraryBaseRule implements RuleDefinition {
<code>cc_library</code> wrapping or producing <code>.so</code> native libraries
for the Android target platform.
<!-- #END_BLAZE_RULE.ATTRIBUTE --> */
- .override(builder.copy("deps")
+ .override(
+ builder
+ .copy("deps")
.allowedRuleClasses(AndroidRuleClasses.ALLOWED_DEPENDENCIES)
.allowedFileTypes()
.aspect(androidNeverlinkAspect))
@@ -89,10 +92,11 @@ public final class AndroidLibraryBaseRule implements RuleDefinition {
target with <code>exports</code>.
<p>The <code>exports</code> are not direct deps of the rule they belong to.</p>
<!-- #END_BLAZE_RULE.ATTRIBUTE --> */
- .add(attr("exports", LABEL_LIST)
- .allowedRuleClasses(AndroidRuleClasses.ALLOWED_DEPENDENCIES)
- .allowedFileTypes(/*May not have files in exports!*/ )
- .aspect(androidNeverlinkAspect))
+ .add(
+ attr("exports", LABEL_LIST)
+ .allowedRuleClasses(AndroidRuleClasses.ALLOWED_DEPENDENCIES)
+ .allowedFileTypes(/*May not have files in exports!*/ )
+ .aspect(androidNeverlinkAspect))
/* <!-- #BLAZE_RULE(android_library).ATTRIBUTE(exports_manifest) -->
Whether to export manifest entries to <code>android_binary</code> targets
that depend on this target. <code>uses-permissions</code> attributes are never exported.
@@ -107,7 +111,10 @@ public final class AndroidLibraryBaseRule implements RuleDefinition {
labels in <code><a href="${link android_library.plugins}">plugins</a></code>.
</p>
<!-- #END_BLAZE_RULE.ATTRIBUTE --> */
- .add(attr("exported_plugins", LABEL_LIST).cfg(HOST).allowedRuleClasses("java_plugin")
+ .add(
+ attr("exported_plugins", LABEL_LIST)
+ .cfg(HOST)
+ .allowedRuleClasses("java_plugin")
.allowedFileTypes(FileTypeSet.NO_FILE))
.add(attr("alwayslink", BOOLEAN).undocumented("purely informational for now"))
/* <!-- #BLAZE_RULE(android_library).ATTRIBUTE(neverlink) -->
@@ -142,8 +149,10 @@ public final class AndroidLibraryBaseRule implements RuleDefinition {
See <a href="${link android_library.idl_import_root}">the description of idl_import_root</a>
for information about what this means.</p>
<!-- #END_BLAZE_RULE.ATTRIBUTE --> */
- .add(attr("idl_srcs", LABEL_LIST).direct_compile_time_input()
- .allowedFileTypes(AndroidRuleClasses.ANDROID_IDL))
+ .add(
+ attr("idl_srcs", LABEL_LIST)
+ .direct_compile_time_input()
+ .allowedFileTypes(AndroidRuleClasses.ANDROID_IDL))
/* <!-- #BLAZE_RULE(android_library).ATTRIBUTE(idl_parcelables) -->
List of Android IDL definitions to supply as imports.
These files will be made available as imports for any
@@ -158,11 +167,34 @@ public final class AndroidLibraryBaseRule implements RuleDefinition {
See <a href="${link android_library.idl_import_root}">the description of idl_import_root</a>
for information about what this means.</p>
<!-- #END_BLAZE_RULE.ATTRIBUTE --> */
- .add(attr("idl_parcelables", LABEL_LIST)
- .direct_compile_time_input()
- .allowedFileTypes(AndroidRuleClasses.ANDROID_IDL))
- .add(attr("$android_manifest_merge_tool", LABEL).cfg(HOST).exec().value(
- env.getToolsLabel(AndroidRuleClasses.MANIFEST_MERGE_TOOL_LABEL)))
+ .add(
+ attr("idl_parcelables", LABEL_LIST)
+ .direct_compile_time_input()
+ .allowedFileTypes(AndroidRuleClasses.ANDROID_IDL))
+ /* <!-- #BLAZE_RULE(android_library).ATTRIBUTE(idl_preprocessed) -->
+ List of preprocessed Android IDL definitions to supply as imports.
+ These files will be made available as imports for any
+ <code>android_library</code> target that depends on this library, directly
+ or via its transitive closure, but will not be translated to Java
+ or compiled.
+ <p>Only preprocessed <code>.aidl</code> files that correspond directly to
+ <code>.java</code> sources in this library should be included (e.g., custom
+ implementations of Parcelable), otherwise use <code>idl_srcs</code> for
+ Android IDL definitions that need to be translated to Java interfaces and
+ use <code>idl_parcelable</code>
+ for non-preprcessed AIDL files.
+ </p>
+
+ <!-- #END_BLAZE_RULE.ATTRIBUTE --> */
+ .add(
+ attr("idl_preprocessed", LABEL_LIST)
+ .direct_compile_time_input()
+ .allowedFileTypes(AndroidRuleClasses.ANDROID_IDL))
+ .add(
+ attr("$android_manifest_merge_tool", LABEL)
+ .cfg(HOST)
+ .exec()
+ .value(env.getToolsLabel(AndroidRuleClasses.MANIFEST_MERGE_TOOL_LABEL)))
.advertiseProvider(JavaCompilationArgsProvider.class)
.build();
}