diff options
author | Colin Cross <ccross@android.com> | 2021-03-06 01:56:48 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2021-03-06 01:56:48 +0000 |
commit | 8c9ec28164db5b864bedd2efca8172fd7333ec8c (patch) | |
tree | 07f4920c25d463814a09efb4590e20773b6ff2b9 | |
parent | a5028bf54ba2e3c02fd4b6baa609e25af76dc93d (diff) | |
parent | 2017bf43d01c5a1d88e1b0fa4a18ecd321e47633 (diff) | |
download | cmdline-tools-8c9ec28164db5b864bedd2efca8172fd7333ec8c.tar.gz |
Repackage lint into a standalone jar am: bda50ab053 am: 0f03d555d5 am: b181eba1f2 am: 2017bf43d0
Original change: https://android-review.googlesource.com/c/platform/prebuilts/cmdline-tools/+/1619830
MUST ONLY BE SUBMITTED BY AUTOMERGER
Change-Id: Ia3ca168ef49b84d8aed964f67cff363dcdbe5dcf
-rw-r--r-- | Android.bp | 30 | ||||
-rwxr-xr-x | tools/bin/lint | 8 |
2 files changed, 37 insertions, 1 deletions
@@ -45,3 +45,33 @@ java_import_host { "tools/lib/external/lint-psi/uast/uast-all.jar", ], } + +// The lint shell script in tools/bin/lint uses tools/lib/lint-classpath.jar as its classpath. +// That jar contains a list of other jars that java adds to the classpath. This makes it impossible +// for the build system to track dependencies. +// This genrule reads the jars from tools/lib/lint-classpath.jar and then merges them all together into +// a single jar. The result is then embedded into a self-contained java_binary. +java_genrule_host { + name: "lint-classpath", + srcs: [ + "tools/lib/lint-classpath.jar", + "tools/lib/**/*.jar", + ], + out: [ + "lint-classpath.jar", + ], + tools: [ + "merge_zips", + ], + cmd: "unzip -pq $(location tools/lib/lint-classpath.jar) META-INF/MANIFEST.MF > $(genDir)/list && " + + "for jar in $$(grep '\\.jar' $(genDir)/list); do " + + " echo $$(dirname $(location tools/lib/lint-classpath.jar))/$${jar}; " + + "done > $(genDir)/jars && " + + "$(location merge_zips) -j -ignore-duplicates -stripFile 'META-INF/*.SF' -stripFile 'META-INF/*.DSA' $(out) $$(cat $(genDir)/jars)", +} + +java_binary_host { + name: "lint", + static_libs: ["lint-classpath"], + wrapper: "tools/bin/lint", +} diff --git a/tools/bin/lint b/tools/bin/lint index 99db3b0..2d38843 100755 --- a/tools/bin/lint +++ b/tools/bin/lint @@ -64,7 +64,13 @@ case "`uname`" in ;; esac -CLASSPATH=$APP_HOME/lib//lint-classpath.jar +# BEGIN ANDROID PLATFORM +# Check ../framework/lint.jar first before falling back to ../lib/lint-classpath.jar. +CLASSPATH=$APP_HOME/framework/lint.jar +if [ ! -e $CLASSPATH ]; then + CLASSPATH=$APP_HOME/lib//lint-classpath.jar +fi +# END ANDROID PLATFORM # Determine the Java command to use to start the JVM. if [ -n "$JAVA_HOME" ] ; then |