-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
123 lines (107 loc) · 3.41 KB
/
build.gradle.kts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
// Copyright 2024, Usman Saleem.
// SPDX-License-Identifier: (Apache-2.0 OR MIT)
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()
// For Besu plugin dependencies
maven {
url = uri("https://hyperledger.jfrog.io/artifactory/besu-maven/")
content { includeGroupByRegex("org\\.hyperledger\\.besu($|\\..*)") }
}
}
dependencies {
// This project jar is not supposed to be used as compilation dependency.
// `api` is used here to distinguish between dependencies which should be used IF it is to be used
// as a dependency during compiling some other library that depends on this project.
api(libs.besu.plugin.api)
api(libs.bcprov)
// https://github.com/google/auto/tree/main/service
annotationProcessor(libs.google.auto.service)
implementation(libs.google.auto.service.annotations)
implementation(libs.slf4j.api)
implementation(libs.picocli)
// testing dependencies
testImplementation(libs.junit.jupiter)
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
}
// Apply a specific Java toolchain to ease working on different environments.
java { toolchain { languageVersion = JavaLanguageVersion.of(21) } }
tasks.named<Test>("test") {
// Use JUnit Platform for unit tests.
useJUnitPlatform()
}
spotless {
java {
importOrder()
removeUnusedImports()
googleJavaFormat()
licenseHeaderFile(layout.projectDirectory.file("gradle/spotless/java.license.template"))
}
kotlinGradle { ktfmt() }
}
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 {
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")
}
}
dependsOnAssemble.set(true)
gitRootSearch.set(true)
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"
// 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}}")
}
}
}
}
}