diff --git a/build.gradle.kts b/build.gradle.kts index 45e3268..d3ae3d9 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,49 +1,5 @@ -import com.redmadrobot.build.dsl.* - plugins { - alias(libs.plugins.gradle.android) apply false - alias(stack.plugins.kotlin.android) apply false - - alias(rmr.plugins.android.config) - alias(rmr.plugins.publish.config) alias(rmr.plugins.detekt) alias(stack.plugins.versions) - `maven-publish` -} - -redmadrobot { - android.minSdk.set(14) - - publishing { - signArtifacts.set(!isRunningOnCi) - pom { - setGitHubProject("RedMadRobot/redmadrobot-android-ktx") - - licenses { - mit() - } - - developers { - developer(id = "osipxd", name = "Osip Fatkullin", email = "o.fatkullin@redmadrobot.com") - } - } - } -} - -subprojects { - apply(plugin = "io.gitlab.arturbosch.detekt") - group = "com.redmadrobot.extensions" - - kotlinCompile { - // Fix module-name conflicts with Android KTX - kotlinOptions.moduleName = "redmadrobot.${project.name}" - } - - apply(plugin = "maven-publish") - publishing { - repositories { - if (isRunningOnCi) githubPackages("RedMadRobot/redmadrobot-android-ktx") - if (isReleaseVersion && credentialsExist("ossrh")) ossrh() - } - } + convention.detekt } diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index 261a9a5..7675dc5 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -2,10 +2,6 @@ plugins { `kotlin-dsl` } -repositories { - mavenCentral() -} - tasks.withType { kotlinOptions.jvmTarget = JavaVersion.VERSION_11.toString() } @@ -14,3 +10,12 @@ java { targetCompatibility = JavaVersion.VERSION_11 sourceCompatibility = JavaVersion.VERSION_11 } + +dependencies { + implementation(rmr.infrastructure.publish) + implementation(rmr.infrastructure.android) + implementation(stack.gradle.android.cacheFixGradlePlugin) + implementation(stack.kotlin.gradlePlugin) + implementation(stack.detekt.gradlePlugin) + implementation(libs.android.gradlePlugin) +} diff --git a/buildSrc/settings.gradle.kts b/buildSrc/settings.gradle.kts new file mode 100644 index 0000000..1fb87b8 --- /dev/null +++ b/buildSrc/settings.gradle.kts @@ -0,0 +1,38 @@ +pluginManagement { + repositories { + gradlePluginPortal() + google() + mavenCentral() + } +} + +@Suppress("UnstableApiUsage") +dependencyResolutionManagement { + repositories { + google { + content { + includeGroupByRegex("com\\.android.*") + includeGroupByRegex("com\\.google.*") + includeGroupByRegex("androidx.*") + } + } + + mavenCentral() + gradlePluginPortal() + } + + versionCatalogs { + val version = "2024.04.10" + create("rmr") { + from("com.redmadrobot.versions:versions-redmadrobot:$version") + } + + create("stack") { + from("com.redmadrobot.versions:versions-stack:$version") + } + + create("libs") { + from(files("../gradle/libs.versions.toml")) + } + } +} diff --git a/buildSrc/src/main/kotlin/convention.detekt.gradle.kts b/buildSrc/src/main/kotlin/convention.detekt.gradle.kts new file mode 100644 index 0000000..aeb9fb0 --- /dev/null +++ b/buildSrc/src/main/kotlin/convention.detekt.gradle.kts @@ -0,0 +1,20 @@ +import io.gitlab.arturbosch.detekt.Detekt +import io.gitlab.arturbosch.detekt.DetektCreateBaselineTask + +plugins { + id("io.gitlab.arturbosch.detekt") +} + +tasks.withType().configureEach { + jvmTarget = JavaVersion.VERSION_11.toString() +} +tasks.withType().configureEach { + jvmTarget = JavaVersion.VERSION_11.toString() +} + +dependencies { + //noinspection UseTomlInstead + detektPlugins("io.gitlab.arturbosch.detekt:detekt-rules-libraries:1.23.6") + //noinspection UseTomlInstead + detektPlugins("io.gitlab.arturbosch.detekt:detekt-formatting:1.23.6") +} diff --git a/buildSrc/src/main/kotlin/convention.library.android.gradle.kts b/buildSrc/src/main/kotlin/convention.library.android.gradle.kts index e69de29..d447089 100644 --- a/buildSrc/src/main/kotlin/convention.library.android.gradle.kts +++ b/buildSrc/src/main/kotlin/convention.library.android.gradle.kts @@ -0,0 +1,9 @@ +plugins { + id("com.redmadrobot.android-library") + id("convention.publishing") + id("convention.detekt") +} + +redmadrobot { + android.minSdk = 19 +} diff --git a/buildSrc/src/main/kotlin/convention.publishing.gradle.kts b/buildSrc/src/main/kotlin/convention.publishing.gradle.kts new file mode 100644 index 0000000..d384948 --- /dev/null +++ b/buildSrc/src/main/kotlin/convention.publishing.gradle.kts @@ -0,0 +1,39 @@ +import com.redmadrobot.build.dsl.* + +plugins { + id("com.redmadrobot.publish-config") + id("com.redmadrobot.publish") +} + +group = "com.redmadrobot.extensions" + +redmadrobot { + publishing { + signArtifacts.set(!isRunningOnCi) + pom { + setGitHubProject("RedMadRobot/redmadrobot-android-ktx") + + licenses { + mit() + } + + developers { + developer(id = "osipxd", name = "Osip Fatkullin", email = "o.fatkullin@redmadrobot.com") + } + } + } +} + +publishing { + repositories { + if (isRunningOnCi) githubPackages("RedMadRobot/redmadrobot-android-ktx") + if (isReleaseVersion && credentialsExist("ossrh")) ossrh() + } +} + +kotlinCompile { + kotlinOptions { + moduleName = "redmadrobot.${project.name}" + } +} + diff --git a/core-ktx/build.gradle.kts b/core-ktx/build.gradle.kts index a9eed20..0092bb9 100644 --- a/core-ktx/build.gradle.kts +++ b/core-ktx/build.gradle.kts @@ -1,6 +1,5 @@ plugins { - id("com.redmadrobot.android-library") - id("com.redmadrobot.publish") + convention.library.android } version = "1.6.0-2" diff --git a/fragment-args-ktx/build.gradle.kts b/fragment-args-ktx/build.gradle.kts index 4b82ae8..3f2ef24 100644 --- a/fragment-args-ktx/build.gradle.kts +++ b/fragment-args-ktx/build.gradle.kts @@ -1,6 +1,5 @@ plugins { - id("com.redmadrobot.android-library") - id("com.redmadrobot.publish") + convention.library.android } version = "1.3.6-1" diff --git a/fragment-ktx/build.gradle.kts b/fragment-ktx/build.gradle.kts index ed32aa6..42a61f8 100644 --- a/fragment-ktx/build.gradle.kts +++ b/fragment-ktx/build.gradle.kts @@ -1,6 +1,5 @@ plugins { - id("com.redmadrobot.android-library") - id("com.redmadrobot.publish") + convention.library.android } version = "1.3.6-0" diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 8049c68..48c0a02 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/lifecycle-livedata-ktx/build.gradle.kts b/lifecycle-livedata-ktx/build.gradle.kts index bcf9871..cf9f374 100644 --- a/lifecycle-livedata-ktx/build.gradle.kts +++ b/lifecycle-livedata-ktx/build.gradle.kts @@ -1,6 +1,5 @@ plugins { - id("com.redmadrobot.android-library") - id("com.redmadrobot.publish") + convention.library.android } version = "2.3.1-0" diff --git a/resources-ktx/build.gradle.kts b/resources-ktx/build.gradle.kts index 3c10ee5..0e9f353 100644 --- a/resources-ktx/build.gradle.kts +++ b/resources-ktx/build.gradle.kts @@ -1,6 +1,5 @@ plugins { - id("com.redmadrobot.android-library") - id("com.redmadrobot.publish") + convention.library.android id("kotlin-parcelize") } diff --git a/viewbinding-ktx/build.gradle.kts b/viewbinding-ktx/build.gradle.kts index de4bf76..4cf521d 100644 --- a/viewbinding-ktx/build.gradle.kts +++ b/viewbinding-ktx/build.gradle.kts @@ -1,6 +1,5 @@ plugins { - id("com.redmadrobot.android-library") - id("com.redmadrobot.publish") + convention.library.android } version = "4.2.1-0"