• 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/debug/**/*.kt",
51        "kotlinx-coroutines-core/jvm/src/test_/TestCoroutineContext.kt",
52    ],
53    java_resource_dirs: ["kotlinx-coroutines-core/jvm/resources"],
54    static_libs: [
55        "kotlinx_atomicfu",
56    ],
57    libs: [
58        "annotations", // for android.annotation.SuppressLint
59        "kotlinx-coroutines-android-annotation-stubs",
60    ],
61    kotlincflags: [
62        "-Xmulti-platform",
63        "-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",
71    ],
72    apex_available: [
73        "//apex_available:platform",
74        "//apex_available:anyapex",
75    ],
76}
77
78// 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
107java_library {
108    name: "kotlinx_coroutines_android",
109    sdk_version: "current",
110    min_sdk_version: "28",
111    srcs: ["ui/kotlinx-coroutines-android/src/**/*.kt"],
112    java_resource_dirs: ["ui/kotlinx-coroutines-android/resources"],
113    kotlincflags: [
114        "-opt-in=kotlinx.coroutines.InternalCoroutinesApi",
115        "-opt-in=kotlinx.coroutines.ExperimentalCoroutinesApi",
116    ],
117    static_libs: [
118        "kotlinx_coroutines",
119    ],
120    libs: [
121        "androidx.annotation_annotation",
122    ],
123    apex_available: [
124        "//apex_available:platform",
125        "//apex_available:anyapex",
126    ],
127    visibility: ["//visibility:public"],
128}
129
130java_library {
131    name: "kotlinx_coroutines_test",
132    host_supported: true,
133    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"],
136    kotlincflags: [
137        "-Xmulti-platform",
138        "-opt-in=kotlin.ExperimentalMultiplatform",
139        "-opt-in=kotlinx.coroutines.InternalCoroutinesApi",
140        "-opt-in=kotlinx.coroutines.ExperimentalCoroutinesApi",
141    ],
142    libs: ["kotlinx_coroutines"],
143    apex_available: [
144        "//apex_available:platform",
145        "//apex_available:anyapex",
146    ],
147    visibility: ["//visibility:public"],
148}
149
150
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
162
163java_library {
164    name: "kotlinx-coroutines-core",
165    host_supported: true,
166    sdk_version: "core_current",
167    min_sdk_version: "28",
168    static_libs: ["kotlinx_coroutines"],
169    apex_available: [
170        "//apex_available:platform",
171        "//apex_available:anyapex",
172    ],
173    visibility: ["//visibility:public"],
174}
175
176java_library {
177    name: "kotlinx-coroutines-core-jvm",
178    host_supported: true,
179    sdk_version: "core_current",
180    min_sdk_version: "28",
181    static_libs: ["kotlinx_coroutines"],
182    apex_available: [
183        "//apex_available:platform",
184        "//apex_available:anyapex",
185    ],
186    visibility: ["//visibility:public"],
187}
188
189java_library {
190    name: "kotlinx-coroutines-android",
191    sdk_version: "current",
192    min_sdk_version: "28",
193    static_libs: [
194        "kotlinx_coroutines_android",
195        "kotlinx_coroutines",
196    ],
197    apex_available: [
198        "//apex_available:platform",
199        "//apex_available:anyapex",
200    ],
201    visibility: ["//visibility:public"],
202}
203
204filegroup {
205    name: "kotlinx-coroutines-play-services",
206    srcs: ["integration/kotlinx-coroutines-play-services/src/**/*.kt"],
207    visibility: ["//visibility:public"],
208}
209