Skip to content

Commit

Permalink
Specify release version in maven plugin descriptor
Browse files Browse the repository at this point in the history
  • Loading branch information
shanshin committed Jul 19, 2024
1 parent ccf20ea commit 332988b
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -170,9 +170,6 @@ fun MavenPublication.addMetadata() {
if (!name.isPresent) {
name.set(artifactId)
}
if (hasProperty("releaseVersion")) {
version = property("releaseVersion") as String
}
groupId = "org.jetbrains.kotlinx"
description.set(extension.description)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ import java.time.format.DateTimeFormatter
// ====================
tasks.register("prepareRelease") {
doLast {
if (!project.hasProperty("releaseVersion")) {
throw GradleException("Property 'releaseVersion' is required to run this task")
if (project.version.toString().endsWith("-SNAPSHOT")) {
throw GradleException("Version shouldn't be snapshot")
}
val releaseVersion = project.property("releaseVersion") as String
val releaseVersion = project.version.toString()
val prevReleaseVersion = project.property("kover.release.version") as String

val projectDir = layout.projectDirectory
Expand All @@ -30,8 +30,6 @@ tasks.register("prepareRelease") {
// replace versions in docs
projectDir.dir("docs").patchDocs(releaseVersion, prevReleaseVersion)
}


}
}

Expand Down
8 changes: 1 addition & 7 deletions kover-features-jvm/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -56,16 +56,10 @@ repositories {
}

tasks.processResources {
val version = if (project.hasProperty("releaseVersion")) {
project.property("releaseVersion").toString()
} else {
project.version.toString()
}

val file = destinationDir.resolve("kover.version")

doLast {
file.writeText(version)
file.writeText(project.version.toString())
}
}

Expand Down
8 changes: 1 addition & 7 deletions kover-jvm-agent/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -45,20 +45,14 @@ dependencies {
fatJar(libs.intellij.agent)
}

val targetVersion = if (project.hasProperty("releaseVersion")) {
project.property("releaseVersion").toString()
} else {
project.version.toString()
}

tasks.jar {
manifest {
attributes(
"Premain-Class" to "kotlinx.kover.jvmagent.KoverJvmAgentPremain",
"Can-Retransform-Classes" to "true",
// We need to pass this parameter, because IntelliJ agent collects data in the bootstrap class loader
// it is not possible to use other loaders because some of them (for example, FilteredClassLoader) restrict access to agent classes
"Boot-Class-Path" to "${project.name}-$targetVersion.jar"
"Boot-Class-Path" to "${project.name}-${project.version}.jar"
)
}
}

0 comments on commit 332988b

Please sign in to comment.