Skip to content

Commit

Permalink
build: configure Gradle with conventions
Browse files Browse the repository at this point in the history
  • Loading branch information
tynn committed Jan 3, 2024
1 parent 12f937c commit 3f382ac
Show file tree
Hide file tree
Showing 13 changed files with 60 additions and 57 deletions.
2 changes: 1 addition & 1 deletion astring/bom/build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
plugins {
id 'xyz.tynn.convention.bom'
id 'maven-publish'
id 'nexus-publish'
}
2 changes: 1 addition & 1 deletion astring/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugins {
alias libs.plugins.android
id 'maven-publish'
id 'nexus-publish'
}

android {
Expand Down
50 changes: 1 addition & 49 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,57 +4,9 @@ plugins {
alias libs.plugins.kotlin.kapt apply false
alias libs.plugins.conventions
alias libs.plugins.publish
id 'android-kotlin'
}

allprojects {
group = 'xyz.tynn.astring'
}

subprojects {
pluginManager.withPlugin('xyz.tynn.convention.android') {
apply plugin: libs.plugins.kotlin.asProvider().get().pluginId

java.toolchain.languageVersion.set JavaLanguageVersion.of(11)

kotlin.explicitApi()

android.kotlinOptions {
afterEvaluate {
if (!findProperty('isKotlinOnly')) freeCompilerArgs += [
'-Xno-call-assertions',
'-Xno-param-assertions',
'-Xno-receiver-assertions',
]
}
}

dependencies {
testImplementation libs.bundles.testing
}
}

pluginManager.withPlugin('maven-publish') {
publishing.publications.all {
pom {
description = 'A context aware string abstraction for Android'
developers {
developer {
id = 'tynn'
name = 'Christian Schmitz'
email = '[email protected]'
}
}
licenses {
license {
name = 'The Apache License, Version 2.0'
url = 'https://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
}
}
}
}

nexusPublishing.repositories.sonatype {
nexusUrl.set uri('https://s01.oss.sonatype.org/service/local/')
}
2 changes: 1 addition & 1 deletion compose/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugins {
alias libs.plugins.android
id 'maven-publish'
id 'nexus-publish'
}

ext.isKotlinOnly = true
Expand Down
5 changes: 5 additions & 0 deletions gradle/conventions/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
plugins {
id 'groovy-gradle-plugin'
}

sourceSets.main.groovy.srcDirs 'src'
22 changes: 22 additions & 0 deletions gradle/conventions/src/android-kotlin.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
if (parent == null) subprojects {
pluginManager.withPlugin('xyz.tynn.convention.android') {
project.apply plugin: libs.plugins.kotlin.asProvider().get().pluginId

kotlin.explicitApi()
java.toolchain.languageVersion.set JavaLanguageVersion.of(11)

android.kotlinOptions {
afterEvaluate {
if (!findProperty('isKotlinOnly')) freeCompilerArgs += [
'-Xno-call-assertions',
'-Xno-param-assertions',
'-Xno-receiver-assertions',
]
}
}

dependencies {
testImplementation libs.bundles.testing
}
}
}
22 changes: 22 additions & 0 deletions gradle/conventions/src/nexus-publish.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
plugins {
id 'maven-publish'
}

publishing.publications.all {
pom {
description = 'A context aware string abstraction for Android'
developers {
developer {
id = 'tynn'
name = 'Christian Schmitz'
email = '[email protected]'
}
}
licenses {
license {
name = 'The Apache License, Version 2.0'
url = 'https://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
}
}
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ kotlin = "1.9.22"

[plugins]
android = { id = "com.android.library", version.ref = "android" }
conventions = "xyz.tynn.convention.project:0.0.4"
conventions = "xyz.tynn.convention.project:0.0.5"
kotlin = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
kotlin-kapt = { id = "org.jetbrains.kotlin.kapt", version.ref = "kotlin" }
publish = "io.github.gradle-nexus.publish-plugin:1.3.0"
Expand Down
2 changes: 2 additions & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ pluginManagement {
gradlePluginPortal()
google()
}

includeBuild 'gradle/conventions'
}

dependencyResolutionManagement {
Expand Down
2 changes: 1 addition & 1 deletion widget/appcompat/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugins {
alias libs.plugins.android
id 'maven-publish'
id 'nexus-publish'
}

dependencies {
Expand Down
2 changes: 1 addition & 1 deletion widget/binding/build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
plugins {
alias libs.plugins.android
alias libs.plugins.kotlin.kapt
id 'maven-publish'
id 'nexus-publish'
}

android {
Expand Down
2 changes: 1 addition & 1 deletion widget/core/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugins {
alias libs.plugins.android
id 'maven-publish'
id 'nexus-publish'
}

android {
Expand Down
2 changes: 1 addition & 1 deletion widget/material/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugins {
alias libs.plugins.android
id 'maven-publish'
id 'nexus-publish'
}

android {
Expand Down

0 comments on commit 3f382ac

Please sign in to comment.