aboutsummaryrefslogtreecommitdiffstats
path: root/buildSrc/src/main/kotlin
diff options
context:
space:
mode:
authorLibravatar Kristóf Marussy <kristof@marussy.com>2023-04-26 17:58:36 +0200
committerLibravatar Kristóf Marussy <kristof@marussy.com>2023-04-26 17:58:36 +0200
commitd34b8e0f4db84f1571785592b523e675a1b2f960 (patch)
tree1e2e123ba2071a11070e8310b7e9e3033f8ffae1 /buildSrc/src/main/kotlin
parentbuild: enable parallel Gradle build (diff)
downloadrefinery-d34b8e0f4db84f1571785592b523e675a1b2f960.tar.gz
refinery-d34b8e0f4db84f1571785592b523e675a1b2f960.tar.zst
refinery-d34b8e0f4db84f1571785592b523e675a1b2f960.zip
build: improve Xtext project isolation
* Avoid writing generated source files directly into sibling projects. * Full project isolation cannot be enabled yet, because the frontend plugin still requires cross-projects task dependencies for Node.js installation.
Diffstat (limited to 'buildSrc/src/main/kotlin')
-rw-r--r--buildSrc/src/main/kotlin/tools/refinery/gradle/xtext-generated.gradle.kts25
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
15val xtextGenPath = "src/main/xtext-gen" 15val xtextGenPath = "src/main/xtext-gen"
16 16
17val xtextGenerated: Configuration by configurations.creating {
18 isCanBeConsumed = false
19 isCanBeResolved = true
20}
21
17sourceSets.main { 22sourceSets.main {
18 java.srcDir(xtextGenPath) 23 java.srcDir(xtextGenPath)
19 resources.srcDir(xtextGenPath) 24 resources.srcDir(xtextGenPath)
20} 25}
21 26
22tasks.clean { 27tasks {
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
26sonarqube.properties { 47sonarqube.properties {
27 SonarPropertiesUtils.addToList(properties, "sonar.exclusions", "$xtextGenPath/**") 48 SonarPropertiesUtils.addToList(properties, "sonar.exclusions", "$xtextGenPath/**")
28} 49}