-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TS-41699 Migrate maven plugin build to Gradle
- Loading branch information
Showing
14 changed files
with
51 additions
and
903 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
20 changes: 0 additions & 20 deletions
20
teamscale-maven-plugin/.mvn/wrapper/maven-wrapper.properties
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,100 +1,31 @@ | ||
import org.apache.tools.ant.taskdefs.condition.Os | ||
|
||
abstract class MavenExec : Exec() { | ||
@TaskAction | ||
override fun exec() { | ||
executable = "./mvnw" | ||
if (Os.isFamily(Os.FAMILY_WINDOWS)) { | ||
executable = "cmd" | ||
args(listOf("/c", "mvnw.cmd") + (args ?: emptyList())) | ||
} | ||
workingDir(".") | ||
project.file("pom.xml").writeText( | ||
project.file("pom.xml").readText().replace( | ||
Regex("<teamscale.agent.version>[^<]+</teamscale.agent.version>"), | ||
"<teamscale.agent.version>${project.version}</teamscale.agent.version>" | ||
).replace( | ||
Regex("<revision>[^<]+</revision>"), | ||
"<revision>${project.version}</revision>" | ||
) | ||
) | ||
super.exec() | ||
project.file("pom.xml").writeText( | ||
project.file("pom.xml").readText().replace( | ||
Regex("<teamscale.agent.version>[^<]+</teamscale.agent.version>"), | ||
"<teamscale.agent.version>34.0.0</teamscale.agent.version>" | ||
).replace( | ||
Regex("<revision>[^<]+</revision>"), | ||
"<revision>1.0.0-SNAPSHOT</revision>" | ||
) | ||
) | ||
} | ||
plugins { | ||
alias(libs.plugins.mavenPluginDevelopment) | ||
com.teamscale.`java-convention` | ||
com.teamscale.coverage | ||
com.teamscale.publish | ||
} | ||
|
||
tasks.register<MavenExec>("clean") { | ||
group = "build" | ||
description = "Cleans the build directory" | ||
args("clean") | ||
publishAs { | ||
readableName.set("Teamscale Maven Plugin") | ||
description.set("Maven Plugin for Teamscale") | ||
} | ||
|
||
tasks.register<MavenExec>("build") { | ||
group = "build" | ||
description = "Builds the project and runs tests" | ||
args( | ||
"verify", | ||
"-Drevision=${project.version}", | ||
"-Dteamscale.agent.version=${project.version}" | ||
) | ||
mavenPlugin { | ||
helpMojoPackage.set("com.teamscale.maven.help") | ||
} | ||
|
||
tasks.register<MavenExec>("publishToMavenLocal") { | ||
group = "publishing" | ||
description = "Publishes the project to the local Maven repository" | ||
args( | ||
"install", | ||
"-Drevision=${project.version}", | ||
"-Dteamscale.agent.version=${project.version}" | ||
) | ||
} | ||
dependencies { | ||
implementation(project(":agent")) | ||
implementation(project(":report-generator")) | ||
implementation(project(":teamscale-client")) | ||
|
||
tasks.withType<MavenExec> { | ||
if (name != "clean") { | ||
dependsOn(":agent:publishToMavenLocal") | ||
dependsOn(":teamscale-client:publishToMavenLocal") | ||
dependsOn(":impacted-test-engine:publishToMavenLocal") | ||
} | ||
} | ||
compileOnly(libs.maven.core) | ||
implementation(libs.maven.pluginApi) | ||
compileOnly(libs.maven.pluginAnnotations) | ||
|
||
if (project.hasProperty("sonatypeUsername") && | ||
project.hasProperty("sonatypePassword") && | ||
project.hasProperty("signing.keyId") && | ||
project.hasProperty("gpgDirectory") | ||
) { | ||
implementation(libs.jgit) | ||
implementation(libs.teamscaleLibCommons) | ||
|
||
tasks.register<MavenExec>("publishMavenPublicationToSonatypeRepository") { | ||
group = "publishing" | ||
description = "Publishes the Maven publication to the Sonatype repository" | ||
doFirst { | ||
file("/tmp/maven-settings.xml").writeText( | ||
""" | ||
<settings> | ||
<servers> | ||
<server> | ||
<id>ossrh</id> | ||
<username>${project.property("sonatypeUsername")}</username> | ||
<password>${project.property("sonatypePassword")}</password> | ||
</server> | ||
</servers> | ||
</settings> | ||
""" | ||
) | ||
} | ||
args( | ||
"deploy", "-s", "/tmp/maven-settings.xml", | ||
"-Dgpg.passphrase=${project.property("signing.password")}", | ||
"-Dgpg.homedir=${project.property("gpgDirectory")}", | ||
"-Dgpg.keyname=${project.property("signing.keyId")}", | ||
"-DsecretKeyRingFile=${project.property("signing.secretKeyRingFile")}" | ||
) | ||
} | ||
testImplementation(libs.junit.jupiter.api) | ||
testImplementation(libs.assertj) | ||
} |
Oops, something went wrong.