xref: /aosp_15_r20/external/doclava/Android.bp (revision feeed43c7c55e85932c547a3cefc559df175227c)
1// Copyright (C) 2018 The Android Open Source Project
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//      http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15package {
16    default_applicable_licenses: ["external_doclava_license"],
17}
18
19// Added automatically by a large-scale-change that took the approach of
20// 'apply every license found to every target'. While this makes sure we respect
21// every license restriction, it may not be entirely correct.
22//
23// e.g. GPL in an MIT project might only apply to the contrib/ directory.
24//
25// Please consider splitting the single license below into multiple licenses,
26// taking care not to lose any license_kind information, and overriding the
27// default license using the 'licenses: [...]' property on targets as needed.
28//
29// For unused files, consider creating a 'fileGroup' with "//visibility:private"
30// to attach the license to, and including a comment whether the files may be
31// used in the current project.
32// See: http://go/android-license-faq
33license {
34    name: "external_doclava_license",
35    visibility: [":__subpackages__"],
36    license_kinds: [
37        "SPDX-license-identifier-Apache-2.0",
38        "SPDX-license-identifier-BSD",
39        "SPDX-license-identifier-CC-BY",
40        "SPDX-license-identifier-GPL",
41        "SPDX-license-identifier-GPL-2.0",
42        "SPDX-license-identifier-GPL-2.0-with-classpath-exception",
43        "SPDX-license-identifier-LGPL",
44        "SPDX-license-identifier-MIT",
45    ],
46    license_text: [
47        "NOTICE",
48    ],
49}
50
51droiddoc_exported_dir {
52    name: "droiddoc-templates-sdk",
53    path: "res/assets/templates-sdk",
54}
55
56java_defaults {
57    name: "doclava_defaults",
58    java_resource_dirs: ["res"],
59    errorprone: {
60        javacflags: [
61            "-Xep:FormatString:WARN",
62            "-Xep:ComparableType:WARN",
63            "-Xep:ReturnValueIgnored:WARN",
64        ],
65    },
66    static_libs: [
67        "jsilver",
68        "antlr-runtime",
69        "tagsoup",
70        "doclava-doclet-adapter",
71    ],
72}
73
74java_library_host {
75    name: "doclava-doclet-adapter",
76    srcs: [
77        "doclet_adapter/src/main/java/**/*.java",
78    ],
79    libs: [
80        "guava",
81    ],
82    javacflags: [
83        "--add-modules=jdk.compiler",
84        "--add-exports jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED",
85        "--add-exports jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED",
86        "--add-exports jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED",
87        "--add-exports jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED",
88        "--add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED",
89        "--add-modules=jdk.javadoc",
90        "--add-exports jdk.javadoc/jdk.javadoc.internal.doclets.formats.html=ALL-UNNAMED",
91        "--add-exports jdk.javadoc/jdk.javadoc.internal.tool=ALL-UNNAMED",
92    ],
93    errorprone: {
94        javacflags: [
95            "-Xep:ComparableType:WARN",
96        ],
97    },
98}
99
100java_library_host {
101    name: "doclava",
102    defaults: ["doclava_defaults"],
103    srcs: [
104        "src/com/google/doclava/**/*.java",
105    ],
106    static_libs: [
107        "guava",
108    ],
109}
110
111
112// TODO: add a test target.
113// For now, you can run the unit tests thus:
114// vogar --classpath /usr/lib/jvm/java-6-sun/lib/tools.jar --classpath ../../out/host/common/obj/JAVA_LIBRARIES/antlr_intermediates/javalib.jar --sourcepath src/ --sourcepath ../jsilver/src/ --mode jvm test/doclava/ApiCheckTest.java
115