1// Copyright (C) 2023 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: ["Android-Apache-2.0"],
17}
18
19java_library_host {
20    name: "AdServicesProdLintChecker",
21    srcs: [
22        "java/**/*.java",
23        "java/**/*.kt",
24    ],
25    exclude_srcs: [
26        "java/**/test/*.java",
27        "java/**/test/*.kt",
28    ],
29    plugins: ["auto_service_plugin"],
30    libs: [
31        "auto_service_annotations",
32        "core-xml-for-host", // For org.xmlpull.v1.*
33        "lint_api",
34    ],
35    kotlincflags: ["-Xjvm-default=all"],
36}
37
38java_library_host {
39    name: "AdServicesTestLintChecker",
40    srcs: [
41        "java/**/*.java",
42        "java/**/*.kt",
43    ],
44    exclude_srcs: [
45        "java/**/prod/*.java",
46        "java/**/prod/*.kt",
47    ],
48    plugins: ["auto_service_plugin"],
49    libs: [
50        "auto_service_annotations",
51        "core-xml-for-host", // For org.xmlpull.v1.*
52        "lint_api",
53    ],
54    kotlincflags: ["-Xjvm-default=all"],
55}
56
57java_test_host {
58    name: "AdServicesLintCheckerTest",
59    team: "trendy_team_android_rubidium",
60    srcs: [
61        "tests/java/**/*.kt",
62    ],
63    static_libs: [
64        "AdServicesProdLintChecker",
65        "AdServicesTestLintChecker",
66        "junit",
67        "lint",
68        "lint_tests",
69    ],
70    test_options: {
71        unit_test: true,
72        tradefed_options: [
73            {
74                // lint bundles in some classes that were built with older versions
75                // of libraries, and no longer load. Since tradefed tries to load
76                // all classes in the jar to look for tests, it crashes loading them.
77                // Exclude these classes from tradefed's search.
78                name: "exclude-paths",
79                value: "org/apache",
80            },
81            {
82                name: "exclude-paths",
83                value: "META-INF",
84            },
85        ],
86    },
87}
88