xref: /aosp_15_r20/external/gson/Android.bp (revision a8de600362638ea28fd6cb3225451dc706d269bb)
1// Copyright (C) 2022 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_gson_license"],
17}
18
19license {
20    name: "external_gson_license",
21    visibility: [":__subpackages__"],
22    license_kinds: [
23        "SPDX-license-identifier-Apache-2.0",
24    ],
25    license_text: [
26        "LICENSE",
27    ],
28}
29
30java_library {
31    name: "gson",
32    host_supported: true,
33    srcs: [
34        "gson/src/main/java/com/google/gson/**/*.java",
35        ":GsonBuildConfig.java",
36    ],
37    sdk_version: "current",
38    min_sdk_version: "30",
39    // b/267831518: Pin tradefed and dependencies to Java 11.
40    java_version: "11",
41    target: {
42        windows: {
43            enabled: true,
44        },
45    },
46    apex_available: [
47        "//apex_available:platform",
48        "//apex_available:anyapex",
49    ],
50}
51
52python_binary_host {
53    name: "gson_version_generator",
54    main: "version_generator.py",
55    srcs: ["version_generator.py"],
56}
57
58genrule {
59    name: "GsonBuildConfig.java",
60    srcs: [
61        "gson/src/main/java-templates/com/google/gson/internal/GsonBuildConfig.java",
62        "pom.xml",
63    ],
64    out: ["com/google/gson/internal/GsonBuildConfig.java"],
65    cmd: "$(location gson_version_generator) $(in) > $(out)",
66    tools: ["gson_version_generator"],
67}
68