109 lines
2.8 KiB
Groovy
109 lines
2.8 KiB
Groovy
plugins {
|
|
id 'java-library'
|
|
alias catalog.plugins.kotlin.jvm
|
|
alias catalog.plugins.envelope
|
|
alias catalog.plugins.sambal
|
|
id 'maven-publish'
|
|
}
|
|
|
|
import net.woggioni.gradle.envelope.EnvelopeJarTask
|
|
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
|
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
|
|
|
|
group = 'net.woggioni'
|
|
|
|
version = project.currentTag ?: "${getProperty('gbcs.version')}.${project.gitRevision[0..10]}"
|
|
|
|
envelopeJar {
|
|
mainModule = 'net.woggioni.gbcs'
|
|
mainClass = 'net.woggioni.gbcs.GradleBuildCacheServer'
|
|
}
|
|
|
|
repositories {
|
|
maven {
|
|
url = getProperty('gitea.maven.url')
|
|
content {
|
|
includeModule 'net.woggioni', 'jwo'
|
|
includeGroup 'com.lys'
|
|
}
|
|
}
|
|
mavenCentral()
|
|
}
|
|
|
|
dependencies {
|
|
implementation catalog.jwo
|
|
implementation catalog.slf4j.api
|
|
implementation catalog.netty.codec.http
|
|
|
|
// runtimeOnly catalog.slf4j.jdk14
|
|
runtimeOnly catalog.logback.classic
|
|
|
|
testImplementation catalog.bcprov.jdk18on
|
|
testImplementation catalog.bcpkix.jdk18on
|
|
testImplementation catalog.junit.jupiter.api
|
|
testImplementation catalog.junit.jupiter.params
|
|
testRuntimeOnly catalog.junit.jupiter.engine
|
|
}
|
|
|
|
java {
|
|
withSourcesJar()
|
|
modularity.inferModulePath = true
|
|
toolchain {
|
|
languageVersion = JavaLanguageVersion.of(21)
|
|
}
|
|
}
|
|
|
|
test {
|
|
useJUnitPlatform()
|
|
}
|
|
|
|
tasks.named(JavaPlugin.COMPILE_JAVA_TASK_NAME, JavaCompile) {
|
|
options.compilerArgs << '--patch-module' << 'net.woggioni.gbcs=' + project.sourceSets.main.output.asPath
|
|
options.javaModuleVersion = provider { version }
|
|
options.javaModuleMainClass = envelopeJar.mainClass
|
|
}
|
|
|
|
tasks.withType(JavaCompile) {
|
|
modularity.inferModulePath = true
|
|
options.release = 21
|
|
}
|
|
|
|
|
|
tasks.named("compileKotlin", KotlinCompile.class) {
|
|
compilerOptions.jvmTarget = JvmTarget.JVM_21
|
|
}
|
|
|
|
Provider<EnvelopeJarTask> envelopeJarTaskProvider = tasks.named('envelopeJar', EnvelopeJarTask.class) {
|
|
// systemProperties['java.util.logging.config.class'] = 'net.woggioni.gbcs.LoggingConfig'
|
|
// systemProperties['log.config.source'] = 'logging.properties'
|
|
systemProperties['logback.configurationFile'] = 'classpath:logback.xml'
|
|
}
|
|
|
|
|
|
def envelopeJarArtifact = artifacts.add('archives', envelopeJarTaskProvider.get().archiveFile.get().asFile) {
|
|
type = 'jar'
|
|
builtBy envelopeJarTaskProvider
|
|
}
|
|
|
|
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) {
|
|
artifact envelopeJarArtifact
|
|
}
|
|
}
|
|
} |