aboutsummaryrefslogtreecommitdiff
path: root/build-logic
diff options
context:
space:
mode:
authorHarsh Shandilya <me@msfjarvis.dev>2022-10-21 12:02:23 +0530
committerGitHub <noreply@github.com>2022-10-21 06:32:23 +0000
commitdf764932f7fdddea9cea5937c6053a95797d35df (patch)
treea24e108f9584c60b4f6e18717af4269cbb49c91b /build-logic
parent7f90d827ae436fe74ce5d3cabb9f1b091462b657 (diff)
Migrate to Metalava for validating API (#2195)
Diffstat (limited to 'build-logic')
-rw-r--r--build-logic/android-plugins/build.gradle.kts1
-rw-r--r--build-logic/android-plugins/src/main/kotlin/app/passwordstore/gradle/PublishedAndroidLibraryPlugin.kt10
-rw-r--r--build-logic/kotlin-plugins/build.gradle.kts5
-rw-r--r--build-logic/kotlin-plugins/src/main/kotlin/app/passwordstore/gradle/BinaryCompatibilityPlugin.kt34
-rw-r--r--build-logic/settings.gradle.kts10
5 files changed, 18 insertions, 42 deletions
diff --git a/build-logic/android-plugins/build.gradle.kts b/build-logic/android-plugins/build.gradle.kts
index e3ab454f..870f5d18 100644
--- a/build-logic/android-plugins/build.gradle.kts
+++ b/build-logic/android-plugins/build.gradle.kts
@@ -56,6 +56,7 @@ gradlePlugin {
dependencies {
implementation(libs.build.agp)
implementation(libs.build.mavenpublish)
+ implementation(libs.build.metalava)
implementation(libs.build.r8)
implementation(libs.build.semver)
implementation(libs.build.sentry)
diff --git a/build-logic/android-plugins/src/main/kotlin/app/passwordstore/gradle/PublishedAndroidLibraryPlugin.kt b/build-logic/android-plugins/src/main/kotlin/app/passwordstore/gradle/PublishedAndroidLibraryPlugin.kt
index b005043b..542bfeb6 100644
--- a/build-logic/android-plugins/src/main/kotlin/app/passwordstore/gradle/PublishedAndroidLibraryPlugin.kt
+++ b/build-logic/android-plugins/src/main/kotlin/app/passwordstore/gradle/PublishedAndroidLibraryPlugin.kt
@@ -5,6 +5,8 @@ package app.passwordstore.gradle
import com.vanniktech.maven.publish.MavenPublishBaseExtension
import com.vanniktech.maven.publish.MavenPublishPlugin
import com.vanniktech.maven.publish.SonatypeHost
+import me.tylerbwong.gradle.metalava.Documentation
+import me.tylerbwong.gradle.metalava.extension.MetalavaExtension
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.kotlin.dsl.apply
@@ -21,6 +23,7 @@ class PublishedAndroidLibraryPlugin : Plugin<Project> {
apply(LibraryPlugin::class)
apply(MavenPublishPlugin::class)
apply(SigningPlugin::class)
+ apply("me.tylerbwong.gradle.metalava")
}
project.extensions.getByType<MavenPublishBaseExtension>().run {
publishToMavenCentral(SonatypeHost.DEFAULT, true)
@@ -33,5 +36,12 @@ class PublishedAndroidLibraryPlugin : Plugin<Project> {
useInMemoryPgpKeys(signingKey, signingPassword)
}
}
+ project.extensions.getByType<MetalavaExtension>().run {
+ documentation.set(Documentation.PUBLIC)
+ inputKotlinNulls.set(true)
+ outputKotlinNulls.set(true)
+ reportLintsAsErrors.set(true)
+ reportWarningsAsErrors.set(true)
+ }
}
}
diff --git a/build-logic/kotlin-plugins/build.gradle.kts b/build-logic/kotlin-plugins/build.gradle.kts
index d891ec0d..1a547454 100644
--- a/build-logic/kotlin-plugins/build.gradle.kts
+++ b/build-logic/kotlin-plugins/build.gradle.kts
@@ -26,10 +26,6 @@ afterEvaluate {
gradlePlugin {
plugins {
- register("binary-compatibility") {
- id = "com.github.android-password-store.binary-compatibility"
- implementationClass = "app.passwordstore.gradle.BinaryCompatibilityPlugin"
- }
register("kotlin-android") {
id = "com.github.android-password-store.kotlin-android"
implementationClass = "app.passwordstore.gradle.KotlinAndroidPlugin"
@@ -59,7 +55,6 @@ gradlePlugin {
dependencies {
implementation(libs.build.agp)
- implementation(libs.build.binarycompat)
implementation(libs.build.detekt)
implementation(libs.build.kotlin)
implementation(libs.build.r8)
diff --git a/build-logic/kotlin-plugins/src/main/kotlin/app/passwordstore/gradle/BinaryCompatibilityPlugin.kt b/build-logic/kotlin-plugins/src/main/kotlin/app/passwordstore/gradle/BinaryCompatibilityPlugin.kt
deleted file mode 100644
index a64d8fb3..00000000
--- a/build-logic/kotlin-plugins/src/main/kotlin/app/passwordstore/gradle/BinaryCompatibilityPlugin.kt
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright © 2014-2021 The Android Password Store Authors. All Rights Reserved.
- * SPDX-License-Identifier: GPL-3.0-only
- */
-
-package app.passwordstore.gradle
-
-import kotlinx.validation.ApiValidationExtension
-import kotlinx.validation.BinaryCompatibilityValidatorPlugin
-import org.gradle.api.Plugin
-import org.gradle.api.Project
-import org.gradle.kotlin.dsl.apply
-import org.gradle.kotlin.dsl.getByType
-
-@Suppress("Unused")
-class BinaryCompatibilityPlugin : Plugin<Project> {
-
- override fun apply(project: Project) {
- project.pluginManager.apply(BinaryCompatibilityValidatorPlugin::class)
- project.extensions.getByType<ApiValidationExtension>().ignoredProjects =
- mutableSetOf(
- "app",
- "coroutine-utils",
- "coroutine-utils-testing",
- "crypto-common",
- "crypto-pgpainless",
- "format-common",
- "diceware",
- "random",
- "sentry-stub",
- "ui-compose",
- )
- }
-}
diff --git a/build-logic/settings.gradle.kts b/build-logic/settings.gradle.kts
index bb233022..07992f1a 100644
--- a/build-logic/settings.gradle.kts
+++ b/build-logic/settings.gradle.kts
@@ -9,7 +9,7 @@ rootProject.name = "build-logic"
dependencyResolutionManagement {
repositories {
exclusiveContent {
- forRepository(::google)
+ forRepository { google() }
filter {
includeGroup("androidx.databinding")
includeGroup("com.android")
@@ -31,11 +31,15 @@ dependencyResolutionManagement {
includeModule("com.android.tools", "repository")
includeModule("com.android.tools", "sdklib")
includeModule("com.android.tools", "sdk-common")
+ includeModule("com.android.tools.metalava", "metalava")
}
}
exclusiveContent {
- forRepository(::gradlePluginPortal)
- filter { includeModule("com.github.ben-manes", "gradle-versions-plugin") }
+ forRepository { gradlePluginPortal() }
+ filter {
+ includeModule("com.github.ben-manes", "gradle-versions-plugin")
+ includeModule("me.tylerbwong.gradle.metalava", "plugin")
+ }
}
exclusiveContent {
forRepository { maven("https://storage.googleapis.com/r8-releases/raw") }