blob: 795e5b0a96e05cec8725b3f8b96a7236b698603d [file] [log] [blame]
Bob Badoura060d412021-02-12 14:45:18 -08001package {
2 default_applicable_licenses: ["external_kotlinx.coroutines_license"],
Steve Elliottca095be2022-07-25 14:26:10 +00003 default_visibility: ["//visibility:private"],
Bob Badoura060d412021-02-12 14:45:18 -08004}
5
6// Added automatically by a large-scale-change that took the approach of
7// 'apply every license found to every target'. While this makes sure we respect
8// every license restriction, it may not be entirely correct.
9//
10// e.g. GPL in an MIT project might only apply to the contrib/ directory.
11//
12// Please consider splitting the single license below into multiple licenses,
13// taking care not to lose any license_kind information, and overriding the
14// default license using the 'licenses: [...]' property on targets as needed.
15//
16// For unused files, consider creating a 'fileGroup' with "//visibility:private"
17// to attach the license to, and including a comment whether the files may be
18// used in the current project.
19//
20// large-scale-change included anything that looked like it might be a license
21// text as a license_text. e.g. LICENSE, NOTICE, COPYING etc.
22//
23// Please consider removing redundant or irrelevant files from 'license_text:'.
24// See: http://go/android-license-faq
25license {
26 name: "external_kotlinx.coroutines_license",
27 visibility: [":__subpackages__"],
28 license_kinds: [
29 "SPDX-license-identifier-Apache-2.0",
30 "SPDX-license-identifier-MIT",
31 ],
32 license_text: [
33 "LICENSE",
34 "LICENSE.txt",
35 "license/**/*",
36 ],
37}
38
Steve Elliottca095be2022-07-25 14:26:10 +000039// Upstream compiles this lib against the JVM bootclasspath; compiling against the Android
40// bootclasspath will fail. Work around this by defining this as a java_library_host, and use
41// java_host_for_device to expose it to Android targets.
42java_library_host {
43 name: "kotlinx_coroutines-host",
Colin Cross905a53f2020-06-25 19:12:23 -070044 srcs: ["kotlinx-coroutines-core/jvm/src/**/*.kt"],
Steve Elliottca095be2022-07-25 14:26:10 +000045 common_srcs: [
46 "kotlinx-coroutines-core/common/src/**/*.kt",
47 "kotlinx-coroutines-core/concurrent/src/**/*.kt",
48 ],
Colin Cross905a53f2020-06-25 19:12:23 -070049 exclude_srcs: [
50 "kotlinx-coroutines-core/jvm/src/debug/**/*.kt",
51 "kotlinx-coroutines-core/jvm/src/test_/TestCoroutineContext.kt",
52 ],
Colin Cross361f4f62021-08-03 13:36:05 -070053 java_resource_dirs: ["kotlinx-coroutines-core/jvm/resources"],
Colin Cross905a53f2020-06-25 19:12:23 -070054 static_libs: [
55 "kotlinx_atomicfu",
56 ],
Steve Elliottca095be2022-07-25 14:26:10 +000057 libs: [
58 "annotations", // for android.annotation.SuppressLint
59 "kotlinx-coroutines-android-annotation-stubs",
60 ],
Colin Cross905a53f2020-06-25 19:12:23 -070061 kotlincflags: [
62 "-Xmulti-platform",
Colin Cross53eee302022-06-23 15:36:42 -070063 "-opt-in=kotlin.RequiresOptIn",
64 "-opt-in=kotlin.experimental.ExperimentalTypeInference",
65 "-opt-in=kotlin.ExperimentalMultiplatform",
66 "-opt-in=kotlinx.coroutines.DelicateCoroutinesApi",
67 "-opt-in=kotlinx.coroutines.ExperimentalCoroutinesApi",
68 "-opt-in=kotlinx.coroutines.ObsoleteCoroutinesApi",
69 "-opt-in=kotlinx.coroutines.InternalCoroutinesApi",
70 "-opt-in=kotlinx.coroutines.FlowPreview",
Colin Cross905a53f2020-06-25 19:12:23 -070071 ],
Colin Crossb5da2582021-07-30 16:43:21 -070072 apex_available: [
73 "//apex_available:platform",
Steve Elliottca095be2022-07-25 14:26:10 +000074 "//apex_available:anyapex",
Colin Crossb5da2582021-07-30 16:43:21 -070075 ],
Colin Cross905a53f2020-06-25 19:12:23 -070076}
Colin Cross9b946d02020-07-17 15:12:08 -070077
Steve Elliottca095be2022-07-25 14:26:10 +000078// Expose the host library to Android targets. This is generally an unsafe operation; in using
79// this, we are asserting that any host-only code will never be evaluated at runtime on Android.
80// If we're wrong, we will see runtime exceptions.
81java_host_for_device {
82 name: "kotlinx_coroutines-device",
83 libs: ["kotlinx_coroutines-host"],
84}
85
86// Combine host and Android libs back into a single target.
87java_library {
88 name: "kotlinx_coroutines",
89 host_supported: true,
90 sdk_version: "core_current",
91 min_sdk_version: "28",
92 target: {
93 host: {
94 static_libs: ["kotlinx_coroutines-host"],
95 },
96 android: {
97 static_libs: ["kotlinx_coroutines-device"],
98 },
99 },
100 apex_available: [
101 "//apex_available:platform",
102 "//apex_available:anyapex",
103 ],
104 visibility: ["//visibility:public"],
105}
106
Colin Cross9b946d02020-07-17 15:12:08 -0700107java_library {
108 name: "kotlinx_coroutines_android",
Cole Faust4963ba02022-06-28 15:59:28 -0700109 sdk_version: "current",
110 min_sdk_version: "28",
Colin Cross9b946d02020-07-17 15:12:08 -0700111 srcs: ["ui/kotlinx-coroutines-android/src/**/*.kt"],
Colin Cross361f4f62021-08-03 13:36:05 -0700112 java_resource_dirs: ["ui/kotlinx-coroutines-android/resources"],
Colin Cross9b946d02020-07-17 15:12:08 -0700113 kotlincflags: [
Colin Cross53eee302022-06-23 15:36:42 -0700114 "-opt-in=kotlinx.coroutines.InternalCoroutinesApi",
115 "-opt-in=kotlinx.coroutines.ExperimentalCoroutinesApi",
Colin Cross9b946d02020-07-17 15:12:08 -0700116 ],
Colin Cross70e65152022-09-22 16:51:25 -0700117 static_libs: [
Colin Cross9b946d02020-07-17 15:12:08 -0700118 "kotlinx_coroutines",
Colin Cross70e65152022-09-22 16:51:25 -0700119 ],
120 libs: [
Colin Cross9b946d02020-07-17 15:12:08 -0700121 "androidx.annotation_annotation",
122 ],
Colin Crossb5da2582021-07-30 16:43:21 -0700123 apex_available: [
124 "//apex_available:platform",
Steve Elliottca095be2022-07-25 14:26:10 +0000125 "//apex_available:anyapex",
Colin Crossb5da2582021-07-30 16:43:21 -0700126 ],
Steve Elliottca095be2022-07-25 14:26:10 +0000127 visibility: ["//visibility:public"],
Colin Cross9b946d02020-07-17 15:12:08 -0700128}
Colin Cross39c97452021-07-30 12:16:41 -0700129
130java_library {
131 name: "kotlinx_coroutines_test",
132 host_supported: true,
Steve Elliottca095be2022-07-25 14:26:10 +0000133 srcs: ["kotlinx-coroutines-test/jvm/src/**/*.kt"],
134 common_srcs: ["kotlinx-coroutines-test/common/src/**/*.kt"],
135 java_resource_dirs: ["kotlinx-coroutines-test/jvm/resources"],
Colin Cross39c97452021-07-30 12:16:41 -0700136 kotlincflags: [
Steve Elliottca095be2022-07-25 14:26:10 +0000137 "-Xmulti-platform",
138 "-opt-in=kotlin.ExperimentalMultiplatform",
Colin Cross53eee302022-06-23 15:36:42 -0700139 "-opt-in=kotlinx.coroutines.InternalCoroutinesApi",
140 "-opt-in=kotlinx.coroutines.ExperimentalCoroutinesApi",
Colin Cross39c97452021-07-30 12:16:41 -0700141 ],
Steve Elliottca095be2022-07-25 14:26:10 +0000142 libs: ["kotlinx_coroutines"],
Colin Crossb5da2582021-07-30 16:43:21 -0700143 apex_available: [
144 "//apex_available:platform",
Steve Elliottca095be2022-07-25 14:26:10 +0000145 "//apex_available:anyapex",
Colin Crossb5da2582021-07-30 16:43:21 -0700146 ],
Steve Elliottca095be2022-07-25 14:26:10 +0000147 visibility: ["//visibility:public"],
Colin Crossb5da2582021-07-30 16:43:21 -0700148}
149
Steve Elliottca095be2022-07-25 14:26:10 +0000150
151// Compile stub implementations of annotations used by kotlinx-coroutines but not present in the
152// Android tree.
153java_library {
154 name: "kotlinx-coroutines-android-annotation-stubs",
155 host_supported: true,
156 sdk_version: "core_current",
157 srcs: ["android-annotation-stubs/src/**/*.java"],
158}
159
160// Temporary aliases for kotlinx-coroutines-core, kotlinx-coroutines-core-jvm and
161// kotlinx-coroutines-android
Colin Crossb5da2582021-07-30 16:43:21 -0700162
163java_library {
164 name: "kotlinx-coroutines-core",
165 host_supported: true,
Cole Faust4963ba02022-06-28 15:59:28 -0700166 sdk_version: "core_current",
167 min_sdk_version: "28",
Colin Crossb5da2582021-07-30 16:43:21 -0700168 static_libs: ["kotlinx_coroutines"],
169 apex_available: [
170 "//apex_available:platform",
Steve Elliottca095be2022-07-25 14:26:10 +0000171 "//apex_available:anyapex",
Colin Crossb5da2582021-07-30 16:43:21 -0700172 ],
Steve Elliottca095be2022-07-25 14:26:10 +0000173 visibility: ["//visibility:public"],
Colin Crossb5da2582021-07-30 16:43:21 -0700174}
175
176java_library {
177 name: "kotlinx-coroutines-core-jvm",
178 host_supported: true,
Cole Faust4963ba02022-06-28 15:59:28 -0700179 sdk_version: "core_current",
180 min_sdk_version: "28",
Colin Crossb5da2582021-07-30 16:43:21 -0700181 static_libs: ["kotlinx_coroutines"],
182 apex_available: [
183 "//apex_available:platform",
Steve Elliottca095be2022-07-25 14:26:10 +0000184 "//apex_available:anyapex",
Colin Crossb5da2582021-07-30 16:43:21 -0700185 ],
Steve Elliottca095be2022-07-25 14:26:10 +0000186 visibility: ["//visibility:public"],
Colin Crossb5da2582021-07-30 16:43:21 -0700187}
188
189java_library {
190 name: "kotlinx-coroutines-android",
Cole Faust4963ba02022-06-28 15:59:28 -0700191 sdk_version: "current",
192 min_sdk_version: "28",
Colin Crossb5da2582021-07-30 16:43:21 -0700193 static_libs: [
194 "kotlinx_coroutines_android",
195 "kotlinx_coroutines",
196 ],
197 apex_available: [
198 "//apex_available:platform",
Steve Elliottca095be2022-07-25 14:26:10 +0000199 "//apex_available:anyapex",
Colin Crossb5da2582021-07-30 16:43:21 -0700200 ],
Steve Elliottca095be2022-07-25 14:26:10 +0000201 visibility: ["//visibility:public"],
Colin Cross39c97452021-07-30 12:16:41 -0700202}
Anubha Kushwaha76874392022-04-13 21:56:03 +0000203
204filegroup {
205 name: "kotlinx-coroutines-play-services",
206 srcs: ["integration/kotlinx-coroutines-play-services/src/**/*.kt"],
207}