1package {
2    // See: http://go/android-license-faq
3    // A large-scale-change added 'default_applicable_licenses' to import
4    // all of the 'license_kinds' from "frameworks_base_license"
5    // to get the below license kinds:
6    //   SPDX-license-identifier-Apache-2.0
7    default_applicable_licenses: ["frameworks_base_license"],
8}
9
10java_library_host {
11    name: "ImmutabilityAnnotationProcessorHostLibrary",
12    srcs: [
13        "src/**/*.kt",
14        "src/**/*.java",
15    ],
16    use_tools_jar: true,
17    javacflags: [
18        "--add-modules=jdk.compiler",
19        "--add-exports jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED",
20        "--add-exports jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED",
21        "--add-exports jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED",
22        "--add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED",
23    ],
24}
25
26java_plugin {
27    name: "ImmutabilityAnnotationProcessor",
28    processor_class: "android.processor.immutability.ImmutabilityProcessor",
29    static_libs: ["ImmutabilityAnnotationProcessorHostLibrary"],
30    javacflags: [
31        "--add-modules=jdk.compiler",
32        "--add-exports jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED",
33        "--add-exports jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED",
34        "--add-exports jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED",
35        "--add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED",
36    ],
37}
38
39java_library {
40    name: "ImmutabilityAnnotation",
41    srcs: ["src/**/Immutable.java"],
42    sdk_version: "core_current",
43    host_supported: true,
44}
45
46java_test_host {
47    name: "ImmutabilityAnnotationProcessorUnitTests",
48
49    srcs: ["test/**/*.kt"],
50
51    static_libs: [
52        "compile-testing-prebuilt",
53        "truth",
54        "junit",
55        "kotlin-reflect",
56        "ImmutabilityAnnotationProcessorHostLibrary",
57    ],
58
59    // Bundle the source file so it can be loaded into the test compiler
60    java_resources: [":ImmutabilityAnnotationJavaSource"],
61
62    test_suites: ["general-tests"],
63    test_options: {
64        unit_test: true,
65    },
66    javacflags: [
67        "--add-modules=jdk.compiler",
68        "--add-exports jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED",
69        "--add-exports jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED",
70        "--add-exports jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED",
71        "--add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED",
72    ],
73    test_config_template: "AndroidTestTemplate.xml",
74}
75
76filegroup {
77    name: "ImmutabilityAnnotationJavaSource",
78    srcs: ["src/android/processor/immutability/Immutable.java"],
79    path: "src/android/processor/immutability/",
80}
81