From 674a7d299bbe10692902d35fd2bbeef9ebe7a9f5 Mon Sep 17 00:00:00 2001 From: Harsh Shandilya Date: Sun, 26 Dec 2021 11:59:57 +0530 Subject: [PATCH] Misc cleanups to build-logic and expand BCV exclusion list (#1622) * build-logic: remove `kotlin-dsl-precompiled-script-plugins` plugin * build-logic: use generated accessors for extensions * build: exclude non-published library projects from API dump There's no point in tracking binary compatibility for libraries that are only used internally --- build-logic/android-plugins/build.gradle.kts | 5 +- ...sword-store.android-application.gradle.kts | 4 +- ...store.published-android-library.gradle.kts | 4 +- .../automation-plugins/build.gradle.kts | 5 +- build-logic/kotlin-plugins/build.gradle.kts | 5 +- ...word-store.binary-compatibility.gradle.kts | 16 +++-- ...roid-password-store.kotlin-kapt.gradle.kts | 4 +- .../api/coroutine-utils-testing.api | 8 --- coroutine-utils/api/coroutine-utils.api | 22 ------- crypto-common/api/crypto-common.api | 63 ------------------- crypto-pgpainless/api/crypto-pgpainless.api | 31 --------- format-common/api/format-common.api | 35 ----------- passgen/diceware/api/diceware.api | 16 ----- 13 files changed, 18 insertions(+), 200 deletions(-) delete mode 100644 coroutine-utils-testing/api/coroutine-utils-testing.api delete mode 100644 coroutine-utils/api/coroutine-utils.api delete mode 100644 crypto-common/api/crypto-common.api delete mode 100644 crypto-pgpainless/api/crypto-pgpainless.api delete mode 100644 format-common/api/format-common.api delete mode 100644 passgen/diceware/api/diceware.api diff --git a/build-logic/android-plugins/build.gradle.kts b/build-logic/android-plugins/build.gradle.kts index 8c4315dd..cdc7c315 100644 --- a/build-logic/android-plugins/build.gradle.kts +++ b/build-logic/android-plugins/build.gradle.kts @@ -8,10 +8,7 @@ import org.gradle.api.tasks.compile.JavaCompile import org.gradle.kotlin.dsl.withType import org.jetbrains.kotlin.gradle.tasks.KotlinCompile -plugins { - `kotlin-dsl` - `kotlin-dsl-precompiled-script-plugins` -} +plugins { `kotlin-dsl` } afterEvaluate { tasks.withType().configureEach { diff --git a/build-logic/android-plugins/src/main/kotlin/com.github.android-password-store.android-application.gradle.kts b/build-logic/android-plugins/src/main/kotlin/com.github.android-password-store.android-application.gradle.kts index e223b721..955ddaaa 100644 --- a/build-logic/android-plugins/src/main/kotlin/com.github.android-password-store.android-application.gradle.kts +++ b/build-logic/android-plugins/src/main/kotlin/com.github.android-password-store.android-application.gradle.kts @@ -3,10 +3,8 @@ * SPDX-License-Identifier: GPL-3.0-only */ -import com.android.build.gradle.internal.dsl.BaseAppModuleExtension import flavors.FlavorDimensions import flavors.ProductFlavors -import org.gradle.kotlin.dsl.configure import signing.configureBuildSigning plugins { @@ -22,7 +20,7 @@ fun Project.isSnapshot(): Boolean { } } -extensions.configure { +android { val minifySwitch = project.providers.environmentVariable("DISABLE_MINIFY").forUseAtConfigurationTime() diff --git a/build-logic/android-plugins/src/main/kotlin/com.github.android-password-store.published-android-library.gradle.kts b/build-logic/android-plugins/src/main/kotlin/com.github.android-password-store.published-android-library.gradle.kts index 85ebdbe3..3aa55b7a 100644 --- a/build-logic/android-plugins/src/main/kotlin/com.github.android-password-store.published-android-library.gradle.kts +++ b/build-logic/android-plugins/src/main/kotlin/com.github.android-password-store.published-android-library.gradle.kts @@ -3,9 +3,7 @@ * SPDX-License-Identifier: GPL-3.0-only */ -import org.gradle.kotlin.dsl.configure import org.gradle.kotlin.dsl.provideDelegate -import org.gradle.plugins.signing.SigningExtension plugins { id("com.github.android-password-store.android-library") @@ -14,7 +12,7 @@ plugins { } afterEvaluate { - extensions.configure { + signing { val signingKey: String? by project val signingPassword: String? by project useInMemoryPgpKeys(signingKey, signingPassword) diff --git a/build-logic/automation-plugins/build.gradle.kts b/build-logic/automation-plugins/build.gradle.kts index 15c5baa9..8ec63671 100644 --- a/build-logic/automation-plugins/build.gradle.kts +++ b/build-logic/automation-plugins/build.gradle.kts @@ -8,10 +8,7 @@ import org.gradle.api.tasks.compile.JavaCompile import org.gradle.kotlin.dsl.withType import org.jetbrains.kotlin.gradle.tasks.KotlinCompile -plugins { - `kotlin-dsl` - `kotlin-dsl-precompiled-script-plugins` -} +plugins { `kotlin-dsl` } afterEvaluate { tasks.withType().configureEach { diff --git a/build-logic/kotlin-plugins/build.gradle.kts b/build-logic/kotlin-plugins/build.gradle.kts index 229c5f17..8e182d12 100644 --- a/build-logic/kotlin-plugins/build.gradle.kts +++ b/build-logic/kotlin-plugins/build.gradle.kts @@ -8,10 +8,7 @@ import org.gradle.api.tasks.compile.JavaCompile import org.gradle.kotlin.dsl.withType import org.jetbrains.kotlin.gradle.tasks.KotlinCompile -plugins { - `kotlin-dsl` - `kotlin-dsl-precompiled-script-plugins` -} +plugins { `kotlin-dsl` } afterEvaluate { tasks.withType().configureEach { diff --git a/build-logic/kotlin-plugins/src/main/kotlin/com.github.android-password-store.binary-compatibility.gradle.kts b/build-logic/kotlin-plugins/src/main/kotlin/com.github.android-password-store.binary-compatibility.gradle.kts index 053a69ab..4e0ceaa3 100644 --- a/build-logic/kotlin-plugins/src/main/kotlin/com.github.android-password-store.binary-compatibility.gradle.kts +++ b/build-logic/kotlin-plugins/src/main/kotlin/com.github.android-password-store.binary-compatibility.gradle.kts @@ -3,9 +3,17 @@ * SPDX-License-Identifier: GPL-3.0-only */ -import kotlinx.validation.ApiValidationExtension -import org.gradle.kotlin.dsl.configure - plugins { id("org.jetbrains.kotlinx.binary-compatibility-validator") } -extensions.configure { ignoredProjects = mutableSetOf("app") } +apiValidation { + ignoredProjects = + mutableSetOf( + "app", + "coroutine-utils", + "coroutine-utils-testing", + "crypto-common", + "crypto-pgpainless", + "format-common", + "diceware", + ) +} diff --git a/build-logic/kotlin-plugins/src/main/kotlin/com.github.android-password-store.kotlin-kapt.gradle.kts b/build-logic/kotlin-plugins/src/main/kotlin/com.github.android-password-store.kotlin-kapt.gradle.kts index 36642ba4..14542655 100644 --- a/build-logic/kotlin-plugins/src/main/kotlin/com.github.android-password-store.kotlin-kapt.gradle.kts +++ b/build-logic/kotlin-plugins/src/main/kotlin/com.github.android-password-store.kotlin-kapt.gradle.kts @@ -4,8 +4,6 @@ */ import org.gradle.api.Project -import org.gradle.kotlin.dsl.configure -import org.jetbrains.kotlin.gradle.plugin.KaptExtension plugins { kotlin("android") @@ -13,7 +11,7 @@ plugins { } afterEvaluate { - extensions.configure { + kapt { javacOptions { if (hasDaggerCompilerDependency()) { // https://dagger.dev/dev-guide/compiler-options#fastinit-mode diff --git a/coroutine-utils-testing/api/coroutine-utils-testing.api b/coroutine-utils-testing/api/coroutine-utils-testing.api deleted file mode 100644 index a90e209f..00000000 --- a/coroutine-utils-testing/api/coroutine-utils-testing.api +++ /dev/null @@ -1,8 +0,0 @@ -public final class dev/msfjarvis/aps/test/CoroutineTestRule : org/junit/rules/TestWatcher { - public fun ()V - public fun (Lkotlinx/coroutines/test/TestDispatcher;)V - public synthetic fun (Lkotlinx/coroutines/test/TestDispatcher;ILkotlin/jvm/internal/DefaultConstructorMarker;)V - public final fun getTestDispatcher ()Lkotlinx/coroutines/test/TestDispatcher; - public final fun getTestDispatcherProvider ()Ldev/msfjarvis/aps/util/coroutines/DispatcherProvider; -} - diff --git a/coroutine-utils/api/coroutine-utils.api b/coroutine-utils/api/coroutine-utils.api deleted file mode 100644 index 000dde65..00000000 --- a/coroutine-utils/api/coroutine-utils.api +++ /dev/null @@ -1,22 +0,0 @@ -public final class dev/msfjarvis/aps/util/coroutines/DefaultDispatcherProvider : dev/msfjarvis/aps/util/coroutines/DispatcherProvider { - public fun ()V - public fun default ()Lkotlinx/coroutines/CoroutineDispatcher; - public fun io ()Lkotlinx/coroutines/CoroutineDispatcher; - public fun main ()Lkotlinx/coroutines/CoroutineDispatcher; - public fun unconfined ()Lkotlinx/coroutines/CoroutineDispatcher; -} - -public abstract interface class dev/msfjarvis/aps/util/coroutines/DispatcherProvider { - public abstract fun default ()Lkotlinx/coroutines/CoroutineDispatcher; - public abstract fun io ()Lkotlinx/coroutines/CoroutineDispatcher; - public abstract fun main ()Lkotlinx/coroutines/CoroutineDispatcher; - public abstract fun unconfined ()Lkotlinx/coroutines/CoroutineDispatcher; -} - -public final class dev/msfjarvis/aps/util/coroutines/DispatcherProvider$DefaultImpls { - public static fun default (Ldev/msfjarvis/aps/util/coroutines/DispatcherProvider;)Lkotlinx/coroutines/CoroutineDispatcher; - public static fun io (Ldev/msfjarvis/aps/util/coroutines/DispatcherProvider;)Lkotlinx/coroutines/CoroutineDispatcher; - public static fun main (Ldev/msfjarvis/aps/util/coroutines/DispatcherProvider;)Lkotlinx/coroutines/CoroutineDispatcher; - public static fun unconfined (Ldev/msfjarvis/aps/util/coroutines/DispatcherProvider;)Lkotlinx/coroutines/CoroutineDispatcher; -} - diff --git a/crypto-common/api/crypto-common.api b/crypto-common/api/crypto-common.api deleted file mode 100644 index 6d137885..00000000 --- a/crypto-common/api/crypto-common.api +++ /dev/null @@ -1,63 +0,0 @@ -public abstract class dev/msfjarvis/aps/crypto/CryptoException : java/lang/Exception { - public synthetic fun (Ljava/lang/String;ILkotlin/jvm/internal/DefaultConstructorMarker;)V - public synthetic fun (Ljava/lang/String;Lkotlin/jvm/internal/DefaultConstructorMarker;)V -} - -public abstract interface class dev/msfjarvis/aps/crypto/CryptoHandler { - public abstract fun canHandle (Ljava/lang/String;)Z - public abstract fun decrypt (Ljava/lang/String;Ljava/lang/String;Ljava/io/InputStream;Ljava/io/OutputStream;)V - public abstract fun encrypt (Ljava/util/List;Ljava/io/InputStream;Ljava/io/OutputStream;)V -} - -public abstract interface class dev/msfjarvis/aps/crypto/KeyManager { - public abstract fun addKey (Ldev/msfjarvis/aps/crypto/KeyPair;ZLkotlin/coroutines/Continuation;)Ljava/lang/Object; - public abstract fun canHandle (Ljava/lang/String;)Z - public abstract fun getAllKeys (Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - public abstract fun getKeyById (Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - public abstract fun removeKey (Ldev/msfjarvis/aps/crypto/KeyPair;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; -} - -public final class dev/msfjarvis/aps/crypto/KeyManager$DefaultImpls { - public static synthetic fun addKey$default (Ldev/msfjarvis/aps/crypto/KeyManager;Ldev/msfjarvis/aps/crypto/KeyPair;ZLkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object; -} - -public abstract class dev/msfjarvis/aps/crypto/KeyManagerException : dev/msfjarvis/aps/crypto/CryptoException { - public synthetic fun (Ljava/lang/String;ILkotlin/jvm/internal/DefaultConstructorMarker;)V - public synthetic fun (Ljava/lang/String;Lkotlin/jvm/internal/DefaultConstructorMarker;)V -} - -public final class dev/msfjarvis/aps/crypto/KeyManagerException$KeyAlreadyExistsException : dev/msfjarvis/aps/crypto/KeyManagerException { - public fun (Ljava/lang/String;)V -} - -public final class dev/msfjarvis/aps/crypto/KeyManagerException$KeyDeletionFailedException : dev/msfjarvis/aps/crypto/KeyManagerException { - public static final field INSTANCE Ldev/msfjarvis/aps/crypto/KeyManagerException$KeyDeletionFailedException; -} - -public final class dev/msfjarvis/aps/crypto/KeyManagerException$KeyDirectoryUnavailableException : dev/msfjarvis/aps/crypto/KeyManagerException { - public static final field INSTANCE Ldev/msfjarvis/aps/crypto/KeyManagerException$KeyDirectoryUnavailableException; -} - -public final class dev/msfjarvis/aps/crypto/KeyManagerException$KeyNotFoundException : dev/msfjarvis/aps/crypto/KeyManagerException { - public fun (Ljava/lang/String;)V -} - -public final class dev/msfjarvis/aps/crypto/KeyManagerException$NoKeysAvailableException : dev/msfjarvis/aps/crypto/KeyManagerException { - public static final field INSTANCE Ldev/msfjarvis/aps/crypto/KeyManagerException$NoKeysAvailableException; -} - -public abstract interface class dev/msfjarvis/aps/crypto/KeyPair { - public abstract fun getKeyId ()Ljava/lang/String; - public abstract fun getPrivateKey ()[B - public abstract fun getPublicKey ()[B -} - -public abstract class dev/msfjarvis/aps/crypto/KeyPairException : dev/msfjarvis/aps/crypto/CryptoException { - public synthetic fun (Ljava/lang/String;ILkotlin/jvm/internal/DefaultConstructorMarker;)V - public synthetic fun (Ljava/lang/String;Lkotlin/jvm/internal/DefaultConstructorMarker;)V -} - -public final class dev/msfjarvis/aps/crypto/KeyPairException$PrivateKeyUnavailableException : dev/msfjarvis/aps/crypto/KeyPairException { - public static final field INSTANCE Ldev/msfjarvis/aps/crypto/KeyPairException$PrivateKeyUnavailableException; -} - diff --git a/crypto-pgpainless/api/crypto-pgpainless.api b/crypto-pgpainless/api/crypto-pgpainless.api deleted file mode 100644 index 1c59ca1f..00000000 --- a/crypto-pgpainless/api/crypto-pgpainless.api +++ /dev/null @@ -1,31 +0,0 @@ -public final class dev/msfjarvis/aps/crypto/PGPKeyManager : dev/msfjarvis/aps/crypto/KeyManager { - public static final field Companion Ldev/msfjarvis/aps/crypto/PGPKeyManager$Companion; - public fun (Ljava/lang/String;Lkotlinx/coroutines/CoroutineDispatcher;)V - public synthetic fun addKey (Ldev/msfjarvis/aps/crypto/KeyPair;ZLkotlin/coroutines/Continuation;)Ljava/lang/Object; - public fun addKey (Ldev/msfjarvis/aps/crypto/PGPKeyPair;ZLkotlin/coroutines/Continuation;)Ljava/lang/Object; - public fun canHandle (Ljava/lang/String;)Z - public fun getAllKeys (Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - public fun getKeyById (Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - public static final fun makeKey (Ljava/lang/String;)Ldev/msfjarvis/aps/crypto/PGPKeyPair; - public synthetic fun removeKey (Ldev/msfjarvis/aps/crypto/KeyPair;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - public fun removeKey (Ldev/msfjarvis/aps/crypto/PGPKeyPair;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; -} - -public final class dev/msfjarvis/aps/crypto/PGPKeyManager$Companion { - public final fun makeKey (Ljava/lang/String;)Ldev/msfjarvis/aps/crypto/PGPKeyPair; -} - -public final class dev/msfjarvis/aps/crypto/PGPKeyPair : dev/msfjarvis/aps/crypto/KeyPair { - public fun (Lorg/bouncycastle/openpgp/PGPSecretKey;)V - public fun getKeyId ()Ljava/lang/String; - public fun getPrivateKey ()[B - public fun getPublicKey ()[B -} - -public final class dev/msfjarvis/aps/crypto/PGPainlessCryptoHandler : dev/msfjarvis/aps/crypto/CryptoHandler { - public fun ()V - public fun canHandle (Ljava/lang/String;)Z - public fun decrypt (Ljava/lang/String;Ljava/lang/String;Ljava/io/InputStream;Ljava/io/OutputStream;)V - public fun encrypt (Ljava/util/List;Ljava/io/InputStream;Ljava/io/OutputStream;)V -} - diff --git a/format-common/api/format-common.api b/format-common/api/format-common.api deleted file mode 100644 index 629644e3..00000000 --- a/format-common/api/format-common.api +++ /dev/null @@ -1,35 +0,0 @@ -public final class dev/msfjarvis/aps/data/passfile/PasswordEntry { - public fun (Ldev/msfjarvis/aps/util/time/UserClock;Ldev/msfjarvis/aps/util/totp/TotpFinder;Ldev/msfjarvis/aps/util/coroutines/DispatcherProvider;Lkotlinx/coroutines/CoroutineScope;[B)V - public final fun getExtraContent ()Ljava/util/Map; - public final fun getExtraContentString ()Ljava/lang/String; - public final fun getExtraContentWithoutAuthData ()Ljava/lang/String; - public final fun getPassword ()Ljava/lang/String; - public final fun getTotp ()Lkotlinx/coroutines/flow/StateFlow; - public final fun getUsername ()Ljava/lang/String; - public final fun hasTotp ()Z -} - -public abstract interface class dev/msfjarvis/aps/data/passfile/PasswordEntry$Factory { - public abstract fun create (Lkotlinx/coroutines/CoroutineScope;[B)Ldev/msfjarvis/aps/data/passfile/PasswordEntry; -} - -public class dev/msfjarvis/aps/util/time/UserClock : java/time/Clock { - public fun ()V - public fun getZone ()Ljava/time/ZoneId; - public fun instant ()Ljava/time/Instant; - public fun withZone (Ljava/time/ZoneId;)Ljava/time/Clock; -} - -public abstract interface class dev/msfjarvis/aps/util/totp/TotpFinder { - public static final field Companion Ldev/msfjarvis/aps/util/totp/TotpFinder$Companion; - public abstract fun findAlgorithm (Ljava/lang/String;)Ljava/lang/String; - public abstract fun findDigits (Ljava/lang/String;)Ljava/lang/String; - public abstract fun findIssuer (Ljava/lang/String;)Ljava/lang/String; - public abstract fun findPeriod (Ljava/lang/String;)J - public abstract fun findSecret (Ljava/lang/String;)Ljava/lang/String; -} - -public final class dev/msfjarvis/aps/util/totp/TotpFinder$Companion { - public final fun getTOTP_FIELDS ()[Ljava/lang/String; -} - diff --git a/passgen/diceware/api/diceware.api b/passgen/diceware/api/diceware.api deleted file mode 100644 index 925d6739..00000000 --- a/passgen/diceware/api/diceware.api +++ /dev/null @@ -1,16 +0,0 @@ -public final class dev/msfjarvis/aps/passgen/diceware/DicewarePassphraseGenerator { - public static final field DIGITS I - public fun (Ldev/msfjarvis/aps/passgen/diceware/Die;Ljava/io/InputStream;)V - public final fun generatePassphrase (IC)Ljava/lang/String; -} - -public final class dev/msfjarvis/aps/passgen/diceware/Die { - public fun (ILdev/msfjarvis/aps/passgen/diceware/RandomIntGenerator;)V - public final fun roll ()I - public final fun rollMultiple (I)I -} - -public abstract interface class dev/msfjarvis/aps/passgen/diceware/RandomIntGenerator { - public abstract fun get (Lkotlin/ranges/IntRange;)I -} -