|
16 | 16 |
|
17 | 17 | import com.google.firebase.dataconnect.gradle.plugin.DataConnectExecutableVersionsRegistry
|
18 | 18 | import com.google.firebase.dataconnect.gradle.plugin.UpdateDataConnectExecutableVersionsTask
|
19 |
| -import org.gradle.kotlin.dsl.withType |
20 | 19 | import org.jetbrains.kotlin.gradle.dsl.JvmTarget
|
21 |
| -import org.jetbrains.kotlin.gradle.tasks.KotlinJvmCompile |
22 | 20 |
|
23 | 21 | plugins {
|
24 | 22 | id("firebase-library")
|
@@ -81,6 +79,7 @@ kotlin {
|
81 | 79 | jvmTarget = JvmTarget.JVM_1_8
|
82 | 80 | optIn.add("kotlin.RequiresOptIn")
|
83 | 81 | }
|
| 82 | + explicitApi() |
84 | 83 | }
|
85 | 84 |
|
86 | 85 | protobuf {
|
@@ -155,18 +154,6 @@ dependencies {
|
155 | 154 | androidTestImplementation(libs.turbine)
|
156 | 155 | }
|
157 | 156 |
|
158 |
| -// Enable Kotlin "Explicit API Mode". This causes the Kotlin compiler to fail if any |
159 |
| -// classes, methods, or properties have implicit `public` visibility. This check helps |
160 |
| -// avoid accidentally leaking elements into the public API, requiring that any public |
161 |
| -// element be explicitly declared as `public`. |
162 |
| -// https://github.com/Kotlin/KEEP/blob/master/proposals/explicit-api-mode.md |
163 |
| -// https://chao2zhang.medium.com/explicit-api-mode-for-kotlin-on-android-b8264fdd76d1 |
164 |
| -tasks.withType<KotlinJvmCompile>().configureEach { |
165 |
| - if (!name.contains("test", ignoreCase = true)) { |
166 |
| - compilerOptions.freeCompilerArgs.add("-Xexplicit-api=strict") |
167 |
| - } |
168 |
| -} |
169 |
| - |
170 | 157 | // Registers a Gradle task that updates the JSON file that stores the list of Data Connect
|
171 | 158 | // executable versions. The task gets the list of all versions from the Internet and then
|
172 | 159 | // updates the JSON file with their sizes and hashes.
|
|
0 commit comments