diff options
10 files changed, 15 insertions, 16 deletions
diff --git a/build-logic/android-plugins/src/main/kotlin/signing/AppSigning.kt b/build-logic/android-plugins/src/main/kotlin/signing/AppSigning.kt index 115f0f56..79f91631 100644 --- a/build-logic/android-plugins/src/main/kotlin/signing/AppSigning.kt +++ b/build-logic/android-plugins/src/main/kotlin/signing/AppSigning.kt @@ -9,7 +9,6 @@ import com.android.build.gradle.internal.dsl.BaseAppModuleExtension import java.util.Properties import org.gradle.api.Project import org.gradle.kotlin.dsl.configure -import org.gradle.kotlin.dsl.provideDelegate private const val KEYSTORE_CONFIG_PATH = "keystore.properties" diff --git a/build-logic/android-plugins/src/main/kotlin/versioning/VersioningPlugin.kt b/build-logic/android-plugins/src/main/kotlin/versioning/VersioningPlugin.kt index 5d838b63..043cd280 100644 --- a/build-logic/android-plugins/src/main/kotlin/versioning/VersioningPlugin.kt +++ b/build-logic/android-plugins/src/main/kotlin/versioning/VersioningPlugin.kt @@ -18,7 +18,7 @@ import org.gradle.kotlin.dsl.register * the [Project.getBuildDir] directory. It also adds Gradle tasks to bump the major, minor, and * patch versions along with one to prepare the next snapshot. */ -@Suppress("UnstableApiUsage", "NAME_SHADOWING", "Unused") +@Suppress("Unused") class VersioningPlugin : Plugin<Project> { override fun apply(project: Project) { diff --git a/build-logic/automation-plugins/src/main/kotlin/crowdin/CrowdinExtension.kt b/build-logic/automation-plugins/src/main/kotlin/crowdin/CrowdinExtension.kt index f1457673..761267b5 100644 --- a/build-logic/automation-plugins/src/main/kotlin/crowdin/CrowdinExtension.kt +++ b/build-logic/automation-plugins/src/main/kotlin/crowdin/CrowdinExtension.kt @@ -5,7 +5,7 @@ package crowdin -/** Extension for configuring [CrowdinPlugin] */ +/** Extension for configuring [CrowdinDownloadPlugin] */ interface CrowdinExtension { /** Configure the project name on Crowdin */ diff --git a/coroutine-utils-testing/build.gradle.kts b/coroutine-utils-testing/build.gradle.kts index c4f7400b..96d87dc1 100644 --- a/coroutine-utils-testing/build.gradle.kts +++ b/coroutine-utils-testing/build.gradle.kts @@ -11,5 +11,4 @@ dependencies { implementation(projects.coroutineUtils) implementation(libs.testing.junit) implementation(libs.kotlin.coroutines.test) - api(libs.testing.turbine) } diff --git a/coroutine-utils-testing/src/main/kotlin/dev/msfjarvis/aps/test/CoroutineTestRule.kt b/coroutine-utils-testing/src/main/kotlin/dev/msfjarvis/aps/test/CoroutineTestRule.kt index fa4a2d41..58ac48c9 100644 --- a/coroutine-utils-testing/src/main/kotlin/dev/msfjarvis/aps/test/CoroutineTestRule.kt +++ b/coroutine-utils-testing/src/main/kotlin/dev/msfjarvis/aps/test/CoroutineTestRule.kt @@ -33,12 +33,12 @@ public class CoroutineTestRule( override fun unconfined(): CoroutineDispatcher = testDispatcher } - override fun starting(description: Description?) { + override fun starting(description: Description) { super.starting(description) Dispatchers.setMain(testDispatcher) } - override fun finished(description: Description?) { + override fun finished(description: Description) { super.finished(description) Dispatchers.resetMain() } diff --git a/coroutine-utils/src/main/kotlin/dev/msfjarvis/aps/util/coroutines/RunSuspendCatching.kt b/coroutine-utils/src/main/kotlin/dev/msfjarvis/aps/util/coroutines/RunSuspendCatching.kt index 7e5b906c..4ba68159 100644 --- a/coroutine-utils/src/main/kotlin/dev/msfjarvis/aps/util/coroutines/RunSuspendCatching.kt +++ b/coroutine-utils/src/main/kotlin/dev/msfjarvis/aps/util/coroutines/RunSuspendCatching.kt @@ -12,11 +12,11 @@ import kotlin.contracts.contract import kotlinx.coroutines.CancellationException /** - * Calls the specified function [block] with [this] value as its receiver and returns its - * encapsulated result if invocation was successful, catching any [Throwable] except - * [CancellationException] that was thrown from the [block] function execution and encapsulating it - * as a failure. + * Calls the specified function [block] and returns its encapsulated result if invocation was + * successful, catching any [Throwable] except [CancellationException] that was thrown from the + * [block] function execution and encapsulating it as a failure. */ +@OptIn(ExperimentalContracts::class) public suspend inline fun <V> runSuspendCatching(block: () -> V): Result<V, Throwable> { contract { callsInPlace(block, InvocationKind.EXACTLY_ONCE) } @@ -34,6 +34,7 @@ public suspend inline fun <V> runSuspendCatching(block: () -> V): Result<V, Thro * [CancellationException] that was thrown from the [block] function execution and encapsulating it * as a failure. */ +@OptIn(ExperimentalContracts::class) public suspend inline infix fun <T, V> T.runSuspendCatching( block: T.() -> V ): Result<V, Throwable> { diff --git a/crypto-common/src/main/kotlin/dev/msfjarvis/aps/crypto/KeyManager.kt b/crypto-common/src/main/kotlin/dev/msfjarvis/aps/crypto/KeyManager.kt index 71efb2fb..b7783163 100644 --- a/crypto-common/src/main/kotlin/dev/msfjarvis/aps/crypto/KeyManager.kt +++ b/crypto-common/src/main/kotlin/dev/msfjarvis/aps/crypto/KeyManager.kt @@ -16,7 +16,7 @@ public interface KeyManager<Key, KeyIdentifier> { /** * Inserts a [key] into the store. If the key already exists, this method will return - * [KeyAlreadyExistsException] unless [replace] is `true`. + * [dev.msfjarvis.aps.crypto.errors.KeyAlreadyExistsException] unless [replace] is `true`. */ public suspend fun addKey(key: Key, replace: Boolean = false): Result<Key, Throwable> diff --git a/crypto-pgpainless/src/main/kotlin/dev/msfjarvis/aps/crypto/GpgIdentifier.kt b/crypto-pgpainless/src/main/kotlin/dev/msfjarvis/aps/crypto/GpgIdentifier.kt index d336e86c..b7dcdd0d 100644 --- a/crypto-pgpainless/src/main/kotlin/dev/msfjarvis/aps/crypto/GpgIdentifier.kt +++ b/crypto-pgpainless/src/main/kotlin/dev/msfjarvis/aps/crypto/GpgIdentifier.kt @@ -38,13 +38,12 @@ public sealed class GpgIdentifier { } public companion object { - @OptIn(ExperimentalUnsignedTypes::class) public fun fromString(identifier: String): GpgIdentifier? { if (identifier.isEmpty()) return null // Match long key IDs: // FF22334455667788 or 0xFF22334455667788 val maybeLongKeyId = - identifier.removePrefix("0x").takeIf { it.matches("[a-fA-F0-9]{16}".toRegex()) } + identifier.removePrefix("0x").takeIf { it.matches("[a-fA-F\\d]{16}".toRegex()) } if (maybeLongKeyId != null) { val keyId = maybeLongKeyId.toULong(16) return KeyId(keyId.toLong()) @@ -53,7 +52,7 @@ public sealed class GpgIdentifier { // Match fingerprints: // FF223344556677889900112233445566778899 or 0xFF223344556677889900112233445566778899 val maybeFingerprint = - identifier.removePrefix("0x").takeIf { it.matches("[a-fA-F0-9]{40}".toRegex()) } + identifier.removePrefix("0x").takeIf { it.matches("[a-fA-F\\d]{40}".toRegex()) } if (maybeFingerprint != null) { // Truncating to the long key ID is not a security issue since OpenKeychain only // accepts diff --git a/crypto-pgpainless/src/test/kotlin/dev/msfjarvis/aps/crypto/PGPKeyManagerTest.kt b/crypto-pgpainless/src/test/kotlin/dev/msfjarvis/aps/crypto/PGPKeyManagerTest.kt index cf33b53f..60436d3b 100644 --- a/crypto-pgpainless/src/test/kotlin/dev/msfjarvis/aps/crypto/PGPKeyManagerTest.kt +++ b/crypto-pgpainless/src/test/kotlin/dev/msfjarvis/aps/crypto/PGPKeyManagerTest.kt @@ -161,17 +161,17 @@ class PGPKeyManagerTest { @Test fun getAllKeys() = scope.runTest { - // TODO: Should we check for more than 1 keys? // Check if KeyManager returns no key val noKeyList = keyManager.getAllKeys().unwrap() assertEquals(0, noKeyList.size) // Add key using KeyManager keyManager.addKey(key).unwrap() + keyManager.addKey(PGPKey(getArmoredPrivateKeyWithMultipleIdentities())).unwrap() // Check if KeyManager returns one key val singleKeyList = keyManager.getAllKeys().unwrap() - assertEquals(1, singleKeyList.size) + assertEquals(2, singleKeyList.size) } @Test diff --git a/format-common/build.gradle.kts b/format-common/build.gradle.kts index 3b940573..f18dc906 100644 --- a/format-common/build.gradle.kts +++ b/format-common/build.gradle.kts @@ -18,4 +18,5 @@ dependencies { testImplementation(projects.coroutineUtilsTesting) testImplementation(libs.bundles.testDependencies) testImplementation(libs.kotlin.coroutines.test) + testImplementation(libs.testing.turbine) } |