From bad89e5e5b171a71e42d7c738ec97a39747e4318 Mon Sep 17 00:00:00 2001 From: Mathew Inwood Date: Thu, 28 Jun 2018 14:12:10 +0100 Subject: Processor for @UnsupportedAppUsage annotations. The processor outputs unsupportedappusage_index.csv, containing source position info for every@UnsupportedAppUsage annotation processed. It is a mapping of dex signature to the source postion of the annotation on that signature. It is used as input for scripts which update the annotations. We include a META-INF file which causes the compiler to automatically pick up the annotation processor. Otherwise we would need to explicitly specify the processor with a -processor flag to javac. We create a new build target for just the @UnsupportedAppUsage annotation and the @IntDef annotation (which it depends on) so that the processor can also depend on that directly. The processor only runs on a new build target framework-annotation-proc so that it is not invoked as part of a regular build. This is done so that we don't slow down peoples builds: Soong does not support annotation processors when javac sharding is in use. This workaround can be removed once b/77284273 is fixed. Test: m framework-annotation-proc Bug: 113853502 Change-Id: Ie9cd5a90ddf7a51f6035e849703fc39ad9127557 --- Android.bp | 34 ++++++++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 4 deletions(-) (limited to 'Android.bp') diff --git a/Android.bp b/Android.bp index 70438d200cb7..dda318b38d0d 100644 --- a/Android.bp +++ b/Android.bp @@ -25,8 +25,8 @@ // // READ ME: ######################################################## -java_library { - name: "framework", +java_defaults { + name: "framework-defaults", installable: true, srcs: [ @@ -695,12 +695,38 @@ java_library { "libmedia2_jni", ], - javac_shard_size: 150, - dxflags: [ "--core-library", "--multi-dex", ], + +} + +java_library { + name: "framework", + defaults: ["framework-defaults"], + javac_shard_size: 150, +} + +java_library { + name: "framework-annotation-proc", + defaults: ["framework-defaults"], + // Use UsedByApps annotation processor + annotation_processors: ["unsupportedappusage-annotation-processor"], + // b/25860419: annotation processors must be explicitly specified for grok + annotation_processor_classes: [ + "android.processor.unsupportedappusage.UsedByAppsProcessor", + ], +} + +// A host library including just UnsupportedAppUsage.java so that the annotation +// processor can also use this annotation. +java_library_host { + name: "unsupportedappusage-annotation", + srcs: [ + "core/java/android/annotation/IntDef.java", + "core/java/android/annotation/UnsupportedAppUsage.java", + ], } // A temporary build target that is conditionally included on the bootclasspath if -- cgit v1.2.3-59-g8ed1b