blob: ff46e7409e74b39a22eaa4d1ae0c3087b973b5a9 [file] [log] [blame]
Colin Crossea8fc512017-10-19 15:06:43 -07001//
2// Copyright (C) 2012 The Android Open Source Project
3//
4// Licensed under the Apache License, Version 2.0 (the "License");
5// you may not use this file except in compliance with the License.
6// You may obtain a copy of the License at
7//
8// http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13// See the License for the specific language governing permissions and
14// limitations under the License.
15//
16
Paul Duffin9c099e22019-06-03 13:38:17 +010017package {
18 default_visibility: ["//visibility:private"],
Bob Badoura16c37e2021-02-12 18:10:09 -080019 default_applicable_licenses: ["external_okhttp_license"],
20}
21
22// Added automatically by a large-scale-change
23// See: http://go/android-license-faq
24license {
25 name: "external_okhttp_license",
26 visibility: [":__subpackages__"],
27 license_kinds: [
28 "SPDX-license-identifier-Apache-2.0",
29 ],
30 license_text: [
31 "LICENSE.txt",
32 ],
Paul Duffin9c099e22019-06-03 13:38:17 +010033}
34
Neil Fuller7c21fa42018-09-24 15:37:43 +010035// The source files that contribute to Android's core library APIs.
36filegroup {
37 name: "okhttp_api_files",
Paul Duffin9c099e22019-06-03 13:38:17 +010038 visibility: ["//libcore"],
Paul Duffinaa7ed342018-11-13 14:51:39 +000039 // Use the repackaged version of android as that is what is used by Android core library
40 // APIs.
41 srcs: ["repackaged/android/src/main/java/com/android/okhttp/internalandroidapi/**/*.java"],
Neil Fuller7c21fa42018-09-24 15:37:43 +010042}
Colin Crossea8fc512017-10-19 15:06:43 -070043
Paul Duffin9c099e22019-06-03 13:38:17 +010044nojarjar_visibility = [
Paul Duffin3fd38302020-01-13 16:48:51 +000045 "//art/build/sdk",
Paul Duffin9c099e22019-06-03 13:38:17 +010046 "//cts/tests/libcore/okhttp",
47]
48
Neil Fuller7c21fa42018-09-24 15:37:43 +010049// non-jarjar'd version of okhttp to compile the tests against
50java_library {
51 name: "okhttp-nojarjar",
Paul Duffin9c099e22019-06-03 13:38:17 +010052 visibility: nojarjar_visibility,
Colin Crossea8fc512017-10-19 15:06:43 -070053 srcs: [
Paul Duffin84746082018-11-13 11:45:44 +000054 "android/src/main/java/**/*.java",
Colin Crossea8fc512017-10-19 15:06:43 -070055 "okhttp/src/main/java/**/*.java",
56 "okhttp-urlconnection/src/main/java/**/*.java",
57 "okhttp-android-support/src/main/java/**/*.java",
58 "okio/okio/src/main/java/**/*.java",
59 ],
Neil Fuller7c21fa42018-09-24 15:37:43 +010060 exclude_srcs: ["okhttp/src/main/java/com/squareup/okhttp/internal/Platform.java"],
Colin Crossea8fc512017-10-19 15:06:43 -070061
Neil Fuller7c21fa42018-09-24 15:37:43 +010062 hostdex: true,
Colin Crossea8fc512017-10-19 15:06:43 -070063
Paul Duffin9b9fc8e2019-06-12 11:07:55 +010064 sdk_version: "none",
Paul Duffin6461a1b2019-09-20 14:43:56 +010065 system_modules: "core-all-system-modules",
Neil Fuller4c219c62018-10-04 13:11:17 +010066 libs: [
Paul Duffin30474ef2020-04-08 13:55:30 +010067 "conscrypt.module.intra.core.api",
Neil Fuller4c219c62018-10-04 13:11:17 +010068 ],
Colin Crossea8fc512017-10-19 15:06:43 -070069 java_version: "1.7",
70}
71
Paul Duffin57176b12021-03-09 02:21:23 +000072// The source implementation files, used to build okhttp and core-all. It is
73// used in the latter case to break the cycle where okhttp depends on core-all
74// and core-all depends on okhttp. By including the source into core-all it
75// ensures that the code can all build correctly and then that is used to build
76// the separate parts.
77filegroup {
78 name: "okhttp_impl_files",
79 visibility: ["//libcore"],
80 srcs: [
81 // Although some of the classes in the android/ directory are already in the correct
82 // package and do not need to be moved to another package they are transformed as they
83 // reference other classes that do require repackaging.
84 "repackaged/android/src/main/java/**/*.java",
85 "repackaged/okhttp/src/main/java/**/*.java",
86 "repackaged/okhttp-urlconnection/src/main/java/**/*.java",
87 "repackaged/okhttp-android-support/src/main/java/**/*.java",
88 "repackaged/okio/okio/src/main/java/**/*.java",
89 ],
90}
91
Colin Crossea8fc512017-10-19 15:06:43 -070092java_library {
93 name: "okhttp",
Paul Duffin777d5072019-03-28 14:26:55 +000094 visibility: [
95 "//art/build/apex",
Paul Duffind1b101a2020-03-25 10:47:40 +000096 "//art/build/sdk",
Hadrien Zalek8a32d9f2020-06-29 09:39:00 -070097 "//external/grpc-grpc-java/okhttp",
Paul Duffin777d5072019-03-28 14:26:55 +000098 "//external/robolectric-shadows",
Rex Hoffman04d65d22022-11-13 23:26:58 +000099 "//external/robolectric",
Paul Duffin777d5072019-03-28 14:26:55 +0000100 "//libcore",
Martin Stjernholmaa1d1a42020-12-17 17:54:03 +0000101 "//packages/modules/ArtPrebuilt",
Paul Duffin777d5072019-03-28 14:26:55 +0000102 ],
Karl Shaffer725cb702020-11-02 16:52:45 +0000103 srcs: [
Paul Duffin57176b12021-03-09 02:21:23 +0000104 ":okhttp_impl_files",
Karl Shaffer725cb702020-11-02 16:52:45 +0000105 ],
Neil Fuller7c21fa42018-09-24 15:37:43 +0100106
107 hostdex: true,
108 installable: true,
109
Colin Crossa006ad82020-06-26 09:14:49 -0700110 sdk_version: "none",
Karl Shaffer725cb702020-11-02 16:52:45 +0000111 system_modules: "core-all-system-modules",
112 libs: [
113 "conscrypt.module.intra.core.api",
114 ],
Colin Crossea8fc512017-10-19 15:06:43 -0700115 java_version: "1.7",
Anton Hansson4dcddc92020-01-10 16:00:45 +0000116 apex_available: [
Martin Stjernholm0bb7f772020-10-12 15:11:12 +0100117 "com.android.art",
Anton Hansson4dcddc92020-01-10 16:00:45 +0000118 "com.android.art.debug",
Anton Hansson4dcddc92020-01-10 16:00:45 +0000119 ],
Nicolas Geoffray4863d852021-03-03 21:59:11 +0000120 min_sdk_version: "31",
Colin Crossea8fc512017-10-19 15:06:43 -0700121}
122
Paul Duffin5778f5b2021-04-19 17:45:48 +0100123// Java library for use on host, e.g. by robolectric.
124java_library {
125 name: "okhttp-for-host",
126 visibility: [
127 "//art/build/sdk",
128 "//external/robolectric-shadows",
Rex Hoffman04d65d22022-11-13 23:26:58 +0000129 "//external/robolectric",
Paul Duffin5778f5b2021-04-19 17:45:48 +0100130 ],
131 static_libs: [
132 "okhttp",
133 ],
134 sdk_version: "none",
135 system_modules: "none",
136}
137
Karl Shaffera62ca2b2020-10-28 16:46:46 -0400138// Java Library for both Host and Android that does not use the repackaged okhttp libraries
139// (com.android.okhttp) and instead uses the original (com.squareup.okhttp) packages.
140// This should not end up on the bootclasspath and instead should only be used to build
141// third-party or unbundled applications or libraries that require OkHttp.
142java_library {
143 name: "okhttp-norepackage",
144 host_supported: true,
145
146 visibility: [
Martin Stjernholme65f8162020-11-05 23:10:45 +0000147 "//art/build/sdk",
Karl Shaffera62ca2b2020-10-28 16:46:46 -0400148 "//external/grpc-grpc-java/okhttp",
149 ],
150
151 srcs: [
152 "okhttp/src/main/java/**/*.java",
153 "okhttp-urlconnection/src/main/java/**/*.java",
154 "okio/okio/src/main/java/**/*.java",
155 ":okhttp_version.java",
156 ],
157
Paul Duffinfa94f2e2021-07-08 14:54:43 +0100158 libs: [
159 // Building against "core_current" means that the android.util.Log API
160 // is not available. This provides stubs for it which allows the code to
161 // compile.
162 "okhttp-android-util-log",
163 ],
Karl Shaffera62ca2b2020-10-28 16:46:46 -0400164
165 installable: true,
Paul Duffinfa94f2e2021-07-08 14:54:43 +0100166 // Build against a "core_current" as it cannot use "current" as it has to
167 // build in manifests without frameworks/base.
168 sdk_version: "core_current",
Karl Shaffera62ca2b2020-10-28 16:46:46 -0400169}
170
Colin Crossa006ad82020-06-26 09:14:49 -0700171// Generate Version.java based on the version number from pom.xml.
172genrule {
173 name: "okhttp_version.java",
174 srcs: [
175 "okhttp/src/main/java-templates/com/squareup/okhttp/internal/Version.java",
176 "okhttp/pom.xml",
177 ],
178 out: ["com/squareup/okhttp/internal/Version.java"],
179 cmd: "grep \"<version>\" $(location okhttp/pom.xml) | head -1 |" +
180 " sed -e \"s/\\s*<version>\\(.*\\)<\\/version>/\\1/\" > $(genDir)/version && " +
181 "sed -e \"s/\\$${project.version}/$$(cat $(genDir)/version)/\" " +
182 " $(location okhttp/src/main/java-templates/com/squareup/okhttp/internal/Version.java) " +
183 "> $(out)",
184}
185
186// A library to provide a stub android.util.Log symbol for
187// okhttp/src/main/java/com/squareup/okhttp/internal/Platform.java
Paul Duffinfa94f2e2021-07-08 14:54:43 +0100188java_library {
Colin Crossa006ad82020-06-26 09:14:49 -0700189 name: "okhttp-android-util-log",
Paul Duffinfa94f2e2021-07-08 14:54:43 +0100190 host_supported: true,
Colin Crossa006ad82020-06-26 09:14:49 -0700191 srcs: ["okhttp-android-util-log/src/main/java/**/*.java"],
Paul Duffinfa94f2e2021-07-08 14:54:43 +0100192 sdk_version: "core_current",
Colin Crossa006ad82020-06-26 09:14:49 -0700193}
194
Paul Duffin9c099e22019-06-03 13:38:17 +0100195java_library {
Colin Crossea8fc512017-10-19 15:06:43 -0700196 name: "okhttp-tests-nojarjar",
Paul Duffin9c099e22019-06-03 13:38:17 +0100197 visibility: nojarjar_visibility,
Colin Crossea8fc512017-10-19 15:06:43 -0700198 srcs: [
199 "android/test/java/**/*.java",
200 "okhttp-android-support/src/test/java/**/*.java",
201 "okhttp-testing-support/src/main/java/**/*.java",
202 "okhttp-tests/src/test/java/**/*.java",
203 "okhttp-urlconnection/src/test/java/**/*.java",
204 "okhttp-ws/src/main/java/**/*.java",
205 "okhttp-ws-tests/src/test/java/**/*.java",
206 "okio/okio/src/test/java/**/*.java",
207 "mockwebserver/src/main/java/**/*.java",
208 "mockwebserver/src/test/java/**/*.java",
209 ],
210 // Exclude test Android currently has problems with due to @Parameterized (requires JUnit 4.11).
211 exclude_srcs: ["okhttp-tests/src/test/java/com/squareup/okhttp/WebPlatformUrlTest.java"],
Neil Fuller7c21fa42018-09-24 15:37:43 +0100212
Paul Duffin9b9fc8e2019-06-12 11:07:55 +0100213 sdk_version: "none",
Paul Duffin6461a1b2019-09-20 14:43:56 +0100214 system_modules: "core-all-system-modules",
Colin Crossea8fc512017-10-19 15:06:43 -0700215 libs: [
216 "okhttp-nojarjar",
217 "junit",
Paul Duffin30474ef2020-04-08 13:55:30 +0100218 "conscrypt.module.intra.core.api",
Narayan Kamath34f350f2018-03-01 12:33:49 +0000219 "bouncycastle-unbundled",
Colin Crossea8fc512017-10-19 15:06:43 -0700220 ],
Neil Fuller1a022c12018-10-09 17:44:35 +0100221
Colin Crossea8fc512017-10-19 15:06:43 -0700222 java_version: "1.7",
223}