Update Gradle, make multiple release tasks for each platform instead of passing a property
This commit is contained in:
parent
63600f9ebb
commit
74b38c62ef
@ -33,7 +33,6 @@ dependencies {
|
|||||||
implementation(libs.dokka.gradle)
|
implementation(libs.dokka.gradle)
|
||||||
implementation(libs.kotlin.jupyter.gradle)
|
implementation(libs.kotlin.jupyter.gradle)
|
||||||
implementation(libs.kotlin.serialization)
|
implementation(libs.kotlin.serialization)
|
||||||
@Suppress("UnstableApiUsage")
|
|
||||||
implementation(libs.kotlinx.html)
|
implementation(libs.kotlinx.html)
|
||||||
implementation("org.tomlj:tomlj:1.0.0")
|
implementation("org.tomlj:tomlj:1.0.0")
|
||||||
// // nexus publishing plugin
|
// // nexus publishing plugin
|
||||||
@ -60,7 +59,7 @@ gradlePlugin {
|
|||||||
|
|
||||||
create("project") {
|
create("project") {
|
||||||
id = "ru.mipt.npm.gradle.project"
|
id = "ru.mipt.npm.gradle.project"
|
||||||
description = "The root plugin for multimodule project infrastructure"
|
description = "The root plugin for multi-module project infrastructure"
|
||||||
implementationClass = "ru.mipt.npm.gradle.KScienceProjectPlugin"
|
implementationClass = "ru.mipt.npm.gradle.KScienceProjectPlugin"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -215,6 +214,10 @@ afterEvaluate {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
|
||||||
|
kotlinOptions.jvmTarget = "11"
|
||||||
|
}
|
||||||
|
|
||||||
tasks.processResources.configure {
|
tasks.processResources.configure {
|
||||||
duplicatesStrategy = DuplicatesStrategy.INCLUDE
|
duplicatesStrategy = DuplicatesStrategy.INCLUDE
|
||||||
from("gradle/libs.versions.toml")
|
from("gradle/libs.versions.toml")
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
[versions]
|
[versions]
|
||||||
tools = "0.11.1-kotlin-1.6.10"
|
tools = "0.11.1-kotlin-1.6.10"
|
||||||
kotlin = "1.6.10"
|
kotlin = "1.6.10"
|
||||||
atomicfu = "0.17.0"
|
atomicfu = "0.17.1"
|
||||||
binary-compatibility-validator = "0.8.0"
|
binary-compatibility-validator = "0.8.0"
|
||||||
changelog = "1.3.1"
|
changelog = "1.3.1"
|
||||||
dokka = "1.6.10"
|
dokka = "1.6.10"
|
||||||
|
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@ -1,5 +1,5 @@
|
|||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
|
@ -1,3 +1 @@
|
|||||||
rootProject.name = "gradle-tools"
|
rootProject.name = "gradle-tools"
|
||||||
|
|
||||||
enableFeaturePreview("VERSION_CATALOGS")
|
|
||||||
|
@ -53,18 +53,22 @@ public class KSciencePublishingExtension(public val project: Project) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Suppress("UNUSED_VARIABLE")
|
private val releaseTasks = mutableSetOf<Task>()
|
||||||
private val release by project.tasks.creating {
|
|
||||||
group = KScienceProjectPlugin.RELEASE_GROUP
|
|
||||||
description = "Publish development or production release based on version suffix"
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun linkPublicationsToReleaseTask(name: String) = project.afterEvaluate {
|
private fun linkPublicationsToReleaseTask(name: String) = project.afterEvaluate {
|
||||||
allTasks()
|
allTasks()
|
||||||
.filter { it.name == "publish${publicationTarget}To${name.capitalize()}Repository" }
|
.filter { it.name.startsWith("publish") && it.name.endsWith("To${name.capitalize()}Repository") }
|
||||||
.forEach {
|
.forEach {
|
||||||
logger.info("Linking $it to release")
|
val theName = "release${it.name.removePrefix("publish").removeSuffix("")}"
|
||||||
release.dependsOn(it)
|
logger.info("Making $theName task depend on ${it.name}")
|
||||||
|
|
||||||
|
val releaseTask = project.tasks.findByName(theName) ?: project.tasks.create(theName) {
|
||||||
|
group = KScienceProjectPlugin.RELEASE_GROUP
|
||||||
|
description = "Publish development or production release based on version suffix"
|
||||||
|
}
|
||||||
|
|
||||||
|
releaseTasks += releaseTask
|
||||||
|
releaseTask.dependsOn(it)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -73,7 +77,6 @@ public class KSciencePublishingExtension(public val project: Project) {
|
|||||||
*
|
*
|
||||||
* @param githubProject the GitHub project.
|
* @param githubProject the GitHub project.
|
||||||
* @param githubOrg the GitHub user or organization.
|
* @param githubOrg the GitHub user or organization.
|
||||||
* @param publish add publish task for github.
|
|
||||||
* @param addToRelease publish packages in the `release` task to the GitHub repository.
|
* @param addToRelease publish packages in the `release` task to the GitHub repository.
|
||||||
*/
|
*/
|
||||||
public fun github(
|
public fun github(
|
||||||
|
@ -107,16 +107,6 @@ internal fun Project.setupPublication(mavenPomConfiguration: MavenPom.() -> Unit
|
|||||||
|
|
||||||
internal fun Project.isSnapshot() = "dev" in version.toString() || version.toString().endsWith("SNAPSHOT")
|
internal fun Project.isSnapshot() = "dev" in version.toString() || version.toString().endsWith("SNAPSHOT")
|
||||||
|
|
||||||
internal val Project.publicationTarget: String
|
|
||||||
get() {
|
|
||||||
val publicationPlatform = project.findProperty("publishing.platform") as? String
|
|
||||||
return if (publicationPlatform == null) {
|
|
||||||
"AllPublications"
|
|
||||||
} else {
|
|
||||||
publicationPlatform.capitalize() + "Publication"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
internal fun Project.addGithubPublishing(
|
internal fun Project.addGithubPublishing(
|
||||||
githubOrg: String,
|
githubOrg: String,
|
||||||
githubProject: String,
|
githubProject: String,
|
||||||
|
Loading…
Reference in New Issue
Block a user