131 lines
3.0 KiB
Groovy
131 lines
3.0 KiB
Groovy
import java.nio.file.Files
|
|
|
|
plugins {
|
|
id 'java-gradle-plugin'
|
|
id 'net.woggioni.gradle.lombok' apply false
|
|
id 'maven-publish'
|
|
}
|
|
|
|
allprojects {
|
|
apply plugin: 'java-library'
|
|
apply plugin: 'net.woggioni.gradle.lombok'
|
|
|
|
repositories {
|
|
maven {
|
|
url = woggioniMavenRepositoryUrl
|
|
}
|
|
mavenCentral()
|
|
}
|
|
|
|
group = "net.woggioni.gradle"
|
|
|
|
lombok {
|
|
version = getProperty('version.lombok')
|
|
}
|
|
|
|
dependencies {
|
|
add("testImplementation", create(group: "org.junit.jupiter", name:"junit-jupiter-api", version: project["version.junitJupiter"]))
|
|
add("testRuntimeOnly", create(group: "org.junit.jupiter", name: "junit-jupiter-engine", version: project["version.junitJupiter"]))
|
|
add("testImplementation", gradleTestKit())
|
|
}
|
|
|
|
tasks.named("test", Test) {
|
|
useJUnitPlatform()
|
|
}
|
|
}
|
|
|
|
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")
|
|
}
|
|
|
|
java {
|
|
sourceCompatibility = JavaVersion.VERSION_1_8
|
|
targetCompatibility = JavaVersion.VERSION_1_8
|
|
}
|
|
|
|
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"
|
|
}
|
|
}
|
|
}
|
|
|
|
publishing {
|
|
repositories {
|
|
maven {
|
|
url = publishMavenRepositoryUrl
|
|
}
|
|
}
|
|
publications {
|
|
maven(MavenPublication) {
|
|
from(components["java"])
|
|
}
|
|
}
|
|
}
|
|
|
|
wrapper {
|
|
gradleVersion = getProperty('version.gradle')
|
|
distributionType = Wrapper.DistributionType.ALL
|
|
}
|
|
|
|
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)
|
|
}
|
|
|