• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Copyright (C) 2010 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_guava_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//
33// large-scale-change included anything that looked like it might be a license
34// text as a license_text. e.g. LICENSE, NOTICE, COPYING etc.
35//
36// Please consider removing redundant or irrelevant files from 'license_text:'.
37// See: http://go/android-license-faq
38license {
39    name: "external_guava_license",
40    visibility: [":__subpackages__"],
41    license_kinds: [
42        "SPDX-license-identifier-Apache-2.0",
43        "SPDX-license-identifier-CC0-1.0",
44        "legacy_unencumbered",
45    ],
46    license_text: [
47        "COPYING",
48        "NOTICE",
49    ],
50}
51
52// Instructions for updating the guava version
53//
54// Guava updates must be merged to AOSP first. Make sure you are not using a
55// shallow copy of the Android tree to run the following instructions:
56//
57// 1. File a bug to generate a branch with the version you want to update to.
58//    You can use b/209469232 as starting point. This step will generate an
59//    upstream branch.
60// 2. Create your work branch using `repo start <your_branch_name>`.
61// 3. Fetch the upstream branch using `git fetch aosp <upstream_branch_name>`.
62// 4. Run the merge using `git merge FETCH_HEAD`.
63// 5. Update the METADATA file in this directory to reflect your changes.
64//
65// Note: When running `repo upload` to generate the CL, repo will produce a
66// warning about the number of commits you are trying to upload. This is
67// expected, and you can accept safely (a single gerrit "merge commit" change
68// will be created).
69
70java_library {
71    name: "guava",
72    host_supported: true,
73    hostdex: true,
74    sdk_version: "core_current",
75    target: {
76        android: {
77            static_libs: ["guava-android"],
78        },
79        host: {
80            static_libs: ["guava-jre"],
81        },
82    },
83    apex_available: [
84        "//apex_available:platform",
85        "//apex_available:anyapex",
86    ],
87}
88
89java_library {
90    name: "guava-both",
91    host_supported: true,
92    sdk_version: "core_current",
93    srcs: ["futures/failureaccess/**/*.java"],
94    static_libs: ["jsr305"],
95    libs: [
96        "guava-android-annotation-stubs",
97        "error_prone_annotations",
98    ],
99    java_version: "1.8",
100}
101
102java_library_host {
103    name: "guava-jre",
104    srcs: ["guava/src/**/*.java"],
105    static_libs: ["guava-both"],
106    libs: [
107        "guava-android-annotation-stubs",
108        "error_prone_annotations",
109    ],
110    java_version: "1.8",
111}
112
113java_library_host {
114    name: "guava-testlib",
115    srcs: ["guava-testlib/src/**/*.java"],
116    libs: [
117         "error_prone_annotations",
118         "guava",
119         "guava-android-annotation-stubs",
120         "jsr305",
121         "junit",
122    ],
123    java_version: "1.8",
124}
125
126// Guava for Android can't compile against an Android bootclasspath, compile
127// it for the host and then use it on the device.  It uses reflection to
128// prevent calling into methods that don't exist on Android.
129java_library_host {
130    name: "guava-android-host",
131    srcs: ["android/guava/src/**/*.java"],
132    static_libs: ["guava-both"],
133    libs: [
134        "guava-android-annotation-stubs",
135        "error_prone_annotations",
136    ],
137    java_version: "1.8",
138}
139
140java_host_for_device {
141    name: "guava-android",
142    libs: ["guava-android-host"],
143}
144
145// Compatibility name for existing host modules
146java_library_host {
147    name: "guavalib",
148    static_libs: ["guava"],
149}
150
151// Compile dummy implementations of annotations used by guava but not
152// present in the Android tree.
153java_library {
154    name: "guava-android-annotation-stubs",
155    host_supported: true,
156    sdk_version: "core_current",
157    srcs: ["android-annotation-stubs/src/**/*.java"],
158}
159
160// Compile guava testlib
161java_library {
162    name: "guava-android-testlib",
163    srcs: ["android/guava-testlib/src/**/*.java"],
164    libs: [
165        "error_prone_annotations",
166        "guava-android",
167        "guava-android-annotation-stubs",
168        "junit",
169    ],
170}
171