You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

219 lines
6.7 KiB

//
// Copyright (C) 2012 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
package {
default_visibility: ["//visibility:private"],
default_applicable_licenses: ["external_okhttp_license"],
}
// Added automatically by a large-scale-change
// See: http://go/android-license-faq
license {
name: "external_okhttp_license",
visibility: [":__subpackages__"],
license_kinds: [
"SPDX-license-identifier-Apache-2.0",
],
license_text: [
"LICENSE.txt",
],
}
// The source files that contribute to Android's core library APIs.
filegroup {
name: "okhttp_api_files",
visibility: ["//libcore"],
// Use the repackaged version of android as that is what is used by Android core library
// APIs.
srcs: ["repackaged/android/src/main/java/com/android/okhttp/internalandroidapi/**/*.java"],
}
nojarjar_visibility = [
"//art/build/sdk",
"//cts/tests/libcore/okhttp",
]
// non-jarjar'd version of okhttp to compile the tests against
java_library {
name: "okhttp-nojarjar",
visibility: nojarjar_visibility,
srcs: [
"android/src/main/java/**/*.java",
"okhttp/src/main/java/**/*.java",
"okhttp-urlconnection/src/main/java/**/*.java",
"okhttp-android-support/src/main/java/**/*.java",
"okio/okio/src/main/java/**/*.java",
],
exclude_srcs: ["okhttp/src/main/java/com/squareup/okhttp/internal/Platform.java"],
hostdex: true,
sdk_version: "none",
system_modules: "core-all-system-modules",
libs: [
"conscrypt.module.intra.core.api",
],
java_version: "1.7",
}
// The source implementation files, used to build okhttp and core-all. It is
// used in the latter case to break the cycle where okhttp depends on core-all
// and core-all depends on okhttp. By including the source into core-all it
// ensures that the code can all build correctly and then that is used to build
// the separate parts.
filegroup {
name: "okhttp_impl_files",
visibility: ["//libcore"],
srcs: [
// Although some of the classes in the android/ directory are already in the correct
// package and do not need to be moved to another package they are transformed as they
// reference other classes that do require repackaging.
"repackaged/android/src/main/java/**/*.java",
"repackaged/okhttp/src/main/java/**/*.java",
"repackaged/okhttp-urlconnection/src/main/java/**/*.java",
"repackaged/okhttp-android-support/src/main/java/**/*.java",
"repackaged/okio/okio/src/main/java/**/*.java",
],
}
java_library {
name: "okhttp",
visibility: [
"//art/build/apex",
"//art/build/sdk",
"//external/grpc-grpc-java/okhttp",
"//external/robolectric-shadows",
"//libcore",
"//packages/modules/ArtPrebuilt",
],
srcs: [
":okhttp_impl_files",
],
hostdex: true,
installable: true,
sdk_version: "none",
system_modules: "core-all-system-modules",
libs: [
"conscrypt.module.intra.core.api",
],
java_version: "1.7",
apex_available: [
"com.android.art",
"com.android.art.debug",
],
min_sdk_version: "31",
}
// Java library for use on host, e.g. by robolectric.
java_library {
name: "okhttp-for-host",
visibility: [
"//art/build/sdk",
"//external/robolectric-shadows",
],
static_libs: [
"okhttp",
],
sdk_version: "none",
system_modules: "none",
}
// Java Library for both Host and Android that does not use the repackaged okhttp libraries
// (com.android.okhttp) and instead uses the original (com.squareup.okhttp) packages.
// This should not end up on the bootclasspath and instead should only be used to build
// third-party or unbundled applications or libraries that require OkHttp.
java_library {
name: "okhttp-norepackage",
host_supported: true,
visibility: [
"//art/build/sdk",
"//external/grpc-grpc-java/okhttp",
],
srcs: [
"okhttp/src/main/java/**/*.java",
"okhttp-urlconnection/src/main/java/**/*.java",
"okio/okio/src/main/java/**/*.java",
":okhttp_version.java",
],
target: {
host: {
libs: [
"okhttp-android-util-log",
],
},
},
installable: true,
sdk_version: "current",
}
// Generate Version.java based on the version number from pom.xml.
genrule {
name: "okhttp_version.java",
srcs: [
"okhttp/src/main/java-templates/com/squareup/okhttp/internal/Version.java",
"okhttp/pom.xml",
],
out: ["com/squareup/okhttp/internal/Version.java"],
cmd: "grep \"<version>\" $(location okhttp/pom.xml) | head -1 |" +
" sed -e \"s/\\s*<version>\\(.*\\)<\\/version>/\\1/\" > $(genDir)/version && " +
"sed -e \"s/\\$${project.version}/$$(cat $(genDir)/version)/\" " +
" $(location okhttp/src/main/java-templates/com/squareup/okhttp/internal/Version.java) " +
"> $(out)",
}
// A library to provide a stub android.util.Log symbol for
// okhttp/src/main/java/com/squareup/okhttp/internal/Platform.java
java_library_host {
name: "okhttp-android-util-log",
srcs: ["okhttp-android-util-log/src/main/java/**/*.java"],
}
java_library {
name: "okhttp-tests-nojarjar",
visibility: nojarjar_visibility,
srcs: [
"android/test/java/**/*.java",
"okhttp-android-support/src/test/java/**/*.java",
"okhttp-testing-support/src/main/java/**/*.java",
"okhttp-tests/src/test/java/**/*.java",
"okhttp-urlconnection/src/test/java/**/*.java",
"okhttp-ws/src/main/java/**/*.java",
"okhttp-ws-tests/src/test/java/**/*.java",
"okio/okio/src/test/java/**/*.java",
"mockwebserver/src/main/java/**/*.java",
"mockwebserver/src/test/java/**/*.java",
],
// Exclude test Android currently has problems with due to @Parameterized (requires JUnit 4.11).
exclude_srcs: ["okhttp-tests/src/test/java/com/squareup/okhttp/WebPlatformUrlTest.java"],
sdk_version: "none",
system_modules: "core-all-system-modules",
libs: [
"okhttp-nojarjar",
"junit",
"conscrypt.module.intra.core.api",
"bouncycastle-unbundled",
],
java_version: "1.7",
}