Skip to content

Commit

Permalink
build: Add jreleaser plugin (#1)
Browse files Browse the repository at this point in the history
Add jreleaser plugin to manage releases.
  • Loading branch information
usmansaleem authored Jul 4, 2024
1 parent bc530de commit 1ff2b50
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 4 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@ integrate with HSM with PKCS11 interface. SoftHSM is used as a test HSM.

Drop the `jar` in the `/plugins` folder under Besu installation. This plugin will expose following additional cli
options:
`TBA`

## Linux SoftHSM Setup
Following steps are tested on Ubuntu 24.04 LTS. Install following packages.
`TBA`

## Docker setup
See Dockerfile for details.
Expand Down
70 changes: 67 additions & 3 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
import org.jreleaser.model.Active
import org.jreleaser.model.Distribution
import org.jreleaser.model.UpdateSection

plugins {
`java-library`
alias(libs.plugins.spotless)
alias(libs.plugins.jgitver)
alias(libs.plugins.jreleaser)
}

project.group = "info.usmans.tools"

repositories {
// Use Maven Central for resolving dependencies.
mavenCentral()
Expand Down Expand Up @@ -38,7 +45,64 @@ spotless {
kotlinGradle { ktfmt() }
}

jgitver {
nonQualifierBranches = "main"
useDirty = true
jgitver { nonQualifierBranches = "main" }

tasks.register("printVersion") {
group = "Help"
description = "Prints the project version"
doLast { println("Version: ${project.version}") }
}

tasks.jar {
manifest {
attributes(
mapOf("Implementation-Title" to project.name, "Implementation-Version" to project.version))
}
}

jreleaser {
dependsOnAssemble = true
project {
description.set("Besu PKCS11-SoftHSM plugin")
authors.set(listOf("Usman Saleem"))
license.set("(Apache-2.0 OR MIT)")
inceptionYear.set("2024")
copyright.set("2024, Usman Saleem")
links {
homepage.set("https://github.com/usmansaleem/besu-pkcs11-plugin")
documentation.set("https://github.com/usmansaleem/besu-pkcs11-plugin")
}
}

distributions {
create("besu-pkcs11-plugin") {
distributionType.set(Distribution.DistributionType.SINGLE_JAR)
artifact {
path.set(layout.buildDirectory.file("libs/{{distributionName}}-{{projectVersion}}.jar"))
}
}
}

release {
github {
repoOwner = "usmansaleem"
token = "__DO_NOT_SET_HERE__"
// append artifacts to an existing release with matching tag
update {
enabled = true
sections.set(listOf(UpdateSection.ASSETS, UpdateSection.TITLE, UpdateSection.BODY))
}
// We need to create tag manually because our version calculation depends on it.
skipTag = true
changelog {
formatted.set(Active.ALWAYS)
preset.set("conventional-commits")
contributors {
enabled.set(true)
format.set(
"- {{contributorName}}{{#contributorUsernameAsLink}} ({{.}}){{/contributorUsernameAsLink}}")
}
}
}
}
}
4 changes: 3 additions & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ spotless = "6.25.0"
slf4j = "2.0.13"
bouncy-castle = "1.78.1"
jgitver = "0.10.0-rc03"
jreleaser = "1.13.1"

[libraries]
junit-jupiter = { module = "org.junit.jupiter:junit-jupiter", version.ref = "junit-jupiter" }
Expand All @@ -18,4 +19,5 @@ bcprov = { module = "org.bouncycastle:bcprov-jdk18on", version.ref = "bouncy-cas

[plugins]
spotless = { id = "com.diffplug.spotless", version.ref = "spotless" }
jgitver = { id = "fr.brouillard.oss.gradle.jgitver", version.ref = "jgitver" }
jgitver = { id = "fr.brouillard.oss.gradle.jgitver", version.ref = "jgitver" }
jreleaser = { id = "org.jreleaser", version.ref = "jreleaser"}

0 comments on commit 1ff2b50

Please sign in to comment.