blob: 6cb1d7b5da09b0cccc25242a8704a113aa8b5de2 (
plain) (
blame)
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
|
/*
* SPDX-FileCopyrightText: 2021-2023 The Refinery Authors <https://refinery.tools/>
*
* SPDX-License-Identifier: EPL-2.0
*/
package tools.refinery.gradle
import tools.refinery.gradle.utils.SonarPropertiesUtils
plugins {
id("tools.refinery.gradle.internal.java-conventions")
id("tools.refinery.gradle.sonarqube")
}
val xtextGenPath = "src/main/xtext-gen"
val xtextGenerated: Configuration by configurations.creating {
isCanBeConsumed = false
isCanBeResolved = true
}
sourceSets.main {
java.srcDir(xtextGenPath)
resources.srcDir(xtextGenPath)
}
tasks {
// Based on the idea from https://stackoverflow.com/a/57788355 to safely consume generated sources in sibling
// projects.
val syncXtextGeneratedSources by tasks.creating(Sync::class) {
from(xtextGenerated)
into(xtextGenPath)
}
for (taskName in listOf("compileJava", "processResources", "generateEclipseSourceFolders")) {
tasks.named(taskName) {
dependsOn(syncXtextGeneratedSources)
}
}
clean {
delete(xtextGenPath)
}
}
sonarqube.properties {
SonarPropertiesUtils.addToList(properties, "sonar.exclusions", "$xtextGenPath/**")
}
|