149 lines
4.0 KiB
Groovy
149 lines
4.0 KiB
Groovy
plugins {
|
|
id 'java-library'
|
|
id 'maven-publish'
|
|
id 'jacoco'
|
|
alias(catalog.plugins.multi.release.jar)
|
|
alias(catalog.plugins.lombok)
|
|
alias(catalog.plugins.sambal)
|
|
}
|
|
|
|
allprojects {
|
|
group = "net.woggioni"
|
|
version = getProperty('jwo.version')
|
|
|
|
repositories {
|
|
maven {
|
|
url = getProperty('gitea.maven.url')
|
|
}
|
|
mavenCentral()
|
|
}
|
|
pluginManager.withPlugin('java-library') {
|
|
|
|
java {
|
|
toolchain {
|
|
languageVersion = JavaLanguageVersion.of(21)
|
|
vendor = JvmVendorSpec.GRAAL_VM
|
|
}
|
|
}
|
|
|
|
dependencies {
|
|
testImplementation catalog.junit.jupiter.api
|
|
testImplementation catalog.junit.jupiter.params
|
|
testRuntimeOnly catalog.junit.jupiter.engine
|
|
}
|
|
|
|
test {
|
|
useJUnitPlatform()
|
|
|
|
systemProperties([
|
|
'junit.jupiter.execution.parallel.enabled' : true,
|
|
'junit.jupiter.execution.parallel.mode.default' : 'concurrent',
|
|
'junit.jupiter.execution.parallel.mode.classes.default' : 'concurrent'
|
|
])
|
|
}
|
|
|
|
pluginManager.withPlugin('jacoco') {
|
|
test {
|
|
finalizedBy jacocoTestReport
|
|
}
|
|
jacocoTestReport {
|
|
dependsOn test
|
|
}
|
|
}
|
|
}
|
|
|
|
pluginManager.withPlugin(catalog.plugins.lombok.get().pluginId) {
|
|
lombok {
|
|
version = catalog.versions.lombok.get()
|
|
}
|
|
}
|
|
|
|
pluginManager.withPlugin('maven-publish') {
|
|
|
|
pluginManager.withPlugin('java-library') {
|
|
java {
|
|
withJavadocJar()
|
|
withSourcesJar()
|
|
}
|
|
}
|
|
|
|
publishing {
|
|
repositories {
|
|
maven {
|
|
name = "Gitea"
|
|
url = uri(getProperty('gitea.maven.url'))
|
|
|
|
credentials(HttpHeaderCredentials) {
|
|
name = "Authorization"
|
|
value = "token ${System.getenv()["PUBLISHER_TOKEN"]}"
|
|
}
|
|
|
|
authentication {
|
|
header(HttpHeaderAuthentication)
|
|
}
|
|
|
|
}
|
|
}
|
|
publications {
|
|
maven(MavenPublication) {
|
|
from(components["java"])
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
ext {
|
|
setProperty('jpms.module.name', 'net.woggioni.jwo')
|
|
}
|
|
|
|
|
|
configurations {
|
|
pathClassloaderTest
|
|
zipTestBundle {
|
|
transitive = false
|
|
canBeConsumed = false
|
|
visible = false
|
|
canBeResolved = true
|
|
}
|
|
}
|
|
|
|
dependencies {
|
|
implementation catalog.slf4j.api
|
|
pathClassloaderTest group: 'com.google.inject', name: 'guice', version: getProperty('guice.version')
|
|
zipTestBundle group: 'com.google.inject', name: 'guice', version: getProperty('guice.version')
|
|
}
|
|
|
|
compileJava {
|
|
options.release = 8
|
|
options.compilerArgs << '-parameters'
|
|
}
|
|
|
|
TaskProvider<Zip> pathClassLoaderTestBundleTask = tasks.register("pathClassLoaderTestBundle", Zip) {
|
|
from(configurations.pathClassloaderTest)
|
|
archiveBaseName = "pathClassLoaderTestBundle"
|
|
}
|
|
|
|
test {
|
|
inputs.files(pathClassLoaderTestBundleTask)
|
|
useJUnitPlatform()
|
|
File junitJupiterEngineJar = configurations.getByName(JavaPlugin.TEST_RUNTIME_CLASSPATH_CONFIGURATION_NAME)
|
|
.resolvedConfiguration.resolvedArtifacts.grep { ResolvedArtifact resolvedArtifact ->
|
|
ModuleVersionIdentifier id = resolvedArtifact.moduleVersion.id
|
|
id.group == 'org.junit.jupiter' && id.name == 'junit-jupiter-engine'
|
|
}.collect {
|
|
ResolvedArtifact resolvedArtifact -> resolvedArtifact.file
|
|
}.first()
|
|
systemProperties([
|
|
'junit.jupiter.engine.jar' : junitJupiterEngineJar.toString(),
|
|
'path.classloader.test.bundle' : pathClassLoaderTestBundleTask.flatMap { it.archiveFile }.get().asFile,
|
|
'zip.test.bundle' : configurations.zipTestBundle.singleFile
|
|
])
|
|
|
|
jvmArgs([
|
|
'--add-opens', 'java.base/sun.nio.fs=ALL-UNNAMED',
|
|
])
|
|
}
|
|
|
|
|