Skip to content

Commit

Permalink
Use metaborg convention plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
Virtlink committed Jul 6, 2024
1 parent 0a64c87 commit 2f5a328
Showing 1 changed file with 14 additions and 72 deletions.
86 changes: 14 additions & 72 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
import org.metaborg.convention.Developer
import java.net.URI

// Workaround for issue: https://youtrack.jetbrains.com/issue/KTIJ-19369
@Suppress("DSL_SCOPE_VIOLATION")
plugins {
`java-library`
alias(libs.plugins.gitonium) // Bootstrap with previous version
alias(libs.plugins.metaborg.convention.java)
alias(libs.plugins.metaborg.convention.mavenpublish)
`kotlin-dsl`
`java-gradle-plugin`
`maven-publish`
Expand All @@ -26,21 +29,6 @@ dependencies {
testImplementation (libs.kotest.property)
}

tasks.test {
useJUnitPlatform()
}

kotlin {
jvmToolchain {
languageVersion.set(JavaLanguageVersion.of(11))
}
}

configure<JavaPluginExtension> {
withSourcesJar()
withJavadocJar()
}

gradlePlugin {
website.set("https://github.com/metaborg/gitonium")
vcsUrl.set("https://github.com/metaborg/gitonium")
Expand All @@ -52,67 +40,21 @@ gradlePlugin {
}
}

publishing {
afterEvaluate {
publications {
withType<MavenPublication> {
pom {
name.set("Gitonium")
description.set(project.description)
url.set("https://github.com/metaborg/gitonium")
inceptionYear.set("2023")
licenses {
// From: https://spdx.org/licenses/
license {
name.set("Apache-2.0")
url.set("http://www.apache.org/licenses/LICENSE-2.0.txt")
distribution.set("repo")
}
}
developers {
developer {
id.set("gohla")
name.set("Gabriel Konat")
email.set("[email protected]")
}
developer {
id.set("virtlink")
name.set("Daniel A. A. Pelsmaeker")
email.set("[email protected]")
}
}
scm {
connection.set("scm:[email protected]:metaborg/gitonium.git")
developerConnection.set("scm:[email protected]:metaborg/gitonium.git")
url.set("scm:[email protected]:metaborg/gitonium.git")
}
}
}
}
}
repositories {
maven {
val releasesRepoUrl = uri("https://artifacts.metaborg.org/content/repositories/releases/")
val snapshotsRepoUrl = uri("https://artifacts.metaborg.org/content/repositories/snapshots/")
name = "MetaborgArtifacts"
url = if (project.extra["isReleaseVersion"] as Boolean) releasesRepoUrl else snapshotsRepoUrl
credentials {
username = project.findProperty("publish.repository.metaborg.artifacts.username") as String? ?: System.getenv("METABORG_ARTIFACTS_USERNAME")
password = project.findProperty("publish.repository.metaborg.artifacts.password") as String? ?: System.getenv("METABORG_ARTIFACTS_PASSWORD")
}
}
maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/metaborg/gitonium")
credentials {
username = project.findProperty("gpr.user") as String? ?: System.getenv("GITHUB_ACTOR")
password = project.findProperty("gpr.publishKey") as String? ?: System.getenv("GITHUB_TOKEN")
}
}
mavenPublishConvention {
repoOwner.set("metaborg")
repoName.set("gitonium")

metadata {
inceptionYear.set("2019")
developers.set(listOf(
Developer("gohla", "Gabriel Konat", "[email protected]"),
Developer("virtlink", "Daniel A. A. Pelsmaeker", "[email protected]"),
))
}
}



// Normally, when you execute a task such as `test` in a multi-project build, you will execute
// all `:test` tasks in all projects. In contrast, when you specifically execute `:test`
// (prefixed with a colon), you execute the `:test` task only in the root project.
Expand Down

0 comments on commit 2f5a328

Please sign in to comment.