diff options
author | Kristóf Marussy <kristof@marussy.com> | 2023-04-26 17:58:36 +0200 |
---|---|---|
committer | Kristóf Marussy <kristof@marussy.com> | 2023-04-26 17:58:36 +0200 |
commit | d34b8e0f4db84f1571785592b523e675a1b2f960 (patch) | |
tree | 1e2e123ba2071a11070e8310b7e9e3033f8ffae1 /buildSrc | |
parent | build: enable parallel Gradle build (diff) | |
download | refinery-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')
-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 | } |