141 lines
3.2 KiB
Groovy
141 lines
3.2 KiB
Groovy
import java.nio.file.Files
|
|
|
|
plugins {
|
|
id 'java-gradle-plugin'
|
|
alias(catalog.plugins.lombok) apply false
|
|
id 'maven-publish'
|
|
}
|
|
|
|
allprojects {
|
|
apply plugin: 'java-library'
|
|
apply plugin: catalog.plugins.lombok.get().pluginId
|
|
|
|
repositories {
|
|
mavenCentral()
|
|
}
|
|
|
|
java {
|
|
toolchain {
|
|
languageVersion = JavaLanguageVersion.of(21)
|
|
}
|
|
}
|
|
|
|
lombok {
|
|
version = catalog.versions.lombok
|
|
}
|
|
|
|
configurations.all {
|
|
resolutionStrategy.cacheDynamicVersionsFor 0, 'seconds'
|
|
}
|
|
|
|
dependencies {
|
|
testImplementation catalog.junit.jupiter.api
|
|
testRuntimeOnly catalog.junit.jupiter.engine
|
|
}
|
|
|
|
tasks.named(JavaPlugin.COMPILE_JAVA_TASK_NAME, JavaCompile) {
|
|
options.release = 8
|
|
}
|
|
|
|
tasks.named("test", Test) {
|
|
useJUnitPlatform()
|
|
}
|
|
|
|
pluginManager.withPlugin('maven-publish') {
|
|
publishing {
|
|
repositories {
|
|
maven {
|
|
name = "Gitea"
|
|
url = uri(getProperty('gitea.maven.url'))
|
|
|
|
credentials(HttpHeaderCredentials) {
|
|
name = "Authorization"
|
|
value = "token ${System.getenv()["PUBLISHER_TOKEN"]}"
|
|
}
|
|
|
|
authentication {
|
|
header(HttpHeaderAuthentication)
|
|
}
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
group = "net.woggioni.gradle"
|
|
|
|
version = getProperty("version.envelope")
|
|
|
|
configurations {
|
|
embedded {
|
|
visible = false
|
|
canBeConsumed = false
|
|
}
|
|
compileOnly.extendsFrom(embedded)
|
|
tar {
|
|
visible = false
|
|
canBeConsumed = false
|
|
transitive = false
|
|
}
|
|
}
|
|
|
|
dependencies {
|
|
tar project(path: "launcher", configuration: 'tar')
|
|
embedded project(path: "common", configuration: "archives")
|
|
|
|
testImplementation gradleTestKit()
|
|
}
|
|
|
|
tasks.named('processResources', ProcessResources) {
|
|
from {
|
|
configurations.named('embedded').map {
|
|
it.collect {
|
|
it.isDirectory() ? it : zipTree(it)
|
|
}
|
|
}
|
|
}
|
|
into('LIB-INF') {
|
|
from(configurations.named('tar'))
|
|
}
|
|
}
|
|
|
|
jar {
|
|
manifest {
|
|
attributes "version" : archiveVersion.get()
|
|
}
|
|
}
|
|
|
|
gradlePlugin {
|
|
plugins {
|
|
create("EnvelopePlugin") {
|
|
id = "net.woggioni.gradle.envelope"
|
|
implementationClass = "net.woggioni.gradle.envelope.EnvelopePlugin"
|
|
}
|
|
}
|
|
}
|
|
|
|
tasks.named('processTestResources') { ProcessResources it ->
|
|
doLast {
|
|
Files.newBufferedWriter(it.destinationDir.toPath().resolve('test-resources.txt')).withCloseable { writer ->
|
|
sourceSets.test.resources.sourceDirectories.each { srcDir ->
|
|
java.nio.file.Path srcPath = srcDir.toPath()
|
|
Files.walk(srcPath).forEach {
|
|
if(Files.isRegularFile(it) && srcPath != it) {
|
|
writer.write(srcPath.relativize(it).toString() + '\n')
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
tasks.named('test', Test) {
|
|
systemProperty('test.gradle.user.home', temporaryDir)
|
|
}
|
|
|
|
tasks.named("pluginUnderTestMetadata", PluginUnderTestMetadata) {
|
|
pluginClasspath.from(configurations.compileClasspath)
|
|
}
|
|
|