xref: /aosp_15_r20/prebuilts/cmdline-tools/Android.bp (revision ec4b0377db3938a8cbcb4033b9a97789ce658793)
1package {
2    default_applicable_licenses: ["prebuilts_cmdline-tools_license"],
3}
4
5// Added automatically by a large-scale-change that took the approach of
6// 'apply every license found to every target'. While this makes sure we respect
7// every license restriction, it may not be entirely correct.
8//
9// e.g. GPL in an MIT project might only apply to the contrib/ directory.
10//
11// Please consider splitting the single license below into multiple licenses,
12// taking care not to lose any license_kind information, and overriding the
13// default license using the 'licenses: [...]' property on targets as needed.
14//
15// For unused files, consider creating a 'fileGroup' with "//visibility:private"
16// to attach the license to, and including a comment whether the files may be
17// used in the current project.
18// See: http://go/android-license-faq
19license {
20    name: "prebuilts_cmdline-tools_license",
21    visibility: [":__subpackages__"],
22    license_kinds: [
23        "SPDX-license-identifier-BSD",
24        "SPDX-license-identifier-CDDL-1.0",
25        "SPDX-license-identifier-GPL-2.0",
26        "SPDX-license-identifier-MIT",
27    ],
28    license_text: [
29        "tools/NOTICE.txt",
30    ],
31}
32
33java_import_host {
34    name: "lint_api",
35    jars: [
36        "tools/lib/lint/tools.lint-api.jar",
37        "tools/lib/lint/tools.lint-checks.jar",
38        "tools/lib/common/tools.common.jar",
39
40        // A subset of the jars listed in MANIFEST.MF in
41        // tools/lib/lint-classpath.jar needed to provide dependencies
42        // of lint-api.jar and lint-checks.jar.
43        "tools/lib/external/com/google/code/findbugs/jsr305/3.0.2/jsr305-3.0.2.jar",
44        "tools/lib/external/com/google/guava/guava/32.0.1-jre/guava-32.0.1-jre.jar",
45        "tools/lib/external/lint-psi/intellij-core/intellij-core-mvn.jar",
46        "tools/lib/external/lint-psi/kotlin-compiler/kotlin-compiler-mvn.jar",
47        "tools/lib/external/lint-psi/uast/uast.jar",
48    ],
49}
50
51// The lint shell script in tools/bin/lint uses tools/lib/lint-classpath.jar as its classpath.
52// That jar contains a list of other jars that java adds to the classpath.  This makes it impossible
53// for the build system to track dependencies.
54// This genrule reads the jars from tools/lib/lint-classpath.jar and then merges them all together into
55// a single jar.  The result is then embedded into a self-contained java_binary.
56java_genrule_host {
57    name: "lint-classpath",
58    srcs: [
59        "tools/lib/lint-classpath.jar",
60        "tools/lib/**/*.jar",
61    ],
62    out: [
63        "lint-classpath.jar",
64    ],
65    tools: [
66        "merge_zips",
67    ],
68    cmd: "unzip -pq $(location tools/lib/lint-classpath.jar) META-INF/MANIFEST.MF > $(genDir)/list && " +
69        "for jar in $$(grep '\\.jar' $(genDir)/list); do " +
70        " echo $$(dirname $(location tools/lib/lint-classpath.jar))/$${jar}; " +
71        "done > $(genDir)/jars && " +
72        "$(location merge_zips) -j -ignore-duplicates -stripFile 'META-INF/*.SF' -stripFile 'META-INF/*.DSA' $(out) $$(cat $(genDir)/jars)",
73}
74
75java_binary_host {
76    name: "lint",
77    static_libs: ["lint-classpath"],
78    wrapper: "tools/bin/lint",
79}
80
81java_genrule_host {
82    name: "resourceshrinker-classpath",
83    srcs: [
84        "tools/lib/resourceshrinker-classpath.jar",
85        "tools/lib/**/*.jar",
86        ":r8lib-prebuilt"
87    ],
88    out: [
89        "resourceshrinker-classpath.jar",
90    ],
91    tools: [
92        "merge_zips",
93    ],
94    // Use r8 from prebuilts/r8 instead of embedded version.
95    cmd: "unzip -pq $(location tools/lib/resourceshrinker-classpath.jar) META-INF/MANIFEST.MF | grep -v r8.jar > $(genDir)/list && " +
96        "for jar in $$(grep '\\.jar' $(genDir)/list); do " +
97        " echo $$(dirname $(location tools/lib/resourceshrinker-classpath.jar))/$${jar}; " +
98        "done > $(genDir)/jars && " +
99        "echo $(location :r8lib-prebuilt) >> $(genDir)/jars && " +
100        "$(location merge_zips) -j -ignore-duplicates -stripFile 'META-INF/*.SF' -stripFile 'META-INF/*.DSA' $(out) $$(cat $(genDir)/jars)",
101}
102
103java_binary_host {
104    name: "resourceshrinker",
105    static_libs: ["resourceshrinker-classpath"],
106    wrapper: "tools/bin/resourceshrinker",
107}
108
109java_import_host {
110    name: "lint_tests",
111    jars: [
112        "lint-tests.jar",
113        "tools/lib/common/tools.common.jar",
114        "tools/lib/external/org/ow2/asm/asm/9.6/asm-9.6.jar",
115        "tools/lib/external/org/ow2/asm/asm-analysis/9.6/asm-analysis-9.6.jar",
116        "tools/lib/external/org/ow2/asm/asm-tree/9.6/asm-tree-9.6.jar",
117        "tools/lib/layoutlib-api/tools.layoutlib-api.jar",
118        "tools/lib/lint/cli/cli.jar",
119        "tools/lib/sdk-common/tools.sdk-common.jar",
120    ]
121}
122