From 208eed426907b235e20429dfc23473211a609e2e Mon Sep 17 00:00:00 2001 From: Harsh Shandilya Date: Fri, 3 Dec 2021 15:08:33 +0530 Subject: [PATCH] Turn on explicit API for Kotlin JVM projects (#1568) --- autofill-parser/build.gradle.kts | 1 + ...oid-password-store.kotlin-library.gradle.kts | 17 +++++++++++++++++ crypto-common/build.gradle.kts | 2 +- crypto-pgpainless/build.gradle.kts | 2 +- format-common/build.gradle.kts | 3 ++- openpgp-ktx/build.gradle.kts | 1 + 6 files changed, 23 insertions(+), 3 deletions(-) create mode 100644 build-logic/kotlin-plugins/src/main/kotlin/com.github.android-password-store.kotlin-library.gradle.kts diff --git a/autofill-parser/build.gradle.kts b/autofill-parser/build.gradle.kts index fea86ce6..b97afc0c 100644 --- a/autofill-parser/build.gradle.kts +++ b/autofill-parser/build.gradle.kts @@ -6,6 +6,7 @@ plugins { id("com.github.android-password-store.android-library") id("com.github.android-password-store.kotlin-android") + id("com.github.android-password-store.kotlin-library") id("com.vanniktech.maven.publish") id("org.jetbrains.dokka") id("com.github.android-password-store.psl-plugin") diff --git a/build-logic/kotlin-plugins/src/main/kotlin/com.github.android-password-store.kotlin-library.gradle.kts b/build-logic/kotlin-plugins/src/main/kotlin/com.github.android-password-store.kotlin-library.gradle.kts new file mode 100644 index 00000000..516f5e4f --- /dev/null +++ b/build-logic/kotlin-plugins/src/main/kotlin/com.github.android-password-store.kotlin-library.gradle.kts @@ -0,0 +1,17 @@ +/* + * Copyright © 2014-2021 The Android Password Store Authors. All Rights Reserved. + * SPDX-License-Identifier: GPL-3.0-only + */ + +import org.gradle.kotlin.dsl.withType +import org.jetbrains.kotlin.gradle.tasks.KotlinCompile + +plugins { id("com.github.android-password-store.kotlin-common") } + +tasks.withType().configureEach { + kotlinOptions { + if (!name.contains("test", ignoreCase = true)) { + freeCompilerArgs += listOf("-Xexplicit-api=strict") + } + } +} diff --git a/crypto-common/build.gradle.kts b/crypto-common/build.gradle.kts index 40e39339..b644cddd 100644 --- a/crypto-common/build.gradle.kts +++ b/crypto-common/build.gradle.kts @@ -4,7 +4,7 @@ */ plugins { kotlin("jvm") - id("com.github.android-password-store.kotlin-common") + id("com.github.android-password-store.kotlin-library") } dependencies { implementation(libs.thirdparty.kotlinResult) } diff --git a/crypto-pgpainless/build.gradle.kts b/crypto-pgpainless/build.gradle.kts index 103463c3..ee55f349 100644 --- a/crypto-pgpainless/build.gradle.kts +++ b/crypto-pgpainless/build.gradle.kts @@ -5,7 +5,7 @@ plugins { kotlin("jvm") - id("com.github.android-password-store.kotlin-common") + id("com.github.android-password-store.kotlin-library") } dependencies { diff --git a/format-common/build.gradle.kts b/format-common/build.gradle.kts index 7ed598e3..e5400bcc 100644 --- a/format-common/build.gradle.kts +++ b/format-common/build.gradle.kts @@ -2,9 +2,10 @@ * Copyright © 2014-2021 The Android Password Store Authors. All Rights Reserved. * SPDX-License-Identifier: GPL-3.0-only */ + plugins { kotlin("jvm") - id("com.github.android-password-store.kotlin-common") + id("com.github.android-password-store.kotlin-library") } dependencies { diff --git a/openpgp-ktx/build.gradle.kts b/openpgp-ktx/build.gradle.kts index b2c25c94..37ebbc62 100644 --- a/openpgp-ktx/build.gradle.kts +++ b/openpgp-ktx/build.gradle.kts @@ -6,6 +6,7 @@ plugins { id("com.github.android-password-store.android-library") id("com.github.android-password-store.kotlin-android") + id("com.github.android-password-store.kotlin-library") id("com.vanniktech.maven.publish") id("org.jetbrains.dokka") }