-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.gradle.kts
151 lines (130 loc) · 4.66 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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
import org.incendo.cloudbuildlogic.jmp
import java.nio.file.Files
import kotlin.io.path.copyTo
import kotlin.io.path.createDirectories
import kotlin.io.path.exists
import kotlin.io.path.invariantSeparatorsPathString
import kotlin.io.path.isDirectory
plugins {
alias(libs.plugins.indra)
alias(libs.plugins.indraCheckstyle)
alias(libs.plugins.indraPublishing)
alias(libs.plugins.javadocLinks)
}
allprojects {
plugins.apply("net.kyori.indra")
plugins.apply("net.kyori.indra.checkstyle")
plugins.apply("net.kyori.indra.publishing")
plugins.apply("org.incendo.cloud-build-logic.javadoc-links")
indra {
javaVersions {
target(17)
strictVersions(true)
}
publishSnapshotsTo("paperSnapshots", "https://repo.papermc.io/repository/maven-snapshots/")
publishReleasesTo("paperReleases", "https://repo.papermc.io/repository/maven-releases/")
signWithKeyFromProperties("signingKey", "signingPassword")
apache2License()
github("PaperMC", "asm-utils") {
ci(true)
}
configurePublications {
pom {
developers {
jmp()
developer {
id = "Machine-Maker"
name = "Jake Potrebic"
url = "https://github.com/Machine-Maker"
}
developer {
id = "kennytv"
name = "Nassim Jahnke"
url = "https://github.com/kennytv"
}
}
}
}
}
repositories {
mavenCentral()
}
dependencies {
if ("-runtime" !in project.name) {
api(rootProject.libs.asm)
testImplementation(rootProject.libs.asm)
api(rootProject.libs.asmCommons)
testImplementation(rootProject.libs.asmCommons)
}
compileOnlyApi(rootProject.libs.checkerQual)
testCompileOnly(rootProject.libs.checkerQual)
compileOnly(rootProject.libs.jetbrainsAnnotations)
testCompileOnly(rootProject.libs.jetbrainsAnnotations)
testImplementation(rootProject.libs.jupiterApi)
testImplementation(rootProject.libs.jupiterParams)
testRuntimeOnly(rootProject.libs.jupiterEngine)
}
}
val mainForNewTargets = sourceSets.create("mainForNewTargets")
val testDataSet = sourceSets.create("testData")
val testDataNewTargets = sourceSets.create("testDataNewTargets")
val filtered = tasks.register<FilterTestClasspath>("filteredTestClasspath") {
outputDir.set(layout.buildDirectory.dir("filteredTestClasspath"))
old.from(testDataSet.output)
new.from(testDataNewTargets.output)
}
dependencies {
implementation(mainForNewTargets.output)
testImplementation(files(filtered.flatMap { it.outputDir }))
testImplementation(testDataNewTargets.output)
testDataNewTargets.implementationConfigurationName(mainForNewTargets.output)
}
abstract class FilterTestClasspath : DefaultTask() {
@get:InputFiles
abstract val old: ConfigurableFileCollection
@get:InputFiles
abstract val new: ConfigurableFileCollection
@get:OutputDirectory
abstract val outputDir: DirectoryProperty
@get:Inject
abstract val fsOps: FileSystemOperations
@TaskAction
fun run() {
if (!outputDir.get().asFile.toPath().exists()) {
outputDir.get().asFile.mkdirs()
} else {
fsOps.delete {
delete(outputDir.get())
}
outputDir.get().asFile.mkdirs()
}
val newExisting = mutableListOf<String>()
for (file in new.files) {
if (file.exists()) {
Files.walk(file.toPath()).use { s ->
s.forEach {
if (it.isDirectory()) {
return@forEach
}
newExisting += file.toPath().relativize(it).invariantSeparatorsPathString
}
}
}
}
for (file in old.files) {
if (file.exists()) {
Files.walk(file.toPath()).use { s ->
s.forEach {
if (it.isDirectory()) {
return@forEach
}
val rel = file.toPath().relativize(it).invariantSeparatorsPathString
if (rel !in newExisting) {
it.copyTo(outputDir.get().asFile.toPath().resolve(rel).also { f -> f.parent.createDirectories() })
}
}
}
}
}
}
}