blob: 795e5b0a96e05cec8725b3f8b96a7236b698603d [file] [log] [blame]
package {
default_applicable_licenses: ["external_kotlinx.coroutines_license"],
default_visibility: ["//visibility:private"],
}
// Added automatically by a large-scale-change that took the approach of
// 'apply every license found to every target'. While this makes sure we respect
// every license restriction, it may not be entirely correct.
//
// e.g. GPL in an MIT project might only apply to the contrib/ directory.
//
// Please consider splitting the single license below into multiple licenses,
// taking care not to lose any license_kind information, and overriding the
// default license using the 'licenses: [...]' property on targets as needed.
//
// For unused files, consider creating a 'fileGroup' with "//visibility:private"
// to attach the license to, and including a comment whether the files may be
// used in the current project.
//
// large-scale-change included anything that looked like it might be a license
// text as a license_text. e.g. LICENSE, NOTICE, COPYING etc.
//
// Please consider removing redundant or irrelevant files from 'license_text:'.
// See: http://go/android-license-faq
license {
name: "external_kotlinx.coroutines_license",
visibility: [":__subpackages__"],
license_kinds: [
"SPDX-license-identifier-Apache-2.0",
"SPDX-license-identifier-MIT",
],
license_text: [
"LICENSE",
"LICENSE.txt",
"license/**/*",
],
}
// Upstream compiles this lib against the JVM bootclasspath; compiling against the Android
// bootclasspath will fail. Work around this by defining this as a java_library_host, and use
// java_host_for_device to expose it to Android targets.
java_library_host {
name: "kotlinx_coroutines-host",
srcs: ["kotlinx-coroutines-core/jvm/src/**/*.kt"],
common_srcs: [
"kotlinx-coroutines-core/common/src/**/*.kt",
"kotlinx-coroutines-core/concurrent/src/**/*.kt",
],
exclude_srcs: [
"kotlinx-coroutines-core/jvm/src/debug/**/*.kt",
"kotlinx-coroutines-core/jvm/src/test_/TestCoroutineContext.kt",
],
java_resource_dirs: ["kotlinx-coroutines-core/jvm/resources"],
static_libs: [
"kotlinx_atomicfu",
],
libs: [
"annotations", // for android.annotation.SuppressLint
"kotlinx-coroutines-android-annotation-stubs",
],
kotlincflags: [
"-Xmulti-platform",
"-opt-in=kotlin.RequiresOptIn",
"-opt-in=kotlin.experimental.ExperimentalTypeInference",
"-opt-in=kotlin.ExperimentalMultiplatform",
"-opt-in=kotlinx.coroutines.DelicateCoroutinesApi",
"-opt-in=kotlinx.coroutines.ExperimentalCoroutinesApi",
"-opt-in=kotlinx.coroutines.ObsoleteCoroutinesApi",
"-opt-in=kotlinx.coroutines.InternalCoroutinesApi",
"-opt-in=kotlinx.coroutines.FlowPreview",
],
apex_available: [
"//apex_available:platform",
"//apex_available:anyapex",
],
}
// Expose the host library to Android targets. This is generally an unsafe operation; in using
// this, we are asserting that any host-only code will never be evaluated at runtime on Android.
// If we're wrong, we will see runtime exceptions.
java_host_for_device {
name: "kotlinx_coroutines-device",
libs: ["kotlinx_coroutines-host"],
}
// Combine host and Android libs back into a single target.
java_library {
name: "kotlinx_coroutines",
host_supported: true,
sdk_version: "core_current",
min_sdk_version: "28",
target: {
host: {
static_libs: ["kotlinx_coroutines-host"],
},
android: {
static_libs: ["kotlinx_coroutines-device"],
},
},
apex_available: [
"//apex_available:platform",
"//apex_available:anyapex",
],
visibility: ["//visibility:public"],
}
java_library {
name: "kotlinx_coroutines_android",
sdk_version: "current",
min_sdk_version: "28",
srcs: ["ui/kotlinx-coroutines-android/src/**/*.kt"],
java_resource_dirs: ["ui/kotlinx-coroutines-android/resources"],
kotlincflags: [
"-opt-in=kotlinx.coroutines.InternalCoroutinesApi",
"-opt-in=kotlinx.coroutines.ExperimentalCoroutinesApi",
],
static_libs: [
"kotlinx_coroutines",
],
libs: [
"androidx.annotation_annotation",
],
apex_available: [
"//apex_available:platform",
"//apex_available:anyapex",
],
visibility: ["//visibility:public"],
}
java_library {
name: "kotlinx_coroutines_test",
host_supported: true,
srcs: ["kotlinx-coroutines-test/jvm/src/**/*.kt"],
common_srcs: ["kotlinx-coroutines-test/common/src/**/*.kt"],
java_resource_dirs: ["kotlinx-coroutines-test/jvm/resources"],
kotlincflags: [
"-Xmulti-platform",
"-opt-in=kotlin.ExperimentalMultiplatform",
"-opt-in=kotlinx.coroutines.InternalCoroutinesApi",
"-opt-in=kotlinx.coroutines.ExperimentalCoroutinesApi",
],
libs: ["kotlinx_coroutines"],
apex_available: [
"//apex_available:platform",
"//apex_available:anyapex",
],
visibility: ["//visibility:public"],
}
// Compile stub implementations of annotations used by kotlinx-coroutines but not present in the
// Android tree.
java_library {
name: "kotlinx-coroutines-android-annotation-stubs",
host_supported: true,
sdk_version: "core_current",
srcs: ["android-annotation-stubs/src/**/*.java"],
}
// Temporary aliases for kotlinx-coroutines-core, kotlinx-coroutines-core-jvm and
// kotlinx-coroutines-android
java_library {
name: "kotlinx-coroutines-core",
host_supported: true,
sdk_version: "core_current",
min_sdk_version: "28",
static_libs: ["kotlinx_coroutines"],
apex_available: [
"//apex_available:platform",
"//apex_available:anyapex",
],
visibility: ["//visibility:public"],
}
java_library {
name: "kotlinx-coroutines-core-jvm",
host_supported: true,
sdk_version: "core_current",
min_sdk_version: "28",
static_libs: ["kotlinx_coroutines"],
apex_available: [
"//apex_available:platform",
"//apex_available:anyapex",
],
visibility: ["//visibility:public"],
}
java_library {
name: "kotlinx-coroutines-android",
sdk_version: "current",
min_sdk_version: "28",
static_libs: [
"kotlinx_coroutines_android",
"kotlinx_coroutines",
],
apex_available: [
"//apex_available:platform",
"//apex_available:anyapex",
],
visibility: ["//visibility:public"],
}
filegroup {
name: "kotlinx-coroutines-play-services",
srcs: ["integration/kotlinx-coroutines-play-services/src/**/*.kt"],
}