• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1package {
2    default_applicable_licenses: ["external_kotlinx.coroutines_license"],
3    default_visibility: ["//visibility:private"],
4}
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
39// 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",
44    srcs: ["kotlinx-coroutines-core/jvm/src/**/*.kt"],
45    common_srcs: [
46        "kotlinx-coroutines-core/common/src/**/*.kt",
47        "kotlinx-coroutines-core/concurrent/src/**/*.kt",
48    ],
49    exclude_srcs: [
50        "kotlinx-coroutines-core/jvm/src/test_/TestCoroutineContext.kt",
51    ],
52    java_resource_dirs: ["kotlinx-coroutines-core/jvm/resources"],
53    static_libs: [
54        "kotlinx_atomicfu",
55    ],
56    libs: [
57        "annotations", // for android.annotation.SuppressLint
58        "kotlinx-coroutines-android-annotation-stubs",
59    ],
60    kotlincflags: [
61        "-Xmulti-platform",
62        "-opt-in=kotlin.RequiresOptIn",
63        "-opt-in=kotlin.experimental.ExperimentalTypeInference",
64        "-opt-in=kotlin.ExperimentalMultiplatform",
65        "-opt-in=kotlinx.coroutines.DelicateCoroutinesApi",
66        "-opt-in=kotlinx.coroutines.ExperimentalCoroutinesApi",
67        "-opt-in=kotlinx.coroutines.ObsoleteCoroutinesApi",
68        "-opt-in=kotlinx.coroutines.InternalCoroutinesApi",
69        "-opt-in=kotlinx.coroutines.FlowPreview",
70    ],
71    apex_available: [
72        "//apex_available:platform",
73        "//apex_available:anyapex",
74    ],
75}
76
77// Expose the host library to Android targets. This is generally an unsafe operation; in using
78// this, we are asserting that any host-only code will never be evaluated at runtime on Android.
79// If we're wrong, we will see runtime exceptions.
80java_host_for_device {
81    name: "kotlinx_coroutines-device",
82    libs: ["kotlinx_coroutines-host"],
83}
84
85// Combine host and Android libs back into a single target.
86java_library {
87    name: "kotlinx_coroutines",
88    host_supported: true,
89    sdk_version: "core_current",
90    min_sdk_version: "28",
91    target: {
92        host: {
93            static_libs: ["kotlinx_coroutines-host"],
94        },
95        android: {
96            static_libs: ["kotlinx_coroutines-device"],
97        },
98    },
99    apex_available: [
100        "//apex_available:platform",
101        "//apex_available:anyapex",
102    ],
103    visibility: ["//visibility:public"],
104}
105
106java_library {
107    name: "kotlinx_coroutines_android",
108    sdk_version: "current",
109    min_sdk_version: "28",
110    srcs: ["ui/kotlinx-coroutines-android/src/**/*.kt"],
111    java_resource_dirs: ["ui/kotlinx-coroutines-android/resources"],
112    kotlincflags: [
113        "-opt-in=kotlinx.coroutines.InternalCoroutinesApi",
114        "-opt-in=kotlinx.coroutines.ExperimentalCoroutinesApi",
115    ],
116    static_libs: [
117        "kotlinx_coroutines",
118    ],
119    libs: [
120        "androidx.annotation_annotation",
121    ],
122    apex_available: [
123        "//apex_available:platform",
124        "//apex_available:anyapex",
125    ],
126    visibility: ["//visibility:public"],
127}
128
129java_library {
130    name: "kotlinx_coroutines_test",
131    host_supported: true,
132    srcs: ["kotlinx-coroutines-test/jvm/src/**/*.kt"],
133    common_srcs: ["kotlinx-coroutines-test/common/src/**/*.kt"],
134    java_resource_dirs: ["kotlinx-coroutines-test/jvm/resources"],
135    kotlincflags: [
136        "-Xmulti-platform",
137        "-opt-in=kotlin.ExperimentalMultiplatform",
138        "-opt-in=kotlinx.coroutines.InternalCoroutinesApi",
139        "-opt-in=kotlinx.coroutines.ExperimentalCoroutinesApi",
140    ],
141    libs: ["kotlinx_coroutines"],
142    apex_available: [
143        "//apex_available:platform",
144        "//apex_available:anyapex",
145    ],
146    visibility: ["//visibility:public"],
147}
148
149// Compile stub implementations of annotations used by kotlinx-coroutines but not present in the
150// Android tree.
151java_library {
152    name: "kotlinx-coroutines-android-annotation-stubs",
153    host_supported: true,
154    sdk_version: "core_current",
155    srcs: ["android-annotation-stubs/src/**/*.java"],
156}
157
158// Temporary aliases for kotlinx-coroutines-core, kotlinx-coroutines-core-jvm and
159// kotlinx-coroutines-android
160
161java_library {
162    name: "kotlinx-coroutines-core",
163    host_supported: true,
164    sdk_version: "core_current",
165    min_sdk_version: "28",
166    static_libs: ["kotlinx_coroutines"],
167    apex_available: [
168        "//apex_available:platform",
169        "//apex_available:anyapex",
170    ],
171    visibility: ["//visibility:public"],
172}
173
174java_library {
175    name: "kotlinx-coroutines-core-jvm",
176    host_supported: true,
177    sdk_version: "core_current",
178    min_sdk_version: "28",
179    static_libs: ["kotlinx_coroutines"],
180    apex_available: [
181        "//apex_available:platform",
182        "//apex_available:anyapex",
183    ],
184    visibility: ["//visibility:public"],
185}
186
187java_library {
188    name: "kotlinx-coroutines-android",
189    sdk_version: "current",
190    min_sdk_version: "28",
191    static_libs: [
192        "kotlinx_coroutines_android",
193        "kotlinx_coroutines",
194    ],
195    apex_available: [
196        "//apex_available:platform",
197        "//apex_available:anyapex",
198    ],
199    visibility: ["//visibility:public"],
200}
201
202filegroup {
203    name: "kotlinx-coroutines-play-services",
204    srcs: ["integration/kotlinx-coroutines-play-services/src/**/*.kt"],
205    visibility: ["//visibility:public"],
206}
207
208// Maven coordinate: org.jetbrains.kotlinx:kotlinx-coroutines-guava
209java_library {
210    name: "kotlinx_coroutines_guava",
211    host_supported: true,
212    srcs: ["integration/kotlinx-coroutines-guava/src/**/*.kt"],
213    kotlincflags: [
214        "-opt-in=kotlin.RequiresOptIn",
215        "-opt-in=kotlinx.coroutines.InternalCoroutinesApi",
216        "-opt-in=kotlinx.coroutines.ExperimentalCoroutinesApi",
217    ],
218    libs: [
219        "kotlinx_coroutines",
220        "kotlin-stdlib-jdk8",
221        "guava",
222    ],
223    apex_available: [
224        "//apex_available:platform",
225        "//apex_available:anyapex",
226    ],
227    visibility: ["//visibility:public"],
228}
229
230