-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbuild.gradle
More file actions
73 lines (63 loc) · 2.68 KB
/
build.gradle
File metadata and controls
73 lines (63 loc) · 2.68 KB
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
import com.diffplug.spotless.cli.picocli.usage.GenerateUsagePropertiesTask
import com.diffplug.spotless.extra.wtp.EclipseWtpFormatterStep
import org.gradle.plugins.ide.eclipse.model.EclipseWtp
plugins {
id 'buildlogic.picocli-conventions'
id 'buildlogic.java-special-tests-conventions'
id 'buildlogic.java-graalvm-conventions'
id 'buildlogic.spotless-json-conventions'
}
version = rootProject.version
dependencies {
testImplementation project(':testlib')
implementation libs.bundles.spotless.libs
implementation libs.diff.utils
// these are fixed versions of the otherwise dynamic dependencies for spotless
// this is necessary to allow for native compilation where reflective access to dynamic jars is not possible
implementation libs.bundles.native.includes
// Eclipse WTP formatter used a custom lockfile to ensure the formatter has the
// correct version of all its libraries
def resourceName = "/com/diffplug/spotless/extra/eclipse_wtp_formatter/v4.21.0.lockfile"
logger.debug("reading eclipse wtp resource: " + resourceName)
EclipseWtpFormatterStep.getResource(resourceName)
.readLines()
.findAll { !it.startsWith('#')} // filter out comments
.each {
implementation("${it}") {
transitive=false
}
}
}
application {
mainClass = 'com.diffplug.spotless.cli.SpotlessCLI'
applicationName = 'spotless'
archivesBaseName = 'spotless-cli'
}
gradle.taskGraph.whenReady { TaskExecutionGraph graph ->
// println "Graph: " + graph.allTasks*.name
if (graph.hasTask(':app:nativeCompile') || graph.hasTask(':app:metadataCopy') || graph.hasTask(':app:shadowJar')) {
// enable graalvm agent using property here instead of command line `-Pagent=standard`
// this collects information about reflective access and resources used by the application (e.g. GJF)
project.ext.agent = 'standard'
}
}
tasks.withType(Test).configureEach {
if (it.name == 'test' || it.name == 'testNpm' || it.name == 'testSeparateJvm') {
it.outputs.dir(nativeCompileMetaDir)
if (project.hasProperty('agent')) {
it.inputs.property('agent', project.property('agent')) // make sure to re-run tests if agent changes
}
it.systemProperty 'spotless.cli.inSameThread', 'true' //mark tests
}
if (it.name == 'testCliProcess' || it.name == 'testCliProcessNpm') {
it.dependsOn('shadowJar')
it.systemProperty 'spotless.cli.shadowJar', tasks.shadowJar.archiveFile.get().asFile
}
if (it.name == 'testCliNative' || it.name == 'testCliNativeNpm') {
it.dependsOn('nativeCompile')
it.systemProperty 'spotless.cli.nativeImage', tasks.nativeCompile.outputFile.get().asFile
}
}
tasks.register("generateUsage", GenerateUsagePropertiesTask) {
it.outputDir.set(layout.buildDirectory.dir("generated-usages").get().asFile)
}