diff options
Diffstat (limited to 'buildSrc/src/main/kotlin')
-rw-r--r-- | buildSrc/src/main/kotlin/tools/refinery/gradle/xtext-generated.gradle.kts | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/buildSrc/src/main/kotlin/tools/refinery/gradle/xtext-generated.gradle.kts b/buildSrc/src/main/kotlin/tools/refinery/gradle/xtext-generated.gradle.kts index 59fe921b..6cb1d7b5 100644 --- a/buildSrc/src/main/kotlin/tools/refinery/gradle/xtext-generated.gradle.kts +++ b/buildSrc/src/main/kotlin/tools/refinery/gradle/xtext-generated.gradle.kts | |||
@@ -14,15 +14,36 @@ plugins { | |||
14 | 14 | ||
15 | val xtextGenPath = "src/main/xtext-gen" | 15 | val xtextGenPath = "src/main/xtext-gen" |
16 | 16 | ||
17 | val xtextGenerated: Configuration by configurations.creating { | ||
18 | isCanBeConsumed = false | ||
19 | isCanBeResolved = true | ||
20 | } | ||
21 | |||
17 | sourceSets.main { | 22 | sourceSets.main { |
18 | java.srcDir(xtextGenPath) | 23 | java.srcDir(xtextGenPath) |
19 | resources.srcDir(xtextGenPath) | 24 | resources.srcDir(xtextGenPath) |
20 | } | 25 | } |
21 | 26 | ||
22 | tasks.clean { | 27 | tasks { |
23 | delete(xtextGenPath) | 28 | // Based on the idea from https://stackoverflow.com/a/57788355 to safely consume generated sources in sibling |
29 | // projects. | ||
30 | val syncXtextGeneratedSources by tasks.creating(Sync::class) { | ||
31 | from(xtextGenerated) | ||
32 | into(xtextGenPath) | ||
33 | } | ||
34 | |||
35 | for (taskName in listOf("compileJava", "processResources", "generateEclipseSourceFolders")) { | ||
36 | tasks.named(taskName) { | ||
37 | dependsOn(syncXtextGeneratedSources) | ||
38 | } | ||
39 | } | ||
40 | |||
41 | clean { | ||
42 | delete(xtextGenPath) | ||
43 | } | ||
24 | } | 44 | } |
25 | 45 | ||
46 | |||
26 | sonarqube.properties { | 47 | sonarqube.properties { |
27 | SonarPropertiesUtils.addToList(properties, "sonar.exclusions", "$xtextGenPath/**") | 48 | SonarPropertiesUtils.addToList(properties, "sonar.exclusions", "$xtextGenPath/**") |
28 | } | 49 | } |