xref: /aosp_15_r20/build/bazel/rules/java/sdk_library.bzl (revision 7594170e27e0732bc44b93d1440d87a54b6ffe7c)
1*7594170eSAndroid Build Coastguard Worker# Copyright (C) 2023 The Android Open Source Project
2*7594170eSAndroid Build Coastguard Worker#
3*7594170eSAndroid Build Coastguard Worker# Licensed under the Apache License, Version 2.0 (the "License");
4*7594170eSAndroid Build Coastguard Worker# you may not use this file except in compliance with the License.
5*7594170eSAndroid Build Coastguard Worker# You may obtain a copy of the License at
6*7594170eSAndroid Build Coastguard Worker#
7*7594170eSAndroid Build Coastguard Worker#     http://www.apache.org/licenses/LICENSE-2.0
8*7594170eSAndroid Build Coastguard Worker#
9*7594170eSAndroid Build Coastguard Worker# Unless required by applicable law or agreed to in writing, software
10*7594170eSAndroid Build Coastguard Worker# distributed under the License is distributed on an "AS IS" BASIS,
11*7594170eSAndroid Build Coastguard Worker# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12*7594170eSAndroid Build Coastguard Worker# See the License for the specific language governing permissions and
13*7594170eSAndroid Build Coastguard Worker# limitations under the License.
14*7594170eSAndroid Build Coastguard Worker
15*7594170eSAndroid Build Coastguard WorkerJavaSdkLibraryInfo = provider(
16*7594170eSAndroid Build Coastguard Worker    "Checked in current.txt for Public, System, Module_lib and System_server",
17*7594170eSAndroid Build Coastguard Worker    fields = [
18*7594170eSAndroid Build Coastguard Worker        "public",
19*7594170eSAndroid Build Coastguard Worker        "system",
20*7594170eSAndroid Build Coastguard Worker        "test",
21*7594170eSAndroid Build Coastguard Worker        "module_lib",
22*7594170eSAndroid Build Coastguard Worker        "system_server",
23*7594170eSAndroid Build Coastguard Worker    ],
24*7594170eSAndroid Build Coastguard Worker)
25*7594170eSAndroid Build Coastguard Worker
26*7594170eSAndroid Build Coastguard Workerdef _java_sdk_library_impl(ctx):
27*7594170eSAndroid Build Coastguard Worker    return [
28*7594170eSAndroid Build Coastguard Worker        JavaSdkLibraryInfo(
29*7594170eSAndroid Build Coastguard Worker            public = ctx.file.public,
30*7594170eSAndroid Build Coastguard Worker            system = ctx.file.system,
31*7594170eSAndroid Build Coastguard Worker            test = ctx.file.test,
32*7594170eSAndroid Build Coastguard Worker            module_lib = ctx.file.module_lib,
33*7594170eSAndroid Build Coastguard Worker            system_server = ctx.file.system_server,
34*7594170eSAndroid Build Coastguard Worker        ),
35*7594170eSAndroid Build Coastguard Worker    ]
36*7594170eSAndroid Build Coastguard Worker
37*7594170eSAndroid Build Coastguard Workerjava_sdk_library = rule(
38*7594170eSAndroid Build Coastguard Worker    implementation = _java_sdk_library_impl,
39*7594170eSAndroid Build Coastguard Worker    attrs = {
40*7594170eSAndroid Build Coastguard Worker        "public": attr.label(
41*7594170eSAndroid Build Coastguard Worker            allow_single_file = True,
42*7594170eSAndroid Build Coastguard Worker            doc = "public api surface file",
43*7594170eSAndroid Build Coastguard Worker        ),
44*7594170eSAndroid Build Coastguard Worker        "system": attr.label(
45*7594170eSAndroid Build Coastguard Worker            allow_single_file = True,
46*7594170eSAndroid Build Coastguard Worker            doc = "system api surface file",
47*7594170eSAndroid Build Coastguard Worker        ),
48*7594170eSAndroid Build Coastguard Worker        "test": attr.label(
49*7594170eSAndroid Build Coastguard Worker            allow_single_file = True,
50*7594170eSAndroid Build Coastguard Worker            doc = "test api surface file",
51*7594170eSAndroid Build Coastguard Worker        ),
52*7594170eSAndroid Build Coastguard Worker        "module_lib": attr.label(
53*7594170eSAndroid Build Coastguard Worker            allow_single_file = True,
54*7594170eSAndroid Build Coastguard Worker            doc = "module_lib api surface file",
55*7594170eSAndroid Build Coastguard Worker        ),
56*7594170eSAndroid Build Coastguard Worker        "system_server": attr.label(
57*7594170eSAndroid Build Coastguard Worker            allow_single_file = True,
58*7594170eSAndroid Build Coastguard Worker            doc = "system_server api surface file",
59*7594170eSAndroid Build Coastguard Worker        ),
60*7594170eSAndroid Build Coastguard Worker    },
61*7594170eSAndroid Build Coastguard Worker)
62