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 errorprone: { 112 javacflags: [ 113 "-Xep:NoCanIgnoreReturnValueOnClasses:WARN", 114 ], 115 }, 116} 117 118java_library_host { 119 name: "guava-testlib", 120 srcs: ["guava-testlib/src/**/*.java"], 121 libs: [ 122 "error_prone_annotations", 123 "guava", 124 "guava-android-annotation-stubs", 125 "jsr305", 126 "junit", 127 ], 128 java_version: "1.8", 129 errorprone: { 130 javacflags: [ 131 "-Xep:ReturnValueIgnored:WARN", 132 ], 133 }, 134} 135 136// Guava for Android can't compile against an Android bootclasspath, compile 137// it for the host and then use it on the device. It uses reflection to 138// prevent calling into methods that don't exist on Android. 139java_library_host { 140 name: "guava-android-host", 141 srcs: ["android/guava/src/**/*.java"], 142 static_libs: ["guava-both"], 143 libs: [ 144 "guava-android-annotation-stubs", 145 "error_prone_annotations", 146 ], 147 java_version: "1.8", 148 errorprone: { 149 javacflags: [ 150 "-Xep:NoCanIgnoreReturnValueOnClasses:WARN", 151 ], 152 }, 153} 154 155java_host_for_device { 156 name: "guava-android", 157 libs: ["guava-android-host"], 158} 159 160// Compile dummy implementations of annotations used by guava but not 161// present in the Android tree. 162// 30 may not be the lowest min_sdk_version, but the min sdk version 163// for permission controller. 164java_library { 165 name: "guava-android-annotation-stubs", 166 host_supported: true, 167 // b/267831518: Pin tradefed and dependencies to Java 11. 168 java_version: "11", 169 sdk_version: "core_current", 170 min_sdk_version: "30", 171 srcs: ["android-annotation-stubs/src/**/*.java"], 172 apex_available: [ 173 "//apex_available:platform", 174 "//apex_available:anyapex", 175 ], 176} 177 178// Compile guava testlib 179java_library { 180 name: "guava-android-testlib", 181 srcs: ["android/guava-testlib/src/**/*.java"], 182 libs: [ 183 "error_prone_annotations", 184 "guava-android", 185 "guava-android-annotation-stubs", 186 "junit", 187 ], 188 errorprone: { 189 javacflags: [ 190 "-Xep:ReturnValueIgnored:WARN", 191 ], 192 }, 193} 194