diff options
29 files changed, 416 insertions, 396 deletions
diff --git a/build.gradle.kts b/build.gradle.kts index 8e50da65..5a673f33 100644 --- a/build.gradle.kts +++ b/build.gradle.kts | |||
@@ -2,7 +2,7 @@ plugins { | |||
2 | // Workaround for https://github.com/gradle/gradle/issues/22797 | 2 | // Workaround for https://github.com/gradle/gradle/issues/22797 |
3 | @Suppress("DSL_SCOPE_VIOLATION") | 3 | @Suppress("DSL_SCOPE_VIOLATION") |
4 | alias(libs.plugins.versions) | 4 | alias(libs.plugins.versions) |
5 | id("refinery-eclipse") | 5 | id("tools.refinery.gradle.eclipse") |
6 | id("refinery-frontend-worktree") | 6 | id("tools.refinery.gradle.frontend-worktree") |
7 | id("refinery-sonarqube") | 7 | id("tools.refinery.gradle.sonarqube") |
8 | } | 8 | } |
diff --git a/buildSrc/src/main/java/tools/refinery/buildsrc/EclipseUtils.java b/buildSrc/src/main/java/tools/refinery/gradle/utils/EclipseUtils.java index 0014a35d..1e33a95d 100644 --- a/buildSrc/src/main/java/tools/refinery/buildsrc/EclipseUtils.java +++ b/buildSrc/src/main/java/tools/refinery/gradle/utils/EclipseUtils.java | |||
@@ -1,4 +1,4 @@ | |||
1 | package tools.refinery.buildsrc; | 1 | package tools.refinery.gradle.utils; |
2 | 2 | ||
3 | import groovy.lang.Closure; | 3 | import groovy.lang.Closure; |
4 | import org.gradle.api.Action; | 4 | import org.gradle.api.Action; |
diff --git a/buildSrc/src/main/java/tools/refinery/buildsrc/SonarPropertiesUtils.java b/buildSrc/src/main/java/tools/refinery/gradle/utils/SonarPropertiesUtils.java index 1d89841e..3810fccf 100644 --- a/buildSrc/src/main/java/tools/refinery/buildsrc/SonarPropertiesUtils.java +++ b/buildSrc/src/main/java/tools/refinery/gradle/utils/SonarPropertiesUtils.java | |||
@@ -1,4 +1,4 @@ | |||
1 | package tools.refinery.buildsrc; | 1 | package tools.refinery.gradle.utils; |
2 | 2 | ||
3 | import java.util.ArrayList; | 3 | import java.util.ArrayList; |
4 | import java.util.Collections; | 4 | import java.util.Collections; |
diff --git a/buildSrc/src/main/kotlin/refinery-frontend-workspace.gradle.kts b/buildSrc/src/main/kotlin/refinery-frontend-workspace.gradle.kts deleted file mode 100644 index 198f73f3..00000000 --- a/buildSrc/src/main/kotlin/refinery-frontend-workspace.gradle.kts +++ /dev/null | |||
@@ -1,32 +0,0 @@ | |||
1 | import org.siouan.frontendgradleplugin.infrastructure.gradle.* | ||
2 | |||
3 | plugins { | ||
4 | id("refinery-eclipse") | ||
5 | id("refinery-frontend-conventions") | ||
6 | } | ||
7 | |||
8 | tasks.named<NodeInstallTask>("installNode") { | ||
9 | dependsOn(rootProject.tasks.named("installNode")) | ||
10 | enabled = false | ||
11 | } | ||
12 | |||
13 | tasks.named<YarnGlobalInstallTask>("installYarnGlobally") { | ||
14 | dependsOn(rootProject.tasks.named("installYarnGlobally")) | ||
15 | enabled = false | ||
16 | } | ||
17 | |||
18 | tasks.named<InstallYarnTask>("installYarn") { | ||
19 | dependsOn(rootProject.tasks.named("installYarn")) | ||
20 | enabled = false | ||
21 | } | ||
22 | |||
23 | val rootInstallFrontend = rootProject.tasks.named("installFrontend") | ||
24 | |||
25 | rootInstallFrontend.configure { | ||
26 | inputs.file("$projectDir/package.json") | ||
27 | } | ||
28 | |||
29 | tasks.named("installFrontend") { | ||
30 | dependsOn(rootInstallFrontend) | ||
31 | enabled = false | ||
32 | } | ||
diff --git a/buildSrc/src/main/kotlin/refinery-frontend-worktree.gradle.kts b/buildSrc/src/main/kotlin/refinery-frontend-worktree.gradle.kts deleted file mode 100644 index d8c3d51f..00000000 --- a/buildSrc/src/main/kotlin/refinery-frontend-worktree.gradle.kts +++ /dev/null | |||
@@ -1,84 +0,0 @@ | |||
1 | import org.siouan.frontendgradleplugin.infrastructure.gradle.* | ||
2 | import java.io.FileInputStream | ||
3 | import java.io.FileNotFoundException | ||
4 | import java.io.FileOutputStream | ||
5 | import java.util.* | ||
6 | |||
7 | plugins { | ||
8 | id("refinery-frontend-conventions") | ||
9 | } | ||
10 | |||
11 | val frontend = the<FrontendExtension>() | ||
12 | |||
13 | val yarn1Version = providers.gradleProperty("frontend.yarn1Version") | ||
14 | |||
15 | frontend.yarnGlobalInstallScript.set(yarn1Version.map { version -> "install -g yarn@$version" }) | ||
16 | frontend.yarnInstallScript.set(frontend.yarnVersion.map { version -> "set version $version --only-if-needed" }) | ||
17 | frontend.installScript.set(provider { | ||
18 | if (project.hasProperty("ci")) "install --immutable --inline-builds" else "install" | ||
19 | }) | ||
20 | |||
21 | val frontendPropertiesFile = frontend.nodeInstallDirectory.map { dir -> "$dir/frontend.properties" } | ||
22 | |||
23 | fun readFrontendProperties(): Properties { | ||
24 | val props = Properties() | ||
25 | try { | ||
26 | FileInputStream(frontendPropertiesFile.get()).use { inputStream -> | ||
27 | props.load(inputStream) | ||
28 | } | ||
29 | } catch (ignored: FileNotFoundException) { | ||
30 | // Ignore missing file. | ||
31 | } | ||
32 | return props | ||
33 | } | ||
34 | |||
35 | fun getFrontendProperty(propertyName: String): String? { | ||
36 | val props = readFrontendProperties() | ||
37 | return props[propertyName]?.toString() | ||
38 | } | ||
39 | |||
40 | fun putFrontedProperty(propertyName: String, propertyValue: String) { | ||
41 | val props = readFrontendProperties() | ||
42 | props[propertyName] = propertyValue | ||
43 | FileOutputStream(frontendPropertiesFile.get()).use { outputStream -> | ||
44 | props.store(outputStream, "generated by refinery-frontend-worktree") | ||
45 | } | ||
46 | } | ||
47 | |||
48 | tasks.named<NodeInstallTask>("installNode") { | ||
49 | onlyIf { | ||
50 | getFrontendProperty("installedNodeVersion") != frontend.nodeVersion.get() | ||
51 | } | ||
52 | doLast { | ||
53 | putFrontedProperty("installedNodeVersion", frontend.nodeVersion.get()) | ||
54 | } | ||
55 | } | ||
56 | |||
57 | tasks.named<YarnGlobalInstallTask>("installYarnGlobally") { | ||
58 | onlyIf { | ||
59 | getFrontendProperty("installedYarn1Version") != yarn1Version.get() | ||
60 | } | ||
61 | doLast { | ||
62 | putFrontedProperty("installedYarn1Version", yarn1Version.get()) | ||
63 | } | ||
64 | outputs.dir(frontend.nodeInstallDirectory.map { dir -> "$dir/lib/node_modules/yarn" }) | ||
65 | } | ||
66 | |||
67 | tasks.named<InstallYarnTask>("installYarn") { | ||
68 | outputs.file(frontend.yarnVersion.map { version -> ".yarn/releases/yarn-$version.cjs" }) | ||
69 | } | ||
70 | |||
71 | tasks.named<InstallDependenciesTask>("installFrontend") { | ||
72 | inputs.files("package.json", "yarn.lock") | ||
73 | outputs.files(".pnp.cjs", ".pnp.loader.mjs") | ||
74 | } | ||
75 | |||
76 | tasks.register("clobberFrontend", Delete::class) { | ||
77 | delete(frontend.nodeInstallDirectory) | ||
78 | delete(".yarn/cache") | ||
79 | delete(".yarn/install-state.gz") | ||
80 | delete(".yarn/sdks") | ||
81 | delete(".yarn/unplugged") | ||
82 | delete(".pnp.cjs") | ||
83 | delete(".pnp.loader.mjs") | ||
84 | } | ||
diff --git a/buildSrc/src/main/kotlin/refinery-java-library.gradle.kts b/buildSrc/src/main/kotlin/refinery-java-library.gradle.kts deleted file mode 100644 index 5a6200e0..00000000 --- a/buildSrc/src/main/kotlin/refinery-java-library.gradle.kts +++ /dev/null | |||
@@ -1,5 +0,0 @@ | |||
1 | plugins { | ||
2 | `java-library` | ||
3 | } | ||
4 | |||
5 | apply(plugin = "refinery-java-conventions") | ||
diff --git a/buildSrc/src/main/kotlin/refinery-xtext-conventions.gradle.kts b/buildSrc/src/main/kotlin/refinery-xtext-conventions.gradle.kts deleted file mode 100644 index 34fbae99..00000000 --- a/buildSrc/src/main/kotlin/refinery-xtext-conventions.gradle.kts +++ /dev/null | |||
@@ -1,21 +0,0 @@ | |||
1 | import org.gradle.api.tasks.SourceSetContainer | ||
2 | import org.sonarqube.gradle.SonarExtension | ||
3 | import tools.refinery.buildsrc.SonarPropertiesUtils | ||
4 | |||
5 | apply(plugin = "refinery-java-conventions") | ||
6 | apply(plugin = "refinery-sonarqube") | ||
7 | |||
8 | val xtextGenPath = "src/main/xtext-gen" | ||
9 | |||
10 | the<SourceSetContainer>().named("main") { | ||
11 | java.srcDir(xtextGenPath) | ||
12 | resources.srcDir(xtextGenPath) | ||
13 | } | ||
14 | |||
15 | tasks.named<Delete>("clean") { | ||
16 | delete(xtextGenPath) | ||
17 | } | ||
18 | |||
19 | the<SonarExtension>().properties { | ||
20 | SonarPropertiesUtils.addToList(properties, "sonar.exclusions", "$xtextGenPath/**") | ||
21 | } | ||
diff --git a/buildSrc/src/main/kotlin/refinery-eclipse.gradle.kts b/buildSrc/src/main/kotlin/tools/refinery/gradle/eclipse.gradle.kts index 85e47370..25e7e573 100644 --- a/buildSrc/src/main/kotlin/refinery-eclipse.gradle.kts +++ b/buildSrc/src/main/kotlin/tools/refinery/gradle/eclipse.gradle.kts | |||
@@ -1,5 +1,6 @@ | |||
1 | import org.gradle.plugins.ide.eclipse.model.EclipseModel | 1 | package tools.refinery.gradle |
2 | import java.util.* | 2 | |
3 | import java.util.Properties | ||
3 | 4 | ||
4 | plugins { | 5 | plugins { |
5 | eclipse | 6 | eclipse |
@@ -23,14 +24,14 @@ val eclipseResourceEncoding by tasks.registering { | |||
23 | } | 24 | } |
24 | } | 25 | } |
25 | 26 | ||
26 | val eclipse by tasks.existing { | 27 | tasks.eclipse { |
27 | dependsOn(eclipseResourceEncoding) | 28 | dependsOn(eclipseResourceEncoding) |
28 | } | 29 | } |
29 | 30 | ||
30 | the<EclipseModel>().synchronizationTasks(eclipseResourceEncoding) | 31 | eclipse.synchronizationTasks(eclipseResourceEncoding) |
31 | 32 | ||
32 | tasks.register<Delete>("clobberEclipse") { | 33 | tasks.register<Delete>("clobberEclipse") { |
33 | mustRunAfter(eclipse) | 34 | mustRunAfter(tasks.eclipse) |
34 | delete(".classpath") | 35 | delete(".classpath") |
35 | delete(".project") | 36 | delete(".project") |
36 | delete(".settings") | 37 | delete(".settings") |
diff --git a/buildSrc/src/main/kotlin/tools/refinery/gradle/frontend-workspace.gradle.kts b/buildSrc/src/main/kotlin/tools/refinery/gradle/frontend-workspace.gradle.kts new file mode 100644 index 00000000..174a2d65 --- /dev/null +++ b/buildSrc/src/main/kotlin/tools/refinery/gradle/frontend-workspace.gradle.kts | |||
@@ -0,0 +1,34 @@ | |||
1 | package tools.refinery.gradle | ||
2 | |||
3 | plugins { | ||
4 | id("tools.refinery.gradle.eclipse") | ||
5 | id("tools.refinery.gradle.internal.frontend-conventions") | ||
6 | } | ||
7 | |||
8 | tasks { | ||
9 | installNode { | ||
10 | dependsOn(rootProject.tasks.named("installNode")) | ||
11 | enabled = false | ||
12 | } | ||
13 | |||
14 | installYarnGlobally { | ||
15 | dependsOn(rootProject.tasks.named("installYarnGlobally")) | ||
16 | enabled = false | ||
17 | } | ||
18 | |||
19 | installYarn { | ||
20 | dependsOn(rootProject.tasks.named("installYarn")) | ||
21 | enabled = false | ||
22 | } | ||
23 | |||
24 | val rootInstallFrontend = rootProject.tasks.named("installFrontend") | ||
25 | |||
26 | rootInstallFrontend.configure { | ||
27 | inputs.file("$projectDir/package.json") | ||
28 | } | ||
29 | |||
30 | installFrontend { | ||
31 | dependsOn(rootInstallFrontend) | ||
32 | enabled = false | ||
33 | } | ||
34 | } | ||
diff --git a/buildSrc/src/main/kotlin/tools/refinery/gradle/frontend-worktree.gradle.kts b/buildSrc/src/main/kotlin/tools/refinery/gradle/frontend-worktree.gradle.kts new file mode 100644 index 00000000..3225a1b1 --- /dev/null +++ b/buildSrc/src/main/kotlin/tools/refinery/gradle/frontend-worktree.gradle.kts | |||
@@ -0,0 +1,87 @@ | |||
1 | package tools.refinery.gradle | ||
2 | |||
3 | import java.io.FileInputStream | ||
4 | import java.io.FileNotFoundException | ||
5 | import java.io.FileOutputStream | ||
6 | import java.util.Properties | ||
7 | |||
8 | plugins { | ||
9 | id("tools.refinery.gradle.internal.frontend-conventions") | ||
10 | } | ||
11 | |||
12 | val yarn1Version = providers.gradleProperty("frontend.yarn1Version") | ||
13 | |||
14 | frontend { | ||
15 | yarnGlobalInstallScript.set(yarn1Version.map { version -> "install -g yarn@$version" }) | ||
16 | yarnInstallScript.set(frontend.yarnVersion.map { version -> "set version $version --only-if-needed" }) | ||
17 | installScript.set(provider { | ||
18 | if (project.hasProperty("ci")) "install --immutable --inline-builds" else "install" | ||
19 | }) | ||
20 | } | ||
21 | |||
22 | val frontendPropertiesFile = frontend.nodeInstallDirectory.map { dir -> "$dir/frontend.properties" } | ||
23 | |||
24 | fun readFrontendProperties(): Properties { | ||
25 | val props = Properties() | ||
26 | try { | ||
27 | FileInputStream(frontendPropertiesFile.get()).use { inputStream -> | ||
28 | props.load(inputStream) | ||
29 | } | ||
30 | } catch (ignored: FileNotFoundException) { | ||
31 | // Ignore missing file. | ||
32 | } | ||
33 | return props | ||
34 | } | ||
35 | |||
36 | fun getFrontendProperty(propertyName: String): String? { | ||
37 | val props = readFrontendProperties() | ||
38 | return props[propertyName]?.toString() | ||
39 | } | ||
40 | |||
41 | fun putFrontedProperty(propertyName: String, propertyValue: String) { | ||
42 | val props = readFrontendProperties() | ||
43 | props[propertyName] = propertyValue | ||
44 | FileOutputStream(frontendPropertiesFile.get()).use { outputStream -> | ||
45 | props.store(outputStream, "generated by refinery-frontend-worktree") | ||
46 | } | ||
47 | } | ||
48 | |||
49 | tasks { | ||
50 | installNode { | ||
51 | onlyIf { | ||
52 | getFrontendProperty("installedNodeVersion") != frontend.nodeVersion.get() | ||
53 | } | ||
54 | doLast { | ||
55 | putFrontedProperty("installedNodeVersion", frontend.nodeVersion.get()) | ||
56 | } | ||
57 | } | ||
58 | |||
59 | installYarnGlobally { | ||
60 | onlyIf { | ||
61 | getFrontendProperty("installedYarn1Version") != yarn1Version.get() | ||
62 | } | ||
63 | doLast { | ||
64 | putFrontedProperty("installedYarn1Version", yarn1Version.get()) | ||
65 | } | ||
66 | outputs.dir(frontend.nodeInstallDirectory.map { dir -> "$dir/lib/node_modules/yarn" }) | ||
67 | } | ||
68 | |||
69 | installYarn { | ||
70 | outputs.file(frontend.yarnVersion.map { version -> ".yarn/releases/yarn-$version.cjs" }) | ||
71 | } | ||
72 | |||
73 | installFrontend { | ||
74 | inputs.files("package.json", "yarn.lock") | ||
75 | outputs.files(".pnp.cjs", ".pnp.loader.mjs") | ||
76 | } | ||
77 | |||
78 | register("clobberFrontend", Delete::class) { | ||
79 | delete(frontend.nodeInstallDirectory) | ||
80 | delete(".yarn/cache") | ||
81 | delete(".yarn/install-state.gz") | ||
82 | delete(".yarn/sdks") | ||
83 | delete(".yarn/unplugged") | ||
84 | delete(".pnp.cjs") | ||
85 | delete(".pnp.loader.mjs") | ||
86 | } | ||
87 | } | ||
diff --git a/buildSrc/src/main/kotlin/refinery-frontend-conventions.gradle.kts b/buildSrc/src/main/kotlin/tools/refinery/gradle/internal/frontend-conventions.gradle.kts index c4658948..b15de515 100644 --- a/buildSrc/src/main/kotlin/refinery-frontend-conventions.gradle.kts +++ b/buildSrc/src/main/kotlin/tools/refinery/gradle/internal/frontend-conventions.gradle.kts | |||
@@ -1,18 +1,17 @@ | |||
1 | import org.siouan.frontendgradleplugin.infrastructure.gradle.EnableYarnBerryTask | 1 | package tools.refinery.gradle.internal |
2 | import org.siouan.frontendgradleplugin.infrastructure.gradle.FrontendExtension | ||
3 | 2 | ||
4 | plugins { | 3 | plugins { |
5 | id("org.siouan.frontend-jdk11") | 4 | id("org.siouan.frontend-jdk11") |
6 | } | 5 | } |
7 | 6 | ||
8 | configure<FrontendExtension> { | 7 | frontend { |
9 | nodeVersion.set(providers.gradleProperty("frontend.nodeVersion")) | 8 | nodeVersion.set(providers.gradleProperty("frontend.nodeVersion")) |
10 | nodeInstallDirectory.set(file("$rootDir/.node")) | 9 | nodeInstallDirectory.set(file("$rootDir/.node")) |
11 | yarnEnabled.set(true) | 10 | yarnEnabled.set(true) |
12 | yarnVersion.set(providers.gradleProperty("frontend.yarnVersion")) | 11 | yarnVersion.set(providers.gradleProperty("frontend.yarnVersion")) |
13 | } | 12 | } |
14 | 13 | ||
15 | tasks.named<EnableYarnBerryTask>("enableYarnBerry") { | 14 | tasks.enableYarnBerry { |
16 | // There is no need to enable berry manually, because berry files are already committed to the repo. | 15 | // There is no need to enable berry manually, because berry files are already committed to the repo. |
17 | enabled = false | 16 | enabled = false |
18 | } | 17 | } |
diff --git a/buildSrc/src/main/kotlin/refinery-java-conventions.gradle.kts b/buildSrc/src/main/kotlin/tools/refinery/gradle/internal/java-conventions.gradle.kts index a55350df..67bb5d88 100644 --- a/buildSrc/src/main/kotlin/refinery-java-conventions.gradle.kts +++ b/buildSrc/src/main/kotlin/tools/refinery/gradle/internal/java-conventions.gradle.kts | |||
@@ -1,15 +1,15 @@ | |||
1 | package tools.refinery.gradle.internal | ||
2 | |||
1 | import org.gradle.accessors.dm.LibrariesForLibs | 3 | import org.gradle.accessors.dm.LibrariesForLibs |
2 | import org.gradle.plugins.ide.eclipse.model.EclipseModel | ||
3 | import org.gradle.plugins.ide.eclipse.model.ProjectDependency | 4 | import org.gradle.plugins.ide.eclipse.model.ProjectDependency |
4 | import tools.refinery.buildsrc.EclipseUtils | 5 | import tools.refinery.gradle.utils.EclipseUtils |
5 | 6 | ||
6 | plugins { | 7 | plugins { |
7 | jacoco | 8 | jacoco |
8 | java | 9 | java |
10 | id("tools.refinery.gradle.eclipse") | ||
9 | } | 11 | } |
10 | 12 | ||
11 | apply(plugin = "refinery-eclipse") | ||
12 | |||
13 | repositories { | 13 | repositories { |
14 | mavenCentral() | 14 | mavenCentral() |
15 | maven { | 15 | maven { |
@@ -41,49 +41,47 @@ java.toolchain { | |||
41 | languageVersion.set(JavaLanguageVersion.of(19)) | 41 | languageVersion.set(JavaLanguageVersion.of(19)) |
42 | } | 42 | } |
43 | 43 | ||
44 | tasks.withType(JavaCompile::class) { | 44 | tasks { |
45 | options.release.set(17) | 45 | withType(JavaCompile::class) { |
46 | } | 46 | options.release.set(17) |
47 | 47 | } | |
48 | val test = tasks.named<Test>("test") | ||
49 | |||
50 | val jacocoTestReport = tasks.named<JacocoReport>("jacocoTestReport") | ||
51 | 48 | ||
52 | test.configure { | 49 | test { |
53 | useJUnitPlatform { | 50 | useJUnitPlatform { |
54 | excludeTags("slow") | 51 | excludeTags("slow") |
55 | } | 52 | } |
56 | finalizedBy(jacocoTestReport) | 53 | finalizedBy(tasks.jacocoTestReport) |
57 | } | 54 | } |
58 | 55 | ||
59 | jacocoTestReport.configure { | 56 | jacocoTestReport { |
60 | dependsOn(test) | 57 | dependsOn(tasks.test) |
61 | reports { | 58 | reports { |
62 | xml.required.set(true) | 59 | xml.required.set(true) |
60 | } | ||
63 | } | 61 | } |
64 | } | ||
65 | 62 | ||
66 | tasks.named<Jar>("jar") { | 63 | jar { |
67 | manifest { | 64 | manifest { |
68 | attributes( | 65 | attributes( |
69 | "Bundle-SymbolicName" to "${project.group}.${project.name}", | 66 | "Bundle-SymbolicName" to "${project.group}.${project.name}", |
70 | "Bundle-Version" to project.version | 67 | "Bundle-Version" to project.version |
71 | ) | 68 | ) |
69 | } | ||
72 | } | 70 | } |
73 | } | ||
74 | 71 | ||
75 | val generateEclipseSourceFolders by tasks.registering | 72 | val generateEclipseSourceFolders by tasks.registering |
76 | 73 | ||
77 | tasks.register("prepareEclipse") { | 74 | register("prepareEclipse") { |
78 | dependsOn(generateEclipseSourceFolders) | 75 | dependsOn(generateEclipseSourceFolders) |
79 | dependsOn(tasks.named("eclipseJdt")) | 76 | dependsOn(tasks.named("eclipseJdt")) |
80 | } | 77 | } |
81 | 78 | ||
82 | tasks.named("eclipseClasspath") { | 79 | eclipseClasspath { |
83 | dependsOn(generateEclipseSourceFolders) | 80 | dependsOn(generateEclipseSourceFolders) |
81 | } | ||
84 | } | 82 | } |
85 | 83 | ||
86 | configure<EclipseModel> { | 84 | eclipse { |
87 | EclipseUtils.patchClasspathEntries(this) { entry -> | 85 | EclipseUtils.patchClasspathEntries(this) { entry -> |
88 | if (entry.path.endsWith("-gen")) { | 86 | if (entry.path.endsWith("-gen")) { |
89 | entry.entryAttributes["ignore_optional_problems"] = true | 87 | entry.entryAttributes["ignore_optional_problems"] = true |
diff --git a/buildSrc/src/main/kotlin/refinery-java-application.gradle.kts b/buildSrc/src/main/kotlin/tools/refinery/gradle/java-application.gradle.kts index 65409acf..269af11c 100644 --- a/buildSrc/src/main/kotlin/refinery-java-application.gradle.kts +++ b/buildSrc/src/main/kotlin/tools/refinery/gradle/java-application.gradle.kts | |||
@@ -1,14 +1,15 @@ | |||
1 | package tools.refinery.gradle | ||
2 | |||
1 | import org.gradle.accessors.dm.LibrariesForLibs | 3 | import org.gradle.accessors.dm.LibrariesForLibs |
2 | 4 | ||
3 | plugins { | 5 | plugins { |
4 | application | 6 | application |
5 | id("com.github.johnrengelman.shadow") | 7 | id("com.github.johnrengelman.shadow") |
8 | id("tools.refinery.gradle.internal.java-conventions") | ||
6 | } | 9 | } |
7 | 10 | ||
8 | apply(plugin = "refinery-java-conventions") | ||
9 | |||
10 | // Use log4j-over-slf4j instead of log4j 1.x when running the application. | 11 | // Use log4j-over-slf4j instead of log4j 1.x when running the application. |
11 | configurations.named("runtimeClasspath") { | 12 | configurations.runtimeClasspath { |
12 | exclude(group = "log4j", module = "log4j") | 13 | exclude(group = "log4j", module = "log4j") |
13 | } | 14 | } |
14 | 15 | ||
diff --git a/buildSrc/src/main/kotlin/tools/refinery/gradle/java-library.gradle.kts b/buildSrc/src/main/kotlin/tools/refinery/gradle/java-library.gradle.kts new file mode 100644 index 00000000..084f65ae --- /dev/null +++ b/buildSrc/src/main/kotlin/tools/refinery/gradle/java-library.gradle.kts | |||
@@ -0,0 +1,6 @@ | |||
1 | package tools.refinery.gradle | ||
2 | |||
3 | plugins { | ||
4 | `java-library` | ||
5 | id("tools.refinery.gradle.internal.java-conventions") | ||
6 | } | ||
diff --git a/buildSrc/src/main/kotlin/refinery-java-test-fixtures.gradle.kts b/buildSrc/src/main/kotlin/tools/refinery/gradle/java-test-fixtures.gradle.kts index 86b0a04b..7e599c3f 100644 --- a/buildSrc/src/main/kotlin/refinery-java-test-fixtures.gradle.kts +++ b/buildSrc/src/main/kotlin/tools/refinery/gradle/java-test-fixtures.gradle.kts | |||
@@ -1,14 +1,14 @@ | |||
1 | package tools.refinery.gradle | ||
2 | |||
1 | import org.gradle.plugins.ide.eclipse.model.AbstractClasspathEntry | 3 | import org.gradle.plugins.ide.eclipse.model.AbstractClasspathEntry |
2 | import org.gradle.plugins.ide.eclipse.model.EclipseModel | 4 | import tools.refinery.gradle.utils.EclipseUtils |
3 | import tools.refinery.buildsrc.EclipseUtils | ||
4 | 5 | ||
5 | plugins { | 6 | plugins { |
6 | `java-test-fixtures` | 7 | `java-test-fixtures` |
8 | id("tools.refinery.gradle.internal.java-conventions") | ||
7 | } | 9 | } |
8 | 10 | ||
9 | apply(plugin = "refinery-java-conventions") | 11 | eclipse.classpath { |
10 | |||
11 | the<EclipseModel>().classpath { | ||
12 | containsTestFixtures.set(true) | 12 | containsTestFixtures.set(true) |
13 | 13 | ||
14 | EclipseUtils.whenClasspathFileMerged(file) { eclipseClasspath -> | 14 | EclipseUtils.whenClasspathFileMerged(file) { eclipseClasspath -> |
diff --git a/buildSrc/src/main/kotlin/refinery-jmh.gradle.kts b/buildSrc/src/main/kotlin/tools/refinery/gradle/jmh.gradle.kts index 6512ef23..eda7d5c6 100644 --- a/buildSrc/src/main/kotlin/refinery-jmh.gradle.kts +++ b/buildSrc/src/main/kotlin/tools/refinery/gradle/jmh.gradle.kts | |||
@@ -1,33 +1,31 @@ | |||
1 | package tools.refinery.gradle | ||
2 | |||
1 | import org.gradle.accessors.dm.LibrariesForLibs | 3 | import org.gradle.accessors.dm.LibrariesForLibs |
2 | import org.gradle.plugins.ide.eclipse.model.EclipseModel | 4 | import tools.refinery.gradle.utils.EclipseUtils |
3 | import org.sonarqube.gradle.SonarExtension | 5 | import tools.refinery.gradle.utils.SonarPropertiesUtils |
4 | import tools.refinery.buildsrc.EclipseUtils | ||
5 | import tools.refinery.buildsrc.SonarPropertiesUtils | ||
6 | 6 | ||
7 | apply(plugin = "refinery-java-conventions") | 7 | plugins { |
8 | apply(plugin = "refinery-sonarqube") | 8 | id("tools.refinery.gradle.internal.java-conventions") |
9 | id("tools.refinery.gradle.sonarqube") | ||
10 | } | ||
9 | 11 | ||
10 | val sourceSets = the<SourceSetContainer>() | 12 | val sourceSets = the<SourceSetContainer>() |
11 | 13 | ||
12 | val main: SourceSet by sourceSets.getting | ||
13 | |||
14 | val test: SourceSet by sourceSets.getting | ||
15 | |||
16 | val jmh: SourceSet by sourceSets.creating { | 14 | val jmh: SourceSet by sourceSets.creating { |
17 | compileClasspath += main.output | 15 | compileClasspath += sourceSets.main.get().output |
18 | runtimeClasspath += main.output | 16 | runtimeClasspath += sourceSets.main.get().output |
19 | // Allow using test classes in benchmarks for now. | 17 | // Allow using test classes in benchmarks for now. |
20 | compileClasspath += test.output | 18 | compileClasspath += sourceSets.test.get().output |
21 | runtimeClasspath += test.output | 19 | runtimeClasspath += sourceSets.test.get().output |
22 | } | 20 | } |
23 | 21 | ||
24 | val jmhImplementation: Configuration by configurations.getting { | 22 | val jmhImplementation: Configuration by configurations.getting { |
25 | extendsFrom(configurations["implementation"], configurations["testImplementation"]) | 23 | extendsFrom(configurations.implementation.get(), configurations.testImplementation.get()) |
26 | } | 24 | } |
27 | 25 | ||
28 | val jmhAnnotationProcessor: Configuration by configurations.getting | 26 | val jmhAnnotationProcessor: Configuration by configurations.getting |
29 | 27 | ||
30 | configurations["jmhRuntimeOnly"].extendsFrom(configurations["runtimeOnly"], configurations["testRuntimeOnly"]) | 28 | configurations["jmhRuntimeOnly"].extendsFrom(configurations.runtimeOnly.get(), configurations.testRuntimeOnly.get()) |
31 | 29 | ||
32 | val libs = the<LibrariesForLibs>() | 30 | val libs = the<LibrariesForLibs>() |
33 | 31 | ||
@@ -42,7 +40,7 @@ tasks.register<JavaExec>("jmh") { | |||
42 | classpath = jmh.runtimeClasspath | 40 | classpath = jmh.runtimeClasspath |
43 | } | 41 | } |
44 | 42 | ||
45 | EclipseUtils.patchClasspathEntries(the<EclipseModel>()) { entry -> | 43 | EclipseUtils.patchClasspathEntries(eclipse) { entry -> |
46 | // Workaround from https://github.com/gradle/gradle/issues/4802#issuecomment-407902081 | 44 | // Workaround from https://github.com/gradle/gradle/issues/4802#issuecomment-407902081 |
47 | if (entry.entryAttributes["gradle_scope"] == "jmh") { | 45 | if (entry.entryAttributes["gradle_scope"] == "jmh") { |
48 | // Allow test helper classes to be used in benchmarks from Eclipse | 46 | // Allow test helper classes to be used in benchmarks from Eclipse |
@@ -58,6 +56,6 @@ EclipseUtils.patchClasspathEntries(the<EclipseModel>()) { entry -> | |||
58 | } | 56 | } |
59 | } | 57 | } |
60 | 58 | ||
61 | the<SonarExtension>().properties { | 59 | sonarqube.properties { |
62 | SonarPropertiesUtils.addToList(properties, "sonar.tests", "src/jmh/java") | 60 | SonarPropertiesUtils.addToList(properties, "sonar.tests", "src/jmh/java") |
63 | } | 61 | } |
diff --git a/buildSrc/src/main/kotlin/refinery-mwe2.gradle.kts b/buildSrc/src/main/kotlin/tools/refinery/gradle/mwe2.gradle.kts index 26963837..8eeabf47 100644 --- a/buildSrc/src/main/kotlin/refinery-mwe2.gradle.kts +++ b/buildSrc/src/main/kotlin/tools/refinery/gradle/mwe2.gradle.kts | |||
@@ -1,12 +1,15 @@ | |||
1 | package tools.refinery.gradle | ||
2 | |||
1 | import org.gradle.accessors.dm.LibrariesForLibs | 3 | import org.gradle.accessors.dm.LibrariesForLibs |
2 | import org.gradle.plugins.ide.eclipse.model.EclipseModel | ||
3 | 4 | ||
4 | apply(plugin = "refinery-java-conventions") | 5 | plugins { |
6 | id("tools.refinery.gradle.internal.java-conventions") | ||
7 | } | ||
5 | 8 | ||
6 | val mwe2: Configuration by configurations.creating { | 9 | val mwe2: Configuration by configurations.creating { |
7 | isCanBeConsumed = false | 10 | isCanBeConsumed = false |
8 | isCanBeResolved = true | 11 | isCanBeResolved = true |
9 | extendsFrom(configurations["implementation"]) | 12 | extendsFrom(configurations.implementation.get()) |
10 | } | 13 | } |
11 | 14 | ||
12 | val libs = the<LibrariesForLibs>() | 15 | val libs = the<LibrariesForLibs>() |
@@ -15,4 +18,4 @@ dependencies { | |||
15 | mwe2(libs.mwe2.launch) | 18 | mwe2(libs.mwe2.launch) |
16 | } | 19 | } |
17 | 20 | ||
18 | the<EclipseModel>().classpath.plusConfigurations += mwe2 | 21 | eclipse.classpath.plusConfigurations += mwe2 |
diff --git a/buildSrc/src/main/kotlin/refinery-sonarqube.gradle.kts b/buildSrc/src/main/kotlin/tools/refinery/gradle/sonarqube.gradle.kts index 6a1dbbf6..ebd9170a 100644 --- a/buildSrc/src/main/kotlin/refinery-sonarqube.gradle.kts +++ b/buildSrc/src/main/kotlin/tools/refinery/gradle/sonarqube.gradle.kts | |||
@@ -1,3 +1,5 @@ | |||
1 | package tools.refinery.gradle | ||
2 | |||
1 | plugins { | 3 | plugins { |
2 | id("org.sonarqube") | 4 | id("org.sonarqube") |
3 | } | 5 | } |
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 new file mode 100644 index 00000000..25aeb826 --- /dev/null +++ b/buildSrc/src/main/kotlin/tools/refinery/gradle/xtext-generated.gradle.kts | |||
@@ -0,0 +1,23 @@ | |||
1 | package tools.refinery.gradle | ||
2 | |||
3 | import tools.refinery.gradle.utils.SonarPropertiesUtils | ||
4 | |||
5 | plugins { | ||
6 | id("tools.refinery.gradle.internal.java-conventions") | ||
7 | id("tools.refinery.gradle.sonarqube") | ||
8 | } | ||
9 | |||
10 | val xtextGenPath = "src/main/xtext-gen" | ||
11 | |||
12 | sourceSets.main { | ||
13 | java.srcDir(xtextGenPath) | ||
14 | resources.srcDir(xtextGenPath) | ||
15 | } | ||
16 | |||
17 | tasks.clean { | ||
18 | delete(xtextGenPath) | ||
19 | } | ||
20 | |||
21 | sonarqube.properties { | ||
22 | SonarPropertiesUtils.addToList(properties, "sonar.exclusions", "$xtextGenPath/**") | ||
23 | } | ||
diff --git a/subprojects/frontend/build.gradle.kts b/subprojects/frontend/build.gradle.kts index ab2f61c9..80f10f7e 100644 --- a/subprojects/frontend/build.gradle.kts +++ b/subprojects/frontend/build.gradle.kts | |||
@@ -1,18 +1,19 @@ | |||
1 | import org.siouan.frontendgradleplugin.infrastructure.gradle.RunYarn | 1 | import org.siouan.frontendgradleplugin.infrastructure.gradle.RunYarn |
2 | import tools.refinery.buildsrc.SonarPropertiesUtils | 2 | import tools.refinery.gradle.utils.SonarPropertiesUtils |
3 | 3 | ||
4 | plugins { | 4 | plugins { |
5 | id("refinery-frontend-workspace") | 5 | id("tools.refinery.gradle.frontend-workspace") |
6 | id("refinery-sonarqube") | 6 | id("tools.refinery.gradle.sonarqube") |
7 | } | 7 | } |
8 | 8 | ||
9 | val viteOutputDir = "$buildDir/vite" | ||
10 | val productionResources = file("$viteOutputDir/production") | ||
11 | |||
12 | frontend { | 9 | frontend { |
13 | assembleScript.set("run build") | 10 | assembleScript.set("run build") |
14 | } | 11 | } |
15 | 12 | ||
13 | val viteOutputDir = "$buildDir/vite" | ||
14 | |||
15 | val productionResources = file("$viteOutputDir/production") | ||
16 | |||
16 | val productionAssets: Configuration by configurations.creating { | 17 | val productionAssets: Configuration by configurations.creating { |
17 | isCanBeConsumed = true | 18 | isCanBeConsumed = true |
18 | isCanBeResolved = false | 19 | isCanBeResolved = false |
@@ -53,78 +54,81 @@ val assembleFiles = assembleSources + assembleConfigFiles | |||
53 | 54 | ||
54 | val lintingFiles = sourcesWithTypes + buildScripts + sharedConfigFiles | 55 | val lintingFiles = sourcesWithTypes + buildScripts + sharedConfigFiles |
55 | 56 | ||
56 | val generateXStateTypes by tasks.registering(RunYarn::class) { | 57 | tasks { |
57 | dependsOn(tasks.installFrontend) | 58 | val generateXStateTypes by registering(RunYarn::class) { |
58 | inputs.files(sourcesWithoutTypes) | 59 | dependsOn(installFrontend) |
59 | inputs.files(installationState) | 60 | inputs.files(sourcesWithoutTypes) |
60 | outputs.dir("src") | 61 | inputs.files(installationState) |
61 | script.set("run typegen") | 62 | outputs.dir("src") |
62 | description = "Generate TypeScript typings for XState state machines." | 63 | script.set("run typegen") |
63 | } | 64 | description = "Generate TypeScript typings for XState state machines." |
65 | } | ||
64 | 66 | ||
65 | tasks.assembleFrontend { | 67 | assembleFrontend { |
66 | dependsOn(generateXStateTypes) | 68 | dependsOn(generateXStateTypes) |
67 | inputs.files(assembleFiles) | 69 | inputs.files(assembleFiles) |
68 | outputs.dir(productionResources) | 70 | outputs.dir(productionResources) |
69 | } | 71 | } |
70 | 72 | ||
71 | artifacts { | 73 | |
72 | add("productionAssets", productionResources) { | 74 | val typeCheckFrontend by registering(RunYarn::class) { |
73 | builtBy(tasks.assembleFrontend) | 75 | dependsOn(installFrontend) |
76 | dependsOn(generateXStateTypes) | ||
77 | inputs.files(lintingFiles) | ||
78 | outputs.dir("$buildDir/typescript") | ||
79 | script.set("run typecheck") | ||
80 | group = "verification" | ||
81 | description = "Check for TypeScript type errors." | ||
74 | } | 82 | } |
75 | } | ||
76 | 83 | ||
77 | val typeCheckFrontend by tasks.registering(RunYarn::class) { | 84 | val lintFrontend by registering(RunYarn::class) { |
78 | dependsOn(tasks.installFrontend) | 85 | dependsOn(installFrontend) |
79 | dependsOn(generateXStateTypes) | 86 | dependsOn(generateXStateTypes) |
80 | inputs.files(lintingFiles) | 87 | dependsOn(typeCheckFrontend) |
81 | outputs.dir("$buildDir/typescript") | 88 | inputs.files(lintingFiles) |
82 | script.set("run typecheck") | 89 | outputs.file("$buildDir/eslint.json") |
83 | group = "verification" | 90 | script.set("run lint") |
84 | description = "Check for TypeScript type errors." | 91 | group = "verification" |
85 | } | 92 | description = "Check for TypeScript lint errors and warnings." |
93 | } | ||
86 | 94 | ||
87 | val lintFrontend by tasks.registering(RunYarn::class) { | 95 | register<RunYarn>("fixFrontend") { |
88 | dependsOn(tasks.installFrontend) | 96 | dependsOn(installFrontend) |
89 | dependsOn(generateXStateTypes) | 97 | dependsOn(generateXStateTypes) |
90 | dependsOn(typeCheckFrontend) | 98 | dependsOn(typeCheckFrontend) |
91 | inputs.files(lintingFiles) | 99 | inputs.files(lintingFiles) |
92 | outputs.file("$buildDir/eslint.json") | 100 | script.set("run lint:fix") |
93 | script.set("run lint") | 101 | group = "verification" |
94 | group = "verification" | 102 | description = "Fix TypeScript lint errors and warnings." |
95 | description = "Check for TypeScript lint errors and warnings." | 103 | } |
96 | } | ||
97 | 104 | ||
98 | val fixFrontend by tasks.registering(RunYarn::class) { | 105 | check { |
99 | dependsOn(tasks.installFrontend) | 106 | dependsOn(typeCheckFrontend) |
100 | dependsOn(generateXStateTypes) | 107 | dependsOn(lintFrontend) |
101 | dependsOn(typeCheckFrontend) | 108 | } |
102 | inputs.files(lintingFiles) | ||
103 | script.set("run lint:fix") | ||
104 | group = "verification" | ||
105 | description = "Fix TypeScript lint errors and warnings." | ||
106 | } | ||
107 | 109 | ||
108 | tasks.check { | 110 | register<RunYarn>("serveFrontend") { |
109 | dependsOn(typeCheckFrontend) | 111 | dependsOn(installFrontend) |
110 | dependsOn(lintFrontend) | 112 | dependsOn(generateXStateTypes) |
111 | } | 113 | inputs.files(assembleFiles) |
114 | outputs.dir("$viteOutputDir/development") | ||
115 | script.set("run serve") | ||
116 | group = "run" | ||
117 | description = "Start a Vite dev server with hot module replacement." | ||
118 | } | ||
112 | 119 | ||
113 | tasks.register<RunYarn>("serveFrontend") { | 120 | clean { |
114 | dependsOn(tasks.installFrontend) | 121 | delete("dev-dist") |
115 | dependsOn(generateXStateTypes) | 122 | delete(fileTree("src") { |
116 | inputs.files(assembleFiles) | 123 | include("**/*.typegen.ts") |
117 | outputs.dir("$viteOutputDir/development") | 124 | }) |
118 | script.set("run serve") | 125 | } |
119 | group = "run" | ||
120 | description = "Start a Vite dev server with hot module replacement." | ||
121 | } | 126 | } |
122 | 127 | ||
123 | tasks.clean { | 128 | artifacts { |
124 | delete("dev-dist") | 129 | add("productionAssets", productionResources) { |
125 | delete(fileTree("src") { | 130 | builtBy(tasks.assembleFrontend) |
126 | include("**/*.typegen.ts") | 131 | } |
127 | }) | ||
128 | } | 132 | } |
129 | 133 | ||
130 | sonarqube.properties { | 134 | sonarqube.properties { |
diff --git a/subprojects/language-ide/build.gradle.kts b/subprojects/language-ide/build.gradle.kts index 28a460e8..f996c00d 100644 --- a/subprojects/language-ide/build.gradle.kts +++ b/subprojects/language-ide/build.gradle.kts | |||
@@ -1,6 +1,6 @@ | |||
1 | plugins { | 1 | plugins { |
2 | id("refinery-java-library") | 2 | id("tools.refinery.gradle.java-library") |
3 | id("refinery-xtext-conventions") | 3 | id("tools.refinery.gradle.xtext-generated") |
4 | } | 4 | } |
5 | 5 | ||
6 | dependencies { | 6 | dependencies { |
diff --git a/subprojects/language-model/build.gradle.kts b/subprojects/language-model/build.gradle.kts index 2804c698..12b6bc13 100644 --- a/subprojects/language-model/build.gradle.kts +++ b/subprojects/language-model/build.gradle.kts | |||
@@ -1,9 +1,9 @@ | |||
1 | import tools.refinery.buildsrc.SonarPropertiesUtils | 1 | import tools.refinery.gradle.utils.SonarPropertiesUtils |
2 | 2 | ||
3 | plugins { | 3 | plugins { |
4 | id("refinery-java-library") | 4 | id("tools.refinery.gradle.java-library") |
5 | id("refinery-mwe2") | 5 | id("tools.refinery.gradle.mwe2") |
6 | id("refinery-sonarqube") | 6 | id("tools.refinery.gradle.sonarqube") |
7 | } | 7 | } |
8 | 8 | ||
9 | dependencies { | 9 | dependencies { |
@@ -22,24 +22,26 @@ sourceSets { | |||
22 | } | 22 | } |
23 | } | 23 | } |
24 | 24 | ||
25 | val generateEPackage by tasks.registering(JavaExec::class) { | 25 | tasks { |
26 | mainClass.set("org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher") | 26 | val generateEPackage by registering(JavaExec::class) { |
27 | classpath(configurations.mwe2) | 27 | mainClass.set("org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher") |
28 | inputs.file("src/main/java/tools/refinery/language/model/GenerateProblemModel.mwe2") | 28 | classpath(configurations.mwe2) |
29 | inputs.file("src/main/resources/model/problem.ecore") | 29 | inputs.file("src/main/java/tools/refinery/language/model/GenerateProblemModel.mwe2") |
30 | inputs.file("src/main/resources/model/problem.genmodel") | 30 | inputs.file("src/main/resources/model/problem.ecore") |
31 | outputs.dir("src/main/emf-gen") | 31 | inputs.file("src/main/resources/model/problem.genmodel") |
32 | args("src/main/java/tools/refinery/language/model/GenerateProblemModel.mwe2", "-p", "rootPath=/$projectDir") | 32 | outputs.dir("src/main/emf-gen") |
33 | } | 33 | args("src/main/java/tools/refinery/language/model/GenerateProblemModel.mwe2", "-p", "rootPath=/$projectDir") |
34 | } | ||
34 | 35 | ||
35 | for (taskName in listOf("compileJava", "processResources", "generateEclipseSourceFolders")) { | 36 | for (taskName in listOf("compileJava", "processResources", "generateEclipseSourceFolders")) { |
36 | tasks.named(taskName) { | 37 | named(taskName) { |
37 | dependsOn(generateEPackage) | 38 | dependsOn(generateEPackage) |
39 | } | ||
38 | } | 40 | } |
39 | } | ||
40 | 41 | ||
41 | tasks.clean { | 42 | clean { |
42 | delete("src/main/emf-gen") | 43 | delete("src/main/emf-gen") |
44 | } | ||
43 | } | 45 | } |
44 | 46 | ||
45 | sonarqube.properties { | 47 | sonarqube.properties { |
diff --git a/subprojects/language-semantics/build.gradle.kts b/subprojects/language-semantics/build.gradle.kts index e13e5e4a..bf016dc9 100644 --- a/subprojects/language-semantics/build.gradle.kts +++ b/subprojects/language-semantics/build.gradle.kts | |||
@@ -1,5 +1,5 @@ | |||
1 | plugins { | 1 | plugins { |
2 | id("refinery-java-library") | 2 | id("tools.refinery.gradle.java-library") |
3 | } | 3 | } |
4 | 4 | ||
5 | dependencies { | 5 | dependencies { |
diff --git a/subprojects/language-web/build.gradle.kts b/subprojects/language-web/build.gradle.kts index b59763a8..d2a39d56 100644 --- a/subprojects/language-web/build.gradle.kts +++ b/subprojects/language-web/build.gradle.kts | |||
@@ -1,6 +1,6 @@ | |||
1 | plugins { | 1 | plugins { |
2 | id("refinery-java-application") | 2 | id("tools.refinery.gradle.java-application") |
3 | id("refinery-xtext-conventions") | 3 | id("tools.refinery.gradle.xtext-generated") |
4 | } | 4 | } |
5 | 5 | ||
6 | val webapp: Configuration by configurations.creating { | 6 | val webapp: Configuration by configurations.creating { |
@@ -21,64 +21,66 @@ dependencies { | |||
21 | testImplementation(libs.jetty.websocket.client) | 21 | testImplementation(libs.jetty.websocket.client) |
22 | } | 22 | } |
23 | 23 | ||
24 | val generateXtextLanguage by project(":refinery-language").tasks.existing | ||
25 | |||
26 | for (taskName in listOf("compileJava", "processResources")) { | ||
27 | tasks.named(taskName) { | ||
28 | dependsOn(generateXtextLanguage) | ||
29 | } | ||
30 | } | ||
31 | |||
32 | application { | 24 | application { |
33 | mainClass.set("tools.refinery.language.web.ServerLauncher") | 25 | mainClass.set("tools.refinery.language.web.ServerLauncher") |
34 | // Enable JDK 19 preview features for virtual thread support. | 26 | // Enable JDK 19 preview features for virtual thread support. |
35 | applicationDefaultJvmArgs += "--enable-preview" | 27 | applicationDefaultJvmArgs += "--enable-preview" |
36 | } | 28 | } |
37 | 29 | ||
38 | tasks.withType(JavaCompile::class) { | ||
39 | options.release.set(19) | ||
40 | // Enable JDK 19 preview features for virtual thread support. | ||
41 | options.compilerArgs.plusAssign("--enable-preview") | ||
42 | } | ||
43 | |||
44 | // Enable JDK 19 preview features for virtual thread support. | 30 | // Enable JDK 19 preview features for virtual thread support. |
45 | fun enablePreview(task: JavaForkOptions) { | 31 | fun enablePreview(task: JavaForkOptions) { |
46 | task.jvmArgs("--enable-preview") | 32 | task.jvmArgs("--enable-preview") |
47 | } | 33 | } |
48 | 34 | ||
49 | tasks.withType(Test::class) { | 35 | tasks { |
50 | enablePreview(this) | 36 | val generateXtextLanguage by project(":refinery-language").tasks.existing |
51 | } | ||
52 | 37 | ||
53 | tasks.jar { | 38 | for (taskName in listOf("compileJava", "processResources")) { |
54 | dependsOn(webapp) | 39 | named(taskName) { |
55 | from(webapp) { | 40 | dependsOn(generateXtextLanguage) |
56 | into("webapp") | 41 | } |
57 | } | 42 | } |
58 | } | ||
59 | 43 | ||
60 | tasks.shadowJar { | 44 | withType(JavaCompile::class) { |
61 | dependsOn(webapp) | 45 | options.release.set(19) |
62 | from(project.sourceSets.main.map { it.output }) | 46 | // Enable JDK 19 preview features for virtual thread support. |
63 | exclude("META-INF/INDEX.LIST", "META-INF/*.SF", "META-INF/*.DSA", "META-INF/*.RSA","schema/*", | 47 | options.compilerArgs.plusAssign("--enable-preview") |
64 | ".options", ".api_description", "*.profile", "about.*", "about_*.html", "about_files/*", | 48 | } |
65 | "plugin.xml", "systembundle.properties", "profile.list", "META-INF/resources/xtext/**") | 49 | |
66 | append("plugin.properties") | 50 | withType(Test::class) { |
67 | from(webapp) { | 51 | enablePreview(this) |
68 | into("webapp") | 52 | } |
53 | |||
54 | jar { | ||
55 | dependsOn(webapp) | ||
56 | from(webapp) { | ||
57 | into("webapp") | ||
58 | } | ||
59 | } | ||
60 | |||
61 | shadowJar { | ||
62 | dependsOn(webapp) | ||
63 | from(project.sourceSets.main.map { it.output }) | ||
64 | exclude("META-INF/INDEX.LIST", "META-INF/*.SF", "META-INF/*.DSA", "META-INF/*.RSA", "schema/*", | ||
65 | ".options", ".api_description", "*.profile", "about.*", "about_*.html", "about_files/*", | ||
66 | "plugin.xml", "systembundle.properties", "profile.list", "META-INF/resources/xtext/**") | ||
67 | append("plugin.properties") | ||
68 | from(webapp) { | ||
69 | into("webapp") | ||
70 | } | ||
69 | } | 71 | } |
70 | } | ||
71 | 72 | ||
72 | tasks.register<JavaExec>("serveBackend") { | 73 | register<JavaExec>("serveBackend") { |
73 | dependsOn(webapp) | 74 | dependsOn(webapp) |
74 | val mainRuntimeClasspath = sourceSets.main.map { it.runtimeClasspath } | 75 | val mainRuntimeClasspath = sourceSets.main.map { it.runtimeClasspath } |
75 | dependsOn(mainRuntimeClasspath) | 76 | dependsOn(mainRuntimeClasspath) |
76 | classpath(mainRuntimeClasspath) | 77 | classpath(mainRuntimeClasspath) |
77 | mainClass.set(application.mainClass) | 78 | mainClass.set(application.mainClass) |
78 | enablePreview(this) | 79 | enablePreview(this) |
79 | standardInput = System.`in` | 80 | standardInput = System.`in` |
80 | val baseResource = webapp.incoming.artifacts.artifactFiles.first() | 81 | val baseResource = webapp.incoming.artifacts.artifactFiles.first() |
81 | environment("BASE_RESOURCE", baseResource) | 82 | environment("BASE_RESOURCE", baseResource) |
82 | group = "run" | 83 | group = "run" |
83 | description = "Start a Jetty web server serving the Xtex API and assets." | 84 | description = "Start a Jetty web server serving the Xtex API and assets." |
85 | } | ||
84 | } | 86 | } |
diff --git a/subprojects/language/build.gradle.kts b/subprojects/language/build.gradle.kts index ed4f95a5..4cfe6895 100644 --- a/subprojects/language/build.gradle.kts +++ b/subprojects/language/build.gradle.kts | |||
@@ -1,11 +1,11 @@ | |||
1 | import tools.refinery.buildsrc.SonarPropertiesUtils | 1 | import tools.refinery.gradle.utils.SonarPropertiesUtils |
2 | 2 | ||
3 | plugins { | 3 | plugins { |
4 | id("refinery-java-library") | 4 | id("tools.refinery.gradle.java-library") |
5 | id("refinery-java-test-fixtures") | 5 | id("tools.refinery.gradle.java-test-fixtures") |
6 | id("refinery-sonarqube") | 6 | id("tools.refinery.gradle.mwe2") |
7 | id("refinery-mwe2") | 7 | id("tools.refinery.gradle.sonarqube") |
8 | id("refinery-xtext-conventions") | 8 | id("tools.refinery.gradle.xtext-generated") |
9 | } | 9 | } |
10 | 10 | ||
11 | dependencies { | 11 | dependencies { |
@@ -26,36 +26,38 @@ sourceSets { | |||
26 | } | 26 | } |
27 | } | 27 | } |
28 | 28 | ||
29 | tasks.jar { | 29 | tasks { |
30 | from(sourceSets.main.map { it.allSource }) { | 30 | jar { |
31 | include("**/*.xtext") | 31 | from(sourceSets.main.map { it.allSource }) { |
32 | include("**/*.xtext") | ||
33 | } | ||
32 | } | 34 | } |
33 | } | ||
34 | 35 | ||
35 | val generateXtextLanguage by tasks.registering(JavaExec::class) { | 36 | val generateXtextLanguage by registering(JavaExec::class) { |
36 | mainClass.set("org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher") | 37 | mainClass.set("org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher") |
37 | classpath(configurations.mwe2) | 38 | classpath(configurations.mwe2) |
38 | inputs.file("src/main/java/tools/refinery/language/GenerateProblem.mwe2") | 39 | inputs.file("src/main/java/tools/refinery/language/GenerateProblem.mwe2") |
39 | inputs.file("src/main/java/tools/refinery/language/Problem.xtext") | 40 | inputs.file("src/main/java/tools/refinery/language/Problem.xtext") |
40 | outputs.dir("src/main/xtext-gen") | 41 | outputs.dir("src/main/xtext-gen") |
41 | outputs.dir("src/testFixtures/xtext-gen") | 42 | outputs.dir("src/testFixtures/xtext-gen") |
42 | outputs.dir("../language-ide/src/main/xtext-gen") | 43 | outputs.dir("../language-ide/src/main/xtext-gen") |
43 | outputs.dir("../language-web/src/main/xtext-gen") | 44 | outputs.dir("../language-web/src/main/xtext-gen") |
44 | args("src/main/java/tools/refinery/language/GenerateProblem.mwe2", "-p", "rootPath=/$projectDir/..") | 45 | args("src/main/java/tools/refinery/language/GenerateProblem.mwe2", "-p", "rootPath=/$projectDir/..") |
45 | } | 46 | } |
46 | 47 | ||
47 | for (taskName in listOf("compileJava", "processResources", "processTestFixturesResources", | 48 | for (taskName in listOf("compileJava", "processResources", "processTestFixturesResources", |
48 | "generateEclipseSourceFolders")) { | 49 | "generateEclipseSourceFolders")) { |
49 | tasks.named(taskName) { | 50 | named(taskName) { |
50 | dependsOn(generateXtextLanguage) | 51 | dependsOn(generateXtextLanguage) |
52 | } | ||
51 | } | 53 | } |
52 | } | ||
53 | 54 | ||
54 | tasks.clean { | 55 | clean { |
55 | delete("src/main/xtext-gen") | 56 | delete("src/main/xtext-gen") |
56 | delete("src/testFixtures/xtext-gen") | 57 | delete("src/testFixtures/xtext-gen") |
57 | delete("../language-ide/src/main/xtext-gen") | 58 | delete("../language-ide/src/main/xtext-gen") |
58 | delete("../language-web/src/main/xtext-gen") | 59 | delete("../language-web/src/main/xtext-gen") |
60 | } | ||
59 | } | 61 | } |
60 | 62 | ||
61 | sonarqube.properties { | 63 | sonarqube.properties { |
diff --git a/subprojects/store-query-viatra/build.gradle.kts b/subprojects/store-query-viatra/build.gradle.kts index 7451dd83..4a894f52 100644 --- a/subprojects/store-query-viatra/build.gradle.kts +++ b/subprojects/store-query-viatra/build.gradle.kts | |||
@@ -1,5 +1,5 @@ | |||
1 | plugins { | 1 | plugins { |
2 | id("refinery-java-library") | 2 | id("tools.refinery.gradle.java-library") |
3 | } | 3 | } |
4 | 4 | ||
5 | dependencies { | 5 | dependencies { |
diff --git a/subprojects/store-query/build.gradle.kts b/subprojects/store-query/build.gradle.kts index 16dbd95d..889a0479 100644 --- a/subprojects/store-query/build.gradle.kts +++ b/subprojects/store-query/build.gradle.kts | |||
@@ -1,6 +1,6 @@ | |||
1 | plugins { | 1 | plugins { |
2 | id("refinery-java-library") | 2 | id("tools.refinery.gradle.java-library") |
3 | id("refinery-java-test-fixtures") | 3 | id("tools.refinery.gradle.java-test-fixtures") |
4 | } | 4 | } |
5 | 5 | ||
6 | dependencies { | 6 | dependencies { |
diff --git a/subprojects/store-reasoning/build.gradle.kts b/subprojects/store-reasoning/build.gradle.kts index fe15fc42..bb37d9d3 100644 --- a/subprojects/store-reasoning/build.gradle.kts +++ b/subprojects/store-reasoning/build.gradle.kts | |||
@@ -1,5 +1,5 @@ | |||
1 | plugins { | 1 | plugins { |
2 | id("refinery-java-library") | 2 | id("tools.refinery.gradle.java-library") |
3 | } | 3 | } |
4 | 4 | ||
5 | dependencies { | 5 | dependencies { |
diff --git a/subprojects/store/build.gradle.kts b/subprojects/store/build.gradle.kts index 5b4eac46..d62e5159 100644 --- a/subprojects/store/build.gradle.kts +++ b/subprojects/store/build.gradle.kts | |||
@@ -1,4 +1,4 @@ | |||
1 | plugins { | 1 | plugins { |
2 | id("refinery-java-library") | 2 | id("tools.refinery.gradle.java-library") |
3 | id("refinery-jmh") | 3 | id("tools.refinery.gradle.jmh") |
4 | } | 4 | } |