Stephan Schroeder
07/29/2019, 3:47 PMsubprojects {
plugins {
java
idea
`maven-publish`
id("pl.allegro.tech.build.axion-release") version "1.9.3"
}
group = "uk.co.di.platform"
version = scmVersion.version
configure<JavaPluginConvention> {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
repositories {
mavenCentral()
mavenLocal()
}
publishing {
publications {
create<MavenPublication>("mavenJava") {
from(components["java"])
}
}
}
tasks {
scmVersion {
versionIncrementer("incrementMinor")
tag(delegateClosureOf<TagNameSerializationConfig> {
initialVersion = KotlinClosure2<TagProperties, ScmPosition, String>({ _, _ ->"1.0.0"})
})
checks(delegateClosureOf<ChecksConfig> {
aheadOfRemote = false
uncommittedChanges = false
})
}
}
}
scmVersion is e.g. flagged as unresolved reverence, but it should have been made accessible by the axion-release plugin.louiscad
07/29/2019, 3:53 PMplugins
DSL can work in the subprojects { }
lambda.
You should still be able to share the remaining logic. This article (especially towards the end) should be helpful to you and give your the needed inspiration: https://medium.com/@p.tournaris/reducing-android-gradle-module-configuration-boilerplate-93ee661c80c4louiscad
07/29/2019, 3:53 PMStephan Schroeder
07/29/2019, 3:58 PMvoben
07/29/2019, 4:42 PMStephan Schroeder
07/30/2019, 1:48 PMscmVersion
and publishing
are still not recognized which means that that not even the maven-publish
plugin was added correctly.louiscad
07/30/2019, 2:46 PMPublishingExtension
Stephan Schroeder
07/30/2019, 3:06 PMbuildscript
config, but scmVersion
is still unresolved (as is publishing). I read the article but that one is mainly concerned with setting the source-version, but my primary problem is the scmVersion
.Stephan Schroeder
07/30/2019, 3:25 PMbuildscript {
repositories {
maven {
url = uri("<https://plugins.gradle.org/m2/>")
}
}
dependencies {
classpath("pl.allegro.tech.build:axion-release-plugin:1.9.3")
}
}
subprojects {
apply(plugin = "java")
apply(plugin = "idea")
apply(plugin = "maven-publish")
apply(plugin = "pl.allegro.tech.build.axion-release")
group = "uk.co.whichdigital.di.platform"
version = scmVersion.version
configure<JavaPluginConvention> {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
repositories {
mavenCentral()
mavenLocal()
}
publishing {
publications {
create<MavenPublication>("mavenJava") {
from(components["java"])
}
}
}
tasks {
scmVersion {
versionIncrementer("incrementMinor")
tag(delegateClosureOf<TagNameSerializationConfig> {
initialVersion = KotlinClosure2<TagProperties, ScmPosition, String>({ _, _ ->"1.0.0"})
})
checks(delegateClosureOf<ChecksConfig> {
aheadOfRemote = false
uncommittedChanges = false
})
}
}
}
voben
07/30/2019, 4:19 PMscmVersion
would be available in the app level build.gradle file. Not so sure about the top level build.gradle thoughlouiscad
07/30/2019, 10:35 PMconfigure<PublishingExtension> { }
instead of publishing { }
Stephan Schroeder
07/31/2019, 1:12 PMversion = scmVersion.version
in each subproject, but the whole scmVersion configuration in tasks doesn’t work, and that ’s way to much to replicate over all subprojects.louiscad
07/31/2019, 1:51 PMgetByName("scmVersion")
. This is Kotlin DSL, not Groovy Gradle with "magic" referencesStephan Schroeder
07/31/2019, 3:12 PMplugins {
id 'pl.allegro.tech.build.axion-release' version ''
}
scmVersion {
// ...
}
allprojects {
project.version = scmVersion.version
}
but what is the Kotlin-DSL version of this?
the Groovy class that contains the context of the scmVersion-block is called VersionConfig
but I guess I have to import it somehow, IntelliJ doesn’t offer autocompeltion.Stephan Schroeder
07/31/2019, 3:19 PM