-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbuild.gradle
More file actions
101 lines (87 loc) · 3.03 KB
/
Copy pathbuild.gradle
File metadata and controls
101 lines (87 loc) · 3.03 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
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
plugins {
id 'base'
id 'net.ltgt.errorprone' version '5.0.0' apply false
id 'com.diffplug.spotless' version '8.5.1' apply false
id 'java'
}
allprojects {
repositories {
mavenCentral()
}
apply plugin: 'com.diffplug.spotless'
spotless {
groovyGradle {
target '**/*.gradle'
targetExclude 'build/**', '.gradle/**', '.direnv/**'
greclipse()
leadingTabsToSpaces(4)
trimTrailingWhitespace()
endWithNewline()
}
}
plugins.withId('java') {
java {
toolchain {
languageVersion = JavaLanguageVersion.of(25)
}
}
spotless {
java {
googleJavaFormat('1.32.0')
}
}
apply plugin: 'net.ltgt.errorprone'
dependencies {
errorprone("com.google.errorprone:error_prone_core:2.49.0")
}
tasks.withType(Test).configureEach {
// Pass the absolute path of the 'dist' folder to the test JVM
useJUnitPlatform()
systemProperty 'agent.dist.dir', rootProject.layout.buildDirectory.dir("dist").get().asFile.absolutePath
// Ensure artifacts are built before running tests
dependsOn rootProject.tasks.named('copyToDist')
// Allow stdout to show up in Gradle logs
testLogging {
events "passed", "skipped", "failed", "standardOut", "standardError"
}
}
}
apply plugin: 'eclipse'
eclipse.classpath {
defaultOutputDir = file("build/default")
file.whenMerged { cp ->
cp.entries.forEach { cpe ->
if (cpe instanceof org.gradle.plugins.ide.eclipse.model.SourceFolder) {
cpe.output = cpe.output.replace "bin/", "build/classes/java/"
}
if (cpe instanceof org.gradle.plugins.ide.eclipse.model.Output) {
cpe.path = cpe.path.replace "bin/", "build/"
}
}
}
}
}
task copyToDist(type: Copy) {
// FIX: Force this task to run every time (disable incremental build check)
outputs.upToDateWhen { false }
// Use the Layout API to get a provider for the destination directory.
// This is safe to capture for the Configuration Cache.
def distDir = layout.buildDirectory.dir("dist")
into distDir
// FIX: Flatten the lists so the Copy task sees the actual files, not a List of Lists
from {
subprojects.collect { it.tasks.withType(Jar) }.flatten()
}
from {
subprojects.findAll { it.plugins.hasPlugin('java') || it.plugins.hasPlugin('java-library') }
.collect { it.configurations.getByName('runtimeClasspath') }
.flatten()
}
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
// Log so we know it ran
doFirst {
// Use the captured provider (.get().asFile) instead of '$buildDir'
println ">> Copying artifacts to ${distDir.get().asFile}"
}
}
build.dependsOn copyToDist