From e2b1a0ceaffae93f5ec8b9b3204588ec591fc182 Mon Sep 17 00:00:00 2001 From: Googler Date: Mon, 26 Jun 2017 22:20:30 +0200 Subject: 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 --- .../lib/rules/android/AndroidLibraryBaseRule.java | 64 ++++++++++++++++------ 1 file changed, 48 insertions(+), 16 deletions(-) (limited to 'src/main/java/com/google/devtools/build/lib/rules/android/AndroidLibraryBaseRule.java') 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.

*/ - .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)) /* The list of other libraries to link against. Permitted library types are: android_library, @@ -79,7 +80,9 @@ public final class AndroidLibraryBaseRule implements RuleDefinition { cc_library wrapping or producing .so native libraries for the Android target platform. */ - .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 exports.

The exports are not direct deps of the rule they belong to.

*/ - .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)) /* Whether to export manifest entries to android_binary targets that depend on this target. uses-permissions attributes are never exported. @@ -107,7 +111,10 @@ public final class AndroidLibraryBaseRule implements RuleDefinition { labels in plugins.

*/ - .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")) /* @@ -142,8 +149,10 @@ public final class AndroidLibraryBaseRule implements RuleDefinition { See the description of idl_import_root for information about what this means.

*/ - .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)) /* 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 the description of idl_import_root for information about what this means.

*/ - .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)) + /* + List of preprocessed Android IDL definitions to supply as imports. + These files will be made available as imports for any + android_library target that depends on this library, directly + or via its transitive closure, but will not be translated to Java + or compiled. +

Only preprocessed .aidl files that correspond directly to + .java sources in this library should be included (e.g., custom + implementations of Parcelable), otherwise use idl_srcs for + Android IDL definitions that need to be translated to Java interfaces and + use idl_parcelable + for non-preprcessed AIDL files. +

+ + */ + .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(); } -- cgit v1.2.3