From af78c7c51eabeb0e44e695122834a359707a4d77 Mon Sep 17 00:00:00 2001 From: "Daniel A. A. Pelsmaeker" Date: Mon, 27 May 2024 13:45:20 +0200 Subject: [PATCH] Reformat code to match Kotlin official style --- build.gradle.kts | 22 +- core/aterm.common/build.gradle.kts | 16 +- core/build.gradle.kts | 28 +- core/constraint.common/build.gradle.kts | 26 +- core/constraint.pie/build.gradle.kts | 22 +- core/esv.common/build.gradle.kts | 14 +- core/jsglr.common/build.gradle.kts | 22 +- core/jsglr.pie/build.gradle.kts | 26 +- core/jsglr1.common/build.gradle.kts | 18 +- core/jsglr2.common/build.gradle.kts | 18 +- core/nabl2.common/build.gradle.kts | 10 +- core/settings.gradle.kts | 6 +- core/spoofax.cli/build.gradle.kts | 20 +- core/spoofax.common/build.gradle.kts | 6 +- .../build.gradle.kts | 46 +- .../build.gradle.kts | 46 +- core/spoofax.compiler.gradle/build.gradle.kts | 80 +-- .../build.gradle.kts | 16 +- .../build.gradle.kts | 14 +- .../build.gradle.kts | 22 +- core/spoofax.compiler/build.gradle.kts | 114 ++-- core/spoofax.core/build.gradle.kts | 40 +- core/spoofax.depconstraints/build.gradle.kts | 228 +++---- core/spoofax.eclipse/build.gradle.kts | 84 +-- core/spoofax.intellij/build.gradle.kts | 24 +- core/spoofax.resource/build.gradle.kts | 10 +- core/spoofax.test/build.gradle.kts | 20 +- core/spoofax2.common/build.gradle.kts | 18 +- core/spt.api/build.gradle.kts | 20 +- .../build.gradle.kts | 24 +- core/statix.codecompletion/build.gradle.kts | 56 +- core/statix.common/build.gradle.kts | 20 +- .../statix.multilang.eclipse/build.gradle.kts | 74 +-- core/statix.multilang/build.gradle.kts | 28 +- core/statix.pie/build.gradle.kts | 22 +- core/stratego.common/build.gradle.kts | 28 +- core/stratego.pie/build.gradle.kts | 20 +- core/tego.runtime/build.gradle.kts | 34 +- core/tooling.eclipsebundle/build.gradle.kts | 110 ++-- core/transform.pie/build.gradle.kts | 18 +- example/build.gradle.kts | 50 +- example/calc/calc.cli/build.gradle.kts | 14 +- example/calc/calc.eclipse/build.gradle.kts | 8 +- example/calc/calc.intellij/build.gradle.kts | 6 +- example/calc/calc/build.gradle.kts | 10 +- example/mod/mod.cli/build.gradle.kts | 14 +- example/mod/mod.eclipse/build.gradle.kts | 8 +- example/mod/mod.intellij/build.gradle.kts | 6 +- example/mod/mod.spoofax/build.gradle.kts | 24 +- example/mod/mod.spoofaxcore/build.gradle.kts | 14 +- example/mod/mod/build.gradle.kts | 68 +- .../generated/minisdf.cli/build.gradle.kts | 14 +- .../minisdf.eclipse/build.gradle.kts | 8 +- .../generated/minisdf/build.gradle.kts | 88 ++- .../generated/ministr.cli/build.gradle.kts | 14 +- .../ministr.eclipse/build.gradle.kts | 8 +- .../generated/ministr/build.gradle.kts | 88 ++- .../generated/module.eclipse/build.gradle.kts | 8 +- .../generated/module/build.gradle.kts | 50 +- .../multilang.eclipse/build.gradle.kts | 14 +- .../generated/multilang.test/build.gradle.kts | 27 +- .../signature.eclipse/build.gradle.kts | 8 +- .../generated/signature/build.gradle.kts | 44 +- .../minisdf.spoofaxcore/build.gradle.kts | 48 +- .../ministr.spoofaxcore/build.gradle.kts | 48 +- .../build.gradle.kts | 22 +- .../build.gradle.kts | 6 +- example/settings.gradle.kts | 108 ++-- .../tiger/manual/tiger.cli/build.gradle.kts | 50 +- .../manual/tiger.eclipse/build.gradle.kts | 74 +-- .../manual/tiger.intellij/build.gradle.kts | 52 +- .../manual/tiger.spoofax/build.gradle.kts | 44 +- example/tiger/manual/tiger/build.gradle.kts | 136 ++-- .../tiger.spoofax3.cli/build.gradle.kts | 14 +- .../tiger.spoofax3.eclipse/build.gradle.kts | 8 +- .../tiger.spoofax3.intellij/build.gradle.kts | 6 +- .../spoofax3/tiger.spoofax3/build.gradle.kts | 14 +- .../tiger.spoofaxcore/build.gradle.kts | 14 +- lwb.distrib/build.gradle.kts | 52 +- .../rv32im/rv32im.eclipse/build.gradle.kts | 48 +- .../lang/rv32im/rv32im/build.gradle.kts | 8 +- lwb.distrib/settings.gradle.kts | 36 +- .../build.gradle.kts | 14 +- .../build.gradle.kts | 20 +- .../spoofax.lwb.eclipse/build.gradle.kts | 312 ++++----- lwb/build.gradle.kts | 56 +- lwb/metalang/cfg/cfg.cli/build.gradle.kts | 14 +- lwb/metalang/cfg/cfg.eclipse/build.gradle.kts | 16 +- .../cfg/cfg.intellij/build.gradle.kts | 6 +- .../cfg/cfg.spoofax2/build.gradle.kts | 20 +- lwb/metalang/cfg/cfg/build.gradle.kts | 144 +++-- .../dynamix/dynamix.cli/build.gradle.kts | 14 +- .../dynamix/dynamix.eclipse/build.gradle.kts | 16 +- .../dynamix/dynamix.intellij/build.gradle.kts | 6 +- .../dynamix/dynamix.spoofax2/build.gradle.kts | 20 +- lwb/metalang/dynamix/dynamix/build.gradle.kts | 264 ++++---- lwb/metalang/esv/esv.cli/build.gradle.kts | 14 +- lwb/metalang/esv/esv.eclipse/build.gradle.kts | 12 +- .../esv/esv.intellij/build.gradle.kts | 6 +- lwb/metalang/esv/esv/build.gradle.kts | 122 ++-- lwb/metalang/sdf3/sdf3.cli/build.gradle.kts | 14 +- .../sdf3/sdf3.eclipse/build.gradle.kts | 44 +- .../sdf3/sdf3.intellij/build.gradle.kts | 6 +- lwb/metalang/sdf3/sdf3/build.gradle.kts | 607 ++++++++++-------- .../sdf3_ext_dynamix.eclipse/build.gradle.kts | 8 +- .../build.gradle.kts | 24 +- .../sdf3_ext_dynamix/build.gradle.kts | 61 +- .../sdf3_ext_statix.eclipse/build.gradle.kts | 8 +- .../sdf3_ext_statix/build.gradle.kts | 68 +- lwb/metalang/spt/spt.cli/build.gradle.kts | 14 +- .../spt/spt.dynamicloading/build.gradle.kts | 8 +- lwb/metalang/spt/spt.eclipse/build.gradle.kts | 12 +- .../spt/spt.intellij/build.gradle.kts | 6 +- lwb/metalang/spt/spt/build.gradle.kts | 241 +++---- .../statix/statix.cli/build.gradle.kts | 14 +- .../statix/statix.eclipse/build.gradle.kts | 52 +- .../statix/statix.intellij/build.gradle.kts | 6 +- lwb/metalang/statix/statix/build.gradle.kts | 215 +++---- .../stratego/stratego.cli/build.gradle.kts | 14 +- .../stratego.eclipse/build.gradle.kts | 56 +- .../stratego.intellij/build.gradle.kts | 6 +- .../stratego/stratego/build.gradle.kts | 464 +++++++------ lwb/metalib/gpp/gpp.eclipse/build.gradle.kts | 36 +- lwb/metalib/gpp/gpp/build.gradle.kts | 76 +-- .../libspoofax2.eclipse/build.gradle.kts | 8 +- .../libspoofax2/libspoofax2/build.gradle.kts | 56 +- .../libstatix.eclipse/build.gradle.kts | 8 +- .../libstatix/libstatix/build.gradle.kts | 48 +- .../strategolib.eclipse/build.gradle.kts | 34 +- .../strategolib/strategolib/build.gradle.kts | 76 +-- lwb/settings.gradle.kts | 118 ++-- .../build.gradle.kts | 40 +- lwb/spoofax.lwb.compiler/build.gradle.kts | 106 +-- .../build.gradle.kts | 50 +- settings.gradle.kts | 22 +- 135 files changed, 3354 insertions(+), 3199 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index c0aa80b4e..bce85ec09 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,17 +1,17 @@ plugins { - id("org.metaborg.gradle.config.root-project") version "0.5.6" - id("org.metaborg.gitonium") version "1.2.0" + id("org.metaborg.gradle.config.root-project") version "0.5.6" + id("org.metaborg.gitonium") version "1.2.0" } // Auto-accept build scan TOS extensions.findByName("buildScan")?.withGroovyBuilder { - try { - // New Develocity plugin - setProperty("termsOfUseUrl", "https://gradle.com/help/legal-terms-of-use") - setProperty("termsOfUseAgree", "yes") - } catch (ex: groovy.lang.MissingPropertyException) { - // Deprecated Gradle Enterprise plugin - setProperty("termsOfServiceUrl", "https://gradle.com/terms-of-service") - setProperty("termsOfServiceAgree", "yes") - } + try { + // New Develocity plugin + setProperty("termsOfUseUrl", "https://gradle.com/help/legal-terms-of-use") + setProperty("termsOfUseAgree", "yes") + } catch (ex: groovy.lang.MissingPropertyException) { + // Deprecated Gradle Enterprise plugin + setProperty("termsOfServiceUrl", "https://gradle.com/terms-of-service") + setProperty("termsOfServiceAgree", "yes") + } } diff --git a/core/aterm.common/build.gradle.kts b/core/aterm.common/build.gradle.kts index ef5758436..b36f36871 100644 --- a/core/aterm.common/build.gradle.kts +++ b/core/aterm.common/build.gradle.kts @@ -1,17 +1,17 @@ plugins { - id("org.metaborg.gradle.config.java-library") + id("org.metaborg.gradle.config.java-library") } dependencies { - api(platform(project(":spoofax.depconstraints"))) + api(platform(project(":spoofax.depconstraints"))) - api("org.metaborg:common") + api("org.metaborg:common") - api("org.metaborg.devenv:org.spoofax.terms") + api("org.metaborg.devenv:org.spoofax.terms") - // Depend on Stratego projects for access to standard library strategies which do aterm pretty printing. - implementation("org.metaborg.devenv:org.spoofax.interpreter.core") - implementation("org.metaborg.devenv:org.strategoxt.strj") + // Depend on Stratego projects for access to standard library strategies which do aterm pretty printing. + implementation("org.metaborg.devenv:org.spoofax.interpreter.core") + implementation("org.metaborg.devenv:org.strategoxt.strj") - compileOnly("org.checkerframework:checker-qual-android") + compileOnly("org.checkerframework:checker-qual-android") } diff --git a/core/build.gradle.kts b/core/build.gradle.kts index 345aaba46..226a335ff 100644 --- a/core/build.gradle.kts +++ b/core/build.gradle.kts @@ -1,25 +1,25 @@ plugins { - id("org.metaborg.gradle.config.root-project") version "0.5.6" - id("org.metaborg.gitonium") version "1.2.0" + id("org.metaborg.gradle.config.root-project") version "0.5.6" + id("org.metaborg.gitonium") version "1.2.0" - // Set versions for plugins to use, only applying them in subprojects (apply false here). - id("org.metaborg.gradle.config.kotlin-gradle-plugin") version "0.5.6" apply false - id("org.metaborg.coronium.bundle") version "0.3.17" apply false - id("biz.aQute.bnd.builder") version "5.3.0" apply false - id("org.jetbrains.intellij") version "1.4.0" apply false - kotlin("jvm") version "1.4.20" apply false // Use 1.4.20 to keep in sync with embedded Kotlin version of Gradle 6.8. - `kotlin-dsl` apply false + // Set versions for plugins to use, only applying them in subprojects (apply false here). + id("org.metaborg.gradle.config.kotlin-gradle-plugin") version "0.5.6" apply false + id("org.metaborg.coronium.bundle") version "0.3.17" apply false + id("biz.aQute.bnd.builder") version "5.3.0" apply false + id("org.jetbrains.intellij") version "1.4.0" apply false + kotlin("jvm") version "1.4.20" apply false // Use 1.4.20 to keep in sync with embedded Kotlin version of Gradle 6.8. + `kotlin-dsl` apply false } subprojects { - metaborg { - configureSubProject() - } + metaborg { + configureSubProject() + } } val spoofax2Version: String = System.getProperty("spoofax2Version") val spoofax2DevenvVersion: String = System.getProperty("spoofax2DevenvVersion") allprojects { - ext["spoofax2Version"] = spoofax2Version - ext["spoofax2DevenvVersion"] = spoofax2DevenvVersion + ext["spoofax2Version"] = spoofax2Version + ext["spoofax2DevenvVersion"] = spoofax2DevenvVersion } diff --git a/core/constraint.common/build.gradle.kts b/core/constraint.common/build.gradle.kts index 36b94a4b3..ca14e349c 100644 --- a/core/constraint.common/build.gradle.kts +++ b/core/constraint.common/build.gradle.kts @@ -1,23 +1,23 @@ plugins { - id("org.metaborg.gradle.config.java-library") + id("org.metaborg.gradle.config.java-library") } dependencies { - api(platform(project(":spoofax.depconstraints"))) - annotationProcessor(platform(project(":spoofax.depconstraints"))) + api(platform(project(":spoofax.depconstraints"))) + annotationProcessor(platform(project(":spoofax.depconstraints"))) - api("org.metaborg:common") - api(project(":aterm.common")) - api(project(":jsglr.common")) - api(project(":stratego.common")) + api("org.metaborg:common") + api(project(":aterm.common")) + api(project(":jsglr.common")) + api(project(":stratego.common")) - api("org.metaborg:log.api") + api("org.metaborg:log.api") - implementation("org.metaborg.devenv:nabl2.terms") - implementation("org.metaborg.devenv:org.metaborg.util") + implementation("org.metaborg.devenv:nabl2.terms") + implementation("org.metaborg.devenv:org.metaborg.util") - compileOnly("org.checkerframework:checker-qual-android") - compileOnly("org.derive4j:derive4j-annotation") + compileOnly("org.checkerframework:checker-qual-android") + compileOnly("org.derive4j:derive4j-annotation") - annotationProcessor("org.derive4j:derive4j") + annotationProcessor("org.derive4j:derive4j") } diff --git a/core/constraint.pie/build.gradle.kts b/core/constraint.pie/build.gradle.kts index 2256bac47..baa77284b 100644 --- a/core/constraint.pie/build.gradle.kts +++ b/core/constraint.pie/build.gradle.kts @@ -1,19 +1,19 @@ plugins { - id("org.metaborg.gradle.config.java-library") + id("org.metaborg.gradle.config.java-library") } dependencies { - api(platform(project(":spoofax.depconstraints"))) - annotationProcessor(platform(project(":spoofax.depconstraints"))) + api(platform(project(":spoofax.depconstraints"))) + annotationProcessor(platform(project(":spoofax.depconstraints"))) - api("org.metaborg:common") - implementation(project(":aterm.common")) - api(project(":constraint.common")) - api(project(":spoofax.core")) - api("org.metaborg:pie.api") + api("org.metaborg:common") + implementation(project(":aterm.common")) + api(project(":constraint.common")) + api(project(":spoofax.core")) + api("org.metaborg:pie.api") - compileOnly("org.checkerframework:checker-qual-android") - compileOnly("org.derive4j:derive4j-annotation") + compileOnly("org.checkerframework:checker-qual-android") + compileOnly("org.derive4j:derive4j-annotation") - annotationProcessor("org.derive4j:derive4j") + annotationProcessor("org.derive4j:derive4j") } diff --git a/core/esv.common/build.gradle.kts b/core/esv.common/build.gradle.kts index b7d4b8c92..3762dda6c 100644 --- a/core/esv.common/build.gradle.kts +++ b/core/esv.common/build.gradle.kts @@ -1,14 +1,14 @@ plugins { - id("org.metaborg.gradle.config.java-library") + id("org.metaborg.gradle.config.java-library") } dependencies { - api(platform(project(":spoofax.depconstraints"))) + api(platform(project(":spoofax.depconstraints"))) - api("org.metaborg:common") - api("org.metaborg:log.api") - api("org.metaborg.devenv:org.spoofax.terms") - implementation("org.metaborg.devenv:org.spoofax.jsglr") // TODO: avoid dependency to jsglr, only need it for imploder attachment. + api("org.metaborg:common") + api("org.metaborg:log.api") + api("org.metaborg.devenv:org.spoofax.terms") + implementation("org.metaborg.devenv:org.spoofax.jsglr") // TODO: avoid dependency to jsglr, only need it for imploder attachment. - compileOnly("org.checkerframework:checker-qual-android") + compileOnly("org.checkerframework:checker-qual-android") } diff --git a/core/jsglr.common/build.gradle.kts b/core/jsglr.common/build.gradle.kts index c06fc0458..d81874ac6 100644 --- a/core/jsglr.common/build.gradle.kts +++ b/core/jsglr.common/build.gradle.kts @@ -1,20 +1,20 @@ plugins { - id("org.metaborg.gradle.config.java-library") + id("org.metaborg.gradle.config.java-library") } dependencies { - api(platform(project(":spoofax.depconstraints"))) - annotationProcessor(platform(project(":spoofax.depconstraints"))) + api(platform(project(":spoofax.depconstraints"))) + annotationProcessor(platform(project(":spoofax.depconstraints"))) - api("org.metaborg:common") + api("org.metaborg:common") - api("org.metaborg:resource") - api("org.metaborg.devenv:jsglr.shared") - api("org.metaborg.devenv:org.spoofax.jsglr") - api("org.metaborg.devenv:org.spoofax.terms") + api("org.metaborg:resource") + api("org.metaborg.devenv:jsglr.shared") + api("org.metaborg.devenv:org.spoofax.jsglr") + api("org.metaborg.devenv:org.spoofax.terms") - compileOnly("org.checkerframework:checker-qual-android") - compileOnly("org.derive4j:derive4j-annotation") + compileOnly("org.checkerframework:checker-qual-android") + compileOnly("org.derive4j:derive4j-annotation") - annotationProcessor("org.derive4j:derive4j") + annotationProcessor("org.derive4j:derive4j") } diff --git a/core/jsglr.pie/build.gradle.kts b/core/jsglr.pie/build.gradle.kts index 48f8e7987..85845dcdd 100644 --- a/core/jsglr.pie/build.gradle.kts +++ b/core/jsglr.pie/build.gradle.kts @@ -1,21 +1,21 @@ plugins { - id("org.metaborg.gradle.config.java-library") + id("org.metaborg.gradle.config.java-library") } dependencies { - api(platform(project(":spoofax.depconstraints"))) - annotationProcessor(platform(project(":spoofax.depconstraints"))) + api(platform(project(":spoofax.depconstraints"))) + annotationProcessor(platform(project(":spoofax.depconstraints"))) - api("org.metaborg:common") - implementation(project(":aterm.common")) - api(project(":jsglr.common")) - api(project(":spoofax.core")) - api("org.metaborg:pie.api") + api("org.metaborg:common") + implementation(project(":aterm.common")) + api(project(":jsglr.common")) + api(project(":spoofax.core")) + api("org.metaborg:pie.api") - compileOnly("org.checkerframework:checker-qual-android") - compileOnly("org.immutables:value-annotations") - compileOnly("org.derive4j:derive4j-annotation") + compileOnly("org.checkerframework:checker-qual-android") + compileOnly("org.immutables:value-annotations") + compileOnly("org.derive4j:derive4j-annotation") - annotationProcessor("org.immutables:value") - annotationProcessor("org.derive4j:derive4j") + annotationProcessor("org.immutables:value") + annotationProcessor("org.derive4j:derive4j") } diff --git a/core/jsglr1.common/build.gradle.kts b/core/jsglr1.common/build.gradle.kts index 5dd0ab9fd..84c9bdee5 100644 --- a/core/jsglr1.common/build.gradle.kts +++ b/core/jsglr1.common/build.gradle.kts @@ -1,17 +1,17 @@ plugins { - id("org.metaborg.gradle.config.java-library") + id("org.metaborg.gradle.config.java-library") } dependencies { - api(platform(project(":spoofax.depconstraints"))) - annotationProcessor(platform(project(":spoofax.depconstraints"))) + api(platform(project(":spoofax.depconstraints"))) + annotationProcessor(platform(project(":spoofax.depconstraints"))) - api("org.metaborg:common") - api(project(":jsglr.common")) - api("org.metaborg.devenv:org.spoofax.jsglr") + api("org.metaborg:common") + api(project(":jsglr.common")) + api("org.metaborg.devenv:org.spoofax.jsglr") - compileOnly("org.checkerframework:checker-qual-android") - compileOnly("org.derive4j:derive4j-annotation") + compileOnly("org.checkerframework:checker-qual-android") + compileOnly("org.derive4j:derive4j-annotation") - annotationProcessor("org.derive4j:derive4j") + annotationProcessor("org.derive4j:derive4j") } diff --git a/core/jsglr2.common/build.gradle.kts b/core/jsglr2.common/build.gradle.kts index 43630c7fc..7555ea19a 100644 --- a/core/jsglr2.common/build.gradle.kts +++ b/core/jsglr2.common/build.gradle.kts @@ -1,17 +1,17 @@ plugins { - id("org.metaborg.gradle.config.java-library") + id("org.metaborg.gradle.config.java-library") } dependencies { - api(platform(project(":spoofax.depconstraints"))) - annotationProcessor(platform(project(":spoofax.depconstraints"))) + api(platform(project(":spoofax.depconstraints"))) + annotationProcessor(platform(project(":spoofax.depconstraints"))) - api("org.metaborg:common") - api(project(":jsglr.common")) - api("org.metaborg.devenv:org.spoofax.jsglr2") + api("org.metaborg:common") + api(project(":jsglr.common")) + api("org.metaborg.devenv:org.spoofax.jsglr2") - compileOnly("org.checkerframework:checker-qual-android") - compileOnly("org.derive4j:derive4j-annotation") + compileOnly("org.checkerframework:checker-qual-android") + compileOnly("org.derive4j:derive4j-annotation") - annotationProcessor("org.derive4j:derive4j") + annotationProcessor("org.derive4j:derive4j") } diff --git a/core/nabl2.common/build.gradle.kts b/core/nabl2.common/build.gradle.kts index dcd23aebc..6656530a2 100644 --- a/core/nabl2.common/build.gradle.kts +++ b/core/nabl2.common/build.gradle.kts @@ -1,13 +1,13 @@ plugins { - id("org.metaborg.gradle.config.java-library") + id("org.metaborg.gradle.config.java-library") } dependencies { - api(platform(project(":spoofax.depconstraints"))) + api(platform(project(":spoofax.depconstraints"))) - api("org.metaborg:common") + api("org.metaborg:common") - api("org.metaborg.devenv:nabl2.solver") + api("org.metaborg.devenv:nabl2.solver") - compileOnly("org.checkerframework:checker-qual-android") + compileOnly("org.checkerframework:checker-qual-android") } diff --git a/core/settings.gradle.kts b/core/settings.gradle.kts index e5ec6f4f9..99ba6ce12 100644 --- a/core/settings.gradle.kts +++ b/core/settings.gradle.kts @@ -1,9 +1,9 @@ rootProject.name = "spoofax3.core.root" pluginManagement { - repositories { - maven("https://artifacts.metaborg.org/content/groups/public/") - } + repositories { + maven("https://artifacts.metaborg.org/content/groups/public/") + } } include("spoofax.depconstraints") diff --git a/core/spoofax.cli/build.gradle.kts b/core/spoofax.cli/build.gradle.kts index cc0516354..c448e450c 100644 --- a/core/spoofax.cli/build.gradle.kts +++ b/core/spoofax.cli/build.gradle.kts @@ -1,21 +1,21 @@ plugins { - id("org.metaborg.gradle.config.java-library") + id("org.metaborg.gradle.config.java-library") } dependencies { - api(platform(project(":spoofax.depconstraints"))) - annotationProcessor(platform(project(":spoofax.depconstraints"))) + api(platform(project(":spoofax.depconstraints"))) + annotationProcessor(platform(project(":spoofax.depconstraints"))) - api("com.google.dagger:dagger") - implementation(project(":spoofax.core")) - api("info.picocli:picocli") + api("com.google.dagger:dagger") + implementation(project(":spoofax.core")) + api("info.picocli:picocli") - compileOnly("org.checkerframework:checker-qual-android") + compileOnly("org.checkerframework:checker-qual-android") - annotationProcessor("com.google.dagger:dagger-compiler") - annotationProcessor("info.picocli:picocli-codegen") + annotationProcessor("com.google.dagger:dagger-compiler") + annotationProcessor("info.picocli:picocli-codegen") } tasks.compileJava { - options.compilerArgs.add("-Aproject=${project.group}/${project.name}") + options.compilerArgs.add("-Aproject=${project.group}/${project.name}") } diff --git a/core/spoofax.common/build.gradle.kts b/core/spoofax.common/build.gradle.kts index 2db258f17..03c696e43 100644 --- a/core/spoofax.common/build.gradle.kts +++ b/core/spoofax.common/build.gradle.kts @@ -1,9 +1,9 @@ plugins { - id("org.metaborg.gradle.config.java-library") + id("org.metaborg.gradle.config.java-library") } dependencies { - api(platform(project(":spoofax.depconstraints"))) + api(platform(project(":spoofax.depconstraints"))) - compileOnly("org.checkerframework:checker-qual-android") + compileOnly("org.checkerframework:checker-qual-android") } diff --git a/core/spoofax.compiler.eclipsebundle/build.gradle.kts b/core/spoofax.compiler.eclipsebundle/build.gradle.kts index 8c4c7f800..effa7fbb6 100644 --- a/core/spoofax.compiler.eclipsebundle/build.gradle.kts +++ b/core/spoofax.compiler.eclipsebundle/build.gradle.kts @@ -1,41 +1,41 @@ plugins { - id("org.metaborg.gradle.config.java-library") - id("org.metaborg.coronium.bundle") + id("org.metaborg.gradle.config.java-library") + id("org.metaborg.coronium.bundle") } mavenize { - majorVersion.set("2022-06") + majorVersion.set("2022-06") } dependencies { - api(platform(project(":spoofax.depconstraints"))) - annotationProcessor(platform(project(":spoofax.depconstraints"))) + api(platform(project(":spoofax.depconstraints"))) + annotationProcessor(platform(project(":spoofax.depconstraints"))) - bundleTargetPlatformApi(eclipse("javax.inject")) + bundleTargetPlatformApi(eclipse("javax.inject")) - bundleApi(project(":spoofax.eclipse")) - bundleApi(project(":tooling.eclipsebundle")) + bundleApi(project(":spoofax.eclipse")) + bundleApi(project(":tooling.eclipsebundle")) - bundleEmbedApi(project(":spoofax.compiler")) + bundleEmbedApi(project(":spoofax.compiler")) } // Use bnd to create a single OSGi bundle JAR that includes all dependencies. val exportPackage = listOf( - // Already provided by `:tooling.eclipsebundle` - "!mb.spoofax.compiler.interfaces.*", - // Export `:spoofax.compiler` and `:spoofax.compiler.dagger`. Allow split package because `:spoofax.compiler.dagger` - // generates dagger classes in the same package - "mb.spoofax.compiler.*;-split-package:=merge-first", - // Export `com.samskivert:jmustache` and `CachingMustacheCompiler` from `:spoofax.compiler`. Allow split package - // because of the `CachingMustacheCompiler` class - "com.samskivert.mustache.*;-split-package:=merge-first" + // Already provided by `:tooling.eclipsebundle` + "!mb.spoofax.compiler.interfaces.*", + // Export `:spoofax.compiler` and `:spoofax.compiler.dagger`. Allow split package because `:spoofax.compiler.dagger` + // generates dagger classes in the same package + "mb.spoofax.compiler.*;-split-package:=merge-first", + // Export `com.samskivert:jmustache` and `CachingMustacheCompiler` from `:spoofax.compiler`. Allow split package + // because of the `CachingMustacheCompiler` class + "com.samskivert.mustache.*;-split-package:=merge-first" ) tasks { - "jar"(Jar::class) { - manifest { - attributes( - Pair("Export-Package", exportPackage.joinToString(", ")) - ) + "jar"(Jar::class) { + manifest { + attributes( + Pair("Export-Package", exportPackage.joinToString(", ")) + ) + } } - } } diff --git a/core/spoofax.compiler.gradle.spoofax2/build.gradle.kts b/core/spoofax.compiler.gradle.spoofax2/build.gradle.kts index 1ad572410..618717eb7 100644 --- a/core/spoofax.compiler.gradle.spoofax2/build.gradle.kts +++ b/core/spoofax.compiler.gradle.spoofax2/build.gradle.kts @@ -1,38 +1,38 @@ plugins { - id("org.metaborg.gradle.config.kotlin-gradle-plugin") - kotlin("jvm") - kotlin("kapt") - id("org.gradle.kotlin.kotlin-dsl") // Same as `kotlin-dsl`, but without version, which is already set in root project. + id("org.metaborg.gradle.config.kotlin-gradle-plugin") + kotlin("jvm") + kotlin("kapt") + id("org.gradle.kotlin.kotlin-dsl") // Same as `kotlin-dsl`, but without version, which is already set in root project. } metaborg { - kotlinApiVersion = "1.3" - kotlinLanguageVersion = "1.3" + kotlinApiVersion = "1.3" + kotlinLanguageVersion = "1.3" } dependencies { - api(platform(project(":spoofax.depconstraints"))) - kapt(platform(project(":spoofax.depconstraints"))) + api(platform(project(":spoofax.depconstraints"))) + kapt(platform(project(":spoofax.depconstraints"))) - api(project(":spoofax.compiler")) - api(project(":spoofax.compiler.spoofax2")) - api(project(":spoofax.compiler.spoofax2.dagger")) - api("com.google.dagger:dagger") - implementation("org.metaborg:pie.runtime") + api(project(":spoofax.compiler")) + api(project(":spoofax.compiler.spoofax2")) + api(project(":spoofax.compiler.spoofax2.dagger")) + api("com.google.dagger:dagger") + implementation("org.metaborg:pie.runtime") - kapt("com.google.dagger:dagger-compiler") - compileOnly("org.immutables:value-annotations") // Dagger accesses these annotations, which have class retention. + kapt("com.google.dagger:dagger-compiler") + compileOnly("org.immutables:value-annotations") // Dagger accesses these annotations, which have class retention. - // Dependencies to be able to use/configure the extensions provided by these Gradle plugins. - compileOnly(project(":spoofax.compiler.gradle")) - compileOnly("org.metaborg.devenv:spoofax.gradle") + // Dependencies to be able to use/configure the extensions provided by these Gradle plugins. + compileOnly(project(":spoofax.compiler.gradle")) + compileOnly("org.metaborg.devenv:spoofax.gradle") } gradlePlugin { - plugins { - create("spoofax-compiler-spoofax2-language") { - id = "org.metaborg.spoofax.compiler.gradle.spoofax2.language" - implementationClass = "mb.spoofax.compiler.gradle.spoofax2.plugin.Spoofax2LanguagePlugin" + plugins { + create("spoofax-compiler-spoofax2-language") { + id = "org.metaborg.spoofax.compiler.gradle.spoofax2.language" + implementationClass = "mb.spoofax.compiler.gradle.spoofax2.plugin.Spoofax2LanguagePlugin" + } } - } } diff --git a/core/spoofax.compiler.gradle/build.gradle.kts b/core/spoofax.compiler.gradle/build.gradle.kts index bd95ab7a2..45ea39f63 100644 --- a/core/spoofax.compiler.gradle/build.gradle.kts +++ b/core/spoofax.compiler.gradle/build.gradle.kts @@ -1,59 +1,59 @@ plugins { - id("org.metaborg.gradle.config.kotlin-gradle-plugin") - kotlin("jvm") - kotlin("kapt") - id("org.gradle.kotlin.kotlin-dsl") // Same as `kotlin-dsl`, but without version, which is already set in root project. + id("org.metaborg.gradle.config.kotlin-gradle-plugin") + kotlin("jvm") + kotlin("kapt") + id("org.gradle.kotlin.kotlin-dsl") // Same as `kotlin-dsl`, but without version, which is already set in root project. } metaborg { - kotlinApiVersion = "1.3" - kotlinLanguageVersion = "1.3" + kotlinApiVersion = "1.3" + kotlinLanguageVersion = "1.3" } repositories { - gradlePluginPortal() // Gradle plugin portal as repository for regular dependencies, as we depend on Gradle plugins. + gradlePluginPortal() // Gradle plugin portal as repository for regular dependencies, as we depend on Gradle plugins. } dependencies { - api(platform(project(":spoofax.depconstraints"))) - kapt(platform(project(":spoofax.depconstraints"))) + api(platform(project(":spoofax.depconstraints"))) + kapt(platform(project(":spoofax.depconstraints"))) - api(project(":spoofax.compiler")) - api("com.google.dagger:dagger") + api(project(":spoofax.compiler")) + api("com.google.dagger:dagger") - implementation("org.metaborg:pie.runtime") - implementation("org.metaborg:log.backend.slf4j") + implementation("org.metaborg:pie.runtime") + implementation("org.metaborg:log.backend.slf4j") - kapt("com.google.dagger:dagger-compiler") - compileOnly("org.immutables:value-annotations") // Dagger accesses these annotations, which have class retention. + kapt("com.google.dagger:dagger-compiler") + compileOnly("org.immutables:value-annotations") // Dagger accesses these annotations, which have class retention. - // Dependencies to be able to configure the extensions provided by these Gradle plugins. - compileOnly("org.metaborg:coronium:0.3.17") - compileOnly("biz.aQute.bnd:biz.aQute.bnd.gradle:5.3.0") - compileOnly("org.jetbrains.intellij:org.jetbrains.intellij.gradle.plugin:1.0") // Keep at 1.0 for JVM 8 compatibility. + // Dependencies to be able to configure the extensions provided by these Gradle plugins. + compileOnly("org.metaborg:coronium:0.3.17") + compileOnly("biz.aQute.bnd:biz.aQute.bnd.gradle:5.3.0") + compileOnly("org.jetbrains.intellij:org.jetbrains.intellij.gradle.plugin:1.0") // Keep at 1.0 for JVM 8 compatibility. } gradlePlugin { - plugins { - create("spoofax-compiler-language") { - id = "org.metaborg.spoofax.compiler.gradle.language" - implementationClass = "mb.spoofax.compiler.gradle.plugin.LanguagePlugin" + plugins { + create("spoofax-compiler-language") { + id = "org.metaborg.spoofax.compiler.gradle.language" + implementationClass = "mb.spoofax.compiler.gradle.plugin.LanguagePlugin" + } + create("spoofax-compiler-adapter") { + id = "org.metaborg.spoofax.compiler.gradle.adapter" + implementationClass = "mb.spoofax.compiler.gradle.plugin.AdapterPlugin" + } + create("spoofax-compiler-cli") { + id = "org.metaborg.spoofax.compiler.gradle.cli" + implementationClass = "mb.spoofax.compiler.gradle.plugin.CliPlugin" + } + create("spoofax-compiler-eclipse") { + id = "org.metaborg.spoofax.compiler.gradle.eclipse" + implementationClass = "mb.spoofax.compiler.gradle.plugin.EclipsePlugin" + } + create("spoofax-compiler-intellij") { + id = "org.metaborg.spoofax.compiler.gradle.intellij" + implementationClass = "mb.spoofax.compiler.gradle.plugin.IntellijPlugin" + } } - create("spoofax-compiler-adapter") { - id = "org.metaborg.spoofax.compiler.gradle.adapter" - implementationClass = "mb.spoofax.compiler.gradle.plugin.AdapterPlugin" - } - create("spoofax-compiler-cli") { - id = "org.metaborg.spoofax.compiler.gradle.cli" - implementationClass = "mb.spoofax.compiler.gradle.plugin.CliPlugin" - } - create("spoofax-compiler-eclipse") { - id = "org.metaborg.spoofax.compiler.gradle.eclipse" - implementationClass = "mb.spoofax.compiler.gradle.plugin.EclipsePlugin" - } - create("spoofax-compiler-intellij") { - id = "org.metaborg.spoofax.compiler.gradle.intellij" - implementationClass = "mb.spoofax.compiler.gradle.plugin.IntellijPlugin" - } - } } diff --git a/core/spoofax.compiler.interfaces/build.gradle.kts b/core/spoofax.compiler.interfaces/build.gradle.kts index e6e4a9ef0..2c1b43049 100644 --- a/core/spoofax.compiler.interfaces/build.gradle.kts +++ b/core/spoofax.compiler.interfaces/build.gradle.kts @@ -1,15 +1,15 @@ plugins { - id("org.metaborg.gradle.config.java-library") + id("org.metaborg.gradle.config.java-library") } dependencies { - api(platform(project(":spoofax.depconstraints"))) + api(platform(project(":spoofax.depconstraints"))) - api("org.metaborg:common") - api(project(":jsglr1.common")) - api(project(":stratego.common")) - api(project(":constraint.common")) - api(project(":tego.runtime")) + api("org.metaborg:common") + api(project(":jsglr1.common")) + api(project(":stratego.common")) + api(project(":constraint.common")) + api(project(":tego.runtime")) - compileOnly("org.checkerframework:checker-qual-android") + compileOnly("org.checkerframework:checker-qual-android") } diff --git a/core/spoofax.compiler.spoofax2.dagger/build.gradle.kts b/core/spoofax.compiler.spoofax2.dagger/build.gradle.kts index b387beb45..aa8cc1244 100644 --- a/core/spoofax.compiler.spoofax2.dagger/build.gradle.kts +++ b/core/spoofax.compiler.spoofax2.dagger/build.gradle.kts @@ -2,17 +2,17 @@ // main project, as there are staging conflicts with the other (org.immutables/derive4j) annotation processors. plugins { - id("org.metaborg.gradle.config.java-library") + id("org.metaborg.gradle.config.java-library") } dependencies { - api(platform(project(":spoofax.depconstraints"))) - annotationProcessor(platform(project(":spoofax.depconstraints"))) + api(platform(project(":spoofax.depconstraints"))) + annotationProcessor(platform(project(":spoofax.depconstraints"))) - api(project(":spoofax.compiler.spoofax2")) - api("com.google.dagger:dagger") + api(project(":spoofax.compiler.spoofax2")) + api("com.google.dagger:dagger") - compileOnly("org.immutables:value-annotations") // Dagger accesses these annotations, which have class retention. + compileOnly("org.immutables:value-annotations") // Dagger accesses these annotations, which have class retention. - annotationProcessor("com.google.dagger:dagger-compiler") + annotationProcessor("com.google.dagger:dagger-compiler") } diff --git a/core/spoofax.compiler.spoofax2/build.gradle.kts b/core/spoofax.compiler.spoofax2/build.gradle.kts index feb94c0ee..c6a702d17 100644 --- a/core/spoofax.compiler.spoofax2/build.gradle.kts +++ b/core/spoofax.compiler.spoofax2/build.gradle.kts @@ -1,19 +1,19 @@ plugins { - id("org.metaborg.gradle.config.java-library") + id("org.metaborg.gradle.config.java-library") } dependencies { - api(platform(project(":spoofax.depconstraints"))) - annotationProcessor(platform(project(":spoofax.depconstraints"))) + api(platform(project(":spoofax.depconstraints"))) + annotationProcessor(platform(project(":spoofax.depconstraints"))) - api("org.metaborg:common") - api(project(":spoofax.core")) - api(project(":spoofax.compiler")) - api("org.metaborg:resource") - api("org.metaborg:pie.api") + api("org.metaborg:common") + api(project(":spoofax.core")) + api(project(":spoofax.compiler")) + api("org.metaborg:resource") + api("org.metaborg:pie.api") - compileOnly("org.checkerframework:checker-qual-android") - compileOnly("org.immutables:value-annotations") + compileOnly("org.checkerframework:checker-qual-android") + compileOnly("org.immutables:value-annotations") - annotationProcessor("org.immutables:value") + annotationProcessor("org.immutables:value") } diff --git a/core/spoofax.compiler/build.gradle.kts b/core/spoofax.compiler/build.gradle.kts index 66688d5ed..3ad9b204c 100644 --- a/core/spoofax.compiler/build.gradle.kts +++ b/core/spoofax.compiler/build.gradle.kts @@ -2,79 +2,79 @@ import org.gradle.api.tasks.testing.logging.TestLogEvent import java.util.* plugins { - id("org.metaborg.gradle.config.java-library") - id("org.metaborg.gradle.config.junit-testing") + id("org.metaborg.gradle.config.java-library") + id("org.metaborg.gradle.config.junit-testing") } repositories { - maven { url = uri("https://repo.gradle.org/gradle/libs-releases") } // Required for Gradle tooling API. + maven { url = uri("https://repo.gradle.org/gradle/libs-releases") } // Required for Gradle tooling API. } dependencies { - api(platform(project(":spoofax.depconstraints"))) - annotationProcessor(platform(project(":spoofax.depconstraints"))) - testAnnotationProcessor(platform(project(":spoofax.depconstraints"))) + api(platform(project(":spoofax.depconstraints"))) + annotationProcessor(platform(project(":spoofax.depconstraints"))) + testAnnotationProcessor(platform(project(":spoofax.depconstraints"))) - api("org.metaborg:common") - api(project(":spoofax.common")) - api(project(":spoofax.core")) - api("org.metaborg:resource") - api("org.metaborg:pie.api") - api("com.samskivert:jmustache:1.15") - api("com.google.dagger:dagger") + api("org.metaborg:common") + api(project(":spoofax.common")) + api(project(":spoofax.core")) + api("org.metaborg:resource") + api("org.metaborg:pie.api") + api("com.samskivert:jmustache:1.15") + api("com.google.dagger:dagger") - compileOnly("org.checkerframework:checker-qual-android") - compileOnly("org.immutables:value-annotations") - compileOnly("org.derive4j:derive4j-annotation") + compileOnly("org.checkerframework:checker-qual-android") + compileOnly("org.immutables:value-annotations") + compileOnly("org.derive4j:derive4j-annotation") - annotationProcessor("org.immutables:value") - annotationProcessor("org.derive4j:derive4j") - annotationProcessor("com.google.dagger:dagger-compiler") + annotationProcessor("org.immutables:value") + annotationProcessor("org.derive4j:derive4j") + annotationProcessor("com.google.dagger:dagger-compiler") - testImplementation(project(":spoofax.compiler")) - testImplementation("com.google.dagger:dagger") - testImplementation("org.metaborg:pie.runtime") - testImplementation("org.junit.jupiter:junit-jupiter-params:${metaborg.junitVersion}") - testImplementation("com.google.jimfs:jimfs:1.1") - testImplementation("org.eclipse.jdt:org.eclipse.jdt.core:3.33.0") - testImplementation("org.gradle:gradle-tooling-api:5.6.4") - testRuntimeOnly("org.slf4j:slf4j-simple:1.7.10") // SLF4J implementation required for Gradle tooling API. - testCompileOnly("org.checkerframework:checker-qual-android") - testCompileOnly("org.immutables:value-annotations") // Dagger accesses these annotations, which have class retention. - testAnnotationProcessor("com.google.dagger:dagger-compiler") + testImplementation(project(":spoofax.compiler")) + testImplementation("com.google.dagger:dagger") + testImplementation("org.metaborg:pie.runtime") + testImplementation("org.junit.jupiter:junit-jupiter-params:${metaborg.junitVersion}") + testImplementation("com.google.jimfs:jimfs:1.1") + testImplementation("org.eclipse.jdt:org.eclipse.jdt.core:3.33.0") + testImplementation("org.gradle:gradle-tooling-api:5.6.4") + testRuntimeOnly("org.slf4j:slf4j-simple:1.7.10") // SLF4J implementation required for Gradle tooling API. + testCompileOnly("org.checkerframework:checker-qual-android") + testCompileOnly("org.immutables:value-annotations") // Dagger accesses these annotations, which have class retention. + testAnnotationProcessor("com.google.dagger:dagger-compiler") } tasks.test { - // Show standard out and err in tests, to ensure that failed Gradle builds are properly reported. - testLogging { - events(TestLogEvent.STANDARD_OUT, TestLogEvent.STANDARD_ERROR) - showStandardStreams = true - } + // Show standard out and err in tests, to ensure that failed Gradle builds are properly reported. + testLogging { + events(TestLogEvent.STANDARD_OUT, TestLogEvent.STANDARD_ERROR) + showStandardStreams = true + } } // Add generated resources directory as a resource source directory. val generatedResourcesDir = project.buildDir.resolve("generated/resources") sourceSets { - main { - resources { - srcDir(generatedResourcesDir) + main { + resources { + srcDir(generatedResourcesDir) + } } - } } // Task that writes (dependency) versions to a versions.properties file, which is used in the Shared class. val versionsPropertiesFile = generatedResourcesDir.resolve("version.properties") val generateVersionPropertiesTask = tasks.register("generateVersionProperties") { - inputs.property("version", project.version.toString()) - outputs.file(versionsPropertiesFile) - doLast { - val properties = NonShittyProperties() - properties.setProperty("spoofax3", project.version.toString()) - versionsPropertiesFile.parentFile.run { if(!exists()) mkdirs() } - versionsPropertiesFile.bufferedWriter().use { - properties.storeWithoutDate(it) + inputs.property("version", project.version.toString()) + outputs.file(versionsPropertiesFile) + doLast { + val properties = NonShittyProperties() + properties.setProperty("spoofax3", project.version.toString()) + versionsPropertiesFile.parentFile.run { if (!exists()) mkdirs() } + versionsPropertiesFile.bufferedWriter().use { + properties.storeWithoutDate(it) + } } - } } tasks.compileJava.configure { dependsOn(generateVersionPropertiesTask) } tasks.compileTestJava.configure { dependsOn(generateVersionPropertiesTask) } @@ -82,14 +82,14 @@ tasks.processResources.configure { dependsOn(generateVersionPropertiesTask) } // Custom properties class that does not write the current date, fixing incrementality. class NonShittyProperties : Properties() { - fun storeWithoutDate(writer: java.io.BufferedWriter) { - val e: Enumeration<*> = keys() - while(e.hasMoreElements()) { - val key = e.nextElement() - val value = get(key) - writer.write("$key=$value") - writer.newLine() + fun storeWithoutDate(writer: java.io.BufferedWriter) { + val e: Enumeration<*> = keys() + while (e.hasMoreElements()) { + val key = e.nextElement() + val value = get(key) + writer.write("$key=$value") + writer.newLine() + } + writer.flush() } - writer.flush() - } } diff --git a/core/spoofax.core/build.gradle.kts b/core/spoofax.core/build.gradle.kts index 384cff124..358a7c5a7 100644 --- a/core/spoofax.core/build.gradle.kts +++ b/core/spoofax.core/build.gradle.kts @@ -1,28 +1,28 @@ plugins { - id("org.metaborg.gradle.config.java-library") + id("org.metaborg.gradle.config.java-library") } dependencies { - api(platform(project(":spoofax.depconstraints"))) - annotationProcessor(platform(project(":spoofax.depconstraints"))) + api(platform(project(":spoofax.depconstraints"))) + annotationProcessor(platform(project(":spoofax.depconstraints"))) - api(project(":spoofax.common")) - api("org.metaborg:common") - api("org.metaborg:log.api") - api("org.metaborg:log.dagger") - api("org.metaborg:resource") - api("org.metaborg:resource.dagger") - api("org.metaborg:spoofax.resource") - api("org.metaborg:pie.api") - api("org.metaborg:pie.graph") - api("org.metaborg:pie.dagger") - api("com.google.dagger:dagger") + api(project(":spoofax.common")) + api("org.metaborg:common") + api("org.metaborg:log.api") + api("org.metaborg:log.dagger") + api("org.metaborg:resource") + api("org.metaborg:resource.dagger") + api("org.metaborg:spoofax.resource") + api("org.metaborg:pie.api") + api("org.metaborg:pie.graph") + api("org.metaborg:pie.dagger") + api("com.google.dagger:dagger") - compileOnly("org.immutables:value-annotations") - compileOnly("org.derive4j:derive4j-annotation") - compileOnly("org.checkerframework:checker-qual-android") + compileOnly("org.immutables:value-annotations") + compileOnly("org.derive4j:derive4j-annotation") + compileOnly("org.checkerframework:checker-qual-android") - annotationProcessor("com.google.dagger:dagger-compiler") - annotationProcessor("org.immutables:value") - annotationProcessor("org.derive4j:derive4j") + annotationProcessor("com.google.dagger:dagger-compiler") + annotationProcessor("org.immutables:value") + annotationProcessor("org.derive4j:derive4j") } diff --git a/core/spoofax.depconstraints/build.gradle.kts b/core/spoofax.depconstraints/build.gradle.kts index 76a82f95b..a1980af17 100644 --- a/core/spoofax.depconstraints/build.gradle.kts +++ b/core/spoofax.depconstraints/build.gradle.kts @@ -1,6 +1,6 @@ plugins { - `java-platform` - `maven-publish` + `java-platform` + `maven-publish` } val commonVersion = "0.11.0" @@ -24,120 +24,120 @@ val immutablesVersion = "2.8.2" val yamlVersion = "1.26" dependencies { - constraints { - // Own projects - api(project(":spoofax.common")) - api(project(":aterm.common")) - api(project(":jsglr.common")) - api(project(":jsglr1.common")) - api(project(":jsglr.pie")) - api(project(":jsglr2.common")) - api(project(":esv.common")) - api(project(":stratego.common")) - api(project(":constraint.common")) - api(project(":nabl2.common")) - api(project(":statix.codecompletion")) - api(project(":statix.codecompletion.pie")) - api(project(":statix.common")) - api(project(":statix.pie")) - api(project(":statix.multilang")) - api(project(":spoofax2.common")) - api(project(":tego.runtime")) - api(project(":tooling.eclipsebundle")) // TODO: bundle versions are not picked up when consuming this platform? - - api(project(":spoofax.compiler.interfaces")) - api(project(":spoofax.resource")) - api(project(":spoofax.core")) - api(project(":spoofax.cli")) - api(project(":spoofax.intellij")) - api(project(":spoofax.eclipse")) // TODO: bundle versions are not picked up when consuming this platform? - api(project(":spoofax.compiler")) - api(project(":spoofax.compiler.gradle")) - api(project(":spoofax.compiler.eclipsebundle")) // TODO: bundle versions are not picked up when consuming this platform? - - - // Main dependencies - /// Common - api("org.metaborg:common:$commonVersion") - /// Log - api("org.metaborg:log.api:$logVersion") - api("org.metaborg:log.backend.logback:$logVersion") - api("org.metaborg:log.backend.slf4j:$logVersion") - api("org.metaborg:log.dagger:$logVersion") - /// SLF4j - api("org.slf4j:slf4j-simple:$slf4jVersion") - /// Resource - api("org.metaborg:resource:$resourceVersion") - api("org.metaborg:resource.dagger:$resourceVersion") - /// PIE - api("org.metaborg:pie.api:$pieVersion") - api("org.metaborg:pie.graph:$pieVersion") - api("org.metaborg:pie.runtime:$pieVersion") - api("org.metaborg:pie.dagger:$pieVersion") - api("org.metaborg:pie.task.java:$pieVersion") - api("org.metaborg:pie.task.archive:$pieVersion") - api("org.metaborg:pie.serde.fst:$pieVersion") - /// Spoofax 2.x - runtime("org.metaborg:strategoxt-min-jar:$spoofax2Version") - /// Spoofax 2.x with devenv override - api("org.metaborg.devenv:org.strategoxt.strj:$spoofax2DevenvVersion") - api("org.metaborg.devenv:org.spoofax.terms:$spoofax2DevenvVersion") - api("org.metaborg.devenv:org.metaborg.util:$spoofax2DevenvVersion") - api("org.metaborg.devenv:org.spoofax.interpreter.core:$spoofax2DevenvVersion") - api("org.metaborg.devenv:org.spoofax.jsglr:$spoofax2DevenvVersion") - api("org.metaborg.devenv:org.spoofax.jsglr2:$spoofax2DevenvVersion") - api("org.metaborg.devenv:jsglr.shared:$spoofax2DevenvVersion") - api("org.metaborg.devenv:sdf2table:$spoofax2DevenvVersion") - api("org.metaborg.devenv:sdf2parenthesize:$spoofax2DevenvVersion") - api("org.metaborg.devenv:org.metaborg.parsetable:$spoofax2DevenvVersion") - api("org.metaborg.devenv:stratego.build:$spoofax2DevenvVersion") - api("org.metaborg.devenv:nabl2.terms:$spoofax2DevenvVersion") - api("org.metaborg.devenv:nabl2.solver:$spoofax2DevenvVersion") - api("org.metaborg.devenv:statix.solver:$spoofax2DevenvVersion") - api("org.metaborg.devenv:statix.generator:$spoofax2DevenvVersion") - - /// Picocli - api("info.picocli:picocli:$picocliVersion") - api("info.picocli:picocli-codegen:$picocliVersion") - - // Annotation-only dependencies - /// javax.inject - api("javax.inject:javax.inject:$javaxInjectVersion") - /// Checkerframework - api("org.checkerframework:checker-qual-android:$checkerframeworkVersion") // Use android version: annotation retention policy is class instead of runtime. - /// FindBugs JSR305 - api("com.google.code.findbugs:jsr305:3.0.2") - - // Annotation processor dependencies - /// Dagger - api("com.google.dagger:dagger:$daggerVersion") - api("com.google.dagger:dagger-compiler:$daggerVersion") - /// Derive4j - api("org.derive4j:derive4j:$derive4jVersion") - api("org.derive4j:derive4j-annotation:$derive4jVersion") - /// org.immutables - api("org.immutables:serial:$immutablesVersion") - api("org.immutables:value:$immutablesVersion") - api("org.immutables:value-annotations:$immutablesVersion") - // Yaml - api("org.yaml:snakeyaml:$yamlVersion") - - // Gradle plugins - api("org.metaborg.devenv:spoofax.gradle:$spoofax2DevenvVersion") - - - // Test dependencies // TODO: should be in a separate platform? - api("org.junit.jupiter:junit-jupiter-api:${metaborg.junitVersion}") - api("com.nhaarman.mockitokotlin2:mockito-kotlin:2.2.0") - api("com.google.jimfs:jimfs:1.1") - api("nl.jqno.equalsverifier:equalsverifier:3.1.12") - } + constraints { + // Own projects + api(project(":spoofax.common")) + api(project(":aterm.common")) + api(project(":jsglr.common")) + api(project(":jsglr1.common")) + api(project(":jsglr.pie")) + api(project(":jsglr2.common")) + api(project(":esv.common")) + api(project(":stratego.common")) + api(project(":constraint.common")) + api(project(":nabl2.common")) + api(project(":statix.codecompletion")) + api(project(":statix.codecompletion.pie")) + api(project(":statix.common")) + api(project(":statix.pie")) + api(project(":statix.multilang")) + api(project(":spoofax2.common")) + api(project(":tego.runtime")) + api(project(":tooling.eclipsebundle")) // TODO: bundle versions are not picked up when consuming this platform? + + api(project(":spoofax.compiler.interfaces")) + api(project(":spoofax.resource")) + api(project(":spoofax.core")) + api(project(":spoofax.cli")) + api(project(":spoofax.intellij")) + api(project(":spoofax.eclipse")) // TODO: bundle versions are not picked up when consuming this platform? + api(project(":spoofax.compiler")) + api(project(":spoofax.compiler.gradle")) + api(project(":spoofax.compiler.eclipsebundle")) // TODO: bundle versions are not picked up when consuming this platform? + + + // Main dependencies + /// Common + api("org.metaborg:common:$commonVersion") + /// Log + api("org.metaborg:log.api:$logVersion") + api("org.metaborg:log.backend.logback:$logVersion") + api("org.metaborg:log.backend.slf4j:$logVersion") + api("org.metaborg:log.dagger:$logVersion") + /// SLF4j + api("org.slf4j:slf4j-simple:$slf4jVersion") + /// Resource + api("org.metaborg:resource:$resourceVersion") + api("org.metaborg:resource.dagger:$resourceVersion") + /// PIE + api("org.metaborg:pie.api:$pieVersion") + api("org.metaborg:pie.graph:$pieVersion") + api("org.metaborg:pie.runtime:$pieVersion") + api("org.metaborg:pie.dagger:$pieVersion") + api("org.metaborg:pie.task.java:$pieVersion") + api("org.metaborg:pie.task.archive:$pieVersion") + api("org.metaborg:pie.serde.fst:$pieVersion") + /// Spoofax 2.x + runtime("org.metaborg:strategoxt-min-jar:$spoofax2Version") + /// Spoofax 2.x with devenv override + api("org.metaborg.devenv:org.strategoxt.strj:$spoofax2DevenvVersion") + api("org.metaborg.devenv:org.spoofax.terms:$spoofax2DevenvVersion") + api("org.metaborg.devenv:org.metaborg.util:$spoofax2DevenvVersion") + api("org.metaborg.devenv:org.spoofax.interpreter.core:$spoofax2DevenvVersion") + api("org.metaborg.devenv:org.spoofax.jsglr:$spoofax2DevenvVersion") + api("org.metaborg.devenv:org.spoofax.jsglr2:$spoofax2DevenvVersion") + api("org.metaborg.devenv:jsglr.shared:$spoofax2DevenvVersion") + api("org.metaborg.devenv:sdf2table:$spoofax2DevenvVersion") + api("org.metaborg.devenv:sdf2parenthesize:$spoofax2DevenvVersion") + api("org.metaborg.devenv:org.metaborg.parsetable:$spoofax2DevenvVersion") + api("org.metaborg.devenv:stratego.build:$spoofax2DevenvVersion") + api("org.metaborg.devenv:nabl2.terms:$spoofax2DevenvVersion") + api("org.metaborg.devenv:nabl2.solver:$spoofax2DevenvVersion") + api("org.metaborg.devenv:statix.solver:$spoofax2DevenvVersion") + api("org.metaborg.devenv:statix.generator:$spoofax2DevenvVersion") + + /// Picocli + api("info.picocli:picocli:$picocliVersion") + api("info.picocli:picocli-codegen:$picocliVersion") + + // Annotation-only dependencies + /// javax.inject + api("javax.inject:javax.inject:$javaxInjectVersion") + /// Checkerframework + api("org.checkerframework:checker-qual-android:$checkerframeworkVersion") // Use android version: annotation retention policy is class instead of runtime. + /// FindBugs JSR305 + api("com.google.code.findbugs:jsr305:3.0.2") + + // Annotation processor dependencies + /// Dagger + api("com.google.dagger:dagger:$daggerVersion") + api("com.google.dagger:dagger-compiler:$daggerVersion") + /// Derive4j + api("org.derive4j:derive4j:$derive4jVersion") + api("org.derive4j:derive4j-annotation:$derive4jVersion") + /// org.immutables + api("org.immutables:serial:$immutablesVersion") + api("org.immutables:value:$immutablesVersion") + api("org.immutables:value-annotations:$immutablesVersion") + // Yaml + api("org.yaml:snakeyaml:$yamlVersion") + + // Gradle plugins + api("org.metaborg.devenv:spoofax.gradle:$spoofax2DevenvVersion") + + + // Test dependencies // TODO: should be in a separate platform? + api("org.junit.jupiter:junit-jupiter-api:${metaborg.junitVersion}") + api("com.nhaarman.mockitokotlin2:mockito-kotlin:2.2.0") + api("com.google.jimfs:jimfs:1.1") + api("nl.jqno.equalsverifier:equalsverifier:3.1.12") + } } publishing { - publications { - create("JavaPlatform") { - from(components["javaPlatform"]) + publications { + create("JavaPlatform") { + from(components["javaPlatform"]) + } } - } } diff --git a/core/spoofax.eclipse/build.gradle.kts b/core/spoofax.eclipse/build.gradle.kts index 052dd76d0..04566db55 100644 --- a/core/spoofax.eclipse/build.gradle.kts +++ b/core/spoofax.eclipse/build.gradle.kts @@ -1,61 +1,61 @@ plugins { - id("org.metaborg.gradle.config.java-library") - id("org.metaborg.coronium.bundle") + id("org.metaborg.gradle.config.java-library") + id("org.metaborg.coronium.bundle") } mavenize { - majorVersion.set("2022-06") + majorVersion.set("2022-06") } dependencies { - api(platform(project(":spoofax.depconstraints"))) - annotationProcessor(platform(project(":spoofax.depconstraints"))) + api(platform(project(":spoofax.depconstraints"))) + annotationProcessor(platform(project(":spoofax.depconstraints"))) - bundleTargetPlatformApi(eclipse("javax.inject")) - bundleTargetPlatformApi(eclipse("org.eclipse.core.runtime")) - bundleTargetPlatformApi(eclipse("org.eclipse.core.expressions")) - bundleTargetPlatformApi(eclipse("org.eclipse.core.resources")) - bundleTargetPlatformApi(eclipse("org.eclipse.core.filesystem")) - bundleTargetPlatformApi(eclipse("org.eclipse.ui")) - bundleTargetPlatformApi(eclipse("org.eclipse.ui.views")) - bundleTargetPlatformApi(eclipse("org.eclipse.ui.editors")) - bundleTargetPlatformApi(eclipse("org.eclipse.ui.console")) - bundleTargetPlatformApi(eclipse("org.eclipse.ui.workbench")) - bundleTargetPlatformApi(eclipse("org.eclipse.ui.workbench.texteditor")) - bundleTargetPlatformApi(eclipse("org.eclipse.ui.ide")) - bundleTargetPlatformApi(eclipse("org.eclipse.ui.forms")) - bundleTargetPlatformApi(eclipse("org.eclipse.jface.text")) - bundleTargetPlatformApi(eclipse("org.eclipse.swt")) - bundleTargetPlatformApi(eclipse("com.ibm.icu")) - bundleTargetPlatformImplementation(eclipse("org.eclipse.ui.views.log")) + bundleTargetPlatformApi(eclipse("javax.inject")) + bundleTargetPlatformApi(eclipse("org.eclipse.core.runtime")) + bundleTargetPlatformApi(eclipse("org.eclipse.core.expressions")) + bundleTargetPlatformApi(eclipse("org.eclipse.core.resources")) + bundleTargetPlatformApi(eclipse("org.eclipse.core.filesystem")) + bundleTargetPlatformApi(eclipse("org.eclipse.ui")) + bundleTargetPlatformApi(eclipse("org.eclipse.ui.views")) + bundleTargetPlatformApi(eclipse("org.eclipse.ui.editors")) + bundleTargetPlatformApi(eclipse("org.eclipse.ui.console")) + bundleTargetPlatformApi(eclipse("org.eclipse.ui.workbench")) + bundleTargetPlatformApi(eclipse("org.eclipse.ui.workbench.texteditor")) + bundleTargetPlatformApi(eclipse("org.eclipse.ui.ide")) + bundleTargetPlatformApi(eclipse("org.eclipse.ui.forms")) + bundleTargetPlatformApi(eclipse("org.eclipse.jface.text")) + bundleTargetPlatformApi(eclipse("org.eclipse.swt")) + bundleTargetPlatformApi(eclipse("com.ibm.icu")) + bundleTargetPlatformImplementation(eclipse("org.eclipse.ui.views.log")) - bundleEmbedApi("org.metaborg:common") - bundleEmbedApi(project(":spoofax.core")) - bundleEmbedApi(project(":spoofax.resource")) - bundleEmbedApi("org.metaborg:log.api") - bundleEmbedApi("org.metaborg:resource") - bundleEmbedApi("org.metaborg:pie.api") - bundleEmbedApi("org.metaborg:pie.runtime") - bundleEmbedApi("com.google.dagger:dagger") + bundleEmbedApi("org.metaborg:common") + bundleEmbedApi(project(":spoofax.core")) + bundleEmbedApi(project(":spoofax.resource")) + bundleEmbedApi("org.metaborg:log.api") + bundleEmbedApi("org.metaborg:resource") + bundleEmbedApi("org.metaborg:pie.api") + bundleEmbedApi("org.metaborg:pie.runtime") + bundleEmbedApi("com.google.dagger:dagger") - compileOnly("org.checkerframework:checker-qual-android") - annotationProcessor("com.google.dagger:dagger-compiler") + compileOnly("org.checkerframework:checker-qual-android") + annotationProcessor("com.google.dagger:dagger-compiler") } // Use bnd to create a single OSGi bundle JAR that includes all dependencies. val provider = "spoofax.eclipse" val exportPackage = listOf( - "mb.spoofax.eclipse.*", - "mb.*;provider=$provider;mandatory:=provider", - "dagger;provider=$provider;mandatory:=provider", - "dagger.*;provider=$provider;mandatory:=provider" + "mb.spoofax.eclipse.*", + "mb.*;provider=$provider;mandatory:=provider", + "dagger;provider=$provider;mandatory:=provider", + "dagger.*;provider=$provider;mandatory:=provider" ) tasks { - "jar"(Jar::class) { - manifest { - attributes( - Pair("Export-Package", exportPackage.joinToString(", ")) - ) + "jar"(Jar::class) { + manifest { + attributes( + Pair("Export-Package", exportPackage.joinToString(", ")) + ) + } } - } } diff --git a/core/spoofax.intellij/build.gradle.kts b/core/spoofax.intellij/build.gradle.kts index a173bd1fd..391c75ce1 100644 --- a/core/spoofax.intellij/build.gradle.kts +++ b/core/spoofax.intellij/build.gradle.kts @@ -1,26 +1,26 @@ plugins { - id("org.metaborg.gradle.config.java-library") - id("org.jetbrains.intellij") + id("org.metaborg.gradle.config.java-library") + id("org.jetbrains.intellij") } dependencies { - implementation(platform(project(":spoofax.depconstraints"))) - annotationProcessor(platform(project(":spoofax.depconstraints"))) + implementation(platform(project(":spoofax.depconstraints"))) + annotationProcessor(platform(project(":spoofax.depconstraints"))) - api(project(":spoofax.core")) + api(project(":spoofax.core")) - api("org.metaborg:log.api") - implementation("org.metaborg:pie.runtime") - implementation("com.google.dagger:dagger") + api("org.metaborg:log.api") + implementation("org.metaborg:pie.runtime") + implementation("com.google.dagger:dagger") - compileOnly("org.checkerframework:checker-qual-android") + compileOnly("org.checkerframework:checker-qual-android") - annotationProcessor("com.google.dagger:dagger-compiler") + annotationProcessor("com.google.dagger:dagger-compiler") } intellij { - version.set("2019.3.2") - instrumentCode.set(false) + version.set("2019.3.2") + instrumentCode.set(false) } // Skip non-incremental, slow, and unnecessary buildSearchableOptions task from IntelliJ. diff --git a/core/spoofax.resource/build.gradle.kts b/core/spoofax.resource/build.gradle.kts index ac7c5fa93..c18ad42cc 100644 --- a/core/spoofax.resource/build.gradle.kts +++ b/core/spoofax.resource/build.gradle.kts @@ -1,12 +1,12 @@ plugins { - id("org.metaborg.gradle.config.java-library") + id("org.metaborg.gradle.config.java-library") } dependencies { - api(platform(project(":spoofax.depconstraints"))) + api(platform(project(":spoofax.depconstraints"))) - api("org.metaborg:common") - api("org.metaborg:resource") + api("org.metaborg:common") + api("org.metaborg:resource") - compileOnly("org.checkerframework:checker-qual-android") + compileOnly("org.checkerframework:checker-qual-android") } diff --git a/core/spoofax.test/build.gradle.kts b/core/spoofax.test/build.gradle.kts index 7b5ba52c9..3f36b70a5 100644 --- a/core/spoofax.test/build.gradle.kts +++ b/core/spoofax.test/build.gradle.kts @@ -1,18 +1,18 @@ plugins { - id("org.metaborg.gradle.config.java-library") + id("org.metaborg.gradle.config.java-library") } dependencies { - api(platform(project(":spoofax.depconstraints"))) + api(platform(project(":spoofax.depconstraints"))) - api(project(":spoofax.core")) - api(project(":spoofax.compiler.interfaces")) - api("org.metaborg:log.backend.slf4j") - api("org.slf4j:slf4j-simple:1.7.30") - api("com.google.jimfs:jimfs:1.1") - api("org.metaborg:pie.runtime") + api(project(":spoofax.core")) + api(project(":spoofax.compiler.interfaces")) + api("org.metaborg:log.backend.slf4j") + api("org.slf4j:slf4j-simple:1.7.30") + api("com.google.jimfs:jimfs:1.1") + api("org.metaborg:pie.runtime") - api("org.junit.jupiter:junit-jupiter-api") + api("org.junit.jupiter:junit-jupiter-api") - compileOnly("org.checkerframework:checker-qual-android") + compileOnly("org.checkerframework:checker-qual-android") } diff --git a/core/spoofax2.common/build.gradle.kts b/core/spoofax2.common/build.gradle.kts index b369a2386..15b48f0d2 100644 --- a/core/spoofax2.common/build.gradle.kts +++ b/core/spoofax2.common/build.gradle.kts @@ -1,18 +1,18 @@ plugins { - id("org.metaborg.gradle.config.java-library") + id("org.metaborg.gradle.config.java-library") } dependencies { - api(platform(project(":spoofax.depconstraints"))) + api(platform(project(":spoofax.depconstraints"))) - implementation("org.metaborg:common") - implementation(project(":stratego.common")) - implementation("org.metaborg.devenv:org.metaborg.util") + implementation("org.metaborg:common") + implementation(project(":stratego.common")) + implementation("org.metaborg.devenv:org.metaborg.util") - api("org.metaborg:resource") - api("org.metaborg:log.api") + api("org.metaborg:resource") + api("org.metaborg:log.api") - implementation("org.metaborg.devenv:org.spoofax.interpreter.core") + implementation("org.metaborg.devenv:org.spoofax.interpreter.core") - compileOnly("org.checkerframework:checker-qual-android") + compileOnly("org.checkerframework:checker-qual-android") } diff --git a/core/spt.api/build.gradle.kts b/core/spt.api/build.gradle.kts index 58682670a..3526cb966 100644 --- a/core/spt.api/build.gradle.kts +++ b/core/spt.api/build.gradle.kts @@ -1,15 +1,15 @@ plugins { - id("org.metaborg.gradle.config.java-library") + id("org.metaborg.gradle.config.java-library") } dependencies { - api(platform(project(":spoofax.depconstraints"))) - annotationProcessor(platform(project(":spoofax.depconstraints"))) - api("org.metaborg:common") - api(project(":spoofax.core")) - api("org.metaborg:pie.api") - api("org.metaborg.devenv:org.spoofax.terms") - compileOnly("org.derive4j:derive4j-annotation") - compileOnly("org.checkerframework:checker-qual-android") - annotationProcessor("org.derive4j:derive4j") + api(platform(project(":spoofax.depconstraints"))) + annotationProcessor(platform(project(":spoofax.depconstraints"))) + api("org.metaborg:common") + api(project(":spoofax.core")) + api("org.metaborg:pie.api") + api("org.metaborg.devenv:org.spoofax.terms") + compileOnly("org.derive4j:derive4j-annotation") + compileOnly("org.checkerframework:checker-qual-android") + annotationProcessor("org.derive4j:derive4j") } diff --git a/core/statix.codecompletion.pie/build.gradle.kts b/core/statix.codecompletion.pie/build.gradle.kts index 6ced36bc1..356c3a6ef 100644 --- a/core/statix.codecompletion.pie/build.gradle.kts +++ b/core/statix.codecompletion.pie/build.gradle.kts @@ -1,20 +1,20 @@ plugins { - id("org.metaborg.gradle.config.java-library") + id("org.metaborg.gradle.config.java-library") } dependencies { - api(platform(project(":spoofax.depconstraints"))) + api(platform(project(":spoofax.depconstraints"))) - api("org.metaborg:common") - api(project(":aterm.common")) - api(project(":statix.common")) - api(project(":spoofax.core")) - api(project(":constraint.pie")) - api(project(":jsglr.pie")) - api(project(":stratego.pie")) - api("org.metaborg:pie.api") + api("org.metaborg:common") + api(project(":aterm.common")) + api(project(":statix.common")) + api(project(":spoofax.core")) + api(project(":constraint.pie")) + api(project(":jsglr.pie")) + api(project(":stratego.pie")) + api("org.metaborg:pie.api") - api(project(":statix.codecompletion")) + api(project(":statix.codecompletion")) - compileOnly("org.checkerframework:checker-qual-android") + compileOnly("org.checkerframework:checker-qual-android") } diff --git a/core/statix.codecompletion/build.gradle.kts b/core/statix.codecompletion/build.gradle.kts index 963aebf3c..ae7265d76 100644 --- a/core/statix.codecompletion/build.gradle.kts +++ b/core/statix.codecompletion/build.gradle.kts @@ -1,48 +1,48 @@ plugins { - id("org.metaborg.gradle.config.java-library") - id("org.metaborg.gradle.config.junit-testing") - jacoco + id("org.metaborg.gradle.config.java-library") + id("org.metaborg.gradle.config.junit-testing") + jacoco } dependencies { - api(platform(project(":spoofax.depconstraints"))) - annotationProcessor(platform(project(":spoofax.depconstraints"))) - testAnnotationProcessor(platform(project(":spoofax.depconstraints"))) + api(platform(project(":spoofax.depconstraints"))) + annotationProcessor(platform(project(":spoofax.depconstraints"))) + testAnnotationProcessor(platform(project(":spoofax.depconstraints"))) - api("org.metaborg:common") - api("org.metaborg:statix.common") - api("org.metaborg:tego.runtime") - api("org.metaborg:log.api") + api("org.metaborg:common") + api("org.metaborg:statix.common") + api("org.metaborg:tego.runtime") + api("org.metaborg:log.api") - api("org.metaborg.devenv:statix.solver") - api("org.metaborg.devenv:statix.generator") + api("org.metaborg.devenv:statix.solver") + api("org.metaborg.devenv:statix.generator") - implementation(project(":stratego.common")) - implementation(project(":jsglr.common")) + implementation(project(":stratego.common")) + implementation(project(":jsglr.common")) - compileOnly("org.checkerframework:checker-qual-android") + compileOnly("org.checkerframework:checker-qual-android") - annotationProcessor("org.immutables:value") - testAnnotationProcessor("org.immutables:value") + annotationProcessor("org.immutables:value") + testAnnotationProcessor("org.immutables:value") - testCompileOnly("org.checkerframework:checker-qual-android") - testImplementation("nl.jqno.equalsverifier:equalsverifier") - testImplementation("org.metaborg:log.backend.slf4j") - testImplementation("org.slf4j:slf4j-simple:1.7.10") - testCompileOnly("org.immutables:value") + testCompileOnly("org.checkerframework:checker-qual-android") + testImplementation("nl.jqno.equalsverifier:equalsverifier") + testImplementation("org.metaborg:log.backend.slf4j") + testImplementation("org.slf4j:slf4j-simple:1.7.10") + testCompileOnly("org.immutables:value") - testImplementation("com.opencsv:opencsv:4.1") + testImplementation("com.opencsv:opencsv:4.1") - // Immutables - testCompileOnly("org.immutables:value") - testAnnotationProcessor("org.immutables:value") + // Immutables + testCompileOnly("org.immutables:value") + testAnnotationProcessor("org.immutables:value") } tasks.test { - finalizedBy(tasks.jacocoTestReport) + finalizedBy(tasks.jacocoTestReport) } tasks.jacocoTestReport { - dependsOn(tasks.test) + dependsOn(tasks.test) } //tasks { withType { diff --git a/core/statix.common/build.gradle.kts b/core/statix.common/build.gradle.kts index e0b58a52a..71e3acaf2 100644 --- a/core/statix.common/build.gradle.kts +++ b/core/statix.common/build.gradle.kts @@ -1,20 +1,20 @@ plugins { - id("org.metaborg.gradle.config.java-library") + id("org.metaborg.gradle.config.java-library") } dependencies { - api(platform(project(":spoofax.depconstraints"))) - annotationProcessor(platform(project(":spoofax.depconstraints"))) + api(platform(project(":spoofax.depconstraints"))) + annotationProcessor(platform(project(":spoofax.depconstraints"))) - api("org.metaborg:common") + api("org.metaborg:common") - api("org.metaborg.devenv:statix.solver") + api("org.metaborg.devenv:statix.solver") - implementation(project(":stratego.common")) - implementation(project(":jsglr.common")) + implementation(project(":stratego.common")) + implementation(project(":jsglr.common")) - compileOnly("org.checkerframework:checker-qual-android") - compileOnly("org.immutables:value-annotations") + compileOnly("org.checkerframework:checker-qual-android") + compileOnly("org.immutables:value-annotations") - annotationProcessor("org.immutables:value") + annotationProcessor("org.immutables:value") } diff --git a/core/statix.multilang.eclipse/build.gradle.kts b/core/statix.multilang.eclipse/build.gradle.kts index b0abe4199..7d4836a4e 100644 --- a/core/statix.multilang.eclipse/build.gradle.kts +++ b/core/statix.multilang.eclipse/build.gradle.kts @@ -1,53 +1,53 @@ plugins { - id("org.metaborg.gradle.config.java-library") - id("org.metaborg.coronium.bundle") + id("org.metaborg.gradle.config.java-library") + id("org.metaborg.coronium.bundle") } dependencies { - api(platform(project(":spoofax.depconstraints"))) - annotationProcessor(platform(project(":spoofax.depconstraints"))) + api(platform(project(":spoofax.depconstraints"))) + annotationProcessor(platform(project(":spoofax.depconstraints"))) - bundleTargetPlatformApi(eclipse("javax.inject")) - bundleTargetPlatformApi(eclipse("org.eclipse.core.runtime")) - bundleTargetPlatformApi(eclipse("org.eclipse.core.expressions")) - bundleTargetPlatformApi(eclipse("org.eclipse.core.resources")) - bundleTargetPlatformApi(eclipse("org.eclipse.core.filesystem")) + bundleTargetPlatformApi(eclipse("javax.inject")) + bundleTargetPlatformApi(eclipse("org.eclipse.core.runtime")) + bundleTargetPlatformApi(eclipse("org.eclipse.core.expressions")) + bundleTargetPlatformApi(eclipse("org.eclipse.core.resources")) + bundleTargetPlatformApi(eclipse("org.eclipse.core.filesystem")) - bundleApi(project(":spoofax.eclipse")) + bundleApi(project(":spoofax.eclipse")) - bundleEmbedApi(project(":statix.multilang")) + bundleEmbedApi(project(":statix.multilang")) - annotationProcessor("com.google.dagger:dagger-compiler") - compileOnly("org.checkerframework:checker-qual-android") + annotationProcessor("com.google.dagger:dagger-compiler") + compileOnly("org.checkerframework:checker-qual-android") } // Use bnd to create a single OSGi bundle JAR that includes all dependencies. val exports = listOf( - // Provided by 'javax.inject' bundle. - "!javax.inject.*", - // Provided by 'spoofax.eclipse' bundle. - "!mb.log.*", - "!mb.resource.*", - "!mb.pie.*", - "!mb.common.*", - "!mb.spoofax.core.*", - // Do not export compile-time annotation packages. - "!org.checkerframework.*", - "!org.codehaus.mojo.animal_sniffer.*", - // Allow split package for 'mb.nabl2' and 'mb.statix'. - "mb.nabl2.*;-split-package:=merge-first", - "mb.statix.*;-split-package:=merge-first", - // Export packages from this project. - "mb.statix.multilang.eclipse.*", - // Export what is left, using a mandatory provider to prevent accidental imports via 'Import-Package'. - "*;provider=statix;mandatory:=provider" + // Provided by 'javax.inject' bundle. + "!javax.inject.*", + // Provided by 'spoofax.eclipse' bundle. + "!mb.log.*", + "!mb.resource.*", + "!mb.pie.*", + "!mb.common.*", + "!mb.spoofax.core.*", + // Do not export compile-time annotation packages. + "!org.checkerframework.*", + "!org.codehaus.mojo.animal_sniffer.*", + // Allow split package for 'mb.nabl2' and 'mb.statix'. + "mb.nabl2.*;-split-package:=merge-first", + "mb.statix.*;-split-package:=merge-first", + // Export packages from this project. + "mb.statix.multilang.eclipse.*", + // Export what is left, using a mandatory provider to prevent accidental imports via 'Import-Package'. + "*;provider=statix;mandatory:=provider" ) tasks { - "jar"(Jar::class) { - manifest { - attributes( - Pair("Export-Package", exports.joinToString(", ")) - ) + "jar"(Jar::class) { + manifest { + attributes( + Pair("Export-Package", exports.joinToString(", ")) + ) + } } - } } diff --git a/core/statix.multilang/build.gradle.kts b/core/statix.multilang/build.gradle.kts index b2c7a4225..5f7965334 100644 --- a/core/statix.multilang/build.gradle.kts +++ b/core/statix.multilang/build.gradle.kts @@ -1,23 +1,23 @@ plugins { - id("org.metaborg.gradle.config.java-library") + id("org.metaborg.gradle.config.java-library") } dependencies { - api(platform(project(":spoofax.depconstraints"))) - annotationProcessor(platform(project(":spoofax.depconstraints"))) + api(platform(project(":spoofax.depconstraints"))) + annotationProcessor(platform(project(":spoofax.depconstraints"))) - api("org.metaborg:common") - api(project(":jsglr.common")) - api(project(":stratego.common")) - api(project(":spoofax.core")) + api("org.metaborg:common") + api(project(":jsglr.common")) + api(project(":stratego.common")) + api(project(":spoofax.core")) - api("org.metaborg.devenv:statix.solver") - api("org.metaborg:pie.api") - api("org.yaml:snakeyaml") + api("org.metaborg.devenv:statix.solver") + api("org.metaborg:pie.api") + api("org.yaml:snakeyaml") - compileOnly("org.checkerframework:checker-qual-android") - compileOnly("org.immutables:value-annotations") + compileOnly("org.checkerframework:checker-qual-android") + compileOnly("org.immutables:value-annotations") - annotationProcessor("com.google.dagger:dagger-compiler") - annotationProcessor("org.immutables:value") + annotationProcessor("com.google.dagger:dagger-compiler") + annotationProcessor("org.immutables:value") } diff --git a/core/statix.pie/build.gradle.kts b/core/statix.pie/build.gradle.kts index 0332f80d0..05d418c56 100644 --- a/core/statix.pie/build.gradle.kts +++ b/core/statix.pie/build.gradle.kts @@ -1,18 +1,18 @@ plugins { - id("org.metaborg.gradle.config.java-library") + id("org.metaborg.gradle.config.java-library") } dependencies { - api(platform(project(":spoofax.depconstraints"))) + api(platform(project(":spoofax.depconstraints"))) - api("org.metaborg:common") - api(project(":aterm.common")) - api(project(":statix.common")) - api(project(":spoofax.core")) - api(project(":constraint.pie")) - api(project(":jsglr.pie")) - api(project(":stratego.pie")) - api("org.metaborg:pie.api") + api("org.metaborg:common") + api(project(":aterm.common")) + api(project(":statix.common")) + api(project(":spoofax.core")) + api(project(":constraint.pie")) + api(project(":jsglr.pie")) + api(project(":stratego.pie")) + api("org.metaborg:pie.api") - compileOnly("org.checkerframework:checker-qual-android") + compileOnly("org.checkerframework:checker-qual-android") } diff --git a/core/stratego.common/build.gradle.kts b/core/stratego.common/build.gradle.kts index 47517e076..bea9be94e 100644 --- a/core/stratego.common/build.gradle.kts +++ b/core/stratego.common/build.gradle.kts @@ -1,24 +1,24 @@ plugins { - id("org.metaborg.gradle.config.java-library") + id("org.metaborg.gradle.config.java-library") } dependencies { - api(platform(project(":spoofax.depconstraints"))) - annotationProcessor(platform(project(":spoofax.depconstraints"))) + api(platform(project(":spoofax.depconstraints"))) + annotationProcessor(platform(project(":spoofax.depconstraints"))) - api("org.metaborg:common") - api("org.metaborg:log.api") - api("org.metaborg:resource") + api("org.metaborg:common") + api("org.metaborg:log.api") + api("org.metaborg:resource") - implementation(project(":aterm.common")) - implementation(project(":jsglr.common")) + implementation(project(":aterm.common")) + implementation(project(":jsglr.common")) - api("org.metaborg.devenv:org.spoofax.terms") - api("org.metaborg.devenv:org.spoofax.interpreter.core") - api("org.metaborg.devenv:org.strategoxt.strj") + api("org.metaborg.devenv:org.spoofax.terms") + api("org.metaborg.devenv:org.spoofax.interpreter.core") + api("org.metaborg.devenv:org.strategoxt.strj") - compileOnly("org.checkerframework:checker-qual-android") - compileOnly("org.derive4j:derive4j-annotation") + compileOnly("org.checkerframework:checker-qual-android") + compileOnly("org.derive4j:derive4j-annotation") - annotationProcessor("org.derive4j:derive4j") + annotationProcessor("org.derive4j:derive4j") } diff --git a/core/stratego.pie/build.gradle.kts b/core/stratego.pie/build.gradle.kts index d5010e421..1aa79de5e 100644 --- a/core/stratego.pie/build.gradle.kts +++ b/core/stratego.pie/build.gradle.kts @@ -1,18 +1,18 @@ plugins { - id("org.metaborg.gradle.config.java-library") + id("org.metaborg.gradle.config.java-library") } dependencies { - api(platform(project(":spoofax.depconstraints"))) - annotationProcessor(platform(project(":spoofax.depconstraints"))) + api(platform(project(":spoofax.depconstraints"))) + annotationProcessor(platform(project(":spoofax.depconstraints"))) - api("org.metaborg:common") - api(project(":stratego.common")) - api("org.metaborg:pie.api") + api("org.metaborg:common") + api(project(":stratego.common")) + api("org.metaborg:pie.api") - compileOnly("javax.inject:javax.inject") - compileOnly("org.checkerframework:checker-qual-android") - compileOnly("org.derive4j:derive4j-annotation") + compileOnly("javax.inject:javax.inject") + compileOnly("org.checkerframework:checker-qual-android") + compileOnly("org.derive4j:derive4j-annotation") - annotationProcessor("org.derive4j:derive4j") + annotationProcessor("org.derive4j:derive4j") } diff --git a/core/tego.runtime/build.gradle.kts b/core/tego.runtime/build.gradle.kts index bd4a2f8bd..888a3d22b 100644 --- a/core/tego.runtime/build.gradle.kts +++ b/core/tego.runtime/build.gradle.kts @@ -1,32 +1,32 @@ plugins { - id("org.metaborg.gradle.config.java-library") - id("org.metaborg.gradle.config.junit-testing") - jacoco + id("org.metaborg.gradle.config.java-library") + id("org.metaborg.gradle.config.junit-testing") + jacoco } dependencies { - api(platform(project(":spoofax.depconstraints"))) - annotationProcessor(platform(project(":spoofax.depconstraints"))) - testAnnotationProcessor(platform(project(":spoofax.depconstraints"))) + api(platform(project(":spoofax.depconstraints"))) + annotationProcessor(platform(project(":spoofax.depconstraints"))) + testAnnotationProcessor(platform(project(":spoofax.depconstraints"))) - api("org.metaborg:common") - api("org.metaborg:log.api") + api("org.metaborg:common") + api("org.metaborg:log.api") - api("org.metaborg:log.dagger") - api("com.google.dagger:dagger") - annotationProcessor("com.google.dagger:dagger-compiler") + api("org.metaborg:log.dagger") + api("com.google.dagger:dagger") + annotationProcessor("com.google.dagger:dagger-compiler") - compileOnly("org.checkerframework:checker-qual-android") + compileOnly("org.checkerframework:checker-qual-android") - testCompileOnly("org.checkerframework:checker-qual-android") - testImplementation("org.metaborg:log.backend.slf4j") - testImplementation("org.slf4j:slf4j-simple:1.7.10") + testCompileOnly("org.checkerframework:checker-qual-android") + testImplementation("org.metaborg:log.backend.slf4j") + testImplementation("org.slf4j:slf4j-simple:1.7.10") } tasks.test { - finalizedBy(tasks.jacocoTestReport) + finalizedBy(tasks.jacocoTestReport) } tasks.jacocoTestReport { - dependsOn(tasks.test) + dependsOn(tasks.test) } diff --git a/core/tooling.eclipsebundle/build.gradle.kts b/core/tooling.eclipsebundle/build.gradle.kts index 6e31d4871..7e7578253 100644 --- a/core/tooling.eclipsebundle/build.gradle.kts +++ b/core/tooling.eclipsebundle/build.gradle.kts @@ -1,74 +1,74 @@ plugins { - id("org.metaborg.gradle.config.java-library") - id("org.metaborg.coronium.bundle") + id("org.metaborg.gradle.config.java-library") + id("org.metaborg.coronium.bundle") } mavenize { - majorVersion.set("2022-06") + majorVersion.set("2022-06") } dependencies { - api(platform(project(":spoofax.depconstraints"))) - annotationProcessor(platform(project(":spoofax.depconstraints"))) + api(platform(project(":spoofax.depconstraints"))) + annotationProcessor(platform(project(":spoofax.depconstraints"))) - bundleTargetPlatformApi(eclipse("javax.inject")) + bundleTargetPlatformApi(eclipse("javax.inject")) - bundleApi(project(":spoofax.eclipse")) + bundleApi(project(":spoofax.eclipse")) - bundleEmbedApi(project(":aterm.common")) - bundleEmbedApi(project(":constraint.common")) - bundleEmbedApi(project(":constraint.pie")) - bundleEmbedApi(project(":esv.common")) - bundleEmbedApi(project(":jsglr.common")) - bundleEmbedApi(project(":jsglr.pie")) - bundleEmbedApi(project(":jsglr1.common")) - bundleEmbedApi(project(":jsglr2.common")) - bundleEmbedApi(project(":nabl2.common")) - bundleEmbedApi(project(":spoofax2.common")) - bundleEmbedApi(project(":statix.common")) - bundleEmbedApi(project(":statix.pie")) - bundleEmbedApi(project(":statix.codecompletion")) - bundleEmbedApi(project(":statix.codecompletion.pie")) - bundleEmbedApi(project(":stratego.common")) - bundleEmbedApi(project(":stratego.pie")) - bundleEmbedApi(project(":spt.api")) - bundleEmbedApi(project(":tego.runtime")) - bundleEmbedApi("org.metaborg:pie.task.archive") + bundleEmbedApi(project(":aterm.common")) + bundleEmbedApi(project(":constraint.common")) + bundleEmbedApi(project(":constraint.pie")) + bundleEmbedApi(project(":esv.common")) + bundleEmbedApi(project(":jsglr.common")) + bundleEmbedApi(project(":jsglr.pie")) + bundleEmbedApi(project(":jsglr1.common")) + bundleEmbedApi(project(":jsglr2.common")) + bundleEmbedApi(project(":nabl2.common")) + bundleEmbedApi(project(":spoofax2.common")) + bundleEmbedApi(project(":statix.common")) + bundleEmbedApi(project(":statix.pie")) + bundleEmbedApi(project(":statix.codecompletion")) + bundleEmbedApi(project(":statix.codecompletion.pie")) + bundleEmbedApi(project(":stratego.common")) + bundleEmbedApi(project(":stratego.pie")) + bundleEmbedApi(project(":spt.api")) + bundleEmbedApi(project(":tego.runtime")) + bundleEmbedApi("org.metaborg:pie.task.archive") - bundleEmbedApi(project(":spoofax.compiler.interfaces")) + bundleEmbedApi(project(":spoofax.compiler.interfaces")) } // Use bnd to create a single OSGi bundle JAR that includes all dependencies. val exportPackage = listOf( - // Provided by `javax.inject` - "!javax.inject.*", - // Provided by `:spoofax.eclipse` - "!mb.log.*", - "!mb.resource.*", - "!mb.pie.api.*", - "!mb.pie.runtime.*", - "!mb.common.*", - "!mb.spoofax.core.*", - "!dagger.*", - // Do not export testing packages. - "!junit.*", - "!org.junit.*", - // Do not export compile-time annotation packages. - "!org.checkerframework.*", - "!org.codehaus.mojo.animal_sniffer.*", - // Allow split package for 'mb.nabl2'. - "mb.nabl2.*;-split-package:=merge-first", - // Export our own package - "mb.tooling.eclipsebundle", - // Export what is left, using a mandatory provider to prevent accidental imports via 'Import-Package'. - "*;provider=tooling.eclipsebundle;mandatory:=provider" + // Provided by `javax.inject` + "!javax.inject.*", + // Provided by `:spoofax.eclipse` + "!mb.log.*", + "!mb.resource.*", + "!mb.pie.api.*", + "!mb.pie.runtime.*", + "!mb.common.*", + "!mb.spoofax.core.*", + "!dagger.*", + // Do not export testing packages. + "!junit.*", + "!org.junit.*", + // Do not export compile-time annotation packages. + "!org.checkerframework.*", + "!org.codehaus.mojo.animal_sniffer.*", + // Allow split package for 'mb.nabl2'. + "mb.nabl2.*;-split-package:=merge-first", + // Export our own package + "mb.tooling.eclipsebundle", + // Export what is left, using a mandatory provider to prevent accidental imports via 'Import-Package'. + "*;provider=tooling.eclipsebundle;mandatory:=provider" ) tasks { - "jar"(Jar::class) { - manifest { - attributes( - Pair("Export-Package", exportPackage.joinToString(", ")) - ) + "jar"(Jar::class) { + manifest { + attributes( + Pair("Export-Package", exportPackage.joinToString(", ")) + ) + } } - } } diff --git a/core/transform.pie/build.gradle.kts b/core/transform.pie/build.gradle.kts index e5cb31585..35d64d4da 100644 --- a/core/transform.pie/build.gradle.kts +++ b/core/transform.pie/build.gradle.kts @@ -1,16 +1,16 @@ plugins { - id("org.metaborg.gradle.config.java-library") + id("org.metaborg.gradle.config.java-library") } dependencies { - api(platform(project(":spoofax.depconstraints"))) - annotationProcessor(platform(project(":spoofax.depconstraints"))) + api(platform(project(":spoofax.depconstraints"))) + annotationProcessor(platform(project(":spoofax.depconstraints"))) - api("org.metaborg:common") - api(project(":stratego.pie")) - implementation(project(":aterm.common")) - api(project(":spoofax.core")) - api("org.metaborg:pie.api") + api("org.metaborg:common") + api(project(":stratego.pie")) + implementation(project(":aterm.common")) + api(project(":spoofax.core")) + api("org.metaborg:pie.api") - compileOnly("org.checkerframework:checker-qual-android") + compileOnly("org.checkerframework:checker-qual-android") } diff --git a/example/build.gradle.kts b/example/build.gradle.kts index 3e6de515c..789226391 100644 --- a/example/build.gradle.kts +++ b/example/build.gradle.kts @@ -1,39 +1,39 @@ plugins { - id("org.metaborg.gradle.config.root-project") version "0.5.6" - id("org.metaborg.gitonium") version "1.2.0" + id("org.metaborg.gradle.config.root-project") version "0.5.6" + id("org.metaborg.gitonium") version "1.2.0" - // Set versions for plugins to use, only applying them in subprojects (apply false here). - id("org.metaborg.devenv.spoofax.gradle.langspec") version "0.1.32" apply false - id("org.metaborg.coronium.bundle") version "0.3.17" apply false - id("biz.aQute.bnd.builder") version "5.3.0" apply false - id("org.jetbrains.intellij") version "1.4.0" apply false - id("com.palantir.graal") version "0.7.1" apply false + // Set versions for plugins to use, only applying them in subprojects (apply false here). + id("org.metaborg.devenv.spoofax.gradle.langspec") version "0.1.32" apply false + id("org.metaborg.coronium.bundle") version "0.3.17" apply false + id("biz.aQute.bnd.builder") version "5.3.0" apply false + id("org.jetbrains.intellij") version "1.4.0" apply false + id("com.palantir.graal") version "0.7.1" apply false - id("org.metaborg.spoofax.compiler.gradle.language") apply false - id("org.metaborg.spoofax.compiler.gradle.adapter") apply false - id("org.metaborg.spoofax.compiler.gradle.cli") apply false - id("org.metaborg.spoofax.compiler.gradle.eclipse") apply false - id("org.metaborg.spoofax.compiler.gradle.intellij") apply false - id("org.metaborg.spoofax.compiler.gradle.spoofax2.language") apply false + id("org.metaborg.spoofax.compiler.gradle.language") apply false + id("org.metaborg.spoofax.compiler.gradle.adapter") apply false + id("org.metaborg.spoofax.compiler.gradle.cli") apply false + id("org.metaborg.spoofax.compiler.gradle.eclipse") apply false + id("org.metaborg.spoofax.compiler.gradle.intellij") apply false + id("org.metaborg.spoofax.compiler.gradle.spoofax2.language") apply false - id("org.metaborg.spoofax.lwb.compiler.gradle.language") apply false + id("org.metaborg.spoofax.lwb.compiler.gradle.language") apply false } subprojects { - metaborg { - configureSubProject() - // Do not publish examples, except for `tiger.spoofax3` - if(this@subprojects.name != "tiger.spoofax3") { - javaCreatePublication = false - javaCreateSourcesJar = false - javaCreateJavadocJar = false + metaborg { + configureSubProject() + // Do not publish examples, except for `tiger.spoofax3` + if (this@subprojects.name != "tiger.spoofax3") { + javaCreatePublication = false + javaCreateSourcesJar = false + javaCreateJavadocJar = false + } } - } } val spoofax2Version: String = System.getProperty("spoofax2Version") val spoofax2DevenvVersion: String = System.getProperty("spoofax2DevenvVersion") allprojects { - ext["spoofax2Version"] = spoofax2Version - ext["spoofax2DevenvVersion"] = spoofax2DevenvVersion + ext["spoofax2Version"] = spoofax2Version + ext["spoofax2DevenvVersion"] = spoofax2DevenvVersion } diff --git a/example/calc/calc.cli/build.gradle.kts b/example/calc/calc.cli/build.gradle.kts index dd18b24fa..7c4701e8e 100644 --- a/example/calc/calc.cli/build.gradle.kts +++ b/example/calc/calc.cli/build.gradle.kts @@ -1,15 +1,15 @@ plugins { - id("org.metaborg.gradle.config.java-library") - id("org.metaborg.spoofax.compiler.gradle.cli") + id("org.metaborg.gradle.config.java-library") + id("org.metaborg.spoofax.compiler.gradle.cli") } languageCliProject { - adapterProject.set(project(":calc")) + adapterProject.set(project(":calc")) } tasks { - // Disable currently unused distribution tasks. - distZip.configure { enabled = false } - distTar.configure { enabled = false } - startScripts.configure { enabled = false } + // Disable currently unused distribution tasks. + distZip.configure { enabled = false } + distTar.configure { enabled = false } + startScripts.configure { enabled = false } } diff --git a/example/calc/calc.eclipse/build.gradle.kts b/example/calc/calc.eclipse/build.gradle.kts index bee804468..ee87be6ff 100644 --- a/example/calc/calc.eclipse/build.gradle.kts +++ b/example/calc/calc.eclipse/build.gradle.kts @@ -1,12 +1,12 @@ plugins { - id("org.metaborg.gradle.config.java-library") - id("org.metaborg.spoofax.compiler.gradle.eclipse") + id("org.metaborg.gradle.config.java-library") + id("org.metaborg.spoofax.compiler.gradle.eclipse") } mavenize { - majorVersion.set("2022-06") + majorVersion.set("2022-06") } languageEclipseProject { - adapterProject.set(project(":calc")) + adapterProject.set(project(":calc")) } diff --git a/example/calc/calc.intellij/build.gradle.kts b/example/calc/calc.intellij/build.gradle.kts index 2859d2fe7..b5fe81532 100644 --- a/example/calc/calc.intellij/build.gradle.kts +++ b/example/calc/calc.intellij/build.gradle.kts @@ -1,8 +1,8 @@ plugins { - id("org.metaborg.gradle.config.java-library") - id("org.metaborg.spoofax.compiler.gradle.intellij") + id("org.metaborg.gradle.config.java-library") + id("org.metaborg.spoofax.compiler.gradle.intellij") } languageIntellijProject { - adapterProject.set(project(":calc")) + adapterProject.set(project(":calc")) } diff --git a/example/calc/calc/build.gradle.kts b/example/calc/calc/build.gradle.kts index 15f74a129..b7ab8e0fa 100644 --- a/example/calc/calc/build.gradle.kts +++ b/example/calc/calc/build.gradle.kts @@ -1,12 +1,12 @@ plugins { - id("org.metaborg.gradle.config.java-library") - id("org.metaborg.gradle.config.junit-testing") - id("org.metaborg.spoofax.lwb.compiler.gradle.language") + id("org.metaborg.gradle.config.java-library") + id("org.metaborg.gradle.config.junit-testing") + id("org.metaborg.spoofax.lwb.compiler.gradle.language") } fun compositeBuild(name: String) = "$group:$name:$version" dependencies { - testImplementation(compositeBuild("spoofax.test")) - testCompileOnly("org.checkerframework:checker-qual-android") + testImplementation(compositeBuild("spoofax.test")) + testCompileOnly("org.checkerframework:checker-qual-android") } diff --git a/example/mod/mod.cli/build.gradle.kts b/example/mod/mod.cli/build.gradle.kts index 46acac1b9..0966e787b 100644 --- a/example/mod/mod.cli/build.gradle.kts +++ b/example/mod/mod.cli/build.gradle.kts @@ -1,15 +1,15 @@ plugins { - id("org.metaborg.gradle.config.java-library") - id("org.metaborg.spoofax.compiler.gradle.cli") + id("org.metaborg.gradle.config.java-library") + id("org.metaborg.spoofax.compiler.gradle.cli") } languageCliProject { - adapterProject.set(project(":mod.spoofax")) + adapterProject.set(project(":mod.spoofax")) } tasks { - // Disable currently unused distribution tasks. - distZip.configure { enabled = false } - distTar.configure { enabled = false } - startScripts.configure { enabled = false } + // Disable currently unused distribution tasks. + distZip.configure { enabled = false } + distTar.configure { enabled = false } + startScripts.configure { enabled = false } } diff --git a/example/mod/mod.eclipse/build.gradle.kts b/example/mod/mod.eclipse/build.gradle.kts index 0576cf80d..5044e6bcf 100644 --- a/example/mod/mod.eclipse/build.gradle.kts +++ b/example/mod/mod.eclipse/build.gradle.kts @@ -1,12 +1,12 @@ plugins { - id("org.metaborg.gradle.config.java-library") - id("org.metaborg.spoofax.compiler.gradle.eclipse") + id("org.metaborg.gradle.config.java-library") + id("org.metaborg.spoofax.compiler.gradle.eclipse") } mavenize { - majorVersion.set("2022-06") + majorVersion.set("2022-06") } languageEclipseProject { - adapterProject.set(project(":mod.spoofax")) + adapterProject.set(project(":mod.spoofax")) } diff --git a/example/mod/mod.intellij/build.gradle.kts b/example/mod/mod.intellij/build.gradle.kts index 2b24cd25f..e15636800 100644 --- a/example/mod/mod.intellij/build.gradle.kts +++ b/example/mod/mod.intellij/build.gradle.kts @@ -1,8 +1,8 @@ plugins { - id("org.metaborg.gradle.config.java-library") - id("org.metaborg.spoofax.compiler.gradle.intellij") + id("org.metaborg.gradle.config.java-library") + id("org.metaborg.spoofax.compiler.gradle.intellij") } languageIntellijProject { - adapterProject.set(project(":mod.spoofax")) + adapterProject.set(project(":mod.spoofax")) } diff --git a/example/mod/mod.spoofax/build.gradle.kts b/example/mod/mod.spoofax/build.gradle.kts index b8b5fc0ff..98418509f 100644 --- a/example/mod/mod.spoofax/build.gradle.kts +++ b/example/mod/mod.spoofax/build.gradle.kts @@ -1,25 +1,25 @@ -import mb.spoofax.compiler.adapter.* +import mb.spoofax.compiler.adapter.AdapterProjectCompiler plugins { - id("org.metaborg.gradle.config.java-library") - id("org.metaborg.spoofax.compiler.gradle.adapter") + id("org.metaborg.gradle.config.java-library") + id("org.metaborg.spoofax.compiler.gradle.adapter") } fun compositeBuild(name: String) = "$group:$name:$version" dependencies { - api(compositeBuild("spoofax2.common")) + api(compositeBuild("spoofax2.common")) } languageAdapterProject { - languageProject.set(project(":mod")) - compilerInput { - withParser() - withStyler() - withStrategoRuntime() - withConstraintAnalyzer() - project.configureCompilerInput() - } + languageProject.set(project(":mod")) + compilerInput { + withParser() + withStyler() + withStrategoRuntime() + withConstraintAnalyzer() + project.configureCompilerInput() + } } fun AdapterProjectCompiler.Input.Builder.configureCompilerInput() { diff --git a/example/mod/mod.spoofaxcore/build.gradle.kts b/example/mod/mod.spoofaxcore/build.gradle.kts index 8e7012431..869c2d5d7 100644 --- a/example/mod/mod.spoofaxcore/build.gradle.kts +++ b/example/mod/mod.spoofaxcore/build.gradle.kts @@ -1,13 +1,13 @@ plugins { - id("org.metaborg.devenv.spoofax.gradle.langspec") - `maven-publish` + id("org.metaborg.devenv.spoofax.gradle.langspec") + `maven-publish` } val spoofax2DevenvVersion: String by ext dependencies { - compileLanguage("org.metaborg.devenv:org.metaborg.meta.lang.template:$spoofax2DevenvVersion") - compileLanguage("org.metaborg.devenv:org.metaborg.meta.lang.esv:$spoofax2DevenvVersion") - compileLanguage("org.metaborg.devenv:statix.lang:$spoofax2DevenvVersion") - sourceLanguage("org.metaborg.devenv:meta.lib.spoofax:$spoofax2DevenvVersion") - sourceLanguage("org.metaborg.devenv:statix.runtime:$spoofax2DevenvVersion") + compileLanguage("org.metaborg.devenv:org.metaborg.meta.lang.template:$spoofax2DevenvVersion") + compileLanguage("org.metaborg.devenv:org.metaborg.meta.lang.esv:$spoofax2DevenvVersion") + compileLanguage("org.metaborg.devenv:statix.lang:$spoofax2DevenvVersion") + sourceLanguage("org.metaborg.devenv:meta.lib.spoofax:$spoofax2DevenvVersion") + sourceLanguage("org.metaborg.devenv:statix.runtime:$spoofax2DevenvVersion") } diff --git a/example/mod/mod/build.gradle.kts b/example/mod/mod/build.gradle.kts index 5500c6530..485c4e6f3 100644 --- a/example/mod/mod/build.gradle.kts +++ b/example/mod/mod/build.gradle.kts @@ -1,53 +1,49 @@ -import mb.spoofax.compiler.gradle.plugin.* -import mb.spoofax.compiler.gradle.spoofax2.plugin.* -import mb.spoofax.compiler.language.* -import mb.spoofax.compiler.spoofax2.language.* -import mb.spoofax.compiler.util.* +import mb.spoofax.compiler.util.GradleDependency plugins { - id("org.metaborg.gradle.config.java-library") - id("org.metaborg.gradle.config.junit-testing") - id("org.metaborg.spoofax.compiler.gradle.spoofax2.language") + id("org.metaborg.gradle.config.java-library") + id("org.metaborg.gradle.config.junit-testing") + id("org.metaborg.spoofax.compiler.gradle.spoofax2.language") } fun compositeBuild(name: String) = "$group:$name:$version" dependencies { - testImplementation(compositeBuild("spoofax.test")) - testCompileOnly("org.checkerframework:checker-qual-android") + testImplementation(compositeBuild("spoofax.test")) + testCompileOnly("org.checkerframework:checker-qual-android") } languageProject { - shared { - name("Mod") - defaultPackageId("mb.mod") - } - compilerInput { - withParser().run { - startSymbol("Start") + shared { + name("Mod") + defaultPackageId("mb.mod") } - withStyler() - withConstraintAnalyzer().run { - enableNaBL2(false) - enableStatix(true) - multiFile(true) + compilerInput { + withParser().run { + startSymbol("Start") + } + withStyler() + withConstraintAnalyzer().run { + enableNaBL2(false) + enableStatix(true) + multiFile(true) + } + withStrategoRuntime() } - withStrategoRuntime() - } } spoofax2BasedLanguageProject { - compilerInput { - withParser() - withStyler() - withConstraintAnalyzer().run { - copyStatix(true) + compilerInput { + withParser() + withStyler() + withConstraintAnalyzer().run { + copyStatix(true) + } + withStrategoRuntime().run { + copyCtree(true) + copyClasses(false) + } + project + .languageSpecificationDependency(GradleDependency.project(":mod.spoofaxcore")) } - withStrategoRuntime().run { - copyCtree(true) - copyClasses(false) - } - project - .languageSpecificationDependency(GradleDependency.project(":mod.spoofaxcore")) - } } diff --git a/example/multilang/generated/minisdf.cli/build.gradle.kts b/example/multilang/generated/minisdf.cli/build.gradle.kts index cf51f7d85..4bde92e9a 100644 --- a/example/multilang/generated/minisdf.cli/build.gradle.kts +++ b/example/multilang/generated/minisdf.cli/build.gradle.kts @@ -1,15 +1,15 @@ plugins { - id("org.metaborg.gradle.config.java-library") - id("org.metaborg.spoofax.compiler.gradle.cli") + id("org.metaborg.gradle.config.java-library") + id("org.metaborg.spoofax.compiler.gradle.cli") } languageCliProject { - adapterProject.set(project(":minisdf")) + adapterProject.set(project(":minisdf")) } tasks { - // Disable currently unused distribution tasks. - distZip.configure { enabled = false } - distTar.configure { enabled = false } - startScripts.configure { enabled = false } + // Disable currently unused distribution tasks. + distZip.configure { enabled = false } + distTar.configure { enabled = false } + startScripts.configure { enabled = false } } diff --git a/example/multilang/generated/minisdf.eclipse/build.gradle.kts b/example/multilang/generated/minisdf.eclipse/build.gradle.kts index bde45dd14..8b0a50453 100644 --- a/example/multilang/generated/minisdf.eclipse/build.gradle.kts +++ b/example/multilang/generated/minisdf.eclipse/build.gradle.kts @@ -1,12 +1,12 @@ plugins { - id("org.metaborg.gradle.config.java-library") - id("org.metaborg.spoofax.compiler.gradle.eclipse") + id("org.metaborg.gradle.config.java-library") + id("org.metaborg.spoofax.compiler.gradle.eclipse") } mavenize { - majorVersion.set("2022-06") + majorVersion.set("2022-06") } languageEclipseProject { - adapterProject.set(project(":minisdf")) + adapterProject.set(project(":minisdf")) } diff --git a/example/multilang/generated/minisdf/build.gradle.kts b/example/multilang/generated/minisdf/build.gradle.kts index 2c2dbfb6b..c60a757ea 100644 --- a/example/multilang/generated/minisdf/build.gradle.kts +++ b/example/multilang/generated/minisdf/build.gradle.kts @@ -1,65 +1,61 @@ -import mb.spoofax.compiler.gradle.plugin.* -import mb.spoofax.compiler.gradle.spoofax2.plugin.* -import mb.spoofax.compiler.language.* -import mb.spoofax.compiler.spoofax2.language.* -import mb.spoofax.compiler.util.* +import mb.spoofax.compiler.util.GradleDependency plugins { - id("org.metaborg.gradle.config.java-library") - id("org.metaborg.gradle.config.junit-testing") - id("org.metaborg.spoofax.compiler.gradle.spoofax2.language") - id("org.metaborg.spoofax.compiler.gradle.adapter") + id("org.metaborg.gradle.config.java-library") + id("org.metaborg.gradle.config.junit-testing") + id("org.metaborg.spoofax.compiler.gradle.spoofax2.language") + id("org.metaborg.spoofax.compiler.gradle.adapter") } dependencies { - api(project(":module")) + api(project(":module")) } languageProject { - shared { - name("MiniSdf") - fileExtensions(listOf("msdf")) - defaultPackageId("mb.minisdf") - } - compilerInput { - withParser().run { - startSymbol("Start") + shared { + name("MiniSdf") + fileExtensions(listOf("msdf")) + defaultPackageId("mb.minisdf") } - withStyler() - withMultilangAnalyzer().run { - rootModules(listOf("mini-sdf")) + compilerInput { + withParser().run { + startSymbol("Start") + } + withStyler() + withMultilangAnalyzer().run { + rootModules(listOf("mini-sdf")) + } + withStrategoRuntime() } - withStrategoRuntime() - } - statixDependencies.set(listOf(project(":module"))) + statixDependencies.set(listOf(project(":module"))) } spoofax2BasedLanguageProject { - compilerInput { - withParser() - withStyler() - withStrategoRuntime().run { - copyCtree(true) - copyClasses(false) + compilerInput { + withParser() + withStyler() + withStrategoRuntime().run { + copyCtree(true) + copyClasses(false) + } + withMultilangAnalyzer() + project + .languageSpecificationDependency(GradleDependency.project(":minisdf.spoofaxcore")) } - withMultilangAnalyzer() - project - .languageSpecificationDependency(GradleDependency.project(":minisdf.spoofaxcore")) - } } languageAdapterProject { - compilerInput { - withParser() - withStyler() - withStrategoRuntime() - withMultilangAnalyzer().run { - preAnalysisStrategy("pre-analyze") - postAnalysisStrategy("post-analyze") - contextId("mini-sdf-str") - fileConstraint("mini-sdf!fileOk") - projectConstraint("mini-sdf!projectOk") + compilerInput { + withParser() + withStyler() + withStrategoRuntime() + withMultilangAnalyzer().run { + preAnalysisStrategy("pre-analyze") + postAnalysisStrategy("post-analyze") + contextId("mini-sdf-str") + fileConstraint("mini-sdf!fileOk") + projectConstraint("mini-sdf!projectOk") + } + project.compositionGroup("minimeta") } - project.compositionGroup("minimeta") - } } diff --git a/example/multilang/generated/ministr.cli/build.gradle.kts b/example/multilang/generated/ministr.cli/build.gradle.kts index ed08902a8..23761f2ff 100644 --- a/example/multilang/generated/ministr.cli/build.gradle.kts +++ b/example/multilang/generated/ministr.cli/build.gradle.kts @@ -1,15 +1,15 @@ plugins { - id("org.metaborg.gradle.config.java-library") - id("org.metaborg.spoofax.compiler.gradle.cli") + id("org.metaborg.gradle.config.java-library") + id("org.metaborg.spoofax.compiler.gradle.cli") } languageCliProject { - adapterProject.set(project(":ministr")) + adapterProject.set(project(":ministr")) } tasks { - // Disable currently unused distribution tasks. - distZip.configure { enabled = false } - distTar.configure { enabled = false } - startScripts.configure { enabled = false } + // Disable currently unused distribution tasks. + distZip.configure { enabled = false } + distTar.configure { enabled = false } + startScripts.configure { enabled = false } } diff --git a/example/multilang/generated/ministr.eclipse/build.gradle.kts b/example/multilang/generated/ministr.eclipse/build.gradle.kts index 899ff7b7e..8b4b4d940 100644 --- a/example/multilang/generated/ministr.eclipse/build.gradle.kts +++ b/example/multilang/generated/ministr.eclipse/build.gradle.kts @@ -1,12 +1,12 @@ plugins { - id("org.metaborg.gradle.config.java-library") - id("org.metaborg.spoofax.compiler.gradle.eclipse") + id("org.metaborg.gradle.config.java-library") + id("org.metaborg.spoofax.compiler.gradle.eclipse") } mavenize { - majorVersion.set("2022-06") + majorVersion.set("2022-06") } languageEclipseProject { - adapterProject.set(project(":ministr")) + adapterProject.set(project(":ministr")) } diff --git a/example/multilang/generated/ministr/build.gradle.kts b/example/multilang/generated/ministr/build.gradle.kts index 241930fbd..b438d4ccb 100644 --- a/example/multilang/generated/ministr/build.gradle.kts +++ b/example/multilang/generated/ministr/build.gradle.kts @@ -1,65 +1,61 @@ -import mb.spoofax.compiler.gradle.plugin.* -import mb.spoofax.compiler.gradle.spoofax2.plugin.* -import mb.spoofax.compiler.language.* -import mb.spoofax.compiler.spoofax2.language.* -import mb.spoofax.compiler.util.* +import mb.spoofax.compiler.util.GradleDependency plugins { - id("org.metaborg.gradle.config.java-library") - id("org.metaborg.gradle.config.junit-testing") - id("org.metaborg.spoofax.compiler.gradle.spoofax2.language") - id("org.metaborg.spoofax.compiler.gradle.adapter") + id("org.metaborg.gradle.config.java-library") + id("org.metaborg.gradle.config.junit-testing") + id("org.metaborg.spoofax.compiler.gradle.spoofax2.language") + id("org.metaborg.spoofax.compiler.gradle.adapter") } dependencies { - api(project(":module")) + api(project(":module")) } languageProject { - shared { - name("MiniStr") - fileExtensions(listOf("mstr")) - defaultPackageId("mb.ministr") - } - compilerInput { - withParser().run { - startSymbol("Start") + shared { + name("MiniStr") + fileExtensions(listOf("mstr")) + defaultPackageId("mb.ministr") } - withStyler() - withMultilangAnalyzer().run { - rootModules(listOf("mini-str")) + compilerInput { + withParser().run { + startSymbol("Start") + } + withStyler() + withMultilangAnalyzer().run { + rootModules(listOf("mini-str")) + } + withStrategoRuntime() } - withStrategoRuntime() - } - statixDependencies.set(listOf(project(":module"))) + statixDependencies.set(listOf(project(":module"))) } spoofax2BasedLanguageProject { - compilerInput { - withParser() - withStyler() - withStrategoRuntime().run { - copyCtree(true) - copyClasses(false) + compilerInput { + withParser() + withStyler() + withStrategoRuntime().run { + copyCtree(true) + copyClasses(false) + } + withMultilangAnalyzer() + project + .languageSpecificationDependency(GradleDependency.project(":ministr.spoofaxcore")) } - withMultilangAnalyzer() - project - .languageSpecificationDependency(GradleDependency.project(":ministr.spoofaxcore")) - } } languageAdapterProject { - compilerInput { - withParser() - withStyler() - withStrategoRuntime() - withMultilangAnalyzer().run { - preAnalysisStrategy("pre-analyze") - postAnalysisStrategy("post-analyze") - contextId("mini-sdf-str") - fileConstraint("mini-str!fileOk") - projectConstraint("mini-str!projectOk") + compilerInput { + withParser() + withStyler() + withStrategoRuntime() + withMultilangAnalyzer().run { + preAnalysisStrategy("pre-analyze") + postAnalysisStrategy("post-analyze") + contextId("mini-sdf-str") + fileConstraint("mini-str!fileOk") + projectConstraint("mini-str!projectOk") + } + project.compositionGroup("minimeta") } - project.compositionGroup("minimeta") - } } diff --git a/example/multilang/generated/module.eclipse/build.gradle.kts b/example/multilang/generated/module.eclipse/build.gradle.kts index ec6179716..202340d0e 100644 --- a/example/multilang/generated/module.eclipse/build.gradle.kts +++ b/example/multilang/generated/module.eclipse/build.gradle.kts @@ -1,12 +1,12 @@ plugins { - id("org.metaborg.gradle.config.java-library") - id("org.metaborg.spoofax.compiler.gradle.eclipse") + id("org.metaborg.gradle.config.java-library") + id("org.metaborg.spoofax.compiler.gradle.eclipse") } mavenize { - majorVersion.set("2022-06") + majorVersion.set("2022-06") } languageEclipseProject { - adapterProject.set(project(":module")) + adapterProject.set(project(":module")) } diff --git a/example/multilang/generated/module/build.gradle.kts b/example/multilang/generated/module/build.gradle.kts index b58ec26ea..dfb74aad8 100644 --- a/example/multilang/generated/module/build.gradle.kts +++ b/example/multilang/generated/module/build.gradle.kts @@ -1,43 +1,39 @@ -import mb.spoofax.compiler.gradle.plugin.* -import mb.spoofax.compiler.gradle.spoofax2.plugin.* -import mb.spoofax.compiler.language.* -import mb.spoofax.compiler.spoofax2.language.* -import mb.spoofax.compiler.util.* +import mb.spoofax.compiler.util.GradleDependency plugins { - id("org.metaborg.gradle.config.java-library") - id("org.metaborg.gradle.config.junit-testing") - id("org.metaborg.spoofax.compiler.gradle.spoofax2.language") - id("org.metaborg.spoofax.compiler.gradle.adapter") + id("org.metaborg.gradle.config.java-library") + id("org.metaborg.gradle.config.junit-testing") + id("org.metaborg.spoofax.compiler.gradle.spoofax2.language") + id("org.metaborg.spoofax.compiler.gradle.adapter") } dependencies { - api(project(":signature")) + api(project(":signature")) } languageProject { - shared { - name("Module") - defaultPackageId("mb.module") - } - compilerInput { - withMultilangAnalyzer().run { - rootModules(listOf("modules/modules")) + shared { + name("Module") + defaultPackageId("mb.module") } - } - statixDependencies.set(listOf(project(":signature"))) + compilerInput { + withMultilangAnalyzer().run { + rootModules(listOf("modules/modules")) + } + } + statixDependencies.set(listOf(project(":signature"))) } spoofax2BasedLanguageProject { - compilerInput { - withMultilangAnalyzer() - project - .languageSpecificationDependency(GradleDependency.project(":module-interface.spoofaxcore")) - } + compilerInput { + withMultilangAnalyzer() + project + .languageSpecificationDependency(GradleDependency.project(":module-interface.spoofaxcore")) + } } languageAdapterProject { - compilerInput { - project.compositionGroup("minimeta") - } + compilerInput { + project.compositionGroup("minimeta") + } } diff --git a/example/multilang/generated/multilang.eclipse/build.gradle.kts b/example/multilang/generated/multilang.eclipse/build.gradle.kts index 761b2c763..779413376 100755 --- a/example/multilang/generated/multilang.eclipse/build.gradle.kts +++ b/example/multilang/generated/multilang.eclipse/build.gradle.kts @@ -1,18 +1,18 @@ plugins { - id("org.metaborg.coronium.bundle") + id("org.metaborg.coronium.bundle") } mavenize { - majorVersion.set("2022-06") + majorVersion.set("2022-06") } fun compositeBuild(name: String) = "$group:$name:$version" dependencies { - api(platform(compositeBuild("spoofax.depconstraints"))) + api(platform(compositeBuild("spoofax.depconstraints"))) - bundleApi(project(":signature.eclipse")) - bundleApi(project(":module.eclipse")) - bundleApi(project(":minisdf.eclipse")) - bundleApi(project(":ministr.eclipse")) + bundleApi(project(":signature.eclipse")) + bundleApi(project(":module.eclipse")) + bundleApi(project(":minisdf.eclipse")) + bundleApi(project(":ministr.eclipse")) } diff --git a/example/multilang/generated/multilang.test/build.gradle.kts b/example/multilang/generated/multilang.test/build.gradle.kts index 2747c8abe..9d9ac8b0e 100644 --- a/example/multilang/generated/multilang.test/build.gradle.kts +++ b/example/multilang/generated/multilang.test/build.gradle.kts @@ -1,23 +1,26 @@ plugins { - id("org.metaborg.gradle.config.java-library") - id("org.metaborg.gradle.config.junit-testing") + id("org.metaborg.gradle.config.java-library") + id("org.metaborg.gradle.config.junit-testing") } fun compositeBuild(name: String) = "$group:$name:$version" dependencies { - testImplementation("org.metaborg:spoofax.core") - testImplementation(project(":minisdf")) - testImplementation(project(":ministr")) + testImplementation("org.metaborg:spoofax.core") + testImplementation(project(":minisdf")) + testImplementation(project(":ministr")) - testImplementation(compositeBuild("spoofax.test")) - testCompileOnly("org.checkerframework:checker-qual-android") + testImplementation(compositeBuild("spoofax.test")) + testCompileOnly("org.checkerframework:checker-qual-android") } tasks.test { - // Show standard out and err in tests. - testLogging { - events(org.gradle.api.tasks.testing.logging.TestLogEvent.STANDARD_OUT, org.gradle.api.tasks.testing.logging.TestLogEvent.STANDARD_ERROR) - showStandardStreams = true - } + // Show standard out and err in tests. + testLogging { + events( + org.gradle.api.tasks.testing.logging.TestLogEvent.STANDARD_OUT, + org.gradle.api.tasks.testing.logging.TestLogEvent.STANDARD_ERROR + ) + showStandardStreams = true + } } diff --git a/example/multilang/generated/signature.eclipse/build.gradle.kts b/example/multilang/generated/signature.eclipse/build.gradle.kts index eb296245e..f01433a6e 100644 --- a/example/multilang/generated/signature.eclipse/build.gradle.kts +++ b/example/multilang/generated/signature.eclipse/build.gradle.kts @@ -1,12 +1,12 @@ plugins { - id("org.metaborg.gradle.config.java-library") - id("org.metaborg.spoofax.compiler.gradle.eclipse") + id("org.metaborg.gradle.config.java-library") + id("org.metaborg.spoofax.compiler.gradle.eclipse") } mavenize { - majorVersion.set("2022-06") + majorVersion.set("2022-06") } languageEclipseProject { - adapterProject.set(project(":signature")) + adapterProject.set(project(":signature")) } diff --git a/example/multilang/generated/signature/build.gradle.kts b/example/multilang/generated/signature/build.gradle.kts index 5e782dfc3..536e7561a 100644 --- a/example/multilang/generated/signature/build.gradle.kts +++ b/example/multilang/generated/signature/build.gradle.kts @@ -1,37 +1,33 @@ -import mb.spoofax.compiler.gradle.plugin.* -import mb.spoofax.compiler.gradle.spoofax2.plugin.* -import mb.spoofax.compiler.language.* -import mb.spoofax.compiler.spoofax2.language.* -import mb.spoofax.compiler.util.* +import mb.spoofax.compiler.util.GradleDependency plugins { - id("org.metaborg.gradle.config.java-library") - id("org.metaborg.gradle.config.junit-testing") - id("org.metaborg.spoofax.compiler.gradle.spoofax2.language") - id("org.metaborg.spoofax.compiler.gradle.adapter") + id("org.metaborg.gradle.config.java-library") + id("org.metaborg.gradle.config.junit-testing") + id("org.metaborg.spoofax.compiler.gradle.spoofax2.language") + id("org.metaborg.spoofax.compiler.gradle.adapter") } languageProject { - shared { - name("Signature") - defaultPackageId("mb.signature") - } - compilerInput { - withMultilangAnalyzer().run { - rootModules(listOf("abstract-sig/conflicts/sorts", "abstract-sig/conflicts/constructors")) + shared { + name("Signature") + defaultPackageId("mb.signature") + } + compilerInput { + withMultilangAnalyzer().run { + rootModules(listOf("abstract-sig/conflicts/sorts", "abstract-sig/conflicts/constructors")) + } } - } } spoofax2BasedLanguageProject { - compilerInput { - withMultilangAnalyzer() - project.languageSpecificationDependency(GradleDependency.project(":signature-interface.spoofaxcore")) - } + compilerInput { + withMultilangAnalyzer() + project.languageSpecificationDependency(GradleDependency.project(":signature-interface.spoofaxcore")) + } } languageAdapterProject { - compilerInput { - project.compositionGroup("minimeta") - } + compilerInput { + project.compositionGroup("minimeta") + } } diff --git a/example/multilang/spoofaxcore/minisdf.spoofaxcore/build.gradle.kts b/example/multilang/spoofaxcore/minisdf.spoofaxcore/build.gradle.kts index 960c15dae..d474e06af 100644 --- a/example/multilang/spoofaxcore/minisdf.spoofaxcore/build.gradle.kts +++ b/example/multilang/spoofaxcore/minisdf.spoofaxcore/build.gradle.kts @@ -1,36 +1,36 @@ plugins { - id("org.metaborg.devenv.spoofax.gradle.langspec") - `maven-publish` + id("org.metaborg.devenv.spoofax.gradle.langspec") + `maven-publish` } val spoofax2DevenvVersion: String by ext spoofaxLanguageSpecification { - addSourceDependenciesFromMetaborgYaml.set(false) - addCompileDependenciesFromMetaborgYaml.set(false) + addSourceDependenciesFromMetaborgYaml.set(false) + addCompileDependenciesFromMetaborgYaml.set(false) } dependencies { - compileLanguage("org.metaborg.devenv:org.metaborg.meta.lang.template:$spoofax2DevenvVersion") - compileLanguage("org.metaborg.devenv:org.metaborg.meta.lang.esv:$spoofax2DevenvVersion") - compileLanguage("org.metaborg.devenv:statix.lang:$spoofax2DevenvVersion") - compileLanguage("org.metaborg.devenv:sdf3.ext.statix:$spoofax2DevenvVersion") + compileLanguage("org.metaborg.devenv:org.metaborg.meta.lang.template:$spoofax2DevenvVersion") + compileLanguage("org.metaborg.devenv:org.metaborg.meta.lang.esv:$spoofax2DevenvVersion") + compileLanguage("org.metaborg.devenv:statix.lang:$spoofax2DevenvVersion") + compileLanguage("org.metaborg.devenv:sdf3.ext.statix:$spoofax2DevenvVersion") - sourceLanguage("org.metaborg.devenv:meta.lib.spoofax:$spoofax2DevenvVersion") - sourceLanguage("org.metaborg.devenv:statix.runtime:$spoofax2DevenvVersion") - sourceLanguage(project(":signature-interface.spoofaxcore")) - sourceLanguage(project(":module-interface.spoofaxcore")) + sourceLanguage("org.metaborg.devenv:meta.lib.spoofax:$spoofax2DevenvVersion") + sourceLanguage("org.metaborg.devenv:statix.runtime:$spoofax2DevenvVersion") + sourceLanguage(project(":signature-interface.spoofaxcore")) + sourceLanguage(project(":module-interface.spoofaxcore")) } afterEvaluate { - val importSignature = tasks.register("importSignature") { - from("../signature-interface.spoofaxcore/trans/abstract-sig") - into("trans/abstract-sig") - } - val importModule = tasks.register("importModule") { - from("../module-interface.spoofaxcore/trans/modules") - into("trans/modules") - } - tasks.getByName("spoofaxBuildLanguageSpec") { - dependsOn(importSignature) - dependsOn(importModule) - } + val importSignature = tasks.register("importSignature") { + from("../signature-interface.spoofaxcore/trans/abstract-sig") + into("trans/abstract-sig") + } + val importModule = tasks.register("importModule") { + from("../module-interface.spoofaxcore/trans/modules") + into("trans/modules") + } + tasks.getByName("spoofaxBuildLanguageSpec") { + dependsOn(importSignature) + dependsOn(importModule) + } } diff --git a/example/multilang/spoofaxcore/ministr.spoofaxcore/build.gradle.kts b/example/multilang/spoofaxcore/ministr.spoofaxcore/build.gradle.kts index 960c15dae..d474e06af 100644 --- a/example/multilang/spoofaxcore/ministr.spoofaxcore/build.gradle.kts +++ b/example/multilang/spoofaxcore/ministr.spoofaxcore/build.gradle.kts @@ -1,36 +1,36 @@ plugins { - id("org.metaborg.devenv.spoofax.gradle.langspec") - `maven-publish` + id("org.metaborg.devenv.spoofax.gradle.langspec") + `maven-publish` } val spoofax2DevenvVersion: String by ext spoofaxLanguageSpecification { - addSourceDependenciesFromMetaborgYaml.set(false) - addCompileDependenciesFromMetaborgYaml.set(false) + addSourceDependenciesFromMetaborgYaml.set(false) + addCompileDependenciesFromMetaborgYaml.set(false) } dependencies { - compileLanguage("org.metaborg.devenv:org.metaborg.meta.lang.template:$spoofax2DevenvVersion") - compileLanguage("org.metaborg.devenv:org.metaborg.meta.lang.esv:$spoofax2DevenvVersion") - compileLanguage("org.metaborg.devenv:statix.lang:$spoofax2DevenvVersion") - compileLanguage("org.metaborg.devenv:sdf3.ext.statix:$spoofax2DevenvVersion") + compileLanguage("org.metaborg.devenv:org.metaborg.meta.lang.template:$spoofax2DevenvVersion") + compileLanguage("org.metaborg.devenv:org.metaborg.meta.lang.esv:$spoofax2DevenvVersion") + compileLanguage("org.metaborg.devenv:statix.lang:$spoofax2DevenvVersion") + compileLanguage("org.metaborg.devenv:sdf3.ext.statix:$spoofax2DevenvVersion") - sourceLanguage("org.metaborg.devenv:meta.lib.spoofax:$spoofax2DevenvVersion") - sourceLanguage("org.metaborg.devenv:statix.runtime:$spoofax2DevenvVersion") - sourceLanguage(project(":signature-interface.spoofaxcore")) - sourceLanguage(project(":module-interface.spoofaxcore")) + sourceLanguage("org.metaborg.devenv:meta.lib.spoofax:$spoofax2DevenvVersion") + sourceLanguage("org.metaborg.devenv:statix.runtime:$spoofax2DevenvVersion") + sourceLanguage(project(":signature-interface.spoofaxcore")) + sourceLanguage(project(":module-interface.spoofaxcore")) } afterEvaluate { - val importSignature = tasks.register("importSignature") { - from("../signature-interface.spoofaxcore/trans/abstract-sig") - into("trans/abstract-sig") - } - val importModule = tasks.register("importModule") { - from("../module-interface.spoofaxcore/trans/modules") - into("trans/modules") - } - tasks.getByName("spoofaxBuildLanguageSpec") { - dependsOn(importSignature) - dependsOn(importModule) - } + val importSignature = tasks.register("importSignature") { + from("../signature-interface.spoofaxcore/trans/abstract-sig") + into("trans/abstract-sig") + } + val importModule = tasks.register("importModule") { + from("../module-interface.spoofaxcore/trans/modules") + into("trans/modules") + } + tasks.getByName("spoofaxBuildLanguageSpec") { + dependsOn(importSignature) + dependsOn(importModule) + } } diff --git a/example/multilang/spoofaxcore/module-interface.spoofaxcore/build.gradle.kts b/example/multilang/spoofaxcore/module-interface.spoofaxcore/build.gradle.kts index a52f045c6..ecb92a27a 100644 --- a/example/multilang/spoofaxcore/module-interface.spoofaxcore/build.gradle.kts +++ b/example/multilang/spoofaxcore/module-interface.spoofaxcore/build.gradle.kts @@ -1,20 +1,20 @@ plugins { - id("org.metaborg.devenv.spoofax.gradle.langspec") - `maven-publish` + id("org.metaborg.devenv.spoofax.gradle.langspec") + `maven-publish` } val spoofax2DevenvVersion: String by ext dependencies { - compileLanguage("org.metaborg.devenv:statix.lang:$spoofax2DevenvVersion") - sourceLanguage(project(":signature-interface.spoofaxcore")) + compileLanguage("org.metaborg.devenv:statix.lang:$spoofax2DevenvVersion") + sourceLanguage(project(":signature-interface.spoofaxcore")) } afterEvaluate { - val importSignature = tasks.register("importSignature") { - from("../signature-interface.spoofaxcore/trans/abstract-sig") - into("trans/abstract-sig") - } - tasks.getByName("spoofaxBuildLanguageSpec") { - dependsOn(importSignature) - } + val importSignature = tasks.register("importSignature") { + from("../signature-interface.spoofaxcore/trans/abstract-sig") + into("trans/abstract-sig") + } + tasks.getByName("spoofaxBuildLanguageSpec") { + dependsOn(importSignature) + } } diff --git a/example/multilang/spoofaxcore/signature-interface.spoofaxcore/build.gradle.kts b/example/multilang/spoofaxcore/signature-interface.spoofaxcore/build.gradle.kts index f633b70c1..d012ca372 100644 --- a/example/multilang/spoofaxcore/signature-interface.spoofaxcore/build.gradle.kts +++ b/example/multilang/spoofaxcore/signature-interface.spoofaxcore/build.gradle.kts @@ -1,9 +1,9 @@ plugins { - id("org.metaborg.devenv.spoofax.gradle.langspec") - `maven-publish` + id("org.metaborg.devenv.spoofax.gradle.langspec") + `maven-publish` } val spoofax2DevenvVersion: String by ext dependencies { - compileLanguage("org.metaborg.devenv:statix.lang:$spoofax2DevenvVersion") + compileLanguage("org.metaborg.devenv:statix.lang:$spoofax2DevenvVersion") } diff --git a/example/settings.gradle.kts b/example/settings.gradle.kts index 1feb6a785..7996d37c7 100644 --- a/example/settings.gradle.kts +++ b/example/settings.gradle.kts @@ -1,95 +1,95 @@ rootProject.name = "spoofax3.example.root" pluginManagement { - repositories { - maven("https://artifacts.metaborg.org/content/groups/public/") - } + repositories { + maven("https://artifacts.metaborg.org/content/groups/public/") + } } // Only include composite builds when this is the root project (it has no parent), for example when running Gradle tasks // from the command-line. Otherwise, the parent project (spoofax.root) will include these composite builds. -if(gradle.parent == null) { - includeBuildWithName("../core", "spoofax3.core.root") - includeBuildWithName("../lwb", "spoofax3.lwb.root") +if (gradle.parent == null) { + includeBuildWithName("../core", "spoofax3.core.root") + includeBuildWithName("../lwb", "spoofax3.lwb.root") } fun includeBuildWithName(dir: String, name: String) { - includeBuild(dir) { - try { - ConfigurableIncludedBuild::class.java - .getDeclaredMethod("setName", String::class.java) - .invoke(this, name) - } catch(e: NoSuchMethodException) { - // Running Gradle < 6, no need to set the name, ignore. + includeBuild(dir) { + try { + ConfigurableIncludedBuild::class.java + .getDeclaredMethod("setName", String::class.java) + .invoke(this, name) + } catch (e: NoSuchMethodException) { + // Running Gradle < 6, no need to set the name, ignore. + } } - } } fun String.includeProject(id: String, path: String = "$this/$id") { - include(id) - project(":$id").projectDir = file(path) + include(id) + project(":$id").projectDir = file(path) } "tiger/spoofaxcore".run { - includeProject("tiger.spoofaxcore") + includeProject("tiger.spoofaxcore") } "tiger/manual".run { - includeProject("tiger", "tiger/manual/tiger") - includeProject("tiger.spoofax", "tiger/manual/tiger.spoofax") - includeProject("tiger.cli", "tiger/manual/tiger.cli") - includeProject("tiger.eclipse", "tiger/manual/tiger.eclipse") - includeProject("tiger.intellij", "tiger/manual/tiger.intellij") + includeProject("tiger", "tiger/manual/tiger") + includeProject("tiger.spoofax", "tiger/manual/tiger.spoofax") + includeProject("tiger.cli", "tiger/manual/tiger.cli") + includeProject("tiger.eclipse", "tiger/manual/tiger.eclipse") + includeProject("tiger.intellij", "tiger/manual/tiger.intellij") } "tiger/spoofax3".run { - includeProject("tiger.spoofax3", "tiger/spoofax3/tiger.spoofax3") - includeProject("tiger.spoofax3.cli", "tiger/spoofax3/tiger.spoofax3.cli") - includeProject("tiger.spoofax3.eclipse", "tiger/spoofax3/tiger.spoofax3.eclipse") - includeProject("tiger.spoofax3.intellij", "tiger/spoofax3/tiger.spoofax3.intellij") + includeProject("tiger.spoofax3", "tiger/spoofax3/tiger.spoofax3") + includeProject("tiger.spoofax3.cli", "tiger/spoofax3/tiger.spoofax3.cli") + includeProject("tiger.spoofax3.eclipse", "tiger/spoofax3/tiger.spoofax3.eclipse") + includeProject("tiger.spoofax3.intellij", "tiger/spoofax3/tiger.spoofax3.intellij") } "mod".run { - includeProject("mod.spoofaxcore") - includeProject("mod") - includeProject("mod.spoofax") - includeProject("mod.cli") - includeProject("mod.eclipse") - includeProject("mod.intellij") + includeProject("mod.spoofaxcore") + includeProject("mod") + includeProject("mod.spoofax") + includeProject("mod.cli") + includeProject("mod.eclipse") + includeProject("mod.intellij") } "calc".run { - includeProject("calc") - includeProject("calc.cli") - includeProject("calc.eclipse") - includeProject("calc.intellij") + includeProject("calc") + includeProject("calc.cli") + includeProject("calc.eclipse") + includeProject("calc.intellij") } "multilang/spoofaxcore".run { - includeProject("signature-interface.spoofaxcore") - includeProject("module-interface.spoofaxcore") - includeProject("minisdf.spoofaxcore") - includeProject("ministr.spoofaxcore") + includeProject("signature-interface.spoofaxcore") + includeProject("module-interface.spoofaxcore") + includeProject("minisdf.spoofaxcore") + includeProject("ministr.spoofaxcore") } "multilang/generated".run { - includeProject("signature") - includeProject("signature.eclipse") - includeProject("module") - includeProject("module.eclipse") + includeProject("signature") + includeProject("signature.eclipse") + includeProject("module") + includeProject("module.eclipse") - includeProject("minisdf") - includeProject("minisdf.eclipse") - includeProject("minisdf.cli") + includeProject("minisdf") + includeProject("minisdf.eclipse") + includeProject("minisdf.cli") - includeProject("ministr") - includeProject("ministr.eclipse") - includeProject("ministr.cli") + includeProject("ministr") + includeProject("ministr.eclipse") + includeProject("ministr.cli") - includeProject("multilang.eclipse") - includeProject("multilang.test") + includeProject("multilang.eclipse") + includeProject("multilang.test") } "deps".run { - includeProject("lib") - includeProject("lang") + includeProject("lib") + includeProject("lang") } diff --git a/example/tiger/manual/tiger.cli/build.gradle.kts b/example/tiger/manual/tiger.cli/build.gradle.kts index 881f42656..1baab1747 100755 --- a/example/tiger/manual/tiger.cli/build.gradle.kts +++ b/example/tiger/manual/tiger.cli/build.gradle.kts @@ -1,42 +1,42 @@ plugins { - id("org.metaborg.gradle.config.java-application") - id("com.palantir.graal") + id("org.metaborg.gradle.config.java-application") + id("com.palantir.graal") } application { - mainClass.set("mb.tiger.cli.Main") + mainClass.set("mb.tiger.cli.Main") } graal { - graalVersion("19.2.0.1") - - mainClass("mb.tiger.cli.Main") - outputName("tiger") - option("--no-fallback") - option("--report-unsupported-elements-at-runtime") - option("--initialize-at-build-time=mb,com,org.metaborg.util.log,org.slf4j,dagger,dagger.internal.InstanceFactory,picocli") - option("-H:+ReportExceptionStackTraces") - option("-H:IncludeResources=mb/tiger/target/.*") /* https://github.com/oracle/graal/blob/master/substratevm/RESOURCES.md */ - option("-H:DynamicProxyConfigurationFiles=src/main/gni/proxy.json") /* https://github.com/oracle/graal/blob/master/substratevm/DYNAMIC_PROXY.md */ - option("-H:ReflectionConfigurationFiles=src/main/gni/reflection.json") /* https://github.com/oracle/graal/blob/master/substratevm/REFLECTION.md */ + graalVersion("19.2.0.1") + + mainClass("mb.tiger.cli.Main") + outputName("tiger") + option("--no-fallback") + option("--report-unsupported-elements-at-runtime") + option("--initialize-at-build-time=mb,com,org.metaborg.util.log,org.slf4j,dagger,dagger.internal.InstanceFactory,picocli") + option("-H:+ReportExceptionStackTraces") + option("-H:IncludeResources=mb/tiger/target/.*") /* https://github.com/oracle/graal/blob/master/substratevm/RESOURCES.md */ + option("-H:DynamicProxyConfigurationFiles=src/main/gni/proxy.json") /* https://github.com/oracle/graal/blob/master/substratevm/DYNAMIC_PROXY.md */ + option("-H:ReflectionConfigurationFiles=src/main/gni/reflection.json") /* https://github.com/oracle/graal/blob/master/substratevm/REFLECTION.md */ } fun compositeBuild(name: String) = "$group:$name:$version" dependencies { - implementation(platform(compositeBuild("spoofax.depconstraints"))) - annotationProcessor(platform(compositeBuild("spoofax.depconstraints"))) + implementation(platform(compositeBuild("spoofax.depconstraints"))) + annotationProcessor(platform(compositeBuild("spoofax.depconstraints"))) - implementation(project(":tiger.spoofax")) - implementation(compositeBuild("spoofax.cli")) - implementation("org.metaborg:log.backend.slf4j") - implementation("org.metaborg:pie.runtime") - implementation("org.metaborg:pie.dagger") + implementation(project(":tiger.spoofax")) + implementation(compositeBuild("spoofax.cli")) + implementation("org.metaborg:log.backend.slf4j") + implementation("org.metaborg:pie.runtime") + implementation("org.metaborg:pie.dagger") - implementation("org.slf4j:slf4j-simple:1.7.26") + implementation("org.slf4j:slf4j-simple:1.7.26") - compileOnly("org.checkerframework:checker-qual-android") + compileOnly("org.checkerframework:checker-qual-android") - annotationProcessor("com.google.dagger:dagger-compiler") - annotationProcessor("info.picocli:picocli-codegen") + annotationProcessor("com.google.dagger:dagger-compiler") + annotationProcessor("info.picocli:picocli-codegen") } diff --git a/example/tiger/manual/tiger.eclipse/build.gradle.kts b/example/tiger/manual/tiger.eclipse/build.gradle.kts index 44c807bfc..1d294b89c 100755 --- a/example/tiger/manual/tiger.eclipse/build.gradle.kts +++ b/example/tiger/manual/tiger.eclipse/build.gradle.kts @@ -1,57 +1,57 @@ plugins { - id("org.metaborg.gradle.config.java-library") - id("org.metaborg.coronium.bundle") + id("org.metaborg.gradle.config.java-library") + id("org.metaborg.coronium.bundle") } mavenize { - majorVersion.set("2022-06") + majorVersion.set("2022-06") } fun compositeBuild(name: String) = "$group:$name:$version" dependencies { - api(platform(compositeBuild("spoofax.depconstraints"))) - annotationProcessor(platform(compositeBuild("spoofax.depconstraints"))) + api(platform(compositeBuild("spoofax.depconstraints"))) + annotationProcessor(platform(compositeBuild("spoofax.depconstraints"))) - bundleApi(compositeBuild("spoofax.eclipse")) + bundleApi(compositeBuild("spoofax.eclipse")) - bundleEmbedApi(project(":tiger")) - bundleEmbedApi(project(":tiger.spoofax")) + bundleEmbedApi(project(":tiger")) + bundleEmbedApi(project(":tiger.spoofax")) - compileOnly("org.checkerframework:checker-qual-android") - annotationProcessor("com.google.dagger:dagger-compiler") + compileOnly("org.checkerframework:checker-qual-android") + annotationProcessor("com.google.dagger:dagger-compiler") } // Use bnd to create a single OSGi bundle JAR that includes all dependencies. val exports = listOf( - // Provided by 'javax.inject' bundle. - "!javax.inject.*", - // Provided by 'spoofax.eclipse' bundle. - "!mb.log.*", - "!mb.resource.*", - "!mb.pie.*", - "!mb.common.*", - "!mb.spoofax.core.*", - "!dagger.*", - // Do not export testing packages. - "!junit.*", - "!org.junit.*", - // Do not export compile-time annotation packages. - "!org.checkerframework.*", - "!org.codehaus.mojo.animal_sniffer.*", - // Allow split package for 'mb.nabl'. - "mb.nabl2.*;-split-package:=merge-first", - // Export packages from this project. - "mb.tiger.eclipse.*", - // Export what is left, using a mandatory provider to prevent accidental imports via 'Import-Package'. - "*;provider=tiger;mandatory:=provider" + // Provided by 'javax.inject' bundle. + "!javax.inject.*", + // Provided by 'spoofax.eclipse' bundle. + "!mb.log.*", + "!mb.resource.*", + "!mb.pie.*", + "!mb.common.*", + "!mb.spoofax.core.*", + "!dagger.*", + // Do not export testing packages. + "!junit.*", + "!org.junit.*", + // Do not export compile-time annotation packages. + "!org.checkerframework.*", + "!org.codehaus.mojo.animal_sniffer.*", + // Allow split package for 'mb.nabl'. + "mb.nabl2.*;-split-package:=merge-first", + // Export packages from this project. + "mb.tiger.eclipse.*", + // Export what is left, using a mandatory provider to prevent accidental imports via 'Import-Package'. + "*;provider=tiger;mandatory:=provider" ) tasks { - "jar"(Jar::class) { - manifest { - attributes( - Pair("Export-Package", exports.joinToString(", ")) - ) + "jar"(Jar::class) { + manifest { + attributes( + Pair("Export-Package", exports.joinToString(", ")) + ) + } } - } } diff --git a/example/tiger/manual/tiger.intellij/build.gradle.kts b/example/tiger/manual/tiger.intellij/build.gradle.kts index 227b26523..d62ad83ed 100755 --- a/example/tiger/manual/tiger.intellij/build.gradle.kts +++ b/example/tiger/manual/tiger.intellij/build.gradle.kts @@ -1,43 +1,43 @@ plugins { - id("org.metaborg.gradle.config.java-library") - id("org.jetbrains.intellij") + id("org.metaborg.gradle.config.java-library") + id("org.jetbrains.intellij") } fun compositeBuild(name: String) = "$group:$name:$version" dependencies { - implementation(platform(compositeBuild("spoofax.depconstraints"))) - annotationProcessor(platform(compositeBuild("spoofax.depconstraints"))) + implementation(platform(compositeBuild("spoofax.depconstraints"))) + annotationProcessor(platform(compositeBuild("spoofax.depconstraints"))) - implementation("org.metaborg:pie.runtime") - implementation(compositeBuild("spoofax.core")) - implementation(compositeBuild("spoofax.intellij")) - implementation(project(":tiger.spoofax")) { - exclude(group = "org.slf4j") - } + implementation("org.metaborg:pie.runtime") + implementation(compositeBuild("spoofax.core")) + implementation(compositeBuild("spoofax.intellij")) + implementation(project(":tiger.spoofax")) { + exclude(group = "org.slf4j") + } - implementation("com.google.dagger:dagger") + implementation("com.google.dagger:dagger") - compileOnly("org.checkerframework:checker-qual-android") + compileOnly("org.checkerframework:checker-qual-android") - annotationProcessor("com.google.dagger:dagger-compiler") + annotationProcessor("com.google.dagger:dagger-compiler") } intellij { - version.set("2020.2.4") // 2020.2.4 is the last version that can be built with Java 8. - instrumentCode.set(false) // Skip non-incremental and slow code instrumentation. + version.set("2020.2.4") // 2020.2.4 is the last version that can be built with Java 8. + instrumentCode.set(false) // Skip non-incremental and slow code instrumentation. } tasks { - named("buildSearchableOptions") { - enabled = false // Skip non-incremental and slow `buildSearchableOptions` task from `org.jetbrains.intellij`. - } - - named("runIde") { - jbrVersion.set("11_0_2b159") // Set JBR version because the latest one cannot be downloaded. - // HACK: make task depend on the runtime classpath to forcefully make it depend on `spoofax.intellij`, which the - // `org.jetbrains.intellij` plugin seems to ignore. This is probably because `spoofax.intellij` is a plugin - // but is not listed as a plugin dependency. This hack may not work when publishing this plugin. - dependsOn(configurations.runtimeClasspath) - } + named("buildSearchableOptions") { + enabled = false // Skip non-incremental and slow `buildSearchableOptions` task from `org.jetbrains.intellij`. + } + + named("runIde") { + jbrVersion.set("11_0_2b159") // Set JBR version because the latest one cannot be downloaded. + // HACK: make task depend on the runtime classpath to forcefully make it depend on `spoofax.intellij`, which the + // `org.jetbrains.intellij` plugin seems to ignore. This is probably because `spoofax.intellij` is a plugin + // but is not listed as a plugin dependency. This hack may not work when publishing this plugin. + dependsOn(configurations.runtimeClasspath) + } } diff --git a/example/tiger/manual/tiger.spoofax/build.gradle.kts b/example/tiger/manual/tiger.spoofax/build.gradle.kts index ffe88dcf6..f6867e520 100755 --- a/example/tiger/manual/tiger.spoofax/build.gradle.kts +++ b/example/tiger/manual/tiger.spoofax/build.gradle.kts @@ -1,33 +1,33 @@ plugins { - id("org.metaborg.gradle.config.java-library") - id("org.metaborg.gradle.config.junit-testing") + id("org.metaborg.gradle.config.java-library") + id("org.metaborg.gradle.config.junit-testing") } fun compositeBuild(name: String) = "$group:$name:$version" dependencies { - // Platforms - api(platform(compositeBuild("spoofax.depconstraints"))) - annotationProcessor(platform(compositeBuild("spoofax.depconstraints"))) - testAnnotationProcessor(platform(compositeBuild("spoofax.depconstraints"))) + // Platforms + api(platform(compositeBuild("spoofax.depconstraints"))) + annotationProcessor(platform(compositeBuild("spoofax.depconstraints"))) + testAnnotationProcessor(platform(compositeBuild("spoofax.depconstraints"))) - // Main - api(project(":tiger")) - api(compositeBuild("spoofax.core")) - api(compositeBuild("aterm.common")) - api(compositeBuild("jsglr.pie")) - api(compositeBuild("constraint.pie")) - api(compositeBuild("transform.pie")) - api(compositeBuild("spt.api")) - api("org.metaborg:pie.api") - api("org.metaborg:pie.dagger") - api("com.google.dagger:dagger") + // Main + api(project(":tiger")) + api(compositeBuild("spoofax.core")) + api(compositeBuild("aterm.common")) + api(compositeBuild("jsglr.pie")) + api(compositeBuild("constraint.pie")) + api(compositeBuild("transform.pie")) + api(compositeBuild("spt.api")) + api("org.metaborg:pie.api") + api("org.metaborg:pie.dagger") + api("com.google.dagger:dagger") - compileOnly("org.checkerframework:checker-qual-android") + compileOnly("org.checkerframework:checker-qual-android") - annotationProcessor("com.google.dagger:dagger-compiler") + annotationProcessor("com.google.dagger:dagger-compiler") - // Test - testImplementation(compositeBuild("spoofax.test")) - testCompileOnly("org.checkerframework:checker-qual-android") + // Test + testImplementation(compositeBuild("spoofax.test")) + testCompileOnly("org.checkerframework:checker-qual-android") } diff --git a/example/tiger/manual/tiger/build.gradle.kts b/example/tiger/manual/tiger/build.gradle.kts index 55e39cb17..b72699d97 100755 --- a/example/tiger/manual/tiger/build.gradle.kts +++ b/example/tiger/manual/tiger/build.gradle.kts @@ -1,93 +1,93 @@ plugins { - id("org.metaborg.gradle.config.java-library") - id("org.metaborg.gradle.config.junit-testing") - id("org.metaborg.devenv.spoofax.gradle.base") + id("org.metaborg.gradle.config.java-library") + id("org.metaborg.gradle.config.junit-testing") + id("org.metaborg.devenv.spoofax.gradle.base") } sourceSets { - main { - java { - srcDir("$buildDir/generated/sources/spoofax/java") + main { + java { + srcDir("$buildDir/generated/sources/spoofax/java") + } } - } } fun compositeBuild(name: String) = "$group:$name:$version" dependencies { - api(platform(compositeBuild("spoofax.depconstraints"))) + api(platform(compositeBuild("spoofax.depconstraints"))) - api("org.metaborg:common") - api(compositeBuild("spoofax.compiler.interfaces")) - api(compositeBuild("spoofax.resource")) - api(compositeBuild("jsglr1.common")) - api(compositeBuild("esv.common")) - api(compositeBuild("stratego.common")) - api(compositeBuild("constraint.common")) + api("org.metaborg:common") + api(compositeBuild("spoofax.compiler.interfaces")) + api(compositeBuild("spoofax.resource")) + api(compositeBuild("jsglr1.common")) + api(compositeBuild("esv.common")) + api(compositeBuild("stratego.common")) + api(compositeBuild("constraint.common")) - implementation(compositeBuild("nabl2.common")) - implementation("org.metaborg:strategoxt-min-jar") + implementation(compositeBuild("nabl2.common")) + implementation("org.metaborg:strategoxt-min-jar") - compileOnly("org.checkerframework:checker-qual-android") + compileOnly("org.checkerframework:checker-qual-android") - testImplementation(compositeBuild("spoofax.test")) - testCompileOnly("org.checkerframework:checker-qual-android") + testImplementation(compositeBuild("spoofax.test")) + testCompileOnly("org.checkerframework:checker-qual-android") } fun copySpoofaxLanguageResources( - dependency: Dependency, - destinationPackage: String, - includeStrategoClasses: Boolean, - vararg resources: String + dependency: Dependency, + destinationPackage: String, + includeStrategoClasses: Boolean, + vararg resources: String, ) { - val allResources = resources.toMutableList() - if(includeStrategoClasses) { - allResources.add("target/metaborg/stratego.jar") - } + val allResources = resources.toMutableList() + if (includeStrategoClasses) { + allResources.add("target/metaborg/stratego.jar") + } - // Add language dependency. - dependencies.add("compileLanguage", dependency) + // Add language dependency. + dependencies.add("compileLanguage", dependency) - // Unpack the '.spoofax-language' archive. - val languageFiles = project.configurations.getByName("languageFiles") - val unpackSpoofaxLanguageDir = "$buildDir/unpackedSpoofaxLanguage/" - val unpackSpoofaxLanguageTask = tasks.register("unpackSpoofaxLanguage") { - dependsOn(languageFiles) - from({ languageFiles.map { project.zipTree(it) } }) /* Closure inside `from` to defer evaluation until task execution time */ - into(unpackSpoofaxLanguageDir) - include(allResources) - } - // Copy resources into `mainSourceSet.java.outputDir` and `testSourceSet.java.outputDir`, so they end up in the target package. - val resourcesCopySpec = copySpec { - from(unpackSpoofaxLanguageDir) - include(*resources) - } - val strategoCopySpec = copySpec { - from(project.zipTree("$unpackSpoofaxLanguageDir/target/metaborg/stratego.jar")) - exclude("META-INF") - } - val copyMainTask = tasks.register("copyMainResources") { - dependsOn(unpackSpoofaxLanguageTask) - into(sourceSets.main.get().java.outputDir) - into(destinationPackage) { with(resourcesCopySpec) } - if(includeStrategoClasses) { - into(".") { with(strategoCopySpec) } + // Unpack the '.spoofax-language' archive. + val languageFiles = project.configurations.getByName("languageFiles") + val unpackSpoofaxLanguageDir = "$buildDir/unpackedSpoofaxLanguage/" + val unpackSpoofaxLanguageTask = tasks.register("unpackSpoofaxLanguage") { + dependsOn(languageFiles) + from({ languageFiles.map { project.zipTree(it) } }) /* Closure inside `from` to defer evaluation until task execution time */ + into(unpackSpoofaxLanguageDir) + include(allResources) + } + // Copy resources into `mainSourceSet.java.outputDir` and `testSourceSet.java.outputDir`, so they end up in the target package. + val resourcesCopySpec = copySpec { + from(unpackSpoofaxLanguageDir) + include(*resources) + } + val strategoCopySpec = copySpec { + from(project.zipTree("$unpackSpoofaxLanguageDir/target/metaborg/stratego.jar")) + exclude("META-INF") + } + val copyMainTask = tasks.register("copyMainResources") { + dependsOn(unpackSpoofaxLanguageTask) + into(sourceSets.main.get().java.outputDir) + into(destinationPackage) { with(resourcesCopySpec) } + if (includeStrategoClasses) { + into(".") { with(strategoCopySpec) } + } } - } - tasks.getByName(JavaPlugin.CLASSES_TASK_NAME).dependsOn(copyMainTask) - val copyTestTask = tasks.register("copyTestResources") { - dependsOn(unpackSpoofaxLanguageTask) - into(sourceSets.test.get().java.outputDir) - into(destinationPackage) { with(resourcesCopySpec) } - if(includeStrategoClasses) { - into(".") { with(strategoCopySpec) } + tasks.getByName(JavaPlugin.CLASSES_TASK_NAME).dependsOn(copyMainTask) + val copyTestTask = tasks.register("copyTestResources") { + dependsOn(unpackSpoofaxLanguageTask) + into(sourceSets.test.get().java.outputDir) + into(destinationPackage) { with(resourcesCopySpec) } + if (includeStrategoClasses) { + into(".") { with(strategoCopySpec) } + } } - } - tasks.getByName(JavaPlugin.TEST_CLASSES_TASK_NAME).dependsOn(copyTestTask) + tasks.getByName(JavaPlugin.TEST_CLASSES_TASK_NAME).dependsOn(copyTestTask) } copySpoofaxLanguageResources( - dependencies.create(compositeBuild("tiger.spoofaxcore")), - "mb/tiger", - true, - "target/metaborg/editor.esv.af", "target/metaborg/sdf.tbl" + dependencies.create(compositeBuild("tiger.spoofaxcore")), + "mb/tiger", + true, + "target/metaborg/editor.esv.af", "target/metaborg/sdf.tbl" ) diff --git a/example/tiger/spoofax3/tiger.spoofax3.cli/build.gradle.kts b/example/tiger/spoofax3/tiger.spoofax3.cli/build.gradle.kts index 1aaf1cf15..f5dbb67c0 100644 --- a/example/tiger/spoofax3/tiger.spoofax3.cli/build.gradle.kts +++ b/example/tiger/spoofax3/tiger.spoofax3.cli/build.gradle.kts @@ -1,15 +1,15 @@ plugins { - id("org.metaborg.gradle.config.java-library") - id("org.metaborg.spoofax.compiler.gradle.cli") + id("org.metaborg.gradle.config.java-library") + id("org.metaborg.spoofax.compiler.gradle.cli") } languageCliProject { - adapterProject.set(project(":tiger.spoofax3")) + adapterProject.set(project(":tiger.spoofax3")) } tasks { - // Disable currently unused distribution tasks. - distZip.configure { enabled = false } - distTar.configure { enabled = false } - startScripts.configure { enabled = false } + // Disable currently unused distribution tasks. + distZip.configure { enabled = false } + distTar.configure { enabled = false } + startScripts.configure { enabled = false } } diff --git a/example/tiger/spoofax3/tiger.spoofax3.eclipse/build.gradle.kts b/example/tiger/spoofax3/tiger.spoofax3.eclipse/build.gradle.kts index 5d45d6bdd..6d3016ef9 100644 --- a/example/tiger/spoofax3/tiger.spoofax3.eclipse/build.gradle.kts +++ b/example/tiger/spoofax3/tiger.spoofax3.eclipse/build.gradle.kts @@ -1,11 +1,11 @@ plugins { - id("org.metaborg.gradle.config.java-library") - id("org.metaborg.spoofax.compiler.gradle.eclipse") + id("org.metaborg.gradle.config.java-library") + id("org.metaborg.spoofax.compiler.gradle.eclipse") } languageEclipseProject { - adapterProject.set(project(":tiger.spoofax3")) + adapterProject.set(project(":tiger.spoofax3")) } mavenize { - majorVersion.set("2022-06") + majorVersion.set("2022-06") } diff --git a/example/tiger/spoofax3/tiger.spoofax3.intellij/build.gradle.kts b/example/tiger/spoofax3/tiger.spoofax3.intellij/build.gradle.kts index f315cb1a7..ea628068c 100644 --- a/example/tiger/spoofax3/tiger.spoofax3.intellij/build.gradle.kts +++ b/example/tiger/spoofax3/tiger.spoofax3.intellij/build.gradle.kts @@ -1,8 +1,8 @@ plugins { - id("org.metaborg.gradle.config.java-library") - id("org.metaborg.spoofax.compiler.gradle.intellij") + id("org.metaborg.gradle.config.java-library") + id("org.metaborg.spoofax.compiler.gradle.intellij") } languageIntellijProject { - adapterProject.set(project(":tiger.spoofax3")) + adapterProject.set(project(":tiger.spoofax3")) } diff --git a/example/tiger/spoofax3/tiger.spoofax3/build.gradle.kts b/example/tiger/spoofax3/tiger.spoofax3/build.gradle.kts index a5dfa9c1b..e12db5566 100644 --- a/example/tiger/spoofax3/tiger.spoofax3/build.gradle.kts +++ b/example/tiger/spoofax3/tiger.spoofax3/build.gradle.kts @@ -1,15 +1,13 @@ -import mb.spoofax.compiler.adapter.* - plugins { - `maven-publish` - id("org.metaborg.gradle.config.java-library") - id("org.metaborg.gradle.config.junit-testing") - id("org.metaborg.spoofax.lwb.compiler.gradle.language") + `maven-publish` + id("org.metaborg.gradle.config.java-library") + id("org.metaborg.gradle.config.junit-testing") + id("org.metaborg.spoofax.lwb.compiler.gradle.language") } fun compositeBuild(name: String) = "$group:$name:$version" dependencies { - testImplementation(compositeBuild("spoofax.test")) - testCompileOnly("org.checkerframework:checker-qual-android") + testImplementation(compositeBuild("spoofax.test")) + testCompileOnly("org.checkerframework:checker-qual-android") } diff --git a/example/tiger/spoofaxcore/tiger.spoofaxcore/build.gradle.kts b/example/tiger/spoofaxcore/tiger.spoofaxcore/build.gradle.kts index 8e7012431..869c2d5d7 100644 --- a/example/tiger/spoofaxcore/tiger.spoofaxcore/build.gradle.kts +++ b/example/tiger/spoofaxcore/tiger.spoofaxcore/build.gradle.kts @@ -1,13 +1,13 @@ plugins { - id("org.metaborg.devenv.spoofax.gradle.langspec") - `maven-publish` + id("org.metaborg.devenv.spoofax.gradle.langspec") + `maven-publish` } val spoofax2DevenvVersion: String by ext dependencies { - compileLanguage("org.metaborg.devenv:org.metaborg.meta.lang.template:$spoofax2DevenvVersion") - compileLanguage("org.metaborg.devenv:org.metaborg.meta.lang.esv:$spoofax2DevenvVersion") - compileLanguage("org.metaborg.devenv:statix.lang:$spoofax2DevenvVersion") - sourceLanguage("org.metaborg.devenv:meta.lib.spoofax:$spoofax2DevenvVersion") - sourceLanguage("org.metaborg.devenv:statix.runtime:$spoofax2DevenvVersion") + compileLanguage("org.metaborg.devenv:org.metaborg.meta.lang.template:$spoofax2DevenvVersion") + compileLanguage("org.metaborg.devenv:org.metaborg.meta.lang.esv:$spoofax2DevenvVersion") + compileLanguage("org.metaborg.devenv:statix.lang:$spoofax2DevenvVersion") + sourceLanguage("org.metaborg.devenv:meta.lib.spoofax:$spoofax2DevenvVersion") + sourceLanguage("org.metaborg.devenv:statix.runtime:$spoofax2DevenvVersion") } diff --git a/lwb.distrib/build.gradle.kts b/lwb.distrib/build.gradle.kts index 3d3a57ec6..6f58da7e6 100644 --- a/lwb.distrib/build.gradle.kts +++ b/lwb.distrib/build.gradle.kts @@ -1,40 +1,40 @@ plugins { - id("org.metaborg.gradle.config.root-project") version "0.5.6" - id("org.metaborg.gitonium") version "1.2.0" + id("org.metaborg.gradle.config.root-project") version "0.5.6" + id("org.metaborg.gitonium") version "1.2.0" - // Set versions for plugins to use, only applying them in subprojects (apply false here). - id("org.metaborg.devenv.spoofax.gradle.langspec") version "0.1.32" apply false - id("org.metaborg.coronium.bundle") version "0.3.17" apply false - id("org.metaborg.coronium.feature") version "0.3.17" apply false - id("org.metaborg.coronium.repository") version "0.3.17" apply false - id("biz.aQute.bnd.builder") version "5.3.0" apply false - id("org.jetbrains.intellij") version "1.4.0" apply false + // Set versions for plugins to use, only applying them in subprojects (apply false here). + id("org.metaborg.devenv.spoofax.gradle.langspec") version "0.1.32" apply false + id("org.metaborg.coronium.bundle") version "0.3.17" apply false + id("org.metaborg.coronium.feature") version "0.3.17" apply false + id("org.metaborg.coronium.repository") version "0.3.17" apply false + id("biz.aQute.bnd.builder") version "5.3.0" apply false + id("org.jetbrains.intellij") version "1.4.0" apply false - id("org.metaborg.spoofax.compiler.gradle.language") apply false - id("org.metaborg.spoofax.compiler.gradle.adapter") apply false - id("org.metaborg.spoofax.compiler.gradle.cli") apply false - id("org.metaborg.spoofax.compiler.gradle.eclipse") apply false - id("org.metaborg.spoofax.compiler.gradle.intellij") apply false - id("org.metaborg.spoofax.compiler.gradle.spoofax2.language") apply false + id("org.metaborg.spoofax.compiler.gradle.language") apply false + id("org.metaborg.spoofax.compiler.gradle.adapter") apply false + id("org.metaborg.spoofax.compiler.gradle.cli") apply false + id("org.metaborg.spoofax.compiler.gradle.eclipse") apply false + id("org.metaborg.spoofax.compiler.gradle.intellij") apply false + id("org.metaborg.spoofax.compiler.gradle.spoofax2.language") apply false - id("org.metaborg.spoofax.lwb.compiler.gradle.language") apply false + id("org.metaborg.spoofax.lwb.compiler.gradle.language") apply false } subprojects { - metaborg { - configureSubProject() - if(name.contains(".cli") || name.contains(".eclipse") || name.contains(".intellij")) { - // Do not publish CLI, Eclipse plugin, and IntelliJ plugin for now. - javaCreatePublication = false - javaCreateSourcesJar = false - javaCreateJavadocJar = false + metaborg { + configureSubProject() + if (name.contains(".cli") || name.contains(".eclipse") || name.contains(".intellij")) { + // Do not publish CLI, Eclipse plugin, and IntelliJ plugin for now. + javaCreatePublication = false + javaCreateSourcesJar = false + javaCreateJavadocJar = false + } } - } } val spoofax2Version: String = System.getProperty("spoofax2Version") val spoofax2DevenvVersion: String = System.getProperty("spoofax2DevenvVersion") allprojects { - ext["spoofax2Version"] = spoofax2Version - ext["spoofax2DevenvVersion"] = spoofax2DevenvVersion + ext["spoofax2Version"] = spoofax2Version + ext["spoofax2DevenvVersion"] = spoofax2DevenvVersion } diff --git a/lwb.distrib/lang/rv32im/rv32im.eclipse/build.gradle.kts b/lwb.distrib/lang/rv32im/rv32im.eclipse/build.gradle.kts index 373b84184..b71fe427e 100644 --- a/lwb.distrib/lang/rv32im/rv32im.eclipse/build.gradle.kts +++ b/lwb.distrib/lang/rv32im/rv32im.eclipse/build.gradle.kts @@ -1,36 +1,36 @@ plugins { - id("org.metaborg.gradle.config.java-library") - id("org.metaborg.spoofax.compiler.gradle.eclipse") + id("org.metaborg.gradle.config.java-library") + id("org.metaborg.spoofax.compiler.gradle.eclipse") } mavenize { - majorVersion.set("2022-06") + majorVersion.set("2022-06") } languageEclipseProject { - adapterProject.set(project(":rv32im")) + adapterProject.set(project(":rv32im")) } tasks { - "jar"(Jar::class) { - val exportPackages = LinkedHashSet() - val existingExportPackages = manifest.attributes.get("Export-Package") - if(existingExportPackages != null) { - exportPackages.add(existingExportPackages.toString()) + "jar"(Jar::class) { + val exportPackages = LinkedHashSet() + val existingExportPackages = manifest.attributes.get("Export-Package") + if (existingExportPackages != null) { + exportPackages.add(existingExportPackages.toString()) + } + val privatePackages = LinkedHashSet() + val existingPrivatePackages = manifest.attributes.get("Private-Package") + if (existingPrivatePackages != null) { + privatePackages.add(existingPrivatePackages.toString()) + } + // Embed `edu.berkeley.eecs.venus164:venus164` and `org.jetbrains.kotlin:kotlin-stdlib` because `rv32im` depends on it. + privatePackages.add("venus.*") + privatePackages.add("kotlin.*") + manifest { + attributes( + Pair("Export-Package", exportPackages.joinToString(", ")), + Pair("Private-Package", privatePackages.joinToString(", ")) + ) + } } - val privatePackages = LinkedHashSet() - val existingPrivatePackages = manifest.attributes.get("Private-Package") - if(existingPrivatePackages != null) { - privatePackages.add(existingPrivatePackages.toString()) - } - // Embed `edu.berkeley.eecs.venus164:venus164` and `org.jetbrains.kotlin:kotlin-stdlib` because `rv32im` depends on it. - privatePackages.add("venus.*") - privatePackages.add("kotlin.*") - manifest { - attributes( - Pair("Export-Package", exportPackages.joinToString(", ")), - Pair("Private-Package", privatePackages.joinToString(", ")) - ) - } - } } diff --git a/lwb.distrib/lang/rv32im/rv32im/build.gradle.kts b/lwb.distrib/lang/rv32im/rv32im/build.gradle.kts index 45882bd30..69adf9e77 100644 --- a/lwb.distrib/lang/rv32im/rv32im/build.gradle.kts +++ b/lwb.distrib/lang/rv32im/rv32im/build.gradle.kts @@ -1,9 +1,9 @@ plugins { - id("org.metaborg.gradle.config.java-library") - id("org.metaborg.spoofax.lwb.compiler.gradle.language") + id("org.metaborg.gradle.config.java-library") + id("org.metaborg.spoofax.lwb.compiler.gradle.language") } dependencies { - implementation("edu.berkeley.eecs.venus164:venus164:0.2.5") - implementation("org.jetbrains.kotlin:kotlin-stdlib:1.4.10") + implementation("edu.berkeley.eecs.venus164:venus164:0.2.5") + implementation("org.jetbrains.kotlin:kotlin-stdlib:1.4.10") } diff --git a/lwb.distrib/settings.gradle.kts b/lwb.distrib/settings.gradle.kts index 51f8ca9d2..1bec11c20 100644 --- a/lwb.distrib/settings.gradle.kts +++ b/lwb.distrib/settings.gradle.kts @@ -1,39 +1,39 @@ rootProject.name = "spoofax3.lwb.distrib.root" pluginManagement { - repositories { - maven("https://artifacts.metaborg.org/content/groups/public/") - } + repositories { + maven("https://artifacts.metaborg.org/content/groups/public/") + } } // Only include composite builds when this is the root project (it has no parent), for example when running Gradle tasks // from the command-line. Otherwise, the parent project (spoofax.root) will include these composite builds. -if(gradle.parent == null) { - includeBuildWithName("../core", "spoofax3.core.root") - includeBuildWithName("../lwb", "spoofax3.lwb.root") +if (gradle.parent == null) { + includeBuildWithName("../core", "spoofax3.core.root") + includeBuildWithName("../lwb", "spoofax3.lwb.root") } fun includeBuildWithName(dir: String, name: String) { - includeBuild(dir) { - try { - ConfigurableIncludedBuild::class.java - .getDeclaredMethod("setName", String::class.java) - .invoke(this, name) - } catch(e: NoSuchMethodException) { - // Running Gradle < 6, no need to set the name, ignore. + includeBuild(dir) { + try { + ConfigurableIncludedBuild::class.java + .getDeclaredMethod("setName", String::class.java) + .invoke(this, name) + } catch (e: NoSuchMethodException) { + // Running Gradle < 6, no need to set the name, ignore. + } } - } } fun String.includeProject(id: String, path: String = "$this/$id") { - include(id) - project(":$id").projectDir = file(path) + include(id) + project(":$id").projectDir = file(path) } "lang/rv32im".run { - includeProject("rv32im") - includeProject("rv32im.eclipse") + includeProject("rv32im") + includeProject("rv32im.eclipse") } include("spoofax.lwb.eclipse") diff --git a/lwb.distrib/spoofax.lwb.eclipse.feature/build.gradle.kts b/lwb.distrib/spoofax.lwb.eclipse.feature/build.gradle.kts index f599e70ed..4b884af22 100644 --- a/lwb.distrib/spoofax.lwb.eclipse.feature/build.gradle.kts +++ b/lwb.distrib/spoofax.lwb.eclipse.feature/build.gradle.kts @@ -1,20 +1,20 @@ plugins { - id("org.metaborg.coronium.feature") + id("org.metaborg.coronium.feature") } mavenize { - majorVersion.set("2022-06") + majorVersion.set("2022-06") } fun compositeBuild(name: String) = "$group:$name:$version" dependencies { - bundle(project(":spoofax.lwb.eclipse")) - bundle(project(":rv32im.eclipse")) + bundle(project(":spoofax.lwb.eclipse")) + bundle(project(":rv32im.eclipse")) } tasks { - withType { - jvmArgs("-Xss16M") // Set required stack size, mainly for serialization. - } + withType { + jvmArgs("-Xss16M") // Set required stack size, mainly for serialization. + } } diff --git a/lwb.distrib/spoofax.lwb.eclipse.repository/build.gradle.kts b/lwb.distrib/spoofax.lwb.eclipse.repository/build.gradle.kts index 5ba781aa3..13bf778ae 100644 --- a/lwb.distrib/spoofax.lwb.eclipse.repository/build.gradle.kts +++ b/lwb.distrib/spoofax.lwb.eclipse.repository/build.gradle.kts @@ -1,28 +1,28 @@ plugins { - id("org.metaborg.coronium.repository") - `maven-publish` + id("org.metaborg.coronium.repository") + `maven-publish` } mavenize { - majorVersion.set("2022-06") + majorVersion.set("2022-06") } repository { - eclipseInstallationAppName.set("Spoofax3") - createEclipseInstallationPublications.set(true) - createEclipseInstallationWithJvmPublications.set(true) + eclipseInstallationAppName.set("Spoofax3") + createEclipseInstallationPublications.set(true) + createEclipseInstallationWithJvmPublications.set(true) } fun compositeBuild(name: String) = "$group:$name:$version" dependencies { - feature(project(":spoofax.lwb.eclipse.feature")) + feature(project(":spoofax.lwb.eclipse.feature")) } tasks { - withType { - jvmArgs("-Xss16M") // Set required stack size, mainly for serialization. - } + withType { + jvmArgs("-Xss16M") // Set required stack size, mainly for serialization. + } // withType { // baseRepositories.set(listOf( // "https://artifacts.metaborg.org/content/groups/eclipse-2021-09/" diff --git a/lwb.distrib/spoofax.lwb.eclipse/build.gradle.kts b/lwb.distrib/spoofax.lwb.eclipse/build.gradle.kts index 31e018a9e..88ab14d4b 100644 --- a/lwb.distrib/spoofax.lwb.eclipse/build.gradle.kts +++ b/lwb.distrib/spoofax.lwb.eclipse/build.gradle.kts @@ -1,172 +1,172 @@ plugins { - id("org.metaborg.gradle.config.java-library") - id("org.metaborg.coronium.bundle") + id("org.metaborg.gradle.config.java-library") + id("org.metaborg.coronium.bundle") } fun compositeBuild(name: String) = "$group:$name:$version" mavenize { - majorVersion.set("2022-06") + majorVersion.set("2022-06") } dependencies { - api(platform(compositeBuild("spoofax.depconstraints"))) - annotationProcessor(platform(compositeBuild("spoofax.depconstraints"))) - - - bundleTargetPlatformApi(eclipse("javax.inject")) - bundleTargetPlatformApi(eclipse("org.eclipse.jdt.core")) - - - bundleApi(compositeBuild("spoofax.eclipse")) - bundleApi(compositeBuild("tooling.eclipsebundle")) - bundleApi(compositeBuild("spoofax.compiler.eclipsebundle")) - - - bundleImplementation(compositeBuild("cfg.eclipse")) - bundleImplementation(compositeBuild("sdf3.eclipse")) - bundleImplementation(compositeBuild("esv.eclipse")) - bundleImplementation(compositeBuild("stratego.eclipse")) - bundleImplementation(compositeBuild("statix.eclipse")) - bundleImplementation(compositeBuild("dynamix.eclipse")) - bundleImplementation(compositeBuild("sdf3_ext_statix.eclipse")) - bundleImplementation(compositeBuild("sdf3_ext_dynamix.eclipse")) - bundleImplementation(compositeBuild("spt.eclipse")) - - bundleImplementation(compositeBuild("strategolib.eclipse")) - bundleImplementation(compositeBuild("gpp.eclipse")) - bundleImplementation(compositeBuild("libspoofax2.eclipse")) - bundleImplementation(compositeBuild("libstatix.eclipse")) - - bundleImplementation(project(":rv32im.eclipse")) - - - // Convenient library to get the current classpath, which works under OSGi (Eclipse) as well. Used to pass the current - // classpath to the Java compiler. - // TODO: only using this to extract a classpath, can we just copy that functionality without a dependency? - bundleEmbedImplementation("io.github.classgraph:classgraph:4.8.102") - - bundleEmbedImplementation("com.google.dagger:dagger-compiler") { - // Exclude `checker-qual` in favor of `checker-qual-android` which has classfile retention instead of runtime. - exclude("org.checkerframework", "checker-qual") - } - - // HACK: embed javax.inject as classgraph does not seem to pick up the above javax.inject dependency? - bundleEmbedImplementation("javax.inject:javax.inject:1") - - // Embed `:spoofax.lwb.dynamicloading`. - bundleEmbedImplementation(compositeBuild("spoofax.lwb.dynamicloading")) { - // Exclude modules already exported by `spoofax.eclipse` - exclude("org.metaborg", "common") - exclude("org.metaborg", "spoofax.core") - exclude("org.metaborg", "log.api") - exclude("org.metaborg", "resource") - exclude("org.metaborg", "pie.api") - exclude("org.metaborg", "pie.runtime") - exclude("com.google.dagger", "dagger") - - // Exclude dagger-compile because we already manually embed it. - exclude("com.google.dagger", "dagger-compiler") - } - - // Embed `:spoofax.lwb.compiler`. - bundleEmbedImplementation(compositeBuild("spoofax.lwb.compiler")) { - // Exclude meta-languages and libraries, as they have their own Eclipse plugins - exclude("org.metaborg", "cfg") - exclude("org.metaborg", "sdf3") - exclude("org.metaborg", "esv") - exclude("org.metaborg", "stratego") - exclude("org.metaborg", "statix") - exclude("org.metaborg", "sdf3_ext_statix") - exclude("org.metaborg", "spt") - - exclude("org.metaborg", "strategolib") - exclude("org.metaborg", "gpp") - exclude("org.metaborg", "libspoofax2") - exclude("org.metaborg", "libstatix") - - // Exclude modules already exported by `spoofax.eclipse` - exclude("org.metaborg", "common") - exclude("org.metaborg", "spoofax.core") - exclude("org.metaborg", "log.api") - exclude("org.metaborg", "resource") - exclude("org.metaborg", "pie.api") - exclude("org.metaborg", "pie.runtime") - exclude("com.google.dagger", "dagger") - - // Exclude modules already exported by `tooling.eclipsebundle` - exclude("org.metaborg", "spoofax.compiler.interfaces") - - // Exclude modules already exported by `spoofax.compiler.eclipsebundle` - exclude("org.metaborg", "spoofax.compiler") - - // Exclude dagger-compile because we already manually embed it. - exclude("com.google.dagger", "dagger-compiler") - } - - // Embed `:spt.dynamicloading`. - bundleEmbedImplementation(compositeBuild("spt.dynamicloading")) - - // Embed `org.metaborg:pie.task.archive` and `org.metaborg:pie.task.java` - bundleEmbedImplementation("org.metaborg:pie.task.archive") - bundleEmbedImplementation("org.metaborg:pie.task.java") - - // Embed FST serialize/deserialize implementation. - bundleEmbedImplementation("org.metaborg:pie.serde.fst") - - compileOnly("org.checkerframework:checker-qual-android") - - annotationProcessor("com.google.dagger:dagger-compiler") + api(platform(compositeBuild("spoofax.depconstraints"))) + annotationProcessor(platform(compositeBuild("spoofax.depconstraints"))) + + + bundleTargetPlatformApi(eclipse("javax.inject")) + bundleTargetPlatformApi(eclipse("org.eclipse.jdt.core")) + + + bundleApi(compositeBuild("spoofax.eclipse")) + bundleApi(compositeBuild("tooling.eclipsebundle")) + bundleApi(compositeBuild("spoofax.compiler.eclipsebundle")) + + + bundleImplementation(compositeBuild("cfg.eclipse")) + bundleImplementation(compositeBuild("sdf3.eclipse")) + bundleImplementation(compositeBuild("esv.eclipse")) + bundleImplementation(compositeBuild("stratego.eclipse")) + bundleImplementation(compositeBuild("statix.eclipse")) + bundleImplementation(compositeBuild("dynamix.eclipse")) + bundleImplementation(compositeBuild("sdf3_ext_statix.eclipse")) + bundleImplementation(compositeBuild("sdf3_ext_dynamix.eclipse")) + bundleImplementation(compositeBuild("spt.eclipse")) + + bundleImplementation(compositeBuild("strategolib.eclipse")) + bundleImplementation(compositeBuild("gpp.eclipse")) + bundleImplementation(compositeBuild("libspoofax2.eclipse")) + bundleImplementation(compositeBuild("libstatix.eclipse")) + + bundleImplementation(project(":rv32im.eclipse")) + + + // Convenient library to get the current classpath, which works under OSGi (Eclipse) as well. Used to pass the current + // classpath to the Java compiler. + // TODO: only using this to extract a classpath, can we just copy that functionality without a dependency? + bundleEmbedImplementation("io.github.classgraph:classgraph:4.8.102") + + bundleEmbedImplementation("com.google.dagger:dagger-compiler") { + // Exclude `checker-qual` in favor of `checker-qual-android` which has classfile retention instead of runtime. + exclude("org.checkerframework", "checker-qual") + } + + // HACK: embed javax.inject as classgraph does not seem to pick up the above javax.inject dependency? + bundleEmbedImplementation("javax.inject:javax.inject:1") + + // Embed `:spoofax.lwb.dynamicloading`. + bundleEmbedImplementation(compositeBuild("spoofax.lwb.dynamicloading")) { + // Exclude modules already exported by `spoofax.eclipse` + exclude("org.metaborg", "common") + exclude("org.metaborg", "spoofax.core") + exclude("org.metaborg", "log.api") + exclude("org.metaborg", "resource") + exclude("org.metaborg", "pie.api") + exclude("org.metaborg", "pie.runtime") + exclude("com.google.dagger", "dagger") + + // Exclude dagger-compile because we already manually embed it. + exclude("com.google.dagger", "dagger-compiler") + } + + // Embed `:spoofax.lwb.compiler`. + bundleEmbedImplementation(compositeBuild("spoofax.lwb.compiler")) { + // Exclude meta-languages and libraries, as they have their own Eclipse plugins + exclude("org.metaborg", "cfg") + exclude("org.metaborg", "sdf3") + exclude("org.metaborg", "esv") + exclude("org.metaborg", "stratego") + exclude("org.metaborg", "statix") + exclude("org.metaborg", "sdf3_ext_statix") + exclude("org.metaborg", "spt") + + exclude("org.metaborg", "strategolib") + exclude("org.metaborg", "gpp") + exclude("org.metaborg", "libspoofax2") + exclude("org.metaborg", "libstatix") + + // Exclude modules already exported by `spoofax.eclipse` + exclude("org.metaborg", "common") + exclude("org.metaborg", "spoofax.core") + exclude("org.metaborg", "log.api") + exclude("org.metaborg", "resource") + exclude("org.metaborg", "pie.api") + exclude("org.metaborg", "pie.runtime") + exclude("com.google.dagger", "dagger") + + // Exclude modules already exported by `tooling.eclipsebundle` + exclude("org.metaborg", "spoofax.compiler.interfaces") + + // Exclude modules already exported by `spoofax.compiler.eclipsebundle` + exclude("org.metaborg", "spoofax.compiler") + + // Exclude dagger-compile because we already manually embed it. + exclude("com.google.dagger", "dagger-compiler") + } + + // Embed `:spt.dynamicloading`. + bundleEmbedImplementation(compositeBuild("spt.dynamicloading")) + + // Embed `org.metaborg:pie.task.archive` and `org.metaborg:pie.task.java` + bundleEmbedImplementation("org.metaborg:pie.task.archive") + bundleEmbedImplementation("org.metaborg:pie.task.java") + + // Embed FST serialize/deserialize implementation. + bundleEmbedImplementation("org.metaborg:pie.serde.fst") + + compileOnly("org.checkerframework:checker-qual-android") + + annotationProcessor("com.google.dagger:dagger-compiler") } val privatePackage = listOf( - // Our own packages should not be private. - "!mb.spoofax.lwb.eclipse", - "!mb.spoofax.lwb.eclipse.*", - // Allow split packages for `mb.spoofax.lwb.compiler` because `spoofax.lwb.compiler.dagger` generates dagger classes - // in the same package - "mb.spoofax.lwb.compiler.*;-split-package:=merge-first", - // Embed `mb.spoofax.lwb`, `mb.spoofax.lwb.dynamicloading`, and co. - "mb.spoofax.lwb.*", - // Embed `mb.spt.dynamicloading` - "mb.spt.dynamicloading.*", - // Embed `javax.inject` - "javax.inject.*", - // Embed `org.checkerframework:checker-qual-android` - "org.checkerframework.*", - // Embed `com.google.dagger:dagger-compiler` and dependencies. Allow split packages for `dagger.model`, as - // `dagger-compiler` and `dagger-spi` both have this package - "dagger.model.*;-split-package:=merge-first", - "dagger.*", - "dagger.internal.*", - "com.google.common.*", - "com.google.common.util.concurrent.internal.*", - "com.squareup.javapoet.*", - "kotlin.*;-split-package:=merge-first", - "javax.annotation.*;-split-package:=merge-first", - // Embed `io.github.classgraph:classgraph`. - "io.github.classgraph.*", - "nonapi.io.github.classgraph.*", - // Embed PIE task modules - "mb.pie.task.archive.*", - "mb.pie.task.java.*", - // Embed PIE FST Serde, FST, and its dependencies. - "mb.pie.serde.fst.*", - "org.nustaq.*", - "com.fasterxml.jackson.core.*", - "org.objenesis.*", - // Embed services, to make the embedded Dagger annotation processor work. - "META-INF.services.*;-split-package:=merge-first" + // Our own packages should not be private. + "!mb.spoofax.lwb.eclipse", + "!mb.spoofax.lwb.eclipse.*", + // Allow split packages for `mb.spoofax.lwb.compiler` because `spoofax.lwb.compiler.dagger` generates dagger classes + // in the same package + "mb.spoofax.lwb.compiler.*;-split-package:=merge-first", + // Embed `mb.spoofax.lwb`, `mb.spoofax.lwb.dynamicloading`, and co. + "mb.spoofax.lwb.*", + // Embed `mb.spt.dynamicloading` + "mb.spt.dynamicloading.*", + // Embed `javax.inject` + "javax.inject.*", + // Embed `org.checkerframework:checker-qual-android` + "org.checkerframework.*", + // Embed `com.google.dagger:dagger-compiler` and dependencies. Allow split packages for `dagger.model`, as + // `dagger-compiler` and `dagger-spi` both have this package + "dagger.model.*;-split-package:=merge-first", + "dagger.*", + "dagger.internal.*", + "com.google.common.*", + "com.google.common.util.concurrent.internal.*", + "com.squareup.javapoet.*", + "kotlin.*;-split-package:=merge-first", + "javax.annotation.*;-split-package:=merge-first", + // Embed `io.github.classgraph:classgraph`. + "io.github.classgraph.*", + "nonapi.io.github.classgraph.*", + // Embed PIE task modules + "mb.pie.task.archive.*", + "mb.pie.task.java.*", + // Embed PIE FST Serde, FST, and its dependencies. + "mb.pie.serde.fst.*", + "org.nustaq.*", + "com.fasterxml.jackson.core.*", + "org.objenesis.*", + // Embed services, to make the embedded Dagger annotation processor work. + "META-INF.services.*;-split-package:=merge-first" ) tasks { - "jar"(Jar::class) { - manifest { - attributes( - Pair("Private-Package", privatePackage.joinToString(", ")) - ) + "jar"(Jar::class) { + manifest { + attributes( + Pair("Private-Package", privatePackage.joinToString(", ")) + ) + } + } + withType { + jvmArgs("-Xss16M") // Set required stack size, mainly for serialization. } - } - withType { - jvmArgs("-Xss16M") // Set required stack size, mainly for serialization. - } } diff --git a/lwb/build.gradle.kts b/lwb/build.gradle.kts index ee7b351c4..8521439fc 100644 --- a/lwb/build.gradle.kts +++ b/lwb/build.gradle.kts @@ -1,45 +1,45 @@ plugins { - id("org.metaborg.gradle.config.root-project") version "0.5.6" - id("org.metaborg.gitonium") version "1.2.0" + id("org.metaborg.gradle.config.root-project") version "0.5.6" + id("org.metaborg.gitonium") version "1.2.0" - // Set versions for plugins to use, only applying them in subprojects (apply false here). - kotlin("jvm") version "1.3.41" apply false // Use 1.3.41 to keep in sync with embedded Kotlin version of Gradle 5.6.4. - `kotlin-dsl` apply false + // Set versions for plugins to use, only applying them in subprojects (apply false here). + kotlin("jvm") version "1.3.41" apply false // Use 1.3.41 to keep in sync with embedded Kotlin version of Gradle 5.6.4. + `kotlin-dsl` apply false - id("org.metaborg.devenv.spoofax.gradle.langspec") version "0.1.32" apply false - id("org.metaborg.coronium.bundle") version "0.3.17" apply false - id("org.metaborg.coronium.feature") version "0.3.17" apply false - id("org.metaborg.coronium.repository") version "0.3.17" apply false - id("biz.aQute.bnd.builder") version "5.3.0" apply false - id("org.jetbrains.intellij") version "1.4.0" apply false + id("org.metaborg.devenv.spoofax.gradle.langspec") version "0.1.32" apply false + id("org.metaborg.coronium.bundle") version "0.3.17" apply false + id("org.metaborg.coronium.feature") version "0.3.17" apply false + id("org.metaborg.coronium.repository") version "0.3.17" apply false + id("biz.aQute.bnd.builder") version "5.3.0" apply false + id("org.jetbrains.intellij") version "1.4.0" apply false - id("org.metaborg.spoofax.compiler.gradle.language") apply false - id("org.metaborg.spoofax.compiler.gradle.adapter") apply false - id("org.metaborg.spoofax.compiler.gradle.cli") apply false - id("org.metaborg.spoofax.compiler.gradle.eclipse") apply false - id("org.metaborg.spoofax.compiler.gradle.intellij") apply false - id("org.metaborg.spoofax.compiler.gradle.spoofax2.language") apply false + id("org.metaborg.spoofax.compiler.gradle.language") apply false + id("org.metaborg.spoofax.compiler.gradle.adapter") apply false + id("org.metaborg.spoofax.compiler.gradle.cli") apply false + id("org.metaborg.spoofax.compiler.gradle.eclipse") apply false + id("org.metaborg.spoofax.compiler.gradle.intellij") apply false + id("org.metaborg.spoofax.compiler.gradle.spoofax2.language") apply false } subprojects { - metaborg { - configureSubProject() - if(name.contains(".cli") || (name.contains(".eclipse") && !isMetaLibThatShouldBePublished(name)) || name.contains(".intellij")) { - // Do not publish CLI, Eclipse plugin, and IntelliJ plugin for now. - javaCreatePublication = false - javaCreateSourcesJar = false - javaCreateJavadocJar = false + metaborg { + configureSubProject() + if (name.contains(".cli") || (name.contains(".eclipse") && !isMetaLibThatShouldBePublished(name)) || name.contains(".intellij")) { + // Do not publish CLI, Eclipse plugin, and IntelliJ plugin for now. + javaCreatePublication = false + javaCreateSourcesJar = false + javaCreateJavadocJar = false + } } - } } fun isMetaLibThatShouldBePublished(name: String): Boolean { - return name.contains("gpp") || name.contains("strategolib") + return name.contains("gpp") || name.contains("strategolib") } val spoofax2Version: String = System.getProperty("spoofax2Version") val spoofax2DevenvVersion: String = System.getProperty("spoofax2DevenvVersion") allprojects { - ext["spoofax2Version"] = spoofax2Version - ext["spoofax2DevenvVersion"] = spoofax2DevenvVersion + ext["spoofax2Version"] = spoofax2Version + ext["spoofax2DevenvVersion"] = spoofax2DevenvVersion } diff --git a/lwb/metalang/cfg/cfg.cli/build.gradle.kts b/lwb/metalang/cfg/cfg.cli/build.gradle.kts index bcfafc183..fdf962bda 100644 --- a/lwb/metalang/cfg/cfg.cli/build.gradle.kts +++ b/lwb/metalang/cfg/cfg.cli/build.gradle.kts @@ -1,15 +1,15 @@ plugins { - id("org.metaborg.gradle.config.java-library") - id("org.metaborg.spoofax.compiler.gradle.cli") + id("org.metaborg.gradle.config.java-library") + id("org.metaborg.spoofax.compiler.gradle.cli") } languageCliProject { - adapterProject.set(project(":cfg")) + adapterProject.set(project(":cfg")) } tasks { - // Disable currently unused distribution tasks. - distZip.configure { enabled = false } - distTar.configure { enabled = false } - startScripts.configure { enabled = false } + // Disable currently unused distribution tasks. + distZip.configure { enabled = false } + distTar.configure { enabled = false } + startScripts.configure { enabled = false } } diff --git a/lwb/metalang/cfg/cfg.eclipse/build.gradle.kts b/lwb/metalang/cfg/cfg.eclipse/build.gradle.kts index d6c6598bf..9cd841a7f 100644 --- a/lwb/metalang/cfg/cfg.eclipse/build.gradle.kts +++ b/lwb/metalang/cfg/cfg.eclipse/build.gradle.kts @@ -1,22 +1,22 @@ plugins { - id("org.metaborg.gradle.config.java-library") - id("org.metaborg.spoofax.compiler.gradle.eclipse") + id("org.metaborg.gradle.config.java-library") + id("org.metaborg.spoofax.compiler.gradle.eclipse") } fun compositeBuild(name: String) = "$group:$name:$version" dependencies { - // Required because @Nullable has runtime retention (which includes classfile retention), and the Java compiler requires access to it. - compileOnly("com.google.code.findbugs:jsr305") + // Required because @Nullable has runtime retention (which includes classfile retention), and the Java compiler requires access to it. + compileOnly("com.google.code.findbugs:jsr305") - // Depend on `spoofax.compiler.eclipsebundle` because `cfg` uses `spoofax.compiler` and `spoofax.compiler.dagger`. - bundleApi(compositeBuild("spoofax.compiler.eclipsebundle")) + // Depend on `spoofax.compiler.eclipsebundle` because `cfg` uses `spoofax.compiler` and `spoofax.compiler.dagger`. + bundleApi(compositeBuild("spoofax.compiler.eclipsebundle")) } languageEclipseProject { - adapterProject.set(project(":cfg")) + adapterProject.set(project(":cfg")) } mavenize { - majorVersion.set("2022-06") + majorVersion.set("2022-06") } diff --git a/lwb/metalang/cfg/cfg.intellij/build.gradle.kts b/lwb/metalang/cfg/cfg.intellij/build.gradle.kts index 68174ceb4..20be01542 100644 --- a/lwb/metalang/cfg/cfg.intellij/build.gradle.kts +++ b/lwb/metalang/cfg/cfg.intellij/build.gradle.kts @@ -1,8 +1,8 @@ plugins { - id("org.metaborg.gradle.config.java-library") - id("org.metaborg.spoofax.compiler.gradle.intellij") + id("org.metaborg.gradle.config.java-library") + id("org.metaborg.spoofax.compiler.gradle.intellij") } languageIntellijProject { - adapterProject.set(project(":cfg")) + adapterProject.set(project(":cfg")) } diff --git a/lwb/metalang/cfg/cfg.spoofax2/build.gradle.kts b/lwb/metalang/cfg/cfg.spoofax2/build.gradle.kts index bf49e60fd..becda3b07 100644 --- a/lwb/metalang/cfg/cfg.spoofax2/build.gradle.kts +++ b/lwb/metalang/cfg/cfg.spoofax2/build.gradle.kts @@ -1,19 +1,19 @@ plugins { - id("org.metaborg.devenv.spoofax.gradle.langspec") - `maven-publish` + id("org.metaborg.devenv.spoofax.gradle.langspec") + `maven-publish` } val spoofax2DevenvVersion: String by ext spoofaxLanguageSpecification { - addSourceDependenciesFromMetaborgYaml.set(false) - addCompileDependenciesFromMetaborgYaml.set(false) + addSourceDependenciesFromMetaborgYaml.set(false) + addCompileDependenciesFromMetaborgYaml.set(false) } dependencies { - compileLanguage("org.metaborg.devenv:org.metaborg.meta.lang.esv:$spoofax2DevenvVersion") - compileLanguage("org.metaborg.devenv:org.metaborg.meta.lang.template:$spoofax2DevenvVersion") - compileLanguage("org.metaborg.devenv:statix.lang:$spoofax2DevenvVersion") - compileLanguage("org.metaborg.devenv:sdf3.ext.statix:$spoofax2DevenvVersion") + compileLanguage("org.metaborg.devenv:org.metaborg.meta.lang.esv:$spoofax2DevenvVersion") + compileLanguage("org.metaborg.devenv:org.metaborg.meta.lang.template:$spoofax2DevenvVersion") + compileLanguage("org.metaborg.devenv:statix.lang:$spoofax2DevenvVersion") + compileLanguage("org.metaborg.devenv:sdf3.ext.statix:$spoofax2DevenvVersion") - sourceLanguage("org.metaborg.devenv:meta.lib.spoofax:$spoofax2DevenvVersion") - sourceLanguage("org.metaborg.devenv:statix.runtime:$spoofax2DevenvVersion") + sourceLanguage("org.metaborg.devenv:meta.lib.spoofax:$spoofax2DevenvVersion") + sourceLanguage("org.metaborg.devenv:statix.runtime:$spoofax2DevenvVersion") } diff --git a/lwb/metalang/cfg/cfg/build.gradle.kts b/lwb/metalang/cfg/cfg/build.gradle.kts index a16a4c4de..66e4794bc 100644 --- a/lwb/metalang/cfg/cfg/build.gradle.kts +++ b/lwb/metalang/cfg/cfg/build.gradle.kts @@ -1,103 +1,105 @@ -import mb.spoofax.compiler.adapter.* -import mb.spoofax.compiler.util.* -import mb.spoofax.common.* +import mb.spoofax.common.BlockCommentSymbols +import mb.spoofax.common.BracketSymbols +import mb.spoofax.compiler.adapter.AdapterProjectCompiler +import mb.spoofax.compiler.util.GradleDependency +import mb.spoofax.compiler.util.TypeInfo plugins { - id("org.metaborg.gradle.config.java-library") - id("org.metaborg.spoofax.compiler.gradle.spoofax2.language") - id("org.metaborg.spoofax.compiler.gradle.adapter") + id("org.metaborg.gradle.config.java-library") + id("org.metaborg.spoofax.compiler.gradle.spoofax2.language") + id("org.metaborg.spoofax.compiler.gradle.adapter") } fun compositeBuild(name: String) = "$group:$name:$version" dependencies { - api(compositeBuild("spoofax.common")) - api(compositeBuild("spoofax.compiler")) + api(compositeBuild("spoofax.common")) + api(compositeBuild("spoofax.compiler")) - compileOnly("org.derive4j:derive4j-annotation") + compileOnly("org.derive4j:derive4j-annotation") - // Required because @Nullable has runtime retention (which includes classfile retention), and the Java compiler requires access to it. - compileOnly("com.google.code.findbugs:jsr305") + // Required because @Nullable has runtime retention (which includes classfile retention), and the Java compiler requires access to it. + compileOnly("com.google.code.findbugs:jsr305") - compileOnly("org.checkerframework:checker-qual-android") - compileOnly("org.immutables:value-annotations") - annotationProcessor("org.immutables:value") - annotationProcessor("org.derive4j:derive4j") + compileOnly("org.checkerframework:checker-qual-android") + compileOnly("org.immutables:value-annotations") + annotationProcessor("org.immutables:value") + annotationProcessor("org.derive4j:derive4j") } languageProject { - shared { - name("CFG") - defaultClassPrefix("Cfg") - defaultPackageId("mb.cfg") - } - compilerInput { - withParser().run { - startSymbol("Start") + shared { + name("CFG") + defaultClassPrefix("Cfg") + defaultPackageId("mb.cfg") } - withStyler() - withConstraintAnalyzer().run { - enableNaBL2(false) - enableStatix(true) - multiFile(false) + compilerInput { + withParser().run { + startSymbol("Start") + } + withStyler() + withConstraintAnalyzer().run { + enableNaBL2(false) + enableStatix(true) + multiFile(false) + } + withStrategoRuntime() } - withStrategoRuntime() - } } spoofax2BasedLanguageProject { - compilerInput { - withParser() - withStyler() - withConstraintAnalyzer().run { - copyStatix(true) + compilerInput { + withParser() + withStyler() + withConstraintAnalyzer().run { + copyStatix(true) + } + withStrategoRuntime().run { + copyCtree(true) + copyClasses(false) + } + project.languageSpecificationDependency(GradleDependency.project(":cfg.spoofax2")) } - withStrategoRuntime().run { - copyCtree(true) - copyClasses(false) - } - project.languageSpecificationDependency(GradleDependency.project(":cfg.spoofax2")) - } } languageAdapterProject { - compilerInput { - withParser() - withStyler() - withConstraintAnalyzer() - withStrategoRuntime() - withReferenceResolution().run { - resolveStrategy("editor-resolve") - } + compilerInput { + withParser() + withStyler() + withConstraintAnalyzer() + withStrategoRuntime() + withReferenceResolution().run { + resolveStrategy("editor-resolve") + } // withHover().run { // hoverStrategy("editor-hover") // } - project.configureCompilerInput() - } + project.configureCompilerInput() + } } fun AdapterProjectCompiler.Input.Builder.configureCompilerInput() { - compositionGroup("mb.spoofax.lwb") + compositionGroup("mb.spoofax.lwb") - val packageId = "mb.cfg" - val taskPackageId = "$packageId.task" + val packageId = "mb.cfg" + val taskPackageId = "$packageId.task" - // Symbols - addLineCommentSymbols("//") - addBlockCommentSymbols(BlockCommentSymbols("/*", "*/")) - addBracketSymbols(BracketSymbols('[', ']')) - addBracketSymbols(BracketSymbols('{', '}')) - addBracketSymbols(BracketSymbols('(', ')')) + // Symbols + addLineCommentSymbols("//") + addBlockCommentSymbols(BlockCommentSymbols("/*", "*/")) + addBracketSymbols(BracketSymbols('[', ']')) + addBracketSymbols(BracketSymbols('{', '}')) + addBracketSymbols(BracketSymbols('(', ')')) - addAdditionalModules(packageId, "CfgCustomizerModule"); + addAdditionalModules(packageId, "CfgCustomizerModule"); - // Config object creation tasks. - val normalize = TypeInfo.of(taskPackageId, "CfgNormalize") - val toObject = TypeInfo.of(taskPackageId, "CfgToObject") - val rootDirectoryToObject = TypeInfo.of(taskPackageId, "CfgRootDirectoryToObject") - addTaskDefs(normalize, toObject, rootDirectoryToObject) + // Config object creation tasks. + val normalize = TypeInfo.of(taskPackageId, "CfgNormalize") + val toObject = TypeInfo.of(taskPackageId, "CfgToObject") + val rootDirectoryToObject = TypeInfo.of(taskPackageId, "CfgRootDirectoryToObject") + addTaskDefs(normalize, toObject, rootDirectoryToObject) - // Manual multi-file check implementation. - isMultiFile(false) - val spoofaxTaskPackageId = "$taskPackageId.spoofax" - baseCheckTaskDef(spoofaxTaskPackageId, "BaseCfgCheck") - extendCheckTaskDef(spoofaxTaskPackageId, "CfgCheck") + // Manual multi-file check implementation. + isMultiFile(false) + val spoofaxTaskPackageId = "$taskPackageId.spoofax" + baseCheckTaskDef(spoofaxTaskPackageId, "BaseCfgCheck") + extendCheckTaskDef(spoofaxTaskPackageId, "CfgCheck") } diff --git a/lwb/metalang/dynamix/dynamix.cli/build.gradle.kts b/lwb/metalang/dynamix/dynamix.cli/build.gradle.kts index b96db4620..26f285fc0 100644 --- a/lwb/metalang/dynamix/dynamix.cli/build.gradle.kts +++ b/lwb/metalang/dynamix/dynamix.cli/build.gradle.kts @@ -1,15 +1,15 @@ plugins { - id("org.metaborg.gradle.config.java-library") - id("org.metaborg.spoofax.compiler.gradle.cli") + id("org.metaborg.gradle.config.java-library") + id("org.metaborg.spoofax.compiler.gradle.cli") } languageCliProject { - adapterProject.set(project(":dynamix")) + adapterProject.set(project(":dynamix")) } tasks { - // Disable currently unused distribution tasks. - distZip.configure { enabled = false } - distTar.configure { enabled = false } - startScripts.configure { enabled = false } + // Disable currently unused distribution tasks. + distZip.configure { enabled = false } + distTar.configure { enabled = false } + startScripts.configure { enabled = false } } diff --git a/lwb/metalang/dynamix/dynamix.eclipse/build.gradle.kts b/lwb/metalang/dynamix/dynamix.eclipse/build.gradle.kts index 0fbfa6d4d..960f63980 100644 --- a/lwb/metalang/dynamix/dynamix.eclipse/build.gradle.kts +++ b/lwb/metalang/dynamix/dynamix.eclipse/build.gradle.kts @@ -1,22 +1,22 @@ plugins { - id("org.metaborg.gradle.config.java-library") - id("org.metaborg.spoofax.compiler.gradle.eclipse") + id("org.metaborg.gradle.config.java-library") + id("org.metaborg.spoofax.compiler.gradle.eclipse") } fun compositeBuild(name: String) = "$group:$name:$version" dependencies { - // Required because @Nullable has runtime retention (which includes classfile retention), and the Java compiler requires access to it. - compileOnly("com.google.code.findbugs:jsr305") + // Required because @Nullable has runtime retention (which includes classfile retention), and the Java compiler requires access to it. + compileOnly("com.google.code.findbugs:jsr305") - // Depend on `spoofax.compiler.eclipsebundle` because `cfg` uses `spoofax.compiler` and `spoofax.compiler.dagger`. - bundleApi(compositeBuild("spoofax.compiler.eclipsebundle")) + // Depend on `spoofax.compiler.eclipsebundle` because `cfg` uses `spoofax.compiler` and `spoofax.compiler.dagger`. + bundleApi(compositeBuild("spoofax.compiler.eclipsebundle")) } languageEclipseProject { - adapterProject.set(project(":dynamix")) + adapterProject.set(project(":dynamix")) } mavenize { - majorVersion.set("2022-06") + majorVersion.set("2022-06") } diff --git a/lwb/metalang/dynamix/dynamix.intellij/build.gradle.kts b/lwb/metalang/dynamix/dynamix.intellij/build.gradle.kts index 982514bb6..571ed916f 100644 --- a/lwb/metalang/dynamix/dynamix.intellij/build.gradle.kts +++ b/lwb/metalang/dynamix/dynamix.intellij/build.gradle.kts @@ -1,8 +1,8 @@ plugins { - id("org.metaborg.gradle.config.java-library") - id("org.metaborg.spoofax.compiler.gradle.intellij") + id("org.metaborg.gradle.config.java-library") + id("org.metaborg.spoofax.compiler.gradle.intellij") } languageIntellijProject { - adapterProject.set(project(":dynamix")) + adapterProject.set(project(":dynamix")) } diff --git a/lwb/metalang/dynamix/dynamix.spoofax2/build.gradle.kts b/lwb/metalang/dynamix/dynamix.spoofax2/build.gradle.kts index bf49e60fd..becda3b07 100644 --- a/lwb/metalang/dynamix/dynamix.spoofax2/build.gradle.kts +++ b/lwb/metalang/dynamix/dynamix.spoofax2/build.gradle.kts @@ -1,19 +1,19 @@ plugins { - id("org.metaborg.devenv.spoofax.gradle.langspec") - `maven-publish` + id("org.metaborg.devenv.spoofax.gradle.langspec") + `maven-publish` } val spoofax2DevenvVersion: String by ext spoofaxLanguageSpecification { - addSourceDependenciesFromMetaborgYaml.set(false) - addCompileDependenciesFromMetaborgYaml.set(false) + addSourceDependenciesFromMetaborgYaml.set(false) + addCompileDependenciesFromMetaborgYaml.set(false) } dependencies { - compileLanguage("org.metaborg.devenv:org.metaborg.meta.lang.esv:$spoofax2DevenvVersion") - compileLanguage("org.metaborg.devenv:org.metaborg.meta.lang.template:$spoofax2DevenvVersion") - compileLanguage("org.metaborg.devenv:statix.lang:$spoofax2DevenvVersion") - compileLanguage("org.metaborg.devenv:sdf3.ext.statix:$spoofax2DevenvVersion") + compileLanguage("org.metaborg.devenv:org.metaborg.meta.lang.esv:$spoofax2DevenvVersion") + compileLanguage("org.metaborg.devenv:org.metaborg.meta.lang.template:$spoofax2DevenvVersion") + compileLanguage("org.metaborg.devenv:statix.lang:$spoofax2DevenvVersion") + compileLanguage("org.metaborg.devenv:sdf3.ext.statix:$spoofax2DevenvVersion") - sourceLanguage("org.metaborg.devenv:meta.lib.spoofax:$spoofax2DevenvVersion") - sourceLanguage("org.metaborg.devenv:statix.runtime:$spoofax2DevenvVersion") + sourceLanguage("org.metaborg.devenv:meta.lib.spoofax:$spoofax2DevenvVersion") + sourceLanguage("org.metaborg.devenv:statix.runtime:$spoofax2DevenvVersion") } diff --git a/lwb/metalang/dynamix/dynamix/build.gradle.kts b/lwb/metalang/dynamix/dynamix/build.gradle.kts index ae44dff92..1bf0b630a 100644 --- a/lwb/metalang/dynamix/dynamix/build.gradle.kts +++ b/lwb/metalang/dynamix/dynamix/build.gradle.kts @@ -1,30 +1,38 @@ -import mb.spoofax.compiler.adapter.* -import mb.spoofax.compiler.adapter.data.* -import mb.spoofax.compiler.util.* -import mb.spoofax.core.language.command.* -import mb.spoofax.common.* +import mb.spoofax.common.BlockCommentSymbols +import mb.spoofax.common.BracketSymbols +import mb.spoofax.compiler.adapter.AdapterProjectCompiler +import mb.spoofax.compiler.adapter.data.ArgProviderRepr +import mb.spoofax.compiler.adapter.data.CommandActionRepr +import mb.spoofax.compiler.adapter.data.CommandDefRepr +import mb.spoofax.compiler.adapter.data.MenuItemRepr +import mb.spoofax.compiler.adapter.data.ParamRepr +import mb.spoofax.compiler.util.GradleDependency +import mb.spoofax.compiler.util.TypeInfo +import mb.spoofax.core.language.command.CommandContextType +import mb.spoofax.core.language.command.CommandExecutionType +import mb.spoofax.core.language.command.EnclosingCommandContextType plugins { - id("org.metaborg.gradle.config.java-library") - id("org.metaborg.spoofax.compiler.gradle.spoofax2.language") - id("org.metaborg.spoofax.compiler.gradle.adapter") + id("org.metaborg.gradle.config.java-library") + id("org.metaborg.spoofax.compiler.gradle.spoofax2.language") + id("org.metaborg.spoofax.compiler.gradle.adapter") } fun compositeBuild(name: String) = "$group:$name:$version" dependencies { - api(compositeBuild("spoofax.common")) - api(compositeBuild("spoofax.compiler")) + api(compositeBuild("spoofax.common")) + api(compositeBuild("spoofax.compiler")) - compileOnly("org.derive4j:derive4j-annotation") + compileOnly("org.derive4j:derive4j-annotation") - // Required because @Nullable has runtime retention (which includes classfile retention), and the Java compiler requires access to it. - compileOnly("com.google.code.findbugs:jsr305") + // Required because @Nullable has runtime retention (which includes classfile retention), and the Java compiler requires access to it. + compileOnly("com.google.code.findbugs:jsr305") - compileOnly("org.checkerframework:checker-qual-android") - compileOnly("org.immutables:value-annotations") - annotationProcessor("org.immutables:value") - annotationProcessor("org.derive4j:derive4j") + compileOnly("org.checkerframework:checker-qual-android") + compileOnly("org.immutables:value-annotations") + annotationProcessor("org.immutables:value") + annotationProcessor("org.derive4j:derive4j") } val packageId = "mb.dynamix" @@ -34,121 +42,133 @@ val debugTaskPackageId = "$taskPackageId.debug" val commandPackageId = "$packageId.command" languageProject { - shared { - name("Dynamix") - defaultClassPrefix("Dynamix") - defaultPackageId("mb.dynamix") - addFileExtensions("dx") - } - compilerInput { - withParser().run { - startSymbol("Start") + shared { + name("Dynamix") + defaultClassPrefix("Dynamix") + defaultPackageId("mb.dynamix") + addFileExtensions("dx") } - withStyler() - withConstraintAnalyzer().run { - enableNaBL2(false) - enableStatix(true) - multiFile(true) + compilerInput { + withParser().run { + startSymbol("Start") + } + withStyler() + withConstraintAnalyzer().run { + enableNaBL2(false) + enableStatix(true) + multiFile(true) + } + withStrategoRuntime().run { + addStrategyPackageIds("dynamix.strategies") + addInteropRegisterersByReflection("dynamix.strategies.InteropRegisterer") + } } - withStrategoRuntime().run { - addStrategyPackageIds("dynamix.strategies") - addInteropRegisterersByReflection("dynamix.strategies.InteropRegisterer") - } - } } spoofax2BasedLanguageProject { - compilerInput { - withParser() - withStyler() - withConstraintAnalyzer().run { - copyStatix(true) - } - withStrategoRuntime().run { - copyCtree(true) - copyClasses(true) + compilerInput { + withParser() + withStyler() + withConstraintAnalyzer().run { + copyStatix(true) + } + withStrategoRuntime().run { + copyCtree(true) + copyClasses(true) + } + project.languageSpecificationDependency(GradleDependency.project(":dynamix.spoofax2")) } - project.languageSpecificationDependency(GradleDependency.project(":dynamix.spoofax2")) - } } languageAdapterProject { - compilerInput { - withParser().run { - // Wrap Parse task - extendParseTaskDef(spoofaxTaskPackageId, "DynamixParseWrapper") - } - withStyler() - withConstraintAnalyzer().run { - // Wrap AnalyzeMulti and rename base task - baseAnalyzeMultiTaskDef(spoofaxTaskPackageId, "BaseDynamixAnalyzeMulti") - extendAnalyzeMultiTaskDef(spoofaxTaskPackageId, "DynamixAnalyzeMultiWrapper") - } - withStrategoRuntime() - withReferenceResolution().run { - resolveStrategy("editor-resolve") - } - withHover().run { - hoverStrategy("editor-hover") - } - withGetSourceFiles().run { - extendGetSourceFilesTaskDef(spoofaxTaskPackageId, "DynamixGetSourceFiles") - baseGetSourceFilesTaskDef(spoofaxTaskPackageId, "BaseDynamixGetSourceFiles") + compilerInput { + withParser().run { + // Wrap Parse task + extendParseTaskDef(spoofaxTaskPackageId, "DynamixParseWrapper") + } + withStyler() + withConstraintAnalyzer().run { + // Wrap AnalyzeMulti and rename base task + baseAnalyzeMultiTaskDef(spoofaxTaskPackageId, "BaseDynamixAnalyzeMulti") + extendAnalyzeMultiTaskDef(spoofaxTaskPackageId, "DynamixAnalyzeMultiWrapper") + } + withStrategoRuntime() + withReferenceResolution().run { + resolveStrategy("editor-resolve") + } + withHover().run { + hoverStrategy("editor-hover") + } + withGetSourceFiles().run { + extendGetSourceFilesTaskDef(spoofaxTaskPackageId, "DynamixGetSourceFiles") + baseGetSourceFilesTaskDef(spoofaxTaskPackageId, "BaseDynamixGetSourceFiles") + } + project.configureCompilerInput() } - project.configureCompilerInput() - } } fun AdapterProjectCompiler.Input.Builder.configureCompilerInput() { - compositionGroup("mb.spoofax.lwb") - - // Symbols - addLineCommentSymbols("//") - addBlockCommentSymbols(BlockCommentSymbols("/*", "*/")) - addBracketSymbols(BracketSymbols('[', ']')) - addBracketSymbols(BracketSymbols('{', '}')) - addBracketSymbols(BracketSymbols('(', ')')) - - baseComponent(packageId, "BaseDynamixComponent") - extendComponent(packageId, "DynamixComponent") - - addTaskDefs(taskPackageId, "DynamixCompileModule") - addTaskDefs(taskPackageId, "DynamixCompileProject") - addTaskDefs(taskPackageId, "DynamixCompileAndMergeProject") - addTaskDefs(taskPackageId, "DynamixPrettyPrint") - - isMultiFile(true) - - val showMerged = TypeInfo.of(debugTaskPackageId, "DynamixShowMerged") - addTaskDefs( - showMerged - ) - - val showMergedCommand = CommandDefRepr.builder() - .type(commandPackageId, showMerged.id() + "Command") - .taskDefType(showMerged) - .argType(showMerged.appendToId(".Args")) - .displayName("Show normalized merged form") - .description("Shows the normalized and merged form in which definitions and calls are fully qualified") - .addSupportedExecutionTypes(CommandExecutionType.ManualOnce, CommandExecutionType.ManualContinuous) - .addAllParams(listOf( - ParamRepr.of("rootDirectory", TypeInfo.of("mb.resource.hierarchical", "ResourcePath"), true, ArgProviderRepr.enclosingContext(EnclosingCommandContextType.Project)), - ParamRepr.of("file", TypeInfo.of("mb.resource", "ResourceKey"), true, ArgProviderRepr.context(CommandContextType.File)) - )) - .build() - val showMergedCommandMenuItem = CommandActionRepr.builder() - .manualOnce(showMergedCommand) - .fileRequired() - .enclosingProjectRequired() - .buildItem() - - val commands = listOf( - showMergedCommand - ) - addAllCommandDefs(commands) - - val menuItems = listOf( - MenuItemRepr.menu("Evaluate", listOf(showMergedCommandMenuItem)) - ) - addAllMainMenuItems(menuItems) - addAllEditorContextMenuItems(menuItems) + compositionGroup("mb.spoofax.lwb") + + // Symbols + addLineCommentSymbols("//") + addBlockCommentSymbols(BlockCommentSymbols("/*", "*/")) + addBracketSymbols(BracketSymbols('[', ']')) + addBracketSymbols(BracketSymbols('{', '}')) + addBracketSymbols(BracketSymbols('(', ')')) + + baseComponent(packageId, "BaseDynamixComponent") + extendComponent(packageId, "DynamixComponent") + + addTaskDefs(taskPackageId, "DynamixCompileModule") + addTaskDefs(taskPackageId, "DynamixCompileProject") + addTaskDefs(taskPackageId, "DynamixCompileAndMergeProject") + addTaskDefs(taskPackageId, "DynamixPrettyPrint") + + isMultiFile(true) + + val showMerged = TypeInfo.of(debugTaskPackageId, "DynamixShowMerged") + addTaskDefs( + showMerged + ) + + val showMergedCommand = CommandDefRepr.builder() + .type(commandPackageId, showMerged.id() + "Command") + .taskDefType(showMerged) + .argType(showMerged.appendToId(".Args")) + .displayName("Show normalized merged form") + .description("Shows the normalized and merged form in which definitions and calls are fully qualified") + .addSupportedExecutionTypes(CommandExecutionType.ManualOnce, CommandExecutionType.ManualContinuous) + .addAllParams( + listOf( + ParamRepr.of( + "rootDirectory", + TypeInfo.of("mb.resource.hierarchical", "ResourcePath"), + true, + ArgProviderRepr.enclosingContext(EnclosingCommandContextType.Project) + ), + ParamRepr.of( + "file", + TypeInfo.of("mb.resource", "ResourceKey"), + true, + ArgProviderRepr.context(CommandContextType.File) + ) + ) + ) + .build() + val showMergedCommandMenuItem = CommandActionRepr.builder() + .manualOnce(showMergedCommand) + .fileRequired() + .enclosingProjectRequired() + .buildItem() + + val commands = listOf( + showMergedCommand + ) + addAllCommandDefs(commands) + + val menuItems = listOf( + MenuItemRepr.menu("Evaluate", listOf(showMergedCommandMenuItem)) + ) + addAllMainMenuItems(menuItems) + addAllEditorContextMenuItems(menuItems) } diff --git a/lwb/metalang/esv/esv.cli/build.gradle.kts b/lwb/metalang/esv/esv.cli/build.gradle.kts index 297b0c806..4a7eeac73 100644 --- a/lwb/metalang/esv/esv.cli/build.gradle.kts +++ b/lwb/metalang/esv/esv.cli/build.gradle.kts @@ -1,15 +1,15 @@ plugins { - id("org.metaborg.gradle.config.java-library") - id("org.metaborg.spoofax.compiler.gradle.cli") + id("org.metaborg.gradle.config.java-library") + id("org.metaborg.spoofax.compiler.gradle.cli") } languageCliProject { - adapterProject.set(project(":esv")) + adapterProject.set(project(":esv")) } tasks { - // Disable currently unused distribution tasks. - distZip.configure { enabled = false } - distTar.configure { enabled = false } - startScripts.configure { enabled = false } + // Disable currently unused distribution tasks. + distZip.configure { enabled = false } + distTar.configure { enabled = false } + startScripts.configure { enabled = false } } diff --git a/lwb/metalang/esv/esv.eclipse/build.gradle.kts b/lwb/metalang/esv/esv.eclipse/build.gradle.kts index 621cc3495..bfd696d81 100644 --- a/lwb/metalang/esv/esv.eclipse/build.gradle.kts +++ b/lwb/metalang/esv/esv.eclipse/build.gradle.kts @@ -1,17 +1,17 @@ plugins { - id("org.metaborg.gradle.config.java-library") - id("org.metaborg.spoofax.compiler.gradle.eclipse") + id("org.metaborg.gradle.config.java-library") + id("org.metaborg.spoofax.compiler.gradle.eclipse") } dependencies { - // Required because @Nullable has runtime retention (which includes classfile retention), and the Java compiler requires access to it. - compileOnly("com.google.code.findbugs:jsr305") + // Required because @Nullable has runtime retention (which includes classfile retention), and the Java compiler requires access to it. + compileOnly("com.google.code.findbugs:jsr305") } languageEclipseProject { - adapterProject.set(project(":esv")) + adapterProject.set(project(":esv")) } mavenize { - majorVersion.set("2022-06") + majorVersion.set("2022-06") } diff --git a/lwb/metalang/esv/esv.intellij/build.gradle.kts b/lwb/metalang/esv/esv.intellij/build.gradle.kts index c319dc59f..3c5e846ea 100644 --- a/lwb/metalang/esv/esv.intellij/build.gradle.kts +++ b/lwb/metalang/esv/esv.intellij/build.gradle.kts @@ -1,8 +1,8 @@ plugins { - id("org.metaborg.gradle.config.java-library") - id("org.metaborg.spoofax.compiler.gradle.intellij") + id("org.metaborg.gradle.config.java-library") + id("org.metaborg.spoofax.compiler.gradle.intellij") } languageIntellijProject { - adapterProject.set(project(":esv")) + adapterProject.set(project(":esv")) } diff --git a/lwb/metalang/esv/esv/build.gradle.kts b/lwb/metalang/esv/esv/build.gradle.kts index d503b9064..49d0cfaea 100644 --- a/lwb/metalang/esv/esv/build.gradle.kts +++ b/lwb/metalang/esv/esv/build.gradle.kts @@ -1,53 +1,49 @@ -import mb.spoofax.compiler.adapter.* -import mb.spoofax.compiler.adapter.data.* -import mb.spoofax.compiler.gradle.plugin.* -import mb.spoofax.compiler.gradle.spoofax2.plugin.* -import mb.spoofax.compiler.language.* -import mb.spoofax.compiler.spoofax2.language.* -import mb.spoofax.compiler.util.* -import mb.spoofax.core.language.command.* -import mb.spoofax.common.* +import mb.spoofax.common.BlockCommentSymbols +import mb.spoofax.common.BracketSymbols +import mb.spoofax.compiler.adapter.AdapterProjectCompiler +import mb.spoofax.compiler.util.GradleDependency +import mb.spoofax.compiler.util.TypeInfo plugins { - id("org.metaborg.gradle.config.java-library") - id("org.metaborg.spoofax.compiler.gradle.spoofax2.language") - id("org.metaborg.spoofax.compiler.gradle.adapter") + id("org.metaborg.gradle.config.java-library") + id("org.metaborg.spoofax.compiler.gradle.spoofax2.language") + id("org.metaborg.spoofax.compiler.gradle.adapter") } dependencies { - // Required because @Nullable has runtime retention (which includes classfile retention), and the Java compiler requires access to it. - compileOnly("com.google.code.findbugs:jsr305") + // Required because @Nullable has runtime retention (which includes classfile retention), and the Java compiler requires access to it. + compileOnly("com.google.code.findbugs:jsr305") } languageProject { - shared { - name("ESV") - defaultClassPrefix("Esv") - defaultPackageId("mb.esv") - } - compilerInput { - withParser().run { - startSymbol("Module") + shared { + name("ESV") + defaultClassPrefix("Esv") + defaultPackageId("mb.esv") } - withStyler() - withStrategoRuntime().run { - addStrategyPackageIds("org.metaborg.meta.lang.esv.trans") - addInteropRegisterersByReflection("org.metaborg.meta.lang.esv.trans.InteropRegisterer") + compilerInput { + withParser().run { + startSymbol("Module") + } + withStyler() + withStrategoRuntime().run { + addStrategyPackageIds("org.metaborg.meta.lang.esv.trans") + addInteropRegisterersByReflection("org.metaborg.meta.lang.esv.trans.InteropRegisterer") + } } - } } spoofax2BasedLanguageProject { - compilerInput { - withParser() - withStyler() - withStrategoRuntime().run { - copyCtree(false) - copyClasses(true) + compilerInput { + withParser() + withStyler() + withStrategoRuntime().run { + copyCtree(false) + copyClasses(true) + } + project.run { + languageSpecificationDependency(GradleDependency.module("org.metaborg.devenv:org.metaborg.meta.lang.esv:${ext["spoofax2DevenvVersion"]}")) + } } - project.run { - languageSpecificationDependency(GradleDependency.module("org.metaborg.devenv:org.metaborg.meta.lang.esv:${ext["spoofax2DevenvVersion"]}")) - } - } } val packageId = "mb.esv" @@ -55,37 +51,37 @@ val taskPackageId = "$packageId.task" val spoofaxTaskPackageId = "$taskPackageId.spoofax" languageAdapterProject { - compilerInput { - withParser().run { - // Wrap Parse task - extendParseTaskDef(spoofaxTaskPackageId, "EsvParseWrapper") + compilerInput { + withParser().run { + // Wrap Parse task + extendParseTaskDef(spoofaxTaskPackageId, "EsvParseWrapper") + } + withStyler() + withStrategoRuntime() + project.configureCompilerInput() } - withStyler() - withStrategoRuntime() - project.configureCompilerInput() - } } fun AdapterProjectCompiler.Input.Builder.configureCompilerInput() { - compositionGroup("mb.spoofax.lwb") + compositionGroup("mb.spoofax.lwb") - // Symbols - addLineCommentSymbols("//") - addBlockCommentSymbols(BlockCommentSymbols("/*", "*/")) - addBracketSymbols(BracketSymbols('(', ')')) - addBracketSymbols(BracketSymbols('<', '>')) + // Symbols + addLineCommentSymbols("//") + addBlockCommentSymbols(BlockCommentSymbols("/*", "*/")) + addBracketSymbols(BracketSymbols('(', ')')) + addBracketSymbols(BracketSymbols('<', '>')) - // Extend component - baseComponent(packageId, "BaseEsvComponent") - extendComponent(packageId, "EsvComponent") + // Extend component + baseComponent(packageId, "BaseEsvComponent") + extendComponent(packageId, "EsvComponent") - // Wrap CheckMulti and rename base tasks - isMultiFile(true) - baseCheckTaskDef(spoofaxTaskPackageId, "BaseEsvCheck") - baseCheckMultiTaskDef(spoofaxTaskPackageId, "BaseEsvCheckMulti") - extendCheckMultiTaskDef(spoofaxTaskPackageId, "EsvCheckMultiWrapper") + // Wrap CheckMulti and rename base tasks + isMultiFile(true) + baseCheckTaskDef(spoofaxTaskPackageId, "BaseEsvCheck") + baseCheckMultiTaskDef(spoofaxTaskPackageId, "BaseEsvCheckMulti") + extendCheckMultiTaskDef(spoofaxTaskPackageId, "EsvCheckMultiWrapper") - // Internal task definitions - val check = TypeInfo.of(taskPackageId, "EsvCheck") - val compile = TypeInfo.of(taskPackageId, "EsvCompile") - addTaskDefs(check, compile) + // Internal task definitions + val check = TypeInfo.of(taskPackageId, "EsvCheck") + val compile = TypeInfo.of(taskPackageId, "EsvCompile") + addTaskDefs(check, compile) } diff --git a/lwb/metalang/sdf3/sdf3.cli/build.gradle.kts b/lwb/metalang/sdf3/sdf3.cli/build.gradle.kts index 2817ef211..c04cf0380 100644 --- a/lwb/metalang/sdf3/sdf3.cli/build.gradle.kts +++ b/lwb/metalang/sdf3/sdf3.cli/build.gradle.kts @@ -1,15 +1,15 @@ plugins { - id("org.metaborg.gradle.config.java-library") - id("org.metaborg.spoofax.compiler.gradle.cli") + id("org.metaborg.gradle.config.java-library") + id("org.metaborg.spoofax.compiler.gradle.cli") } languageCliProject { - adapterProject.set(project(":sdf3")) + adapterProject.set(project(":sdf3")) } tasks { - // Disable currently unused distribution tasks. - distZip.configure { enabled = false } - distTar.configure { enabled = false } - startScripts.configure { enabled = false } + // Disable currently unused distribution tasks. + distZip.configure { enabled = false } + distTar.configure { enabled = false } + startScripts.configure { enabled = false } } diff --git a/lwb/metalang/sdf3/sdf3.eclipse/build.gradle.kts b/lwb/metalang/sdf3/sdf3.eclipse/build.gradle.kts index bbcb7c7d0..4f76c422e 100644 --- a/lwb/metalang/sdf3/sdf3.eclipse/build.gradle.kts +++ b/lwb/metalang/sdf3/sdf3.eclipse/build.gradle.kts @@ -1,34 +1,34 @@ plugins { - id("org.metaborg.gradle.config.java-library") - id("org.metaborg.spoofax.compiler.gradle.eclipse") + id("org.metaborg.gradle.config.java-library") + id("org.metaborg.spoofax.compiler.gradle.eclipse") } languageEclipseProject { - adapterProject.set(project(":sdf3")) + adapterProject.set(project(":sdf3")) } tasks { - "jar"(Jar::class) { - val exportPackages = LinkedHashSet() - val existingExportPackages = manifest.attributes.get("Export-Package") - if(existingExportPackages != null) { - exportPackages.add(existingExportPackages.toString()) + "jar"(Jar::class) { + val exportPackages = LinkedHashSet() + val existingExportPackages = manifest.attributes.get("Export-Package") + if (existingExportPackages != null) { + exportPackages.add(existingExportPackages.toString()) + } + val privatePackages = LinkedHashSet() + val existingPrivatePackages = manifest.attributes.get("Private-Package") + if (existingPrivatePackages != null) { + privatePackages.add(existingPrivatePackages.toString()) + } + privatePackages.add("org.metaborg.sdf2parenthesize.*") // Embed `sdf2parenthesize` because `sdf3` depends on it. + manifest { + attributes( + Pair("Export-Package", exportPackages.joinToString(", ")), + Pair("Private-Package", privatePackages.joinToString(", ")) + ) + } } - val privatePackages = LinkedHashSet() - val existingPrivatePackages = manifest.attributes.get("Private-Package") - if(existingPrivatePackages != null) { - privatePackages.add(existingPrivatePackages.toString()) - } - privatePackages.add("org.metaborg.sdf2parenthesize.*") // Embed `sdf2parenthesize` because `sdf3` depends on it. - manifest { - attributes( - Pair("Export-Package", exportPackages.joinToString(", ")), - Pair("Private-Package", privatePackages.joinToString(", ")) - ) - } - } } mavenize { - majorVersion.set("2022-06") + majorVersion.set("2022-06") } diff --git a/lwb/metalang/sdf3/sdf3.intellij/build.gradle.kts b/lwb/metalang/sdf3/sdf3.intellij/build.gradle.kts index 2e573ead4..4a314be0a 100644 --- a/lwb/metalang/sdf3/sdf3.intellij/build.gradle.kts +++ b/lwb/metalang/sdf3/sdf3.intellij/build.gradle.kts @@ -1,8 +1,8 @@ plugins { - id("org.metaborg.gradle.config.java-library") - id("org.metaborg.spoofax.compiler.gradle.intellij") + id("org.metaborg.gradle.config.java-library") + id("org.metaborg.spoofax.compiler.gradle.intellij") } languageIntellijProject { - adapterProject.set(project(":sdf3")) + adapterProject.set(project(":sdf3")) } diff --git a/lwb/metalang/sdf3/sdf3/build.gradle.kts b/lwb/metalang/sdf3/sdf3/build.gradle.kts index 042f2a831..6cab02cb2 100644 --- a/lwb/metalang/sdf3/sdf3/build.gradle.kts +++ b/lwb/metalang/sdf3/sdf3/build.gradle.kts @@ -1,73 +1,77 @@ -import mb.spoofax.compiler.adapter.* -import mb.spoofax.compiler.adapter.data.* -import mb.spoofax.compiler.gradle.plugin.* -import mb.spoofax.compiler.gradle.spoofax2.plugin.* -import mb.spoofax.compiler.language.* -import mb.spoofax.compiler.spoofax2.language.* -import mb.spoofax.compiler.util.* -import mb.spoofax.core.language.command.* -import mb.spoofax.common.* +import mb.spoofax.common.BlockCommentSymbols +import mb.spoofax.common.BracketSymbols +import mb.spoofax.compiler.adapter.AdapterProjectCompiler +import mb.spoofax.compiler.adapter.data.ArgProviderRepr +import mb.spoofax.compiler.adapter.data.CommandActionRepr +import mb.spoofax.compiler.adapter.data.CommandDefRepr +import mb.spoofax.compiler.adapter.data.MenuItemRepr +import mb.spoofax.compiler.adapter.data.ParamRepr +import mb.spoofax.compiler.util.GradleDependency +import mb.spoofax.compiler.util.TypeInfo +import mb.spoofax.core.language.command.CommandContextType +import mb.spoofax.core.language.command.CommandExecutionType +import mb.spoofax.core.language.command.EnclosingCommandContextType plugins { - id("org.metaborg.gradle.config.java-library") - id("org.metaborg.gradle.config.junit-testing") - id("org.metaborg.spoofax.compiler.gradle.spoofax2.language") - id("org.metaborg.spoofax.compiler.gradle.adapter") + id("org.metaborg.gradle.config.java-library") + id("org.metaborg.gradle.config.junit-testing") + id("org.metaborg.spoofax.compiler.gradle.spoofax2.language") + id("org.metaborg.spoofax.compiler.gradle.adapter") } fun compositeBuild(name: String) = "$group:$name:$version" dependencies { - api("org.metaborg.devenv:sdf2table") - api("org.metaborg.devenv:sdf2parenthesize") + api("org.metaborg.devenv:sdf2table") + api("org.metaborg.devenv:sdf2parenthesize") - testImplementation(compositeBuild("spoofax.test")) - testCompileOnly("org.checkerframework:checker-qual-android") + testImplementation(compositeBuild("spoofax.test")) + testCompileOnly("org.checkerframework:checker-qual-android") } languageProject { - shared { - name("SDF3") - defaultClassPrefix("Sdf3") - defaultPackageId("mb.sdf3") - addFileExtensions("sdf3", "tmpl") - } - compilerInput { - withParser().run { - startSymbol("Module") + shared { + name("SDF3") + defaultClassPrefix("Sdf3") + defaultPackageId("mb.sdf3") + addFileExtensions("sdf3", "tmpl") } - withStyler() - withConstraintAnalyzer().run { - strategoStrategy("statix-editor-analyze") - enableNaBL2(false) - enableStatix(true) - multiFile(true) + compilerInput { + withParser().run { + startSymbol("Module") + } + withStyler() + withConstraintAnalyzer().run { + strategoStrategy("statix-editor-analyze") + enableNaBL2(false) + enableStatix(true) + multiFile(true) + } + withStrategoRuntime().run { + addStrategyPackageIds("org.metaborg.meta.lang.template.strategies") + addStrategyPackageIds("org.metaborg.meta.lang.template.trans") + addInteropRegisterersByReflection("org.metaborg.meta.lang.template.strategies.InteropRegisterer") + addInteropRegisterersByReflection("org.metaborg.meta.lang.template.trans.InteropRegisterer") + baseStrategoRuntimeBuilderFactory("mb.sdf3.stratego", "BaseSdf3StrategoRuntimeBuilderFactory") + extendStrategoRuntimeBuilderFactory("mb.sdf3.stratego", "Sdf3StrategoRuntimeBuilderFactory") + } } - withStrategoRuntime().run { - addStrategyPackageIds("org.metaborg.meta.lang.template.strategies") - addStrategyPackageIds("org.metaborg.meta.lang.template.trans") - addInteropRegisterersByReflection("org.metaborg.meta.lang.template.strategies.InteropRegisterer") - addInteropRegisterersByReflection("org.metaborg.meta.lang.template.trans.InteropRegisterer") - baseStrategoRuntimeBuilderFactory("mb.sdf3.stratego", "BaseSdf3StrategoRuntimeBuilderFactory") - extendStrategoRuntimeBuilderFactory("mb.sdf3.stratego", "Sdf3StrategoRuntimeBuilderFactory") - } - } } spoofax2BasedLanguageProject { - compilerInput { - withParser() - withStyler() - withConstraintAnalyzer().run { - copyStatix(true) - } - withStrategoRuntime().run { - copyClasses(true) - } - project.run { - addAdditionalCopyResources("target/metaborg/EditorService-pretty.pp.af") - languageSpecificationDependency(GradleDependency.module("org.metaborg.devenv:org.metaborg.meta.lang.template:${ext["spoofax2DevenvVersion"]}")) + compilerInput { + withParser() + withStyler() + withConstraintAnalyzer().run { + copyStatix(true) + } + withStrategoRuntime().run { + copyClasses(true) + } + project.run { + addAdditionalCopyResources("target/metaborg/EditorService-pretty.pp.af") + languageSpecificationDependency(GradleDependency.module("org.metaborg.devenv:org.metaborg.meta.lang.template:${ext["spoofax2DevenvVersion"]}")) + } } - } } val packageId = "mb.sdf3" @@ -75,230 +79,289 @@ val taskPackageId = "$packageId.task" val spoofaxTaskPackageId = "$taskPackageId.spoofax" languageAdapterProject { - compilerInput { - withParser().run { - // Wrap Parse task - extendParseTaskDef(spoofaxTaskPackageId, "Sdf3ParseWrapper") - } - withStyler() - withStrategoRuntime() - withConstraintAnalyzer() - withReferenceResolution().run { - resolveStrategy("statix-editor-resolve") - } + compilerInput { + withParser().run { + // Wrap Parse task + extendParseTaskDef(spoofaxTaskPackageId, "Sdf3ParseWrapper") + } + withStyler() + withStrategoRuntime() + withConstraintAnalyzer() + withReferenceResolution().run { + resolveStrategy("statix-editor-resolve") + } // withHover().run { // hoverStrategy("statix-editor-hover") // } - withGetSourceFiles().run { - baseGetSourceFilesTaskDef(spoofaxTaskPackageId, "BaseSdf3GetSourceFiles") - extendGetSourceFilesTaskDef(spoofaxTaskPackageId, "Sdf3GetSourceFilesWrapper") + withGetSourceFiles().run { + baseGetSourceFilesTaskDef(spoofaxTaskPackageId, "BaseSdf3GetSourceFiles") + extendGetSourceFilesTaskDef(spoofaxTaskPackageId, "Sdf3GetSourceFilesWrapper") + } + project.configureCompilerInput() } - project.configureCompilerInput() - } } fun AdapterProjectCompiler.Input.Builder.configureCompilerInput() { - compositionGroup("mb.spoofax.lwb") - - // Symbols - addLineCommentSymbols("//") - addBlockCommentSymbols(BlockCommentSymbols("/*", "*/")) - addBracketSymbols(BracketSymbols('[', ']')) - addBracketSymbols(BracketSymbols('{', '}')) - addBracketSymbols(BracketSymbols('(', ')')) - - // Extend component - baseComponent(packageId, "BaseSdf3Component") - extendComponent(packageId, "Sdf3Component") - - - /// Tasks - // Utility task definitions - val desugar = TypeInfo.of(taskPackageId, "Sdf3Desugar") - val prettyPrint = TypeInfo.of(taskPackageId, "Sdf3PrettyPrint") - addTaskDefs(desugar, prettyPrint) - - // Per-module transformations - val toCompletionColorer = TypeInfo.of(taskPackageId, "Sdf3ToCompletionColorer") - val toCompletionRuntime = TypeInfo.of(taskPackageId, "Sdf3ToCompletionRuntime") - val toCompletion = TypeInfo.of(taskPackageId, "Sdf3ToCompletion") - val toSignature = TypeInfo.of(taskPackageId, "Sdf3ToSignature") - val toDynsemSignature = TypeInfo.of(taskPackageId, "Sdf3ToDynsemSignature") - val toPrettyPrinter = TypeInfo.of(taskPackageId, "Sdf3ToPrettyPrinter") - val toPermissive = TypeInfo.of(taskPackageId, "Sdf3ToPermissive") - val toNormalForm = TypeInfo.of(taskPackageId, "Sdf3ToNormalForm") - val preStatix = TypeInfo.of(taskPackageId, "Sdf3PreStatix") - val postStatix = TypeInfo.of(taskPackageId, "Sdf3PostStatix") - val indexAst = TypeInfo.of(taskPackageId, "Sdf3IndexAst") - addTaskDefs(toCompletionColorer, toCompletionRuntime, toCompletion, toSignature, toDynsemSignature, - toPrettyPrinter, toPermissive, toNormalForm, preStatix, postStatix, indexAst) - - // Per-spec tasks - val specTaskPackageId = "$taskPackageId.spec" - val checkSpec = TypeInfo.of(specTaskPackageId, "Sdf3CheckSpec") - val specToParseTable = TypeInfo.of(specTaskPackageId, "Sdf3SpecToParseTable") - val parseTableToParenthesizer = TypeInfo.of(specTaskPackageId, "Sdf3ParseTableToParenthesizer") - val parseTableToFile = TypeInfo.of(specTaskPackageId, "Sdf3ParseTableToFile") - addTaskDefs(checkSpec, specToParseTable, parseTableToParenthesizer, parseTableToFile) - - // Debugging task definitions - val debugTaskPackageId = "$taskPackageId.debug" - val showDesugar = TypeInfo.of(debugTaskPackageId, "Sdf3ShowDesugar") - val showPermissive = TypeInfo.of(debugTaskPackageId, "Sdf3ShowPermissive") - val showNormalForm = TypeInfo.of(debugTaskPackageId, "Sdf3ShowNormalForm") - val showSignature = TypeInfo.of(debugTaskPackageId, "Sdf3ShowSignature") - val showDynsemSignature = TypeInfo.of(debugTaskPackageId, "Sdf3ShowDynsemSignature") - val showCompletion = TypeInfo.of(debugTaskPackageId, "Sdf3ShowCompletion") - val showCompletionRuntime = TypeInfo.of(debugTaskPackageId, "Sdf3ShowCompletionRuntime") - val showCompletionColorer = TypeInfo.of(debugTaskPackageId, "Sdf3ShowCompletionColorer") - val showSpecParseTable = TypeInfo.of(debugTaskPackageId, "Sdf3ShowSpecParseTable") - val showSpecParenthesizer = TypeInfo.of(debugTaskPackageId, "Sdf3ShowSpecParenthesizer") - addTaskDefs( - showDesugar, - showPermissive, - showNormalForm, - showSignature, - showDynsemSignature, - showCompletion, - showCompletionRuntime, - showCompletionColorer, - showSpecParseTable, - showSpecParenthesizer - ) - - // Additional tasks - addTaskDefs(TypeInfo.of(taskPackageId, "Sdf3ParseTableFromFile")) - - // Extend CheckMulti and GetSourceFiles, rename base tasks. - isMultiFile(true) - baseCheckTaskDef(spoofaxTaskPackageId, "BaseSdf3Check") - baseCheckMultiTaskDef(spoofaxTaskPackageId, "BaseSdf3CheckMulti") - extendCheckMultiTaskDef(spoofaxTaskPackageId, "Sdf3CheckMultiWrapper") - - /// Commands - val commandPackageId = "$packageId.command" - - // Show (debugging) commands - val showAbstractTaskDef = TypeInfo.of(debugTaskPackageId, "ShowTaskDef") - val showAnalyzedAbstractTaskDef = TypeInfo.of(debugTaskPackageId, "ShowAnalyzedTaskDef") - fun showCommand(taskDefType: TypeInfo, resultName: String) = CommandDefRepr.builder() - .type(commandPackageId, taskDefType.id() + "Command") - .taskDefType(taskDefType) - .argType(showAbstractTaskDef.appendToId(".Args")) - .displayName("Show $resultName") - .description("Shows the $resultName of the file") - .addSupportedExecutionTypes(CommandExecutionType.ManualOnce, CommandExecutionType.ManualContinuous) - .addAllParams(listOf( - ParamRepr.of("file", TypeInfo.of("mb.resource", "ResourceKey"), true, ArgProviderRepr.context(CommandContextType.File)), - ParamRepr.of("concrete", TypeInfo.ofBoolean(), true) - )) - .build() - - fun showAnalyzedCommand(taskDefType: TypeInfo, resultName: String) = CommandDefRepr.builder() - .type(commandPackageId, taskDefType.id() + "Command") - .taskDefType(taskDefType) - .argType(showAnalyzedAbstractTaskDef.appendToId(".Args")) - .displayName("Show $resultName") - .description("Shows the $resultName of the file") - .addSupportedExecutionTypes(CommandExecutionType.ManualOnce, CommandExecutionType.ManualContinuous) - .addAllParams(listOf( - ParamRepr.of("project", TypeInfo.of("mb.resource.hierarchical", "ResourcePath"), true, ArgProviderRepr.enclosingContext(EnclosingCommandContextType.Project)), - ParamRepr.of("file", TypeInfo.of("mb.resource", "ResourceKey"), true, ArgProviderRepr.context(CommandContextType.File)), - ParamRepr.of("concrete", TypeInfo.ofBoolean(), true) - )) - .build() - - val showDesugarCommand = showCommand(showDesugar, "desugared") - val showPermissiveCommand = showCommand(showPermissive, "permissive grammar") - val showNormalFormCommand = showCommand(showNormalForm, "normal-form") - val showSignatureCommand = showAnalyzedCommand(showSignature, "Stratego signatures") - val showDynsemSignatureCommand = showAnalyzedCommand(showDynsemSignature, "DynSem signatures") - - val showCompletionCommand = showCommand(showCompletion, "completion insertions") - val showCompletionRuntimeCommand = showCommand(showCompletionRuntime, "completion runtime") - val showCompletionColorerCommand = showCommand(showCompletionColorer, "completion colorer") - val showSpecParenthesizerCommand = CommandDefRepr.builder() - .type(commandPackageId, showSpecParenthesizer.id() + "Command") - .taskDefType(showSpecParenthesizer) - .argType(showSpecParenthesizer.appendToId(".Args")) - .displayName("Show parenthesizer") - .description("Shows the parenthesizer built from given main file") - .addSupportedExecutionTypes(CommandExecutionType.ManualOnce, CommandExecutionType.ManualContinuous) - .addAllParams(listOf( - ParamRepr.of("root", TypeInfo.of("mb.resource.hierarchical", "ResourcePath"), true, ArgProviderRepr.enclosingContext(EnclosingCommandContextType.Project)), - ParamRepr.of("concrete", TypeInfo.ofBoolean(), true) - )) - .build() - - val showCommands = listOf( - showDesugarCommand, - showPermissiveCommand, - showNormalFormCommand, - showCompletionCommand, - showCompletionRuntimeCommand, - showCompletionColorerCommand - ) - addAllCommandDefs(showCommands) - val showAnalyzedCommands = listOf( - showSignatureCommand, - showDynsemSignatureCommand, - showSpecParenthesizerCommand - ) - addAllCommandDefs(showAnalyzedCommands) - - - // Additional show (debugging) commands that do not fit the regular pattern. - val showSpecParseTableCommand = CommandDefRepr.builder() - .type(commandPackageId, showSpecParseTable.id() + "Command") - .taskDefType(showSpecParseTable) - .argType(showSpecParseTable.appendToId(".Args")) - .displayName("Show parse table") - .description("Shows the parse table built from given main file") - .addSupportedExecutionTypes(CommandExecutionType.ManualOnce, CommandExecutionType.ManualContinuous) - .addAllParams(listOf( - ParamRepr.of("root", TypeInfo.of("mb.resource.hierarchical", "ResourcePath"), true, ArgProviderRepr.enclosingContext(EnclosingCommandContextType.Project)) - )) - .build() - addCommandDefs( - showSpecParseTableCommand, - showSpecParenthesizerCommand - ) - val showSpecParseTableOnceMenuItem = CommandActionRepr.builder().manualOnce(showSpecParseTableCommand).fileRequired().enclosingProjectRequired().buildItem() - val showSpecParseTableContinuousMenuItem = CommandActionRepr.builder().manualContinuous(showSpecParseTableCommand).fileRequired().enclosingProjectRequired().buildItem() - val showSpecParseTableMenuItems = listOf(showSpecParseTableOnceMenuItem, showSpecParseTableContinuousMenuItem) - - - // Show (debugging) menu command actions - fun showManualOnce(commandDef: CommandDefRepr, concrete: Boolean) = CommandActionRepr.builder().manualOnce(commandDef, mapOf(Pair("concrete", concrete.toString()))).fileRequired().buildItem() - fun showManualContinuous(commandDef: CommandDefRepr, concrete: Boolean) = CommandActionRepr.builder().manualContinuous(commandDef, mapOf(Pair("concrete", concrete.toString()))).fileRequired().buildItem() - fun showAnalyzedManualOnce(commandDef: CommandDefRepr, concrete: Boolean) = CommandActionRepr.builder().manualOnce(commandDef, mapOf(Pair("concrete", concrete.toString()))).fileRequired().enclosingProjectRequired().buildItem() - fun showAnalyzedManualContinuous(commandDef: CommandDefRepr, concrete: Boolean) = CommandActionRepr.builder().manualContinuous(commandDef, mapOf(Pair("concrete", concrete.toString()))).fileRequired().enclosingProjectRequired().buildItem() - val showAbstractEditorMenuItems = showCommands.flatMap { listOf(showManualOnce(it, false), showManualContinuous(it, false)) } - val showConcreteEditorMenuItems = showCommands.flatMap { listOf(showManualOnce(it, true), showManualContinuous(it, true)) } - val showAbstractResourceMenuItems = showCommands.map { showManualOnce(it, false) } - val showConcreteResourceMenuItems = showCommands.map { showManualOnce(it, true) } - val showAnalyzedAbstractEditorMenuItems = showAnalyzedCommands.flatMap { listOf(showAnalyzedManualOnce(it, false), showAnalyzedManualContinuous(it, false)) } - val showAnalyzedConcreteEditorMenuItems = showAnalyzedCommands.flatMap { listOf(showAnalyzedManualOnce(it, true), showAnalyzedManualContinuous(it, true)) } - val showAnalyzedAbstractResourceMenuItems = showAnalyzedCommands.map { showAnalyzedManualOnce(it, false) } - val showAnalyzedConcreteResourceMenuItems = showAnalyzedCommands.map { showAnalyzedManualOnce(it, true) } - - - // Menu bindings - val mainAndEditorMenu = listOf( - MenuItemRepr.menu("Debug", - MenuItemRepr.menu("Transform", - MenuItemRepr.menu("Abstract", showAbstractEditorMenuItems + showAnalyzedAbstractEditorMenuItems + showSpecParseTableMenuItems), - MenuItemRepr.menu("Concrete", showConcreteEditorMenuItems + showAnalyzedConcreteEditorMenuItems) - ) + compositionGroup("mb.spoofax.lwb") + + // Symbols + addLineCommentSymbols("//") + addBlockCommentSymbols(BlockCommentSymbols("/*", "*/")) + addBracketSymbols(BracketSymbols('[', ']')) + addBracketSymbols(BracketSymbols('{', '}')) + addBracketSymbols(BracketSymbols('(', ')')) + + // Extend component + baseComponent(packageId, "BaseSdf3Component") + extendComponent(packageId, "Sdf3Component") + + + /// Tasks + // Utility task definitions + val desugar = TypeInfo.of(taskPackageId, "Sdf3Desugar") + val prettyPrint = TypeInfo.of(taskPackageId, "Sdf3PrettyPrint") + addTaskDefs(desugar, prettyPrint) + + // Per-module transformations + val toCompletionColorer = TypeInfo.of(taskPackageId, "Sdf3ToCompletionColorer") + val toCompletionRuntime = TypeInfo.of(taskPackageId, "Sdf3ToCompletionRuntime") + val toCompletion = TypeInfo.of(taskPackageId, "Sdf3ToCompletion") + val toSignature = TypeInfo.of(taskPackageId, "Sdf3ToSignature") + val toDynsemSignature = TypeInfo.of(taskPackageId, "Sdf3ToDynsemSignature") + val toPrettyPrinter = TypeInfo.of(taskPackageId, "Sdf3ToPrettyPrinter") + val toPermissive = TypeInfo.of(taskPackageId, "Sdf3ToPermissive") + val toNormalForm = TypeInfo.of(taskPackageId, "Sdf3ToNormalForm") + val preStatix = TypeInfo.of(taskPackageId, "Sdf3PreStatix") + val postStatix = TypeInfo.of(taskPackageId, "Sdf3PostStatix") + val indexAst = TypeInfo.of(taskPackageId, "Sdf3IndexAst") + addTaskDefs( + toCompletionColorer, toCompletionRuntime, toCompletion, toSignature, toDynsemSignature, + toPrettyPrinter, toPermissive, toNormalForm, preStatix, postStatix, indexAst + ) + + // Per-spec tasks + val specTaskPackageId = "$taskPackageId.spec" + val checkSpec = TypeInfo.of(specTaskPackageId, "Sdf3CheckSpec") + val specToParseTable = TypeInfo.of(specTaskPackageId, "Sdf3SpecToParseTable") + val parseTableToParenthesizer = TypeInfo.of(specTaskPackageId, "Sdf3ParseTableToParenthesizer") + val parseTableToFile = TypeInfo.of(specTaskPackageId, "Sdf3ParseTableToFile") + addTaskDefs(checkSpec, specToParseTable, parseTableToParenthesizer, parseTableToFile) + + // Debugging task definitions + val debugTaskPackageId = "$taskPackageId.debug" + val showDesugar = TypeInfo.of(debugTaskPackageId, "Sdf3ShowDesugar") + val showPermissive = TypeInfo.of(debugTaskPackageId, "Sdf3ShowPermissive") + val showNormalForm = TypeInfo.of(debugTaskPackageId, "Sdf3ShowNormalForm") + val showSignature = TypeInfo.of(debugTaskPackageId, "Sdf3ShowSignature") + val showDynsemSignature = TypeInfo.of(debugTaskPackageId, "Sdf3ShowDynsemSignature") + val showCompletion = TypeInfo.of(debugTaskPackageId, "Sdf3ShowCompletion") + val showCompletionRuntime = TypeInfo.of(debugTaskPackageId, "Sdf3ShowCompletionRuntime") + val showCompletionColorer = TypeInfo.of(debugTaskPackageId, "Sdf3ShowCompletionColorer") + val showSpecParseTable = TypeInfo.of(debugTaskPackageId, "Sdf3ShowSpecParseTable") + val showSpecParenthesizer = TypeInfo.of(debugTaskPackageId, "Sdf3ShowSpecParenthesizer") + addTaskDefs( + showDesugar, + showPermissive, + showNormalForm, + showSignature, + showDynsemSignature, + showCompletion, + showCompletionRuntime, + showCompletionColorer, + showSpecParseTable, + showSpecParenthesizer + ) + + // Additional tasks + addTaskDefs(TypeInfo.of(taskPackageId, "Sdf3ParseTableFromFile")) + + // Extend CheckMulti and GetSourceFiles, rename base tasks. + isMultiFile(true) + baseCheckTaskDef(spoofaxTaskPackageId, "BaseSdf3Check") + baseCheckMultiTaskDef(spoofaxTaskPackageId, "BaseSdf3CheckMulti") + extendCheckMultiTaskDef(spoofaxTaskPackageId, "Sdf3CheckMultiWrapper") + + /// Commands + val commandPackageId = "$packageId.command" + + // Show (debugging) commands + val showAbstractTaskDef = TypeInfo.of(debugTaskPackageId, "ShowTaskDef") + val showAnalyzedAbstractTaskDef = TypeInfo.of(debugTaskPackageId, "ShowAnalyzedTaskDef") + fun showCommand(taskDefType: TypeInfo, resultName: String) = CommandDefRepr.builder() + .type(commandPackageId, taskDefType.id() + "Command") + .taskDefType(taskDefType) + .argType(showAbstractTaskDef.appendToId(".Args")) + .displayName("Show $resultName") + .description("Shows the $resultName of the file") + .addSupportedExecutionTypes(CommandExecutionType.ManualOnce, CommandExecutionType.ManualContinuous) + .addAllParams( + listOf( + ParamRepr.of( + "file", + TypeInfo.of("mb.resource", "ResourceKey"), + true, + ArgProviderRepr.context(CommandContextType.File) + ), + ParamRepr.of("concrete", TypeInfo.ofBoolean(), true) + ) + ) + .build() + + fun showAnalyzedCommand(taskDefType: TypeInfo, resultName: String) = CommandDefRepr.builder() + .type(commandPackageId, taskDefType.id() + "Command") + .taskDefType(taskDefType) + .argType(showAnalyzedAbstractTaskDef.appendToId(".Args")) + .displayName("Show $resultName") + .description("Shows the $resultName of the file") + .addSupportedExecutionTypes(CommandExecutionType.ManualOnce, CommandExecutionType.ManualContinuous) + .addAllParams( + listOf( + ParamRepr.of( + "project", + TypeInfo.of("mb.resource.hierarchical", "ResourcePath"), + true, + ArgProviderRepr.enclosingContext(EnclosingCommandContextType.Project) + ), + ParamRepr.of( + "file", + TypeInfo.of("mb.resource", "ResourceKey"), + true, + ArgProviderRepr.context(CommandContextType.File) + ), + ParamRepr.of("concrete", TypeInfo.ofBoolean(), true) + ) + ) + .build() + + val showDesugarCommand = showCommand(showDesugar, "desugared") + val showPermissiveCommand = showCommand(showPermissive, "permissive grammar") + val showNormalFormCommand = showCommand(showNormalForm, "normal-form") + val showSignatureCommand = showAnalyzedCommand(showSignature, "Stratego signatures") + val showDynsemSignatureCommand = showAnalyzedCommand(showDynsemSignature, "DynSem signatures") + + val showCompletionCommand = showCommand(showCompletion, "completion insertions") + val showCompletionRuntimeCommand = showCommand(showCompletionRuntime, "completion runtime") + val showCompletionColorerCommand = showCommand(showCompletionColorer, "completion colorer") + val showSpecParenthesizerCommand = CommandDefRepr.builder() + .type(commandPackageId, showSpecParenthesizer.id() + "Command") + .taskDefType(showSpecParenthesizer) + .argType(showSpecParenthesizer.appendToId(".Args")) + .displayName("Show parenthesizer") + .description("Shows the parenthesizer built from given main file") + .addSupportedExecutionTypes(CommandExecutionType.ManualOnce, CommandExecutionType.ManualContinuous) + .addAllParams( + listOf( + ParamRepr.of( + "root", + TypeInfo.of("mb.resource.hierarchical", "ResourcePath"), + true, + ArgProviderRepr.enclosingContext(EnclosingCommandContextType.Project) + ), + ParamRepr.of("concrete", TypeInfo.ofBoolean(), true) + ) + ) + .build() + + val showCommands = listOf( + showDesugarCommand, + showPermissiveCommand, + showNormalFormCommand, + showCompletionCommand, + showCompletionRuntimeCommand, + showCompletionColorerCommand + ) + addAllCommandDefs(showCommands) + val showAnalyzedCommands = listOf( + showSignatureCommand, + showDynsemSignatureCommand, + showSpecParenthesizerCommand + ) + addAllCommandDefs(showAnalyzedCommands) + + + // Additional show (debugging) commands that do not fit the regular pattern. + val showSpecParseTableCommand = CommandDefRepr.builder() + .type(commandPackageId, showSpecParseTable.id() + "Command") + .taskDefType(showSpecParseTable) + .argType(showSpecParseTable.appendToId(".Args")) + .displayName("Show parse table") + .description("Shows the parse table built from given main file") + .addSupportedExecutionTypes(CommandExecutionType.ManualOnce, CommandExecutionType.ManualContinuous) + .addAllParams( + listOf( + ParamRepr.of( + "root", + TypeInfo.of("mb.resource.hierarchical", "ResourcePath"), + true, + ArgProviderRepr.enclosingContext(EnclosingCommandContextType.Project) + ) + ) + ) + .build() + addCommandDefs( + showSpecParseTableCommand, + showSpecParenthesizerCommand + ) + val showSpecParseTableOnceMenuItem = CommandActionRepr.builder().manualOnce(showSpecParseTableCommand).fileRequired().enclosingProjectRequired().buildItem() + val showSpecParseTableContinuousMenuItem = CommandActionRepr.builder().manualContinuous(showSpecParseTableCommand).fileRequired().enclosingProjectRequired().buildItem() + val showSpecParseTableMenuItems = listOf(showSpecParseTableOnceMenuItem, showSpecParseTableContinuousMenuItem) + + + // Show (debugging) menu command actions + fun showManualOnce(commandDef: CommandDefRepr, concrete: Boolean) = + CommandActionRepr.builder().manualOnce(commandDef, mapOf(Pair("concrete", concrete.toString()))).fileRequired().buildItem() + + fun showManualContinuous(commandDef: CommandDefRepr, concrete: Boolean) = + CommandActionRepr.builder().manualContinuous(commandDef, mapOf(Pair("concrete", concrete.toString()))).fileRequired().buildItem() + + fun showAnalyzedManualOnce(commandDef: CommandDefRepr, concrete: Boolean) = + CommandActionRepr.builder().manualOnce(commandDef, mapOf(Pair("concrete", concrete.toString()))).fileRequired().enclosingProjectRequired().buildItem() + + fun showAnalyzedManualContinuous(commandDef: CommandDefRepr, concrete: Boolean) = + CommandActionRepr.builder().manualContinuous(commandDef, mapOf(Pair("concrete", concrete.toString()))).fileRequired().enclosingProjectRequired().buildItem() + + val showAbstractEditorMenuItems = + showCommands.flatMap { listOf(showManualOnce(it, false), showManualContinuous(it, false)) } + val showConcreteEditorMenuItems = + showCommands.flatMap { listOf(showManualOnce(it, true), showManualContinuous(it, true)) } + val showAbstractResourceMenuItems = showCommands.map { showManualOnce(it, false) } + val showConcreteResourceMenuItems = showCommands.map { showManualOnce(it, true) } + val showAnalyzedAbstractEditorMenuItems = showAnalyzedCommands.flatMap { + listOf( + showAnalyzedManualOnce(it, false), + showAnalyzedManualContinuous(it, false) + ) + } + val showAnalyzedConcreteEditorMenuItems = showAnalyzedCommands.flatMap { + listOf( + showAnalyzedManualOnce(it, true), + showAnalyzedManualContinuous(it, true) + ) + } + val showAnalyzedAbstractResourceMenuItems = showAnalyzedCommands.map { showAnalyzedManualOnce(it, false) } + val showAnalyzedConcreteResourceMenuItems = showAnalyzedCommands.map { showAnalyzedManualOnce(it, true) } + + + // Menu bindings + val mainAndEditorMenu = listOf( + MenuItemRepr.menu("Debug", + MenuItemRepr.menu("Transform", + MenuItemRepr.menu("Abstract", + showAbstractEditorMenuItems + showAnalyzedAbstractEditorMenuItems + showSpecParseTableMenuItems + ), + MenuItemRepr.menu("Concrete", showConcreteEditorMenuItems + showAnalyzedConcreteEditorMenuItems) + ) + ) ) - ) - addAllMainMenuItems(mainAndEditorMenu) - addAllEditorContextMenuItems(mainAndEditorMenu) - addResourceContextMenuItems( - MenuItemRepr.menu("Debug", - MenuItemRepr.menu("Transform", - MenuItemRepr.menu("Abstract", showAbstractResourceMenuItems + showAnalyzedAbstractResourceMenuItems + showSpecParseTableMenuItems), - MenuItemRepr.menu("Concrete", showConcreteResourceMenuItems + showAnalyzedConcreteResourceMenuItems) - ) + addAllMainMenuItems(mainAndEditorMenu) + addAllEditorContextMenuItems(mainAndEditorMenu) + addResourceContextMenuItems( + MenuItemRepr.menu("Debug", + MenuItemRepr.menu("Transform", + MenuItemRepr.menu("Abstract", + showAbstractResourceMenuItems + showAnalyzedAbstractResourceMenuItems + showSpecParseTableMenuItems + ), + MenuItemRepr.menu("Concrete", showConcreteResourceMenuItems + showAnalyzedConcreteResourceMenuItems) + ) + ) ) - ) } diff --git a/lwb/metalang/sdf3_ext_dynamix/sdf3_ext_dynamix.eclipse/build.gradle.kts b/lwb/metalang/sdf3_ext_dynamix/sdf3_ext_dynamix.eclipse/build.gradle.kts index b7217e46e..95dc98125 100644 --- a/lwb/metalang/sdf3_ext_dynamix/sdf3_ext_dynamix.eclipse/build.gradle.kts +++ b/lwb/metalang/sdf3_ext_dynamix/sdf3_ext_dynamix.eclipse/build.gradle.kts @@ -1,12 +1,12 @@ plugins { - id("org.metaborg.gradle.config.java-library") - id("org.metaborg.spoofax.compiler.gradle.eclipse") + id("org.metaborg.gradle.config.java-library") + id("org.metaborg.spoofax.compiler.gradle.eclipse") } languageEclipseProject { - adapterProject.set(project(":sdf3_ext_dynamix")) + adapterProject.set(project(":sdf3_ext_dynamix")) } mavenize { - majorVersion.set("2022-06") + majorVersion.set("2022-06") } diff --git a/lwb/metalang/sdf3_ext_dynamix/sdf3_ext_dynamix.spoofax2/build.gradle.kts b/lwb/metalang/sdf3_ext_dynamix/sdf3_ext_dynamix.spoofax2/build.gradle.kts index 622451e1f..ca5228f52 100644 --- a/lwb/metalang/sdf3_ext_dynamix/sdf3_ext_dynamix.spoofax2/build.gradle.kts +++ b/lwb/metalang/sdf3_ext_dynamix/sdf3_ext_dynamix.spoofax2/build.gradle.kts @@ -1,24 +1,24 @@ import org.metaborg.core.language.* plugins { - id("org.metaborg.devenv.spoofax.gradle.langspec") - `maven-publish` + id("org.metaborg.devenv.spoofax.gradle.langspec") + `maven-publish` } val spoofax2DevenvVersion: String by ext spoofaxLanguageSpecification { - addSourceDependenciesFromMetaborgYaml.set(false) - addCompileDependenciesFromMetaborgYaml.set(false) - addLanguageContributionsFromMetaborgYaml.set(false) - languageContributions.add(LanguageContributionIdentifier(LanguageIdentifier("$group", "org.metaborg.meta.lang.template", LanguageVersion.parse("$version")), "TemplateLang")) + addSourceDependenciesFromMetaborgYaml.set(false) + addCompileDependenciesFromMetaborgYaml.set(false) + addLanguageContributionsFromMetaborgYaml.set(false) + languageContributions.add(LanguageContributionIdentifier(LanguageIdentifier("$group", "org.metaborg.meta.lang.template", LanguageVersion.parse("$version")), "TemplateLang")) } dependencies { - compileLanguage("org.metaborg.devenv:org.metaborg.meta.lang.esv:$spoofax2DevenvVersion") - sourceLanguage("org.metaborg.devenv:org.metaborg.meta.lang.template:$spoofax2DevenvVersion") - sourceLanguage("org.metaborg.devenv:statix.lang:$spoofax2DevenvVersion") + compileLanguage("org.metaborg.devenv:org.metaborg.meta.lang.esv:$spoofax2DevenvVersion") + sourceLanguage("org.metaborg.devenv:org.metaborg.meta.lang.template:$spoofax2DevenvVersion") + sourceLanguage("org.metaborg.devenv:statix.lang:$spoofax2DevenvVersion") - sourceLanguage("org.metaborg.devenv:meta.lib.spoofax:$spoofax2DevenvVersion") - sourceLanguage("org.metaborg.devenv:statix.runtime:$spoofax2DevenvVersion") + sourceLanguage("org.metaborg.devenv:meta.lib.spoofax:$spoofax2DevenvVersion") + sourceLanguage("org.metaborg.devenv:statix.runtime:$spoofax2DevenvVersion") - sourceLanguage(project(":dynamix.spoofax2")) + sourceLanguage(project(":dynamix.spoofax2")) } diff --git a/lwb/metalang/sdf3_ext_dynamix/sdf3_ext_dynamix/build.gradle.kts b/lwb/metalang/sdf3_ext_dynamix/sdf3_ext_dynamix/build.gradle.kts index e4c955b37..5b5d42cf2 100644 --- a/lwb/metalang/sdf3_ext_dynamix/sdf3_ext_dynamix/build.gradle.kts +++ b/lwb/metalang/sdf3_ext_dynamix/sdf3_ext_dynamix/build.gradle.kts @@ -1,10 +1,11 @@ -import mb.spoofax.compiler.adapter.* -import mb.spoofax.compiler.util.* +import mb.spoofax.compiler.adapter.AdapterProjectCompiler +import mb.spoofax.compiler.util.GradleDependency +import mb.spoofax.compiler.util.TypeInfo plugins { - id("org.metaborg.gradle.config.java-library") - id("org.metaborg.spoofax.compiler.gradle.spoofax2.language") - id("org.metaborg.spoofax.compiler.gradle.adapter") + id("org.metaborg.gradle.config.java-library") + id("org.metaborg.spoofax.compiler.gradle.spoofax2.language") + id("org.metaborg.spoofax.compiler.gradle.adapter") } fun compositeBuild(name: String) = "$group:$name:$version" @@ -14,39 +15,39 @@ dependencies { } languageProject { - shared { - name("Sdf3ExtDynamix") - defaultClassPrefix("Sdf3ExtDynamix") - defaultPackageId("mb.sdf3_ext_dynamix") - fileExtensions(listOf()) // No file extensions. - } - compilerInput { - withStrategoRuntime() - } + shared { + name("Sdf3ExtDynamix") + defaultClassPrefix("Sdf3ExtDynamix") + defaultPackageId("mb.sdf3_ext_dynamix") + fileExtensions(listOf()) // No file extensions. + } + compilerInput { + withStrategoRuntime() + } } spoofax2BasedLanguageProject { - compilerInput { - withStrategoRuntime().run { - copyCtree(true) - copyClasses(false) + compilerInput { + withStrategoRuntime().run { + copyCtree(true) + copyClasses(false) + } + project.languageSpecificationDependency(GradleDependency.project(":sdf3_ext_dynamix.spoofax2")) } - project.languageSpecificationDependency(GradleDependency.project(":sdf3_ext_dynamix.spoofax2")) - } } languageAdapterProject { - compilerInput { - withStrategoRuntime() - project.configureCompilerInput() - } + compilerInput { + withStrategoRuntime() + project.configureCompilerInput() + } } fun AdapterProjectCompiler.Input.Builder.configureCompilerInput() { - compositionGroup("mb.spoofax.lwb") + compositionGroup("mb.spoofax.lwb") - val packageId = "mb.sdf3_ext_dynamix" - val taskPackageId = "$packageId.task" + val packageId = "mb.sdf3_ext_dynamix" + val taskPackageId = "$packageId.task" - addTaskDefs( - TypeInfo.of(taskPackageId, "Sdf3ExtDynamixGenerateDynamix") - ) + addTaskDefs( + TypeInfo.of(taskPackageId, "Sdf3ExtDynamixGenerateDynamix") + ) } diff --git a/lwb/metalang/sdf3_ext_statix/sdf3_ext_statix.eclipse/build.gradle.kts b/lwb/metalang/sdf3_ext_statix/sdf3_ext_statix.eclipse/build.gradle.kts index 1faeec915..12ff65441 100644 --- a/lwb/metalang/sdf3_ext_statix/sdf3_ext_statix.eclipse/build.gradle.kts +++ b/lwb/metalang/sdf3_ext_statix/sdf3_ext_statix.eclipse/build.gradle.kts @@ -1,12 +1,12 @@ plugins { - id("org.metaborg.gradle.config.java-library") - id("org.metaborg.spoofax.compiler.gradle.eclipse") + id("org.metaborg.gradle.config.java-library") + id("org.metaborg.spoofax.compiler.gradle.eclipse") } languageEclipseProject { - adapterProject.set(project(":sdf3_ext_statix")) + adapterProject.set(project(":sdf3_ext_statix")) } mavenize { - majorVersion.set("2022-06") + majorVersion.set("2022-06") } diff --git a/lwb/metalang/sdf3_ext_statix/sdf3_ext_statix/build.gradle.kts b/lwb/metalang/sdf3_ext_statix/sdf3_ext_statix/build.gradle.kts index d0f808305..51c79988b 100644 --- a/lwb/metalang/sdf3_ext_statix/sdf3_ext_statix/build.gradle.kts +++ b/lwb/metalang/sdf3_ext_statix/sdf3_ext_statix/build.gradle.kts @@ -2,9 +2,9 @@ import mb.spoofax.compiler.adapter.* import mb.spoofax.compiler.util.* plugins { - id("org.metaborg.gradle.config.java-library") - id("org.metaborg.spoofax.compiler.gradle.spoofax2.language") - id("org.metaborg.spoofax.compiler.gradle.adapter") + id("org.metaborg.gradle.config.java-library") + id("org.metaborg.spoofax.compiler.gradle.spoofax2.language") + id("org.metaborg.spoofax.compiler.gradle.adapter") } fun compositeBuild(name: String) = "$group:$name:$version" @@ -14,46 +14,46 @@ dependencies { } languageProject { - shared { - name("Sdf3ExtStatix") - defaultClassPrefix("Sdf3ExtStatix") - defaultPackageId("mb.sdf3_ext_statix") - fileExtensions(listOf()) // No file extensions. - } - compilerInput { - withStrategoRuntime().run { - addStrategyPackageIds("sdf3.ext.statix.strategies") - addStrategyPackageIds("sdf3.ext.statix.trans") - addInteropRegisterersByReflection("sdf3.ext.statix.trans.InteropRegisterer") - addInteropRegisterersByReflection("sdf3.ext.statix.strategies.InteropRegisterer") - baseStrategoRuntimeBuilderFactory("mb.sdf3_ext_statix.stratego", "BaseSdf3ExtStatixStrategoRuntimeBuilderFactory") - extendStrategoRuntimeBuilderFactory("mb.sdf3_ext_statix.stratego", "Sdf3ExtStatixStrategoRuntimeBuilderFactory") + shared { + name("Sdf3ExtStatix") + defaultClassPrefix("Sdf3ExtStatix") + defaultPackageId("mb.sdf3_ext_statix") + fileExtensions(listOf()) // No file extensions. + } + compilerInput { + withStrategoRuntime().run { + addStrategyPackageIds("sdf3.ext.statix.strategies") + addStrategyPackageIds("sdf3.ext.statix.trans") + addInteropRegisterersByReflection("sdf3.ext.statix.trans.InteropRegisterer") + addInteropRegisterersByReflection("sdf3.ext.statix.strategies.InteropRegisterer") + baseStrategoRuntimeBuilderFactory("mb.sdf3_ext_statix.stratego", "BaseSdf3ExtStatixStrategoRuntimeBuilderFactory") + extendStrategoRuntimeBuilderFactory("mb.sdf3_ext_statix.stratego", "Sdf3ExtStatixStrategoRuntimeBuilderFactory") + } } - } } spoofax2BasedLanguageProject { - compilerInput { - withStrategoRuntime().run { - copyClasses(true) + compilerInput { + withStrategoRuntime().run { + copyClasses(true) + } + project.languageSpecificationDependency(GradleDependency.module("org.metaborg.devenv:sdf3.ext.statix:${ext["spoofax2DevenvVersion"]}")) } - project.languageSpecificationDependency(GradleDependency.module("org.metaborg.devenv:sdf3.ext.statix:${ext["spoofax2DevenvVersion"]}")) - } } languageAdapterProject { - compilerInput { - withStrategoRuntime() - project.configureCompilerInput() - } + compilerInput { + withStrategoRuntime() + project.configureCompilerInput() + } } fun AdapterProjectCompiler.Input.Builder.configureCompilerInput() { - compositionGroup("mb.spoofax.lwb") + compositionGroup("mb.spoofax.lwb") - val packageId = "mb.sdf3_ext_statix" - val taskPackageId = "$packageId.task" + val packageId = "mb.sdf3_ext_statix" + val taskPackageId = "$packageId.task" - addTaskDefs( - TypeInfo.of(taskPackageId, "Sdf3ExtStatixGenerateStatix"), - TypeInfo.of(taskPackageId, "Sdf3ExtStatixGenerateStratego") - ) + addTaskDefs( + TypeInfo.of(taskPackageId, "Sdf3ExtStatixGenerateStatix"), + TypeInfo.of(taskPackageId, "Sdf3ExtStatixGenerateStratego") + ) } diff --git a/lwb/metalang/spt/spt.cli/build.gradle.kts b/lwb/metalang/spt/spt.cli/build.gradle.kts index e316085df..557bbcea0 100644 --- a/lwb/metalang/spt/spt.cli/build.gradle.kts +++ b/lwb/metalang/spt/spt.cli/build.gradle.kts @@ -1,15 +1,15 @@ plugins { - id("org.metaborg.gradle.config.java-library") - id("org.metaborg.spoofax.compiler.gradle.cli") + id("org.metaborg.gradle.config.java-library") + id("org.metaborg.spoofax.compiler.gradle.cli") } languageCliProject { - adapterProject.set(project(":spt")) + adapterProject.set(project(":spt")) } tasks { - // Disable currently unused distribution tasks. - distZip.configure { enabled = false } - distTar.configure { enabled = false } - startScripts.configure { enabled = false } + // Disable currently unused distribution tasks. + distZip.configure { enabled = false } + distTar.configure { enabled = false } + startScripts.configure { enabled = false } } diff --git a/lwb/metalang/spt/spt.dynamicloading/build.gradle.kts b/lwb/metalang/spt/spt.dynamicloading/build.gradle.kts index b82c550b2..b4e618afe 100644 --- a/lwb/metalang/spt/spt.dynamicloading/build.gradle.kts +++ b/lwb/metalang/spt/spt.dynamicloading/build.gradle.kts @@ -1,10 +1,10 @@ plugins { - id("org.metaborg.gradle.config.java-library") + id("org.metaborg.gradle.config.java-library") } dependencies { - api(project(":spt")) - api(project(":spoofax.lwb.dynamicloading")) + api(project(":spt")) + api(project(":spoofax.lwb.dynamicloading")) - compileOnly("org.checkerframework:checker-qual-android") + compileOnly("org.checkerframework:checker-qual-android") } diff --git a/lwb/metalang/spt/spt.eclipse/build.gradle.kts b/lwb/metalang/spt/spt.eclipse/build.gradle.kts index be407a9ae..cd659471c 100644 --- a/lwb/metalang/spt/spt.eclipse/build.gradle.kts +++ b/lwb/metalang/spt/spt.eclipse/build.gradle.kts @@ -1,17 +1,17 @@ plugins { - id("org.metaborg.gradle.config.java-library") - id("org.metaborg.spoofax.compiler.gradle.eclipse") + id("org.metaborg.gradle.config.java-library") + id("org.metaborg.spoofax.compiler.gradle.eclipse") } dependencies { - // Required because @Nullable has runtime retention (which includes classfile retention), and the Java compiler requires access to it. - compileOnly("com.google.code.findbugs:jsr305") + // Required because @Nullable has runtime retention (which includes classfile retention), and the Java compiler requires access to it. + compileOnly("com.google.code.findbugs:jsr305") } languageEclipseProject { - adapterProject.set(project(":spt")) + adapterProject.set(project(":spt")) } mavenize { - majorVersion.set("2022-06") + majorVersion.set("2022-06") } diff --git a/lwb/metalang/spt/spt.intellij/build.gradle.kts b/lwb/metalang/spt/spt.intellij/build.gradle.kts index 958553fc9..cf7303f86 100644 --- a/lwb/metalang/spt/spt.intellij/build.gradle.kts +++ b/lwb/metalang/spt/spt.intellij/build.gradle.kts @@ -1,8 +1,8 @@ plugins { - id("org.metaborg.gradle.config.java-library") - id("org.metaborg.spoofax.compiler.gradle.intellij") + id("org.metaborg.gradle.config.java-library") + id("org.metaborg.spoofax.compiler.gradle.intellij") } languageIntellijProject { - adapterProject.set(project(":spt")) + adapterProject.set(project(":spt")) } diff --git a/lwb/metalang/spt/spt/build.gradle.kts b/lwb/metalang/spt/spt/build.gradle.kts index 5b45e6828..eedff75c9 100644 --- a/lwb/metalang/spt/spt/build.gradle.kts +++ b/lwb/metalang/spt/spt/build.gradle.kts @@ -7,47 +7,47 @@ import mb.spoofax.core.language.command.CommandExecutionType import mb.spoofax.common.* plugins { - id("org.metaborg.gradle.config.java-library") - id("org.metaborg.spoofax.compiler.gradle.spoofax2.language") - id("org.metaborg.spoofax.compiler.gradle.adapter") + id("org.metaborg.gradle.config.java-library") + id("org.metaborg.spoofax.compiler.gradle.spoofax2.language") + id("org.metaborg.spoofax.compiler.gradle.adapter") } fun compositeBuild(name: String) = "$group:$name:$version" dependencies { - api(compositeBuild("spt.api")) + api(compositeBuild("spt.api")) - // Required because @Nullable has runtime retention (which includes classfile retention), and the Java compiler requires access to it. - compileOnly("com.google.code.findbugs:jsr305") + // Required because @Nullable has runtime retention (which includes classfile retention), and the Java compiler requires access to it. + compileOnly("com.google.code.findbugs:jsr305") } languageProject { - shared { - name("SPT") - defaultClassPrefix("Spt") - defaultPackageId("mb.spt") - } - compilerInput { - withParser().run { - startSymbol("TestSuite") + shared { + name("SPT") + defaultClassPrefix("Spt") + defaultPackageId("mb.spt") } - withStyler() - withStrategoRuntime().run { - addStrategyPackageIds("org.metaborg.meta.lang.spt.trans") - addStrategyPackageIds("org.metaborg.meta.lang.spt.strategies") - addInteropRegisterersByReflection("org.metaborg.meta.lang.spt.trans.InteropRegisterer") - addInteropRegisterersByReflection("org.metaborg.meta.lang.spt.strategies.InteropRegisterer") + compilerInput { + withParser().run { + startSymbol("TestSuite") + } + withStyler() + withStrategoRuntime().run { + addStrategyPackageIds("org.metaborg.meta.lang.spt.trans") + addStrategyPackageIds("org.metaborg.meta.lang.spt.strategies") + addInteropRegisterersByReflection("org.metaborg.meta.lang.spt.trans.InteropRegisterer") + addInteropRegisterersByReflection("org.metaborg.meta.lang.spt.strategies.InteropRegisterer") + } } - } } spoofax2BasedLanguageProject { - compilerInput { - withParser() - withStyler() - withStrategoRuntime().run { - copyClasses(true) + compilerInput { + withParser() + withStyler() + withStrategoRuntime().run { + copyClasses(true) + } + project.languageSpecificationDependency(GradleDependency.module("org.metaborg.devenv:org.metaborg.meta.lang.spt:${ext["spoofax2DevenvVersion"]}")) } - project.languageSpecificationDependency(GradleDependency.module("org.metaborg.devenv:org.metaborg.meta.lang.spt:${ext["spoofax2DevenvVersion"]}")) - } } val packageId = "mb.spt" @@ -55,101 +55,114 @@ val taskPackageId = "$packageId.task" val commandPackageId = "$packageId.command" languageAdapterProject { - compilerInput { - withParser() - withStyler() - withStrategoRuntime() - project.configureCompilerInput() - } + compilerInput { + withParser() + withStyler() + withStrategoRuntime() + project.configureCompilerInput() + } } fun AdapterProjectCompiler.Input.Builder.configureCompilerInput() { - compositionGroup("mb.spoofax.lwb") + compositionGroup("mb.spoofax.lwb") - // Symbols - addLineCommentSymbols("//") - addBlockCommentSymbols(BlockCommentSymbols("/*", "*/")) - addBracketSymbols(BracketSymbols('[', ']')) - addBracketSymbols(BracketSymbols('{', '}')) - addBracketSymbols(BracketSymbols('(', ')')) + // Symbols + addLineCommentSymbols("//") + addBlockCommentSymbols(BlockCommentSymbols("/*", "*/")) + addBracketSymbols(BracketSymbols('[', ']')) + addBracketSymbols(BracketSymbols('{', '}')) + addBracketSymbols(BracketSymbols('(', ')')) - // Extend resources component and add modules - baseResourcesComponent(packageId, "BaseSptResourcesComponent") - extendResourcesComponent(packageId, "SptResourcesComponent") - addAdditionalResourcesModules("$packageId.resource", "SptTestCaseResourceModule") + // Extend resources component and add modules + baseResourcesComponent(packageId, "BaseSptResourcesComponent") + extendResourcesComponent(packageId, "SptResourcesComponent") + addAdditionalResourcesModules("$packageId.resource", "SptTestCaseResourceModule") - // Extend component and add modules - baseComponent(packageId, "BaseSptComponent") - extendComponent(packageId, "SptComponent") - addAdditionalModules("$packageId.fromterm", "ExpectationFromTermsModule") + // Extend component and add modules + baseComponent(packageId, "BaseSptComponent") + extendComponent(packageId, "SptComponent") + addAdditionalModules("$packageId.fromterm", "ExpectationFromTermsModule") - // Extend participant - baseParticipant(packageId, "BaseSptParticipant") - extendParticipant(packageId, "SptParticipant") + // Extend participant + baseParticipant(packageId, "BaseSptParticipant") + extendParticipant(packageId, "SptParticipant") - // Wrap Check and rename base tasks - isMultiFile(false) - baseCheckTaskDef(taskPackageId, "BaseSptCheck") - baseCheckMultiTaskDef(taskPackageId, "BaseSptCheckMulti") - extendCheckTaskDef(taskPackageId, "SptCheck") + // Wrap Check and rename base tasks + isMultiFile(false) + baseCheckTaskDef(taskPackageId, "BaseSptCheck") + baseCheckMultiTaskDef(taskPackageId, "BaseSptCheckMulti") + extendCheckTaskDef(taskPackageId, "SptCheck") - // Internal task definitions - val check = TypeInfo.of(taskPackageId, "SptCheck") - addTaskDefs(check) - val runTestSuite = TypeInfo.of(taskPackageId, "SptRunTestSuite") - val runTestSuites = TypeInfo.of(taskPackageId, "SptRunTestSuites") - addTaskDefs(runTestSuite, runTestSuites) + // Internal task definitions + val check = TypeInfo.of(taskPackageId, "SptCheck") + addTaskDefs(check) + val runTestSuite = TypeInfo.of(taskPackageId, "SptRunTestSuite") + val runTestSuites = TypeInfo.of(taskPackageId, "SptRunTestSuites") + addTaskDefs(runTestSuite, runTestSuites) - // Add test running tasks - val showTestSuiteResults = TypeInfo.of(taskPackageId, "SptShowTestSuiteResults") - val showTestResults = TypeInfo.of(taskPackageId, "SptShowTestSuitesResults") - addTaskDefs(showTestSuiteResults, showTestResults) + // Add test running tasks + val showTestSuiteResults = TypeInfo.of(taskPackageId, "SptShowTestSuiteResults") + val showTestResults = TypeInfo.of(taskPackageId, "SptShowTestSuitesResults") + addTaskDefs(showTestSuiteResults, showTestResults) - // Add test running commands - val showTestSuiteCommand = CommandDefRepr.builder() - .type(commandPackageId, showTestSuiteResults.id() + "Command") - .taskDefType(showTestSuiteResults) - .argType(TypeInfo.of(taskPackageId, "SptShowTestSuiteResults.Args")) - .displayName("Run SPT tests") - .description("Run the SPT tests in this file") - .addSupportedExecutionTypes(CommandExecutionType.ManualOnce) - .addAllParams(listOf( - ParamRepr.of( - "rootDir", TypeInfo.of("mb.resource.hierarchical", "ResourcePath"), - true, ArgProviderRepr.enclosingContext(EnclosingCommandContextType.Project) - ), - ParamRepr.of("file", TypeInfo.of("mb.resource", "ResourceKey"), true, ArgProviderRepr.context(CommandContextType.File)) - )) - .build() - val showTestSuitesCommand = CommandDefRepr.builder() - .type(commandPackageId, showTestResults.id() + "Command") - .taskDefType(showTestResults) - .argType(TypeInfo.of(taskPackageId, "SptShowTestSuitesResults.Args")) - .displayName("Run SPT tests") - .description("Run the SPT tests in this directory") - .addSupportedExecutionTypes(CommandExecutionType.ManualOnce) - .addAllParams(listOf( - ParamRepr.of( - "rootDir", - TypeInfo.of("mb.resource.hierarchical", "ResourcePath"), - true, - ArgProviderRepr.enclosingContext(EnclosingCommandContextType.Project) - ), - ParamRepr.of("directory", - TypeInfo.of("mb.resource.hierarchical", "ResourcePath"), - true, - ArgProviderRepr.context(CommandContextType.Directory)) - )) - .build() - addCommandDefs(showTestSuiteCommand, showTestSuitesCommand) + // Add test running commands + val showTestSuiteCommand = CommandDefRepr.builder() + .type(commandPackageId, showTestSuiteResults.id() + "Command") + .taskDefType(showTestSuiteResults) + .argType(TypeInfo.of(taskPackageId, "SptShowTestSuiteResults.Args")) + .displayName("Run SPT tests") + .description("Run the SPT tests in this file") + .addSupportedExecutionTypes(CommandExecutionType.ManualOnce) + .addAllParams( + listOf( + ParamRepr.of( + "rootDir", + TypeInfo.of("mb.resource.hierarchical", "ResourcePath"), + true, + ArgProviderRepr.enclosingContext(EnclosingCommandContextType.Project) + ), + ParamRepr.of( + "file", + TypeInfo.of("mb.resource", "ResourceKey"), + true, + ArgProviderRepr.context(CommandContextType.File) + ) + ) + ) + .build() + val showTestSuitesCommand = CommandDefRepr.builder() + .type(commandPackageId, showTestResults.id() + "Command") + .taskDefType(showTestResults) + .argType(TypeInfo.of(taskPackageId, "SptShowTestSuitesResults.Args")) + .displayName("Run SPT tests") + .description("Run the SPT tests in this directory") + .addSupportedExecutionTypes(CommandExecutionType.ManualOnce) + .addAllParams( + listOf( + ParamRepr.of( + "rootDir", + TypeInfo.of("mb.resource.hierarchical", "ResourcePath"), + true, + ArgProviderRepr.enclosingContext(EnclosingCommandContextType.Project) + ), + ParamRepr.of( + "directory", + TypeInfo.of("mb.resource.hierarchical", "ResourcePath"), + true, + ArgProviderRepr.context(CommandContextType.Directory) + ) + ) + ) + .build() + addCommandDefs(showTestSuiteCommand, showTestSuitesCommand) - // Menu bindings - val mainAndEditorMenu = listOf( - CommandActionRepr.builder().manualOnce(showTestSuiteCommand).fileRequired().enclosingProjectRequired().buildItem() - ) - addAllMainMenuItems(mainAndEditorMenu) - addAllEditorContextMenuItems(mainAndEditorMenu) - addResourceContextMenuItems( - CommandActionRepr.builder().manualOnce(showTestSuiteCommand).fileRequired().enclosingProjectRequired().buildItem(), - CommandActionRepr.builder().manualOnce(showTestSuitesCommand).directoryRequired().enclosingProjectRequired().buildItem() - ) + // Menu bindings + val mainAndEditorMenu = listOf( + CommandActionRepr.builder().manualOnce(showTestSuiteCommand).fileRequired().enclosingProjectRequired().buildItem() + ) + addAllMainMenuItems(mainAndEditorMenu) + addAllEditorContextMenuItems(mainAndEditorMenu) + addResourceContextMenuItems( + CommandActionRepr.builder().manualOnce(showTestSuiteCommand).fileRequired().enclosingProjectRequired().buildItem(), + CommandActionRepr.builder().manualOnce(showTestSuitesCommand).directoryRequired().enclosingProjectRequired().buildItem() + ) } diff --git a/lwb/metalang/statix/statix.cli/build.gradle.kts b/lwb/metalang/statix/statix.cli/build.gradle.kts index f89a1408b..33732d016 100644 --- a/lwb/metalang/statix/statix.cli/build.gradle.kts +++ b/lwb/metalang/statix/statix.cli/build.gradle.kts @@ -1,15 +1,15 @@ plugins { - id("org.metaborg.gradle.config.java-library") - id("org.metaborg.spoofax.compiler.gradle.cli") + id("org.metaborg.gradle.config.java-library") + id("org.metaborg.spoofax.compiler.gradle.cli") } languageCliProject { - adapterProject.set(project(":statix")) + adapterProject.set(project(":statix")) } tasks { - // Disable currently unused distribution tasks. - distZip.configure { enabled = false } - distTar.configure { enabled = false } - startScripts.configure { enabled = false } + // Disable currently unused distribution tasks. + distZip.configure { enabled = false } + distTar.configure { enabled = false } + startScripts.configure { enabled = false } } diff --git a/lwb/metalang/statix/statix.eclipse/build.gradle.kts b/lwb/metalang/statix/statix.eclipse/build.gradle.kts index 43a339fc8..95bce2aaa 100644 --- a/lwb/metalang/statix/statix.eclipse/build.gradle.kts +++ b/lwb/metalang/statix/statix.eclipse/build.gradle.kts @@ -1,41 +1,41 @@ plugins { - id("org.metaborg.gradle.config.java-library") - id("org.metaborg.spoofax.compiler.gradle.eclipse") + id("org.metaborg.gradle.config.java-library") + id("org.metaborg.spoofax.compiler.gradle.eclipse") } dependencies { - // Required because @Nullable has runtime retention (which includes classfile retention), and the Java compiler requires access to it. - compileOnly("com.google.code.findbugs:jsr305") + // Required because @Nullable has runtime retention (which includes classfile retention), and the Java compiler requires access to it. + compileOnly("com.google.code.findbugs:jsr305") } languageEclipseProject { - adapterProject.set(project(":statix")) + adapterProject.set(project(":statix")) } mavenize { - majorVersion.set("2022-06") + majorVersion.set("2022-06") } tasks { - "jar"(Jar::class) { - val exportPackages = LinkedHashSet() - // Allow split package because `statix.solver` also includes the `mb.statix` package. Add before existing exports so - // that this takes precedence - exportPackages.add("mb.statix.*;-split-package:=merge-first") - val existingExportPackages = manifest.attributes.get("Export-Package") - if(existingExportPackages != null) { - exportPackages.add(existingExportPackages.toString()) + "jar"(Jar::class) { + val exportPackages = LinkedHashSet() + // Allow split package because `statix.solver` also includes the `mb.statix` package. Add before existing exports so + // that this takes precedence + exportPackages.add("mb.statix.*;-split-package:=merge-first") + val existingExportPackages = manifest.attributes.get("Export-Package") + if (existingExportPackages != null) { + exportPackages.add(existingExportPackages.toString()) + } + val privatePackages = LinkedHashSet() + val existingPrivatePackages = manifest.attributes.get("Private-Package") + if (existingPrivatePackages != null) { + privatePackages.add(existingPrivatePackages.toString()) + } + manifest { + attributes( + Pair("Export-Package", exportPackages.joinToString(", ")), + Pair("Private-Package", privatePackages.joinToString(", ")) + ) + } } - val privatePackages = LinkedHashSet() - val existingPrivatePackages = manifest.attributes.get("Private-Package") - if(existingPrivatePackages != null) { - privatePackages.add(existingPrivatePackages.toString()) - } - manifest { - attributes( - Pair("Export-Package", exportPackages.joinToString(", ")), - Pair("Private-Package", privatePackages.joinToString(", ")) - ) - } - } } diff --git a/lwb/metalang/statix/statix.intellij/build.gradle.kts b/lwb/metalang/statix/statix.intellij/build.gradle.kts index 5602ab4bd..a99a3f24e 100644 --- a/lwb/metalang/statix/statix.intellij/build.gradle.kts +++ b/lwb/metalang/statix/statix.intellij/build.gradle.kts @@ -1,8 +1,8 @@ plugins { - id("org.metaborg.gradle.config.java-library") - id("org.metaborg.spoofax.compiler.gradle.intellij") + id("org.metaborg.gradle.config.java-library") + id("org.metaborg.spoofax.compiler.gradle.intellij") } languageIntellijProject { - adapterProject.set(project(":statix")) + adapterProject.set(project(":statix")) } diff --git a/lwb/metalang/statix/statix/build.gradle.kts b/lwb/metalang/statix/statix/build.gradle.kts index 981ff8975..80588ff8b 100644 --- a/lwb/metalang/statix/statix/build.gradle.kts +++ b/lwb/metalang/statix/statix/build.gradle.kts @@ -7,146 +7,145 @@ import mb.spoofax.core.language.command.EnclosingCommandContextType import mb.spoofax.common.* plugins { - id("org.metaborg.gradle.config.java-library") - id("org.metaborg.gradle.config.junit-testing") - id("org.metaborg.spoofax.compiler.gradle.spoofax2.language") - id("org.metaborg.spoofax.compiler.gradle.adapter") + id("org.metaborg.gradle.config.java-library") + id("org.metaborg.gradle.config.junit-testing") + id("org.metaborg.spoofax.compiler.gradle.spoofax2.language") + id("org.metaborg.spoofax.compiler.gradle.adapter") } fun compositeBuild(name: String) = "$group:$name:$version" dependencies { - // Required because @Nullable has runtime retention (which includes classfile retention), and the Java compiler requires access to it. - compileOnly("com.google.code.findbugs:jsr305") + // Required because @Nullable has runtime retention (which includes classfile retention), and the Java compiler requires access to it. + compileOnly("com.google.code.findbugs:jsr305") - implementation("$group:spoofax2.common:$version") + implementation("$group:spoofax2.common:$version") - testImplementation(compositeBuild("spoofax.test")) - testCompileOnly("org.checkerframework:checker-qual-android") + testImplementation(compositeBuild("spoofax.test")) + testCompileOnly("org.checkerframework:checker-qual-android") } languageProject { - shared { - name("Statix") - addFileExtensions("stx", "stxtest") - defaultClassPrefix("Statix") - defaultPackageId("mb.statix") - } - compilerInput { - withParser().run { - startSymbol("Start") + shared { + name("Statix") + addFileExtensions("stx", "stxtest") + defaultClassPrefix("Statix") + defaultPackageId("mb.statix") } - withStyler() - withConstraintAnalyzer().run { - enableNaBL2(true) - enableStatix(false) - multiFile(true) + compilerInput { + withParser().run { + startSymbol("Start") + } + withStyler() + withConstraintAnalyzer().run { + enableNaBL2(true) + enableStatix(false) + multiFile(true) + } + withStrategoRuntime().run { + addStrategyPackageIds("statix.lang.strategies") + addStrategyPackageIds("statix.lang.trans") + addInteropRegisterersByReflection("statix.lang.strategies.InteropRegisterer") + addInteropRegisterersByReflection("statix.lang.trans.InteropRegisterer") + addSpoofax2Primitives(true) + addStatixPrimitives(true) // Requires the STX_compare_patterns primitive. + } } - withStrategoRuntime().run { - addStrategyPackageIds("statix.lang.strategies") - addStrategyPackageIds("statix.lang.trans") - addInteropRegisterersByReflection("statix.lang.strategies.InteropRegisterer") - addInteropRegisterersByReflection("statix.lang.trans.InteropRegisterer") - addSpoofax2Primitives(true) - addStatixPrimitives(true) // Requires the STX_compare_patterns primitive. - } - } } spoofax2BasedLanguageProject { - compilerInput { - withParser() - withStyler() - withConstraintAnalyzer() - withStrategoRuntime().run { - copyCtree(false) - copyClasses(true) + compilerInput { + withParser() + withStyler() + withConstraintAnalyzer() + withStrategoRuntime().run { + copyCtree(false) + copyClasses(true) + } + project.languageSpecificationDependency(GradleDependency.module("org.metaborg.devenv:statix.lang:${ext["spoofax2DevenvVersion"]}")) } - project.languageSpecificationDependency(GradleDependency.module("org.metaborg.devenv:statix.lang:${ext["spoofax2DevenvVersion"]}")) - } } val packageId = "mb.statix" val taskPackageId = "$packageId.task" val spoofaxTaskPackageId = "$taskPackageId.spoofax" languageAdapterProject { - compilerInput { - withGetSourceFiles().run { - extendGetSourceFilesTaskDef(spoofaxTaskPackageId, "StatixGetSourceFiles") - baseGetSourceFilesTaskDef(spoofaxTaskPackageId, "BaseStatixGetSourceFiles") - } - withParser().run { - // Wrap Parse task - extendParseTaskDef(spoofaxTaskPackageId, "StatixParseWrapper") - } - withStyler() - withConstraintAnalyzer().run { - // Wrap AnalyzeMulti and rename base task - baseAnalyzeMultiTaskDef(spoofaxTaskPackageId, "BaseStatixAnalyzeMulti") - extendAnalyzeMultiTaskDef(spoofaxTaskPackageId, "StatixAnalyzeMultiWrapper") - } - withStrategoRuntime() - withReferenceResolution().run { - resolveStrategy("nabl2--editor-resolve") - } + compilerInput { + withGetSourceFiles().run { + extendGetSourceFilesTaskDef(spoofaxTaskPackageId, "StatixGetSourceFiles") + baseGetSourceFilesTaskDef(spoofaxTaskPackageId, "BaseStatixGetSourceFiles") + } + withParser().run { + // Wrap Parse task + extendParseTaskDef(spoofaxTaskPackageId, "StatixParseWrapper") + } + withStyler() + withConstraintAnalyzer().run { + // Wrap AnalyzeMulti and rename base task + baseAnalyzeMultiTaskDef(spoofaxTaskPackageId, "BaseStatixAnalyzeMulti") + extendAnalyzeMultiTaskDef(spoofaxTaskPackageId, "StatixAnalyzeMultiWrapper") + } + withStrategoRuntime() + withReferenceResolution().run { + resolveStrategy("nabl2--editor-resolve") + } // withHover().run { // hoverStrategy("nabl2--editor-hover") // } - project.configureCompilerInput() - } + project.configureCompilerInput() + } } fun AdapterProjectCompiler.Input.Builder.configureCompilerInput() { - compositionGroup("mb.spoofax.lwb") + compositionGroup("mb.spoofax.lwb") - val commandPackageId = "$packageId.command" + val commandPackageId = "$packageId.command" - // Symbols - addLineCommentSymbols("//") - addBlockCommentSymbols(BlockCommentSymbols("/*", "*/")) - addBracketSymbols(BracketSymbols('[', ']')) - addBracketSymbols(BracketSymbols('{', '}')) - addBracketSymbols(BracketSymbols('(', ')')) + // Symbols + addLineCommentSymbols("//") + addBlockCommentSymbols(BlockCommentSymbols("/*", "*/")) + addBracketSymbols(BracketSymbols('[', ']')) + addBracketSymbols(BracketSymbols('{', '}')) + addBracketSymbols(BracketSymbols('(', ')')) - // Extend component - baseComponent(packageId, "BaseStatixComponent") - extendComponent(packageId, "StatixComponent") + // Extend component + baseComponent(packageId, "BaseStatixComponent") + extendComponent(packageId, "StatixComponent") - // Wrap CheckMulti and rename base tasks - isMultiFile(true) - baseCheckTaskDef(spoofaxTaskPackageId, "BaseStatixCheck") + // Wrap CheckMulti and rename base tasks + isMultiFile(true) + baseCheckTaskDef(spoofaxTaskPackageId, "BaseStatixCheck") - addTaskDefs(taskPackageId, "StatixPrettyPrint") + addTaskDefs(taskPackageId, "StatixPrettyPrint") - addTaskDefs(taskPackageId, "StatixCompileModule") - addTaskDefs(taskPackageId, "StatixCompileProject") - addTaskDefs(taskPackageId, "StatixCompileAndMergeProject") - addTaskDefs(taskPackageId, "StatixCompileSpec") + addTaskDefs(taskPackageId, "StatixCompileModule") + addTaskDefs(taskPackageId, "StatixCompileProject") + addTaskDefs(taskPackageId, "StatixCompileAndMergeProject") + addTaskDefs(taskPackageId, "StatixCompileSpec") - // Evaluate test - val evaluateTest = TypeInfo.of(taskPackageId, "StatixEvaluateTest") - addTaskDefs(evaluateTest) - val evaluateTestCommand = CommandDefRepr.builder() - .type(commandPackageId, evaluateTest.id() + "Command") - .taskDefType(evaluateTest) - .argType(evaluateTest.appendToId(".Args")) - .displayName("Evaluate test") - .description("Evaluates a .stxtest file and shows the test result") - .addSupportedExecutionTypes(CommandExecutionType.ManualOnce, CommandExecutionType.ManualContinuous) - .addAllParams(listOf( - ParamRepr.of("rootDirectory", TypeInfo.of("mb.resource.hierarchical", "ResourcePath"), true, ArgProviderRepr.enclosingContext(EnclosingCommandContextType.Project)), - ParamRepr.of("file", TypeInfo.of("mb.resource", "ResourceKey"), true, ArgProviderRepr.context(CommandContextType.ReadableResource)) - )) - .build() - addCommandDefs(evaluateTestCommand) + // Evaluate test + val evaluateTest = TypeInfo.of(taskPackageId, "StatixEvaluateTest") + addTaskDefs(evaluateTest) + val evaluateTestCommand = CommandDefRepr.builder() + .type(commandPackageId, evaluateTest.id() + "Command") + .taskDefType(evaluateTest) + .argType(evaluateTest.appendToId(".Args")) + .displayName("Evaluate test") + .description("Evaluates a .stxtest file and shows the test result") + .addSupportedExecutionTypes(CommandExecutionType.ManualOnce, CommandExecutionType.ManualContinuous) + .addAllParams(listOf( + ParamRepr.of("rootDirectory", TypeInfo.of("mb.resource.hierarchical", "ResourcePath"), true, ArgProviderRepr.enclosingContext(EnclosingCommandContextType.Project)), + ParamRepr.of("file", TypeInfo.of("mb.resource", "ResourceKey"), true, ArgProviderRepr.context(CommandContextType.ReadableResource)) + )).build() + addCommandDefs(evaluateTestCommand) - // Menu bindings - val mainAndEditorMenu = listOf( - MenuItemRepr.commandAction(CommandActionRepr.builder().manualOnce(evaluateTestCommand).readableResourceRequired().enclosingProjectRequired().build()), - MenuItemRepr.commandAction(CommandActionRepr.builder().manualContinuous(evaluateTestCommand).readableResourceRequired().enclosingProjectRequired().build()) - ) - addAllMainMenuItems(mainAndEditorMenu) - addAllEditorContextMenuItems(mainAndEditorMenu) - addResourceContextMenuItems( - MenuItemRepr.commandAction(CommandActionRepr.builder().manualOnce(evaluateTestCommand).fileRequired().enclosingProjectRequired().build()), - MenuItemRepr.commandAction(CommandActionRepr.builder().manualContinuous(evaluateTestCommand).fileRequired().enclosingProjectRequired().build()) - ) + // Menu bindings + val mainAndEditorMenu = listOf( + MenuItemRepr.commandAction(CommandActionRepr.builder().manualOnce(evaluateTestCommand).readableResourceRequired().enclosingProjectRequired().build()), + MenuItemRepr.commandAction(CommandActionRepr.builder().manualContinuous(evaluateTestCommand).readableResourceRequired().enclosingProjectRequired().build()) + ) + addAllMainMenuItems(mainAndEditorMenu) + addAllEditorContextMenuItems(mainAndEditorMenu) + addResourceContextMenuItems( + MenuItemRepr.commandAction(CommandActionRepr.builder().manualOnce(evaluateTestCommand).fileRequired().enclosingProjectRequired().build()), + MenuItemRepr.commandAction(CommandActionRepr.builder().manualContinuous(evaluateTestCommand).fileRequired().enclosingProjectRequired().build()) + ) } diff --git a/lwb/metalang/stratego/stratego.cli/build.gradle.kts b/lwb/metalang/stratego/stratego.cli/build.gradle.kts index 4dbe9615e..ae5784f12 100644 --- a/lwb/metalang/stratego/stratego.cli/build.gradle.kts +++ b/lwb/metalang/stratego/stratego.cli/build.gradle.kts @@ -1,15 +1,15 @@ plugins { - id("org.metaborg.gradle.config.java-library") - id("org.metaborg.spoofax.compiler.gradle.cli") + id("org.metaborg.gradle.config.java-library") + id("org.metaborg.spoofax.compiler.gradle.cli") } languageCliProject { - adapterProject.set(project(":stratego")) + adapterProject.set(project(":stratego")) } tasks { - // Disable currently unused distribution tasks. - distZip.configure { enabled = false } - distTar.configure { enabled = false } - startScripts.configure { enabled = false } + // Disable currently unused distribution tasks. + distZip.configure { enabled = false } + distTar.configure { enabled = false } + startScripts.configure { enabled = false } } diff --git a/lwb/metalang/stratego/stratego.eclipse/build.gradle.kts b/lwb/metalang/stratego/stratego.eclipse/build.gradle.kts index 09d143a48..5781f7713 100644 --- a/lwb/metalang/stratego/stratego.eclipse/build.gradle.kts +++ b/lwb/metalang/stratego/stratego.eclipse/build.gradle.kts @@ -1,43 +1,43 @@ plugins { - id("org.metaborg.gradle.config.java-library") - id("org.metaborg.spoofax.compiler.gradle.eclipse") + id("org.metaborg.gradle.config.java-library") + id("org.metaborg.spoofax.compiler.gradle.eclipse") } dependencies { - // Required because @Nullable has runtime retention (which includes classfile retention), and the Java compiler requires access to it. - compileOnly("com.google.code.findbugs:jsr305") + // Required because @Nullable has runtime retention (which includes classfile retention), and the Java compiler requires access to it. + compileOnly("com.google.code.findbugs:jsr305") } languageEclipseProject { - adapterProject.set(project(":stratego")) + adapterProject.set(project(":stratego")) } mavenize { - majorVersion.set("2022-06") + majorVersion.set("2022-06") } tasks { - "jar"(Jar::class) { - val exportPackages = LinkedHashSet() - val existingExportPackages = manifest.attributes.get("Export-Package") - if(existingExportPackages != null) { - exportPackages.add(existingExportPackages.toString()) + "jar"(Jar::class) { + val exportPackages = LinkedHashSet() + val existingExportPackages = manifest.attributes.get("Export-Package") + if (existingExportPackages != null) { + exportPackages.add(existingExportPackages.toString()) + } + val privatePackages = LinkedHashSet() + val existingPrivatePackages = manifest.attributes.get("Private-Package") + if (existingPrivatePackages != null) { + privatePackages.add(existingPrivatePackages.toString()) + } + // Export `stratego.build` because `stratego` depends on it. Allow split package because dagger generates classes in + // the same package + exportPackages.add("mb.stratego.build.*;-split-package:=merge-first") + // Embed `stratego.compiler.pack` because `stratego` depends on it + privatePackages.add("mb.stratego.compiler.pack.*") + manifest { + attributes( + Pair("Export-Package", exportPackages.joinToString(", ")), + Pair("Private-Package", privatePackages.joinToString(", ")) + ) + } } - val privatePackages = LinkedHashSet() - val existingPrivatePackages = manifest.attributes.get("Private-Package") - if(existingPrivatePackages != null) { - privatePackages.add(existingPrivatePackages.toString()) - } - // Export `stratego.build` because `stratego` depends on it. Allow split package because dagger generates classes in - // the same package - exportPackages.add("mb.stratego.build.*;-split-package:=merge-first") - // Embed `stratego.compiler.pack` because `stratego` depends on it - privatePackages.add("mb.stratego.compiler.pack.*") - manifest { - attributes( - Pair("Export-Package", exportPackages.joinToString(", ")), - Pair("Private-Package", privatePackages.joinToString(", ")) - ) - } - } } diff --git a/lwb/metalang/stratego/stratego.intellij/build.gradle.kts b/lwb/metalang/stratego/stratego.intellij/build.gradle.kts index 49aeaec3b..5f88ce06e 100644 --- a/lwb/metalang/stratego/stratego.intellij/build.gradle.kts +++ b/lwb/metalang/stratego/stratego.intellij/build.gradle.kts @@ -1,8 +1,8 @@ plugins { - id("org.metaborg.gradle.config.java-library") - id("org.metaborg.spoofax.compiler.gradle.intellij") + id("org.metaborg.gradle.config.java-library") + id("org.metaborg.spoofax.compiler.gradle.intellij") } languageIntellijProject { - adapterProject.set(project(":stratego")) + adapterProject.set(project(":stratego")) } diff --git a/lwb/metalang/stratego/stratego/build.gradle.kts b/lwb/metalang/stratego/stratego/build.gradle.kts index 521c05cca..dbacae388 100644 --- a/lwb/metalang/stratego/stratego/build.gradle.kts +++ b/lwb/metalang/stratego/stratego/build.gradle.kts @@ -1,80 +1,86 @@ -import mb.spoofax.compiler.adapter.* -import mb.spoofax.compiler.adapter.data.* -import mb.spoofax.compiler.language.* -import mb.spoofax.compiler.util.* -import mb.spoofax.common.* +import mb.spoofax.common.BlockCommentSymbols +import mb.spoofax.common.BracketSymbols +import mb.spoofax.compiler.adapter.AdapterProjectCompiler +import mb.spoofax.compiler.adapter.data.ArgProviderRepr +import mb.spoofax.compiler.adapter.data.CommandActionRepr +import mb.spoofax.compiler.adapter.data.CommandDefRepr +import mb.spoofax.compiler.adapter.data.MenuItemRepr +import mb.spoofax.compiler.adapter.data.ParamRepr +import mb.spoofax.compiler.language.ParserVariant +import mb.spoofax.compiler.util.GradleDependency +import mb.spoofax.compiler.util.TypeInfo import mb.spoofax.core.language.command.CommandContextType import mb.spoofax.core.language.command.CommandExecutionType import mb.spoofax.core.language.command.EnclosingCommandContextType plugins { - id("org.metaborg.gradle.config.java-library") - id("org.metaborg.gradle.config.junit-testing") - id("org.metaborg.spoofax.compiler.gradle.spoofax2.language") - id("org.metaborg.spoofax.compiler.gradle.adapter") + id("org.metaborg.gradle.config.java-library") + id("org.metaborg.gradle.config.junit-testing") + id("org.metaborg.spoofax.compiler.gradle.spoofax2.language") + id("org.metaborg.spoofax.compiler.gradle.adapter") } fun compositeBuild(name: String) = "$group:$name:$version" dependencies { - api(platform(compositeBuild("spoofax.depconstraints"))) - testAnnotationProcessor(platform(compositeBuild("spoofax.depconstraints"))) + api(platform(compositeBuild("spoofax.depconstraints"))) + testAnnotationProcessor(platform(compositeBuild("spoofax.depconstraints"))) - api("org.metaborg.devenv:org.metaborg.util") - api("org.metaborg.devenv:stratego.build") - api("org.metaborg:pie.task.archive") + api("org.metaborg.devenv:org.metaborg.util") + api("org.metaborg.devenv:stratego.build") + api("org.metaborg:pie.task.archive") - // Required because @Nullable has runtime retention (which includes classfile retention), and the Java compiler requires access to it. - compileOnly("com.google.code.findbugs:jsr305") + // Required because @Nullable has runtime retention (which includes classfile retention), and the Java compiler requires access to it. + compileOnly("com.google.code.findbugs:jsr305") - implementation("commons-io:commons-io") + implementation("commons-io:commons-io") - testImplementation(compositeBuild("spoofax.test")) - testImplementation("org.metaborg:pie.task.java") - testImplementation("org.metaborg:pie.task.archive") - testImplementation(compositeBuild("spoofax.test")) - testImplementation(project(":strategolib")) - testAnnotationProcessor("com.google.dagger:dagger-compiler") - testCompileOnly("org.checkerframework:checker-qual-android") + testImplementation(compositeBuild("spoofax.test")) + testImplementation("org.metaborg:pie.task.java") + testImplementation("org.metaborg:pie.task.archive") + testImplementation(compositeBuild("spoofax.test")) + testImplementation(project(":strategolib")) + testAnnotationProcessor("com.google.dagger:dagger-compiler") + testCompileOnly("org.checkerframework:checker-qual-android") } languageProject { - shared { - name("Stratego") - defaultClassPrefix("Stratego") - defaultPackageId("mb.str") - addFileExtensions("str", "str2") - } - compilerInput { - withParser().run { - startSymbol("Module") - variant(ParserVariant.jsglr2(ParserVariant.Jsglr2Preset.Recovery)) + shared { + name("Stratego") + defaultClassPrefix("Stratego") + defaultPackageId("mb.str") + addFileExtensions("str", "str2") } - withStyler() - withStrategoRuntime().run { - addStrategyPackageIds("stratego.lang.trans") - addInteropRegisterersByReflection("stratego.lang.trans.InteropRegisterer") - addStrategyPackageIds("stratego.lang.strategies") - addInteropRegisterersByReflection("stratego.lang.strategies.InteropRegisterer") + compilerInput { + withParser().run { + startSymbol("Module") + variant(ParserVariant.jsglr2(ParserVariant.Jsglr2Preset.Recovery)) + } + withStyler() + withStrategoRuntime().run { + addStrategyPackageIds("stratego.lang.trans") + addInteropRegisterersByReflection("stratego.lang.trans.InteropRegisterer") + addStrategyPackageIds("stratego.lang.strategies") + addInteropRegisterersByReflection("stratego.lang.strategies.InteropRegisterer") + } } - } } spoofax2BasedLanguageProject { - compilerInput { - withParser() - withStyler() - withStrategoRuntime().run { - copyCtree(false) - copyClasses(true) + compilerInput { + withParser() + withStyler() + withStrategoRuntime().run { + copyCtree(false) + copyClasses(true) + } + project.run { + addAdditionalCopyResources( + "syntax/**/*.sdf3", + "src-gen/syntax/**/*.sdf3" + ) + languageSpecificationDependency(GradleDependency.module("org.metaborg.devenv:stratego.lang:${ext["spoofax2DevenvVersion"]}")) + } } - project.run { - addAdditionalCopyResources( - "syntax/**/*.sdf3", - "src-gen/syntax/**/*.sdf3" - ) - languageSpecificationDependency(GradleDependency.module("org.metaborg.devenv:stratego.lang:${ext["spoofax2DevenvVersion"]}")) - } - } } val packageId = "mb.str" @@ -82,154 +88,228 @@ val taskPackageId = "$packageId.task" val spoofaxTaskPackageId = "$taskPackageId.spoofax" languageAdapterProject { - compilerInput { - withParser().run { - // Wrap Parse task - extendParseTaskDef(spoofaxTaskPackageId, "StrategoParseWrapper") - } - withStyler() - withStrategoRuntime() - withExports().run { - addDirectoryExport("SDF3", "syntax") - addDirectoryExport("SDF3", "src-gen/syntax") + compilerInput { + withParser().run { + // Wrap Parse task + extendParseTaskDef(spoofaxTaskPackageId, "StrategoParseWrapper") + } + withStyler() + withStrategoRuntime() + withExports().run { + addDirectoryExport("SDF3", "syntax") + addDirectoryExport("SDF3", "src-gen/syntax") + } + project.configureCompilerInput() } - project.configureCompilerInput() - } } fun AdapterProjectCompiler.Input.Builder.configureCompilerInput() { - compositionGroup("mb.spoofax.lwb") - - val incrPackageId = "$packageId.incr" - val commandPackageId = "$packageId.command" - - // Symbols - addLineCommentSymbols("//") - addBlockCommentSymbols(BlockCommentSymbols("/*", "*/")) - addBracketSymbols(BracketSymbols('[', ']')) - addBracketSymbols(BracketSymbols('{', '}')) - addBracketSymbols(BracketSymbols('(', ')')) - - // Extend component - baseComponent(packageId, "BaseStrategoComponent") - extendComponent(packageId, "StrategoComponent") - addAdditionalModules(incrPackageId, "StrategoIncrModule") - - // Wrap CheckMulti and rename base tasks - isMultiFile(true) - baseCheckTaskDef(spoofaxTaskPackageId, "BaseStrategoCheck") - baseCheckMultiTaskDef(spoofaxTaskPackageId, "BaseStrategoCheckMulti") - extendCheckMultiTaskDef(spoofaxTaskPackageId, "StrategoCheckMultiWrapper") - - // Stratego incremental compiler task definitions - val strBuildTaskPackageId = "mb.stratego.build.strincr.task" - addTaskDefs(strBuildTaskPackageId, "Back") - addTaskDefs(strBuildTaskPackageId, "Check") - addTaskDefs(strBuildTaskPackageId, "CheckModule") - addTaskDefs(strBuildTaskPackageId, "CheckOpenModule") - addTaskDefs(strBuildTaskPackageId, "Compile") - addTaskDefs(strBuildTaskPackageId, "Front") - addTaskDefs(strBuildTaskPackageId, "FrontSplit") - addTaskDefs(strBuildTaskPackageId, "Resolve") - addTaskDefs(strBuildTaskPackageId, "CopyLibraryClassFiles") - addTaskDefs(strBuildTaskPackageId, "CompileDynamicRules") - - // Task definitions - addTaskDefs(taskPackageId, "StrategoCompileToJava") - addTaskDefs(taskPackageId, "StrategoCheck") - val compileToJavaEditor = TypeInfo.of(taskPackageId, "StrategoEditorCompileToJava") - addTaskDefs(compileToJavaEditor, compileToJavaEditor) - addTaskDefs(taskPackageId, "StrategoPrettyPrint") - - // Compilation command - val resourcePathType = TypeInfo.of("mb.resource.hierarchical", "ResourcePath") - val compileToJavaCommand = CommandDefRepr.builder() - .type(commandPackageId, compileToJavaEditor.id() + "Command") - .taskDefType(compileToJavaEditor) - .argType("mb.str.config", "StrategoCompileConfig") - .displayName("Compile to Java") - .description("Compiles Stratego source files to Java source files") - .addSupportedExecutionTypes(CommandExecutionType.ManualOnce) - .addAllParams(listOf( - ParamRepr.of("rootDirectory", resourcePathType, true, ArgProviderRepr.enclosingContext(EnclosingCommandContextType.Project)), - ParamRepr.of("mainFile", resourcePathType, true, ArgProviderRepr.context(CommandContextType.File)), - ParamRepr.of("includeDirs", TypeInfo.of("mb.common.util", "ListView"), false, ArgProviderRepr.value("mb.common.util.ListView.of()")), - ParamRepr.of("builtinLibs", TypeInfo.of("mb.common.util", "ListView"), false, ArgProviderRepr.value("mb.common.util.ListView.of()")), - ParamRepr.of("str2libraries", TypeInfo.of("mb.common.util", "ListView"), false, ArgProviderRepr.value("mb.common.util.ListView.of()")), - ParamRepr.of("extraCompilerArguments", TypeInfo.of("org.metaborg.util.cmd", "Arguments"), false, ArgProviderRepr.value("new org.metaborg.util.cmd.Arguments()")), - ParamRepr.of("concreteSyntaxExtensionParseTables", TypeInfo.of("mb.common.util", "MapView"), false, ArgProviderRepr.value("mb.common.util.MapView.of()")), - ParamRepr.of("concreteSyntaxExtensionTransientParseTables", TypeInfo.of("mb.common.util", "MapView"), false, ArgProviderRepr.value("mb.common.util.MapView.of()")), - ParamRepr.of("sourceFileOrigins", TypeInfo.of("mb.common.util", "ListView"), false, ArgProviderRepr.value("mb.common.util.ListView.of()")), - ParamRepr.of("cacheDir", resourcePathType, false), - ParamRepr.of("javaSourceFileOutputDir", resourcePathType, true), - ParamRepr.of("javaClassFileOutputDir", resourcePathType, true), - ParamRepr.of("outputJavaPackageId", TypeInfo.ofString(), true), - ParamRepr.of("outputLibraryName", TypeInfo.ofString(), true), - ParamRepr.of("javaClassPaths", TypeInfo.of("mb.common.util", "ListView"), false, ArgProviderRepr.value("mb.common.util.ListView.of()")) - )) - .build() - addCommandDefs(compileToJavaCommand) - - // Show (debugging) task definitions - val debugTaskPackageId = "$taskPackageId.debug" - val showParsedAst = TypeInfo.of(debugTaskPackageId, "StrategoShowParsedAst") - val showDesugaredAst = TypeInfo.of(debugTaskPackageId, "StrategoShowDesugaredAst") - addTaskDefs(showParsedAst, showDesugaredAst) - // Show (debugging) commands - fun showCommand(taskDefType: TypeInfo, resultName: String) = CommandDefRepr.builder() - .type(commandPackageId, taskDefType.id() + "Command") - .taskDefType(taskDefType) - .argType(TypeInfo.of(debugTaskPackageId, "StrategoShowArgs")) - .displayName("Show $resultName") - .description("Shows the $resultName of the file") - .addSupportedExecutionTypes(CommandExecutionType.ManualOnce, CommandExecutionType.ManualContinuous) - .addAllParams(listOf( - ParamRepr.of("file", TypeInfo.of("mb.resource", "ResourceKey"), true, ArgProviderRepr.context(CommandContextType.File)), - ParamRepr.of("rootDirectoryHint", TypeInfo.of("mb.resource.hierarchical", "ResourcePath"), true, ArgProviderRepr.enclosingContext(mb.spoofax.core.language.command.EnclosingCommandContextType.Project)), - ParamRepr.of("region", TypeInfo.of("mb.common.region", "Region"), false) - )) - .build() - - val showParsedAstCommand = showCommand(showParsedAst, "parsed AST") - val showDesugaredAstCommand = showCommand(showDesugaredAst, "desugared AST") - val showCommands = listOf( - showParsedAstCommand, - showDesugaredAstCommand - ) - addAllCommandDefs(showCommands) - - // Menu bindings - val mainAndEditorMenu = listOf( - MenuItemRepr.menu("Compile", - CommandActionRepr.builder().manualOnce(compileToJavaCommand).enclosingProjectRequired().fileRequired().buildItem() - ), - MenuItemRepr.menu("Debug", - showCommands.flatMap { listOf(CommandActionRepr.builder().manualOnce(it).fileRequired().buildItem(), CommandActionRepr.builder().manualContinuous(it).fileRequired().buildItem()) } + compositionGroup("mb.spoofax.lwb") + + val incrPackageId = "$packageId.incr" + val commandPackageId = "$packageId.command" + + // Symbols + addLineCommentSymbols("//") + addBlockCommentSymbols(BlockCommentSymbols("/*", "*/")) + addBracketSymbols(BracketSymbols('[', ']')) + addBracketSymbols(BracketSymbols('{', '}')) + addBracketSymbols(BracketSymbols('(', ')')) + + // Extend component + baseComponent(packageId, "BaseStrategoComponent") + extendComponent(packageId, "StrategoComponent") + addAdditionalModules(incrPackageId, "StrategoIncrModule") + + // Wrap CheckMulti and rename base tasks + isMultiFile(true) + baseCheckTaskDef(spoofaxTaskPackageId, "BaseStrategoCheck") + baseCheckMultiTaskDef(spoofaxTaskPackageId, "BaseStrategoCheckMulti") + extendCheckMultiTaskDef(spoofaxTaskPackageId, "StrategoCheckMultiWrapper") + + // Stratego incremental compiler task definitions + val strBuildTaskPackageId = "mb.stratego.build.strincr.task" + addTaskDefs(strBuildTaskPackageId, "Back") + addTaskDefs(strBuildTaskPackageId, "Check") + addTaskDefs(strBuildTaskPackageId, "CheckModule") + addTaskDefs(strBuildTaskPackageId, "CheckOpenModule") + addTaskDefs(strBuildTaskPackageId, "Compile") + addTaskDefs(strBuildTaskPackageId, "Front") + addTaskDefs(strBuildTaskPackageId, "FrontSplit") + addTaskDefs(strBuildTaskPackageId, "Resolve") + addTaskDefs(strBuildTaskPackageId, "CopyLibraryClassFiles") + addTaskDefs(strBuildTaskPackageId, "CompileDynamicRules") + + // Task definitions + addTaskDefs(taskPackageId, "StrategoCompileToJava") + addTaskDefs(taskPackageId, "StrategoCheck") + val compileToJavaEditor = TypeInfo.of(taskPackageId, "StrategoEditorCompileToJava") + addTaskDefs(compileToJavaEditor, compileToJavaEditor) + addTaskDefs(taskPackageId, "StrategoPrettyPrint") + + // Compilation command + val resourcePathType = TypeInfo.of("mb.resource.hierarchical", "ResourcePath") + val compileToJavaCommand = CommandDefRepr.builder() + .type(commandPackageId, compileToJavaEditor.id() + "Command") + .taskDefType(compileToJavaEditor) + .argType("mb.str.config", "StrategoCompileConfig") + .displayName("Compile to Java") + .description("Compiles Stratego source files to Java source files") + .addSupportedExecutionTypes(CommandExecutionType.ManualOnce) + .addAllParams( + listOf( + ParamRepr.of( + "rootDirectory", + resourcePathType, + true, + ArgProviderRepr.enclosingContext(EnclosingCommandContextType.Project) + ), + ParamRepr.of( + "mainFile", + resourcePathType, + true, + ArgProviderRepr.context(CommandContextType.File) + ), + ParamRepr.of( + "includeDirs", + TypeInfo.of("mb.common.util", "ListView"), + false, + ArgProviderRepr.value("mb.common.util.ListView.of()") + ), + ParamRepr.of( + "builtinLibs", + TypeInfo.of("mb.common.util", "ListView"), + false, + ArgProviderRepr.value("mb.common.util.ListView.of()") + ), + ParamRepr.of( + "str2libraries", + TypeInfo.of("mb.common.util", "ListView"), + false, + ArgProviderRepr.value("mb.common.util.ListView.of()") + ), + ParamRepr.of( + "extraCompilerArguments", + TypeInfo.of("org.metaborg.util.cmd", "Arguments"), + false, + ArgProviderRepr.value("new org.metaborg.util.cmd.Arguments()") + ), + ParamRepr.of( + "concreteSyntaxExtensionParseTables", + TypeInfo.of("mb.common.util", "MapView"), + false, + ArgProviderRepr.value("mb.common.util.MapView.of()") + ), + ParamRepr.of( + "concreteSyntaxExtensionTransientParseTables", + TypeInfo.of("mb.common.util", "MapView"), + false, + ArgProviderRepr.value("mb.common.util.MapView.of()") + ), + ParamRepr.of( + "sourceFileOrigins", + TypeInfo.of("mb.common.util", "ListView"), + false, + ArgProviderRepr.value("mb.common.util.ListView.of()") + ), + ParamRepr.of("cacheDir", resourcePathType, false), + ParamRepr.of("javaSourceFileOutputDir", resourcePathType, true), + ParamRepr.of("javaClassFileOutputDir", resourcePathType, true), + ParamRepr.of("outputJavaPackageId", TypeInfo.ofString(), true), + ParamRepr.of("outputLibraryName", TypeInfo.ofString(), true), + ParamRepr.of( + "javaClassPaths", + TypeInfo.of("mb.common.util", "ListView"), + false, + ArgProviderRepr.value("mb.common.util.ListView.of()") + ) + ) + ) + .build() + addCommandDefs(compileToJavaCommand) + + // Show (debugging) task definitions + val debugTaskPackageId = "$taskPackageId.debug" + val showParsedAst = TypeInfo.of(debugTaskPackageId, "StrategoShowParsedAst") + val showDesugaredAst = TypeInfo.of(debugTaskPackageId, "StrategoShowDesugaredAst") + addTaskDefs(showParsedAst, showDesugaredAst) + // Show (debugging) commands + fun showCommand(taskDefType: TypeInfo, resultName: String) = CommandDefRepr.builder() + .type(commandPackageId, taskDefType.id() + "Command") + .taskDefType(taskDefType) + .argType(TypeInfo.of(debugTaskPackageId, "StrategoShowArgs")) + .displayName("Show $resultName") + .description("Shows the $resultName of the file") + .addSupportedExecutionTypes(CommandExecutionType.ManualOnce, CommandExecutionType.ManualContinuous) + .addAllParams( + listOf( + ParamRepr.of( + "file", + TypeInfo.of("mb.resource", "ResourceKey"), + true, + ArgProviderRepr.context(CommandContextType.File) + ), + ParamRepr.of( + "rootDirectoryHint", + TypeInfo.of("mb.resource.hierarchical", "ResourcePath"), + true, + ArgProviderRepr.enclosingContext(EnclosingCommandContextType.Project) + ), + ParamRepr.of("region", TypeInfo.of("mb.common.region", "Region"), false) + ) + ) + .build() + + val showParsedAstCommand = showCommand(showParsedAst, "parsed AST") + val showDesugaredAstCommand = showCommand(showDesugaredAst, "desugared AST") + val showCommands = listOf( + showParsedAstCommand, + showDesugaredAstCommand ) - ) - addAllMainMenuItems(mainAndEditorMenu) - addAllEditorContextMenuItems(mainAndEditorMenu) - addResourceContextMenuItems( - MenuItemRepr.menu("Compile", - CommandActionRepr.builder().manualOnce(compileToJavaCommand).enclosingProjectRequired().fileRequired().buildItem() - ), - MenuItemRepr.menu("Debug", - showCommands.flatMap { listOf(CommandActionRepr.builder().manualOnce(it).fileRequired().buildItem()) } + addAllCommandDefs(showCommands) + + // Menu bindings + val mainAndEditorMenu = listOf( + MenuItemRepr.menu( + "Compile", + CommandActionRepr.builder().manualOnce(compileToJavaCommand).enclosingProjectRequired().fileRequired().buildItem() + ), + MenuItemRepr.menu("Debug", + showCommands.flatMap { + listOf( + CommandActionRepr.builder().manualOnce(it).fileRequired().buildItem(), + CommandActionRepr.builder().manualContinuous(it).fileRequired().buildItem() + ) + } + ) + ) + addAllMainMenuItems(mainAndEditorMenu) + addAllEditorContextMenuItems(mainAndEditorMenu) + addResourceContextMenuItems( + MenuItemRepr.menu( + "Compile", + CommandActionRepr.builder().manualOnce(compileToJavaCommand).enclosingProjectRequired().fileRequired().buildItem() + ), + MenuItemRepr.menu("Debug", + showCommands.flatMap { listOf(CommandActionRepr.builder().manualOnce(it).fileRequired().buildItem()) } + ) ) - ) } // Additional dependencies which are injected into tests. val classPathInjection = configurations.create("classPathInjection") dependencies { - classPathInjection(platform("$group:spoofax.depconstraints:$version")) - classPathInjection("org.metaborg.devenv:org.strategoxt.strj") + classPathInjection(platform("$group:spoofax.depconstraints:$version")) + classPathInjection("org.metaborg.devenv:org.strategoxt.strj") } tasks.test { - // Pass classPathInjection to tests in the form of system properties - dependsOn(classPathInjection) - doFirst { - // Wrap in doFirst to properly defer dependency resolution to the task execution phase. - systemProperty("classPath", classPathInjection.resolvedConfiguration.resolvedArtifacts.map { it.file }.joinToString(File.pathSeparator)) - } + // Pass classPathInjection to tests in the form of system properties + dependsOn(classPathInjection) + doFirst { + // Wrap in doFirst to properly defer dependency resolution to the task execution phase. + systemProperty( + "classPath", + classPathInjection.resolvedConfiguration.resolvedArtifacts.map { it.file }.joinToString(File.pathSeparator) + ) + } } diff --git a/lwb/metalib/gpp/gpp.eclipse/build.gradle.kts b/lwb/metalib/gpp/gpp.eclipse/build.gradle.kts index 5fa179894..3ec08156e 100644 --- a/lwb/metalib/gpp/gpp.eclipse/build.gradle.kts +++ b/lwb/metalib/gpp/gpp.eclipse/build.gradle.kts @@ -1,34 +1,34 @@ plugins { - id("org.metaborg.gradle.config.java-library") - id("org.metaborg.spoofax.compiler.gradle.eclipse") + id("org.metaborg.gradle.config.java-library") + id("org.metaborg.spoofax.compiler.gradle.eclipse") } fun compositeBuild(name: String) = "$group:$name:$version" dependencies { - bundleImplementation(compositeBuild("strategolib.eclipse")) + bundleImplementation(compositeBuild("strategolib.eclipse")) } languageEclipseProject { - adapterProject.set(project(":gpp")) + adapterProject.set(project(":gpp")) } mavenize { - majorVersion.set("2022-06") + majorVersion.set("2022-06") } tasks { - "jar"(Jar::class) { - val exportPackages = LinkedHashSet() - // Export `strategolib` package. - exportPackages.add("gpp.*") - val existingExportPackages = manifest.attributes.get("Export-Package") - if(existingExportPackages != null) { - exportPackages.add(existingExportPackages.toString()) + "jar"(Jar::class) { + val exportPackages = LinkedHashSet() + // Export `strategolib` package. + exportPackages.add("gpp.*") + val existingExportPackages = manifest.attributes.get("Export-Package") + if (existingExportPackages != null) { + exportPackages.add(existingExportPackages.toString()) + } + manifest { + attributes( + Pair("Export-Package", exportPackages.joinToString(", ")) + ) + } } - manifest { - attributes( - Pair("Export-Package", exportPackages.joinToString(", ")) - ) - } - } } diff --git a/lwb/metalib/gpp/gpp/build.gradle.kts b/lwb/metalib/gpp/gpp/build.gradle.kts index 03164bc3b..675b9666c 100644 --- a/lwb/metalib/gpp/gpp/build.gradle.kts +++ b/lwb/metalib/gpp/gpp/build.gradle.kts @@ -1,61 +1,61 @@ -import mb.spoofax.compiler.adapter.* -import mb.spoofax.compiler.util.* +import mb.spoofax.compiler.adapter.AdapterProjectCompiler +import mb.spoofax.compiler.util.GradleDependency plugins { - id("org.metaborg.gradle.config.java-library") - id("org.metaborg.spoofax.compiler.gradle.spoofax2.language") - id("org.metaborg.spoofax.compiler.gradle.adapter") + id("org.metaborg.gradle.config.java-library") + id("org.metaborg.spoofax.compiler.gradle.spoofax2.language") + id("org.metaborg.spoofax.compiler.gradle.adapter") } fun compositeBuild(name: String) = "$group:$name:$version" dependencies { - api(project(":strategolib")) - api("org.metaborg:pie.task.archive") + api(project(":strategolib")) + api("org.metaborg:pie.task.archive") } languageProject { - shared { - name("Gpp") - defaultClassPrefix("Gpp") - defaultPackageId("mb.gpp") - } - compilerInput { - withStrategoRuntime().run { - addStrategyPackageIds("gpp.trans") - addInteropRegisterersByReflection("gpp.trans.InteropRegisterer") + shared { + name("Gpp") + defaultClassPrefix("Gpp") + defaultPackageId("mb.gpp") + } + compilerInput { + withStrategoRuntime().run { + addStrategyPackageIds("gpp.trans") + addInteropRegisterersByReflection("gpp.trans.InteropRegisterer") + } } - } } spoofax2BasedLanguageProject { - compilerInput { - withStrategoRuntime().run { - copyCtree(false) - copyClasses(true) - } - project.run { - addAdditionalCopyResources( - "src-gen/java/gpp/trans/gpp.str2lib" - ) - languageSpecificationDependency(GradleDependency.module("org.metaborg.devenv:gpp:${ext["spoofax2DevenvVersion"]}")) + compilerInput { + withStrategoRuntime().run { + copyCtree(false) + copyClasses(true) + } + project.run { + addAdditionalCopyResources( + "src-gen/java/gpp/trans/gpp.str2lib" + ) + languageSpecificationDependency(GradleDependency.module("org.metaborg.devenv:gpp:${ext["spoofax2DevenvVersion"]}")) + } } - } } languageAdapterProject { - compilerInput { - project.configureCompilerInput() - withExports().run { - addFileExport("Stratego", "src-gen/java/gpp/trans/gpp.str2lib") + compilerInput { + project.configureCompilerInput() + withExports().run { + addFileExport("Stratego", "src-gen/java/gpp/trans/gpp.str2lib") + } } - } } fun AdapterProjectCompiler.Input.Builder.configureCompilerInput() { - compositionGroup("mb.spoofax.lwb") + compositionGroup("mb.spoofax.lwb") - val packageId = "mb.gpp" + val packageId = "mb.gpp" - // Extend component - baseComponent(packageId, "BaseGppComponent") - extendComponent(packageId, "GppComponent") + // Extend component + baseComponent(packageId, "BaseGppComponent") + extendComponent(packageId, "GppComponent") } diff --git a/lwb/metalib/libspoofax2/libspoofax2.eclipse/build.gradle.kts b/lwb/metalib/libspoofax2/libspoofax2.eclipse/build.gradle.kts index aa3af56f4..72295b337 100644 --- a/lwb/metalib/libspoofax2/libspoofax2.eclipse/build.gradle.kts +++ b/lwb/metalib/libspoofax2/libspoofax2.eclipse/build.gradle.kts @@ -1,12 +1,12 @@ plugins { - id("org.metaborg.gradle.config.java-library") - id("org.metaborg.spoofax.compiler.gradle.eclipse") + id("org.metaborg.gradle.config.java-library") + id("org.metaborg.spoofax.compiler.gradle.eclipse") } languageEclipseProject { - adapterProject.set(project(":libspoofax2")) + adapterProject.set(project(":libspoofax2")) } mavenize { - majorVersion.set("2022-06") + majorVersion.set("2022-06") } diff --git a/lwb/metalib/libspoofax2/libspoofax2/build.gradle.kts b/lwb/metalib/libspoofax2/libspoofax2/build.gradle.kts index 788eff627..3868b0f38 100644 --- a/lwb/metalib/libspoofax2/libspoofax2/build.gradle.kts +++ b/lwb/metalib/libspoofax2/libspoofax2/build.gradle.kts @@ -1,43 +1,43 @@ -import mb.spoofax.compiler.adapter.* -import mb.spoofax.compiler.util.* +import mb.spoofax.compiler.adapter.AdapterProjectCompiler +import mb.spoofax.compiler.util.GradleDependency plugins { - id("org.metaborg.gradle.config.java-library") - id("org.metaborg.spoofax.compiler.gradle.spoofax2.language") - id("org.metaborg.spoofax.compiler.gradle.adapter") + id("org.metaborg.gradle.config.java-library") + id("org.metaborg.spoofax.compiler.gradle.spoofax2.language") + id("org.metaborg.spoofax.compiler.gradle.adapter") } languageProject { - shared { - name("LibSpoofax2") - defaultClassPrefix("LibSpoofax2") - defaultPackageId("mb.libspoofax2") - } - compilerInput { - } + shared { + name("LibSpoofax2") + defaultClassPrefix("LibSpoofax2") + defaultPackageId("mb.libspoofax2") + } + compilerInput { + } } spoofax2BasedLanguageProject { - compilerInput { - project.run { - addAdditionalCopyResources( - "trans/**/*.str", - "trans/**/*.str2", - "editor/**/*.esv" - ) - languageSpecificationDependency(GradleDependency.module("org.metaborg.devenv:meta.lib.spoofax:${ext["spoofax2DevenvVersion"]}")) + compilerInput { + project.run { + addAdditionalCopyResources( + "trans/**/*.str", + "trans/**/*.str2", + "editor/**/*.esv" + ) + languageSpecificationDependency(GradleDependency.module("org.metaborg.devenv:meta.lib.spoofax:${ext["spoofax2DevenvVersion"]}")) + } } - } } languageAdapterProject { - compilerInput { - project.configureCompilerInput() - withExports().run { - addDirectoryExport("Stratego", "trans") - addDirectoryExport("ESV", "editor") + compilerInput { + project.configureCompilerInput() + withExports().run { + addDirectoryExport("Stratego", "trans") + addDirectoryExport("ESV", "editor") + } } - } } fun AdapterProjectCompiler.Input.Builder.configureCompilerInput() { - compositionGroup("mb.spoofax.lwb") + compositionGroup("mb.spoofax.lwb") } diff --git a/lwb/metalib/libstatix/libstatix.eclipse/build.gradle.kts b/lwb/metalib/libstatix/libstatix.eclipse/build.gradle.kts index 497a48c70..d03c35c1e 100644 --- a/lwb/metalib/libstatix/libstatix.eclipse/build.gradle.kts +++ b/lwb/metalib/libstatix/libstatix.eclipse/build.gradle.kts @@ -1,12 +1,12 @@ plugins { - id("org.metaborg.gradle.config.java-library") - id("org.metaborg.spoofax.compiler.gradle.eclipse") + id("org.metaborg.gradle.config.java-library") + id("org.metaborg.spoofax.compiler.gradle.eclipse") } languageEclipseProject { - adapterProject.set(project(":libstatix")) + adapterProject.set(project(":libstatix")) } mavenize { - majorVersion.set("2022-06") + majorVersion.set("2022-06") } diff --git a/lwb/metalib/libstatix/libstatix/build.gradle.kts b/lwb/metalib/libstatix/libstatix/build.gradle.kts index c9e451a6e..47575f6d7 100644 --- a/lwb/metalib/libstatix/libstatix/build.gradle.kts +++ b/lwb/metalib/libstatix/libstatix/build.gradle.kts @@ -1,39 +1,39 @@ -import mb.spoofax.compiler.adapter.* -import mb.spoofax.compiler.util.* +import mb.spoofax.compiler.adapter.AdapterProjectCompiler +import mb.spoofax.compiler.util.GradleDependency plugins { - id("org.metaborg.gradle.config.java-library") - id("org.metaborg.spoofax.compiler.gradle.spoofax2.language") - id("org.metaborg.spoofax.compiler.gradle.adapter") + id("org.metaborg.gradle.config.java-library") + id("org.metaborg.spoofax.compiler.gradle.spoofax2.language") + id("org.metaborg.spoofax.compiler.gradle.adapter") } languageProject { - shared { - name("LibStatix") - defaultClassPrefix("LibStatix") - defaultPackageId("mb.libstatix") - } - compilerInput { - } + shared { + name("LibStatix") + defaultClassPrefix("LibStatix") + defaultPackageId("mb.libstatix") + } + compilerInput { + } } spoofax2BasedLanguageProject { - compilerInput { - project.run { - addAdditionalCopyResources("trans/**/*.str", "trans/**/*.str2", "src-gen/**/*.str", "src-gen/**/*.str2") - languageSpecificationDependency(GradleDependency.module("org.metaborg.devenv:statix.runtime:${ext["spoofax2DevenvVersion"]}")) + compilerInput { + project.run { + addAdditionalCopyResources("trans/**/*.str", "trans/**/*.str2", "src-gen/**/*.str", "src-gen/**/*.str2") + languageSpecificationDependency(GradleDependency.module("org.metaborg.devenv:statix.runtime:${ext["spoofax2DevenvVersion"]}")) + } } - } } languageAdapterProject { - compilerInput { - project.configureCompilerInput() - withExports().run { - addDirectoryExport("Stratego", "trans") - addDirectoryExport("Stratego", "src-gen") + compilerInput { + project.configureCompilerInput() + withExports().run { + addDirectoryExport("Stratego", "trans") + addDirectoryExport("Stratego", "src-gen") + } } - } } fun AdapterProjectCompiler.Input.Builder.configureCompilerInput() { - compositionGroup("mb.spoofax.lwb") + compositionGroup("mb.spoofax.lwb") } diff --git a/lwb/metalib/strategolib/strategolib.eclipse/build.gradle.kts b/lwb/metalib/strategolib/strategolib.eclipse/build.gradle.kts index 15e84eb02..bfe03a39e 100644 --- a/lwb/metalib/strategolib/strategolib.eclipse/build.gradle.kts +++ b/lwb/metalib/strategolib/strategolib.eclipse/build.gradle.kts @@ -1,29 +1,29 @@ plugins { - id("org.metaborg.gradle.config.java-library") - id("org.metaborg.spoofax.compiler.gradle.eclipse") + id("org.metaborg.gradle.config.java-library") + id("org.metaborg.spoofax.compiler.gradle.eclipse") } languageEclipseProject { - adapterProject.set(project(":strategolib")) + adapterProject.set(project(":strategolib")) } mavenize { - majorVersion.set("2022-06") + majorVersion.set("2022-06") } tasks { - "jar"(Jar::class) { - val exportPackages = LinkedHashSet() - // Export `strategolib` package. - exportPackages.add("strategolib.*") - val existingExportPackages = manifest.attributes.get("Export-Package") - if(existingExportPackages != null) { - exportPackages.add(existingExportPackages.toString()) + "jar"(Jar::class) { + val exportPackages = LinkedHashSet() + // Export `strategolib` package. + exportPackages.add("strategolib.*") + val existingExportPackages = manifest.attributes.get("Export-Package") + if (existingExportPackages != null) { + exportPackages.add(existingExportPackages.toString()) + } + manifest { + attributes( + Pair("Export-Package", exportPackages.joinToString(", ")) + ) + } } - manifest { - attributes( - Pair("Export-Package", exportPackages.joinToString(", ")) - ) - } - } } diff --git a/lwb/metalib/strategolib/strategolib/build.gradle.kts b/lwb/metalib/strategolib/strategolib/build.gradle.kts index dfc33a236..cad1a3e47 100644 --- a/lwb/metalib/strategolib/strategolib/build.gradle.kts +++ b/lwb/metalib/strategolib/strategolib/build.gradle.kts @@ -1,60 +1,60 @@ -import mb.spoofax.compiler.adapter.* -import mb.spoofax.compiler.util.* +import mb.spoofax.compiler.adapter.AdapterProjectCompiler +import mb.spoofax.compiler.util.GradleDependency plugins { - id("org.metaborg.gradle.config.java-library") - id("org.metaborg.spoofax.compiler.gradle.spoofax2.language") - id("org.metaborg.spoofax.compiler.gradle.adapter") + id("org.metaborg.gradle.config.java-library") + id("org.metaborg.spoofax.compiler.gradle.spoofax2.language") + id("org.metaborg.spoofax.compiler.gradle.adapter") } fun compositeBuild(name: String) = "$group:$name:$version" dependencies { - api("org.metaborg:pie.task.archive") + api("org.metaborg:pie.task.archive") } languageProject { - shared { - name("StrategoLib") - defaultClassPrefix("StrategoLib") - defaultPackageId("mb.strategolib") - } - compilerInput { - withStrategoRuntime().run { - addStrategyPackageIds("strategolib.trans") - addInteropRegisterersByReflection("strategolib.trans.InteropRegisterer") + shared { + name("StrategoLib") + defaultClassPrefix("StrategoLib") + defaultPackageId("mb.strategolib") + } + compilerInput { + withStrategoRuntime().run { + addStrategyPackageIds("strategolib.trans") + addInteropRegisterersByReflection("strategolib.trans.InteropRegisterer") + } } - } } spoofax2BasedLanguageProject { - compilerInput { - withStrategoRuntime().run { - copyCtree(false) - copyClasses(true) - } - project.run { - addAdditionalCopyResources( - "src-gen/java/strategolib/trans/strategolib.str2lib" - ) - languageSpecificationDependency(GradleDependency.module("org.metaborg.devenv:strategolib:${ext["spoofax2DevenvVersion"]}")) + compilerInput { + withStrategoRuntime().run { + copyCtree(false) + copyClasses(true) + } + project.run { + addAdditionalCopyResources( + "src-gen/java/strategolib/trans/strategolib.str2lib" + ) + languageSpecificationDependency(GradleDependency.module("org.metaborg.devenv:strategolib:${ext["spoofax2DevenvVersion"]}")) + } } - } } languageAdapterProject { - compilerInput { - project.configureCompilerInput() - withExports().run { - addFileExport("Stratego", "src-gen/java/strategolib/trans/strategolib.str2lib") - } - } + compilerInput { + project.configureCompilerInput() + withExports().run { + addFileExport("Stratego", "src-gen/java/strategolib/trans/strategolib.str2lib") + } + } } fun AdapterProjectCompiler.Input.Builder.configureCompilerInput() { - compositionGroup("mb.spoofax.lwb") + compositionGroup("mb.spoofax.lwb") - val packageId = "mb.strategolib" + val packageId = "mb.strategolib" - // Extend component - baseComponent(packageId, "BaseStrategoLibComponent") - extendComponent(packageId, "StrategoLibComponent") + // Extend component + baseComponent(packageId, "BaseStrategoLibComponent") + extendComponent(packageId, "StrategoLibComponent") } diff --git a/lwb/settings.gradle.kts b/lwb/settings.gradle.kts index 337c2893c..3a184debd 100644 --- a/lwb/settings.gradle.kts +++ b/lwb/settings.gradle.kts @@ -1,104 +1,104 @@ rootProject.name = "spoofax3.lwb.root" pluginManagement { - repositories { - maven("https://artifacts.metaborg.org/content/groups/public/") - } + repositories { + maven("https://artifacts.metaborg.org/content/groups/public/") + } } // Only include composite builds when this is the root project (it has no parent), for example when running Gradle tasks // from the command-line. Otherwise, the parent project (spoofax.root) will include these composite builds. -if(gradle.parent == null) { - includeBuildWithName("../core", "spoofax3.core.root") +if (gradle.parent == null) { + includeBuildWithName("../core", "spoofax3.core.root") } fun includeBuildWithName(dir: String, name: String) { - includeBuild(dir) { - try { - ConfigurableIncludedBuild::class.java - .getDeclaredMethod("setName", String::class.java) - .invoke(this, name) - } catch(e: NoSuchMethodException) { - // Running Gradle < 6, no need to set the name, ignore. + includeBuild(dir) { + try { + ConfigurableIncludedBuild::class.java + .getDeclaredMethod("setName", String::class.java) + .invoke(this, name) + } catch (e: NoSuchMethodException) { + // Running Gradle < 6, no need to set the name, ignore. + } } - } } fun String.includeProject(id: String, path: String = "$this/$id") { - include(id) - project(":$id").projectDir = file(path) + include(id) + project(":$id").projectDir = file(path) } "metalang/cfg".run { - includeProject("cfg") - includeProject("cfg.cli") - includeProject("cfg.eclipse") - includeProject("cfg.intellij") - includeProject("cfg.spoofax2") + includeProject("cfg") + includeProject("cfg.cli") + includeProject("cfg.eclipse") + includeProject("cfg.intellij") + includeProject("cfg.spoofax2") } "metalang/dynamix".run { - includeProject("dynamix") - includeProject("dynamix.cli") - includeProject("dynamix.eclipse") - includeProject("dynamix.intellij") - includeProject("dynamix.spoofax2") + includeProject("dynamix") + includeProject("dynamix.cli") + includeProject("dynamix.eclipse") + includeProject("dynamix.intellij") + includeProject("dynamix.spoofax2") } "metalang/sdf3_ext_dynamix".run { - includeProject("sdf3_ext_dynamix") - includeProject("sdf3_ext_dynamix.eclipse") - includeProject("sdf3_ext_dynamix.spoofax2") + includeProject("sdf3_ext_dynamix") + includeProject("sdf3_ext_dynamix.eclipse") + includeProject("sdf3_ext_dynamix.spoofax2") } "metalang/sdf3".run { - includeProject("sdf3") - includeProject("sdf3.cli") - includeProject("sdf3.eclipse") - includeProject("sdf3.intellij") + includeProject("sdf3") + includeProject("sdf3.cli") + includeProject("sdf3.eclipse") + includeProject("sdf3.intellij") } "metalang/stratego".run { - includeProject("stratego") - includeProject("stratego.cli") - includeProject("stratego.eclipse") - includeProject("stratego.intellij") + includeProject("stratego") + includeProject("stratego.cli") + includeProject("stratego.eclipse") + includeProject("stratego.intellij") } "metalang/esv".run { - includeProject("esv") - includeProject("esv.cli") - includeProject("esv.eclipse") - includeProject("esv.intellij") + includeProject("esv") + includeProject("esv.cli") + includeProject("esv.eclipse") + includeProject("esv.intellij") } "metalang/statix".run { - includeProject("statix") - includeProject("statix.cli") - includeProject("statix.eclipse") - includeProject("statix.intellij") + includeProject("statix") + includeProject("statix.cli") + includeProject("statix.eclipse") + includeProject("statix.intellij") } "metalang/sdf3_ext_statix".run { - includeProject("sdf3_ext_statix") - includeProject("sdf3_ext_statix.eclipse") + includeProject("sdf3_ext_statix") + includeProject("sdf3_ext_statix.eclipse") } "metalang/spt".run { - includeProject("spt") - includeProject("spt.dynamicloading") - includeProject("spt.cli") - includeProject("spt.eclipse") - includeProject("spt.intellij") + includeProject("spt") + includeProject("spt.dynamicloading") + includeProject("spt.cli") + includeProject("spt.eclipse") + includeProject("spt.intellij") } "metalib/libspoofax2".run { - includeProject("libspoofax2") - includeProject("libspoofax2.eclipse") + includeProject("libspoofax2") + includeProject("libspoofax2.eclipse") } "metalib/libstatix".run { - includeProject("libstatix") - includeProject("libstatix.eclipse") + includeProject("libstatix") + includeProject("libstatix.eclipse") } "metalib/strategolib".run { - includeProject("strategolib") - includeProject("strategolib.eclipse") + includeProject("strategolib") + includeProject("strategolib.eclipse") } "metalib/gpp".run { - includeProject("gpp") - includeProject("gpp.eclipse") + includeProject("gpp") + includeProject("gpp.eclipse") } include("spoofax.lwb.compiler") diff --git a/lwb/spoofax.lwb.compiler.gradle/build.gradle.kts b/lwb/spoofax.lwb.compiler.gradle/build.gradle.kts index baaeaeee2..7dd129296 100644 --- a/lwb/spoofax.lwb.compiler.gradle/build.gradle.kts +++ b/lwb/spoofax.lwb.compiler.gradle/build.gradle.kts @@ -1,36 +1,36 @@ plugins { - id("org.metaborg.gradle.config.kotlin-gradle-plugin") - kotlin("jvm") - kotlin("kapt") - id("org.gradle.kotlin.kotlin-dsl") // Same as `kotlin-dsl`, but without version, which is already set in root project. + id("org.metaborg.gradle.config.kotlin-gradle-plugin") + kotlin("jvm") + kotlin("kapt") + id("org.gradle.kotlin.kotlin-dsl") // Same as `kotlin-dsl`, but without version, which is already set in root project. } metaborg { - kotlinApiVersion = "1.3" - kotlinLanguageVersion = "1.3" + kotlinApiVersion = "1.3" + kotlinLanguageVersion = "1.3" } fun compositeBuild(name: String) = "$group:$name:$version" dependencies { - api(platform(compositeBuild("spoofax.depconstraints"))) - kapt(platform(compositeBuild("spoofax.depconstraints"))) + api(platform(compositeBuild("spoofax.depconstraints"))) + kapt(platform(compositeBuild("spoofax.depconstraints"))) - compileOnly("org.metaborg:spoofax.compiler.gradle") - api(project(":spoofax.lwb.compiler")) - api("com.google.dagger:dagger") - implementation("org.metaborg:pie.runtime") - implementation("org.metaborg:log.backend.slf4j") + compileOnly("org.metaborg:spoofax.compiler.gradle") + api(project(":spoofax.lwb.compiler")) + api("com.google.dagger:dagger") + implementation("org.metaborg:pie.runtime") + implementation("org.metaborg:log.backend.slf4j") - kapt("com.google.dagger:dagger-compiler") - compileOnly("org.immutables:value-annotations") // Dagger accesses these annotations, which have class retention. + kapt("com.google.dagger:dagger-compiler") + compileOnly("org.immutables:value-annotations") // Dagger accesses these annotations, which have class retention. } gradlePlugin { - plugins { - create("spoofax-lwb-compiler-language") { - id = "org.metaborg.spoofax.lwb.compiler.gradle.language" - implementationClass = "mb.spoofax.lwb.compiler.gradle.LanguagePlugin" + plugins { + create("spoofax-lwb-compiler-language") { + id = "org.metaborg.spoofax.lwb.compiler.gradle.language" + implementationClass = "mb.spoofax.lwb.compiler.gradle.LanguagePlugin" + } } - } } diff --git a/lwb/spoofax.lwb.compiler/build.gradle.kts b/lwb/spoofax.lwb.compiler/build.gradle.kts index 8bc83fc38..061580bd2 100644 --- a/lwb/spoofax.lwb.compiler/build.gradle.kts +++ b/lwb/spoofax.lwb.compiler/build.gradle.kts @@ -1,63 +1,63 @@ plugins { - id("org.metaborg.gradle.config.java-library") - id("org.metaborg.gradle.config.junit-testing") + id("org.metaborg.gradle.config.java-library") + id("org.metaborg.gradle.config.junit-testing") } fun compositeBuild(name: String) = "$group:$name:$version" dependencies { - api(platform(compositeBuild("spoofax.depconstraints"))) - annotationProcessor(platform(compositeBuild("spoofax.depconstraints"))) - - - api(compositeBuild("spoofax.core")) - api(compositeBuild("spoofax.compiler")) - api("org.metaborg:common") - api("org.metaborg:resource") - api("org.metaborg:pie.api") - api("org.metaborg:pie.task.archive") - api("org.metaborg:pie.task.java") - - // TODO: should the meta-languages use implementation configuration? We don't expose their API AFAICS. - api(project(":cfg")) - api(project(":sdf3")) - api(project(":stratego")) - api(project(":esv")) - api(project(":statix")) - api(project(":dynamix")) - api(project(":sdf3_ext_statix")) - api(project(":sdf3_ext_dynamix")) - - api(project(":strategolib")) - api(project(":gpp")) - api(project(":libspoofax2")) - api(project(":libstatix")) - - // Using api configuration to make these annotations and processors available to javac that we call during - // compilation, and to users of this library as well. - api("org.checkerframework:checker-qual-android") - api("com.google.dagger:dagger-compiler") - - - compileOnly("org.immutables:value-annotations") - compileOnly("org.derive4j:derive4j-annotation") - - annotationProcessor("org.immutables:value") - annotationProcessor("org.derive4j:derive4j") - annotationProcessor("com.google.dagger:dagger-compiler") - - - testImplementation("org.junit.jupiter:junit-jupiter-params:${metaborg.junitVersion}") - testImplementation("org.metaborg:pie.runtime") - testImplementation("org.metaborg:pie.serde.fst") - testCompileOnly("org.checkerframework:checker-qual-android") + api(platform(compositeBuild("spoofax.depconstraints"))) + annotationProcessor(platform(compositeBuild("spoofax.depconstraints"))) + + + api(compositeBuild("spoofax.core")) + api(compositeBuild("spoofax.compiler")) + api("org.metaborg:common") + api("org.metaborg:resource") + api("org.metaborg:pie.api") + api("org.metaborg:pie.task.archive") + api("org.metaborg:pie.task.java") + + // TODO: should the meta-languages use implementation configuration? We don't expose their API AFAICS. + api(project(":cfg")) + api(project(":sdf3")) + api(project(":stratego")) + api(project(":esv")) + api(project(":statix")) + api(project(":dynamix")) + api(project(":sdf3_ext_statix")) + api(project(":sdf3_ext_dynamix")) + + api(project(":strategolib")) + api(project(":gpp")) + api(project(":libspoofax2")) + api(project(":libstatix")) + + // Using api configuration to make these annotations and processors available to javac that we call during + // compilation, and to users of this library as well. + api("org.checkerframework:checker-qual-android") + api("com.google.dagger:dagger-compiler") + + + compileOnly("org.immutables:value-annotations") + compileOnly("org.derive4j:derive4j-annotation") + + annotationProcessor("org.immutables:value") + annotationProcessor("org.derive4j:derive4j") + annotationProcessor("com.google.dagger:dagger-compiler") + + + testImplementation("org.junit.jupiter:junit-jupiter-params:${metaborg.junitVersion}") + testImplementation("org.metaborg:pie.runtime") + testImplementation("org.metaborg:pie.serde.fst") + testCompileOnly("org.checkerframework:checker-qual-android") } tasks.test { - enableAssertions = false // HACK: disable assertions until we support JSGLR2 parsing for Stratego - // Show standard err in tests. - testLogging { - events(org.gradle.api.tasks.testing.logging.TestLogEvent.STANDARD_ERROR) - } - jvmArgs("-Xss16M") // Set required stack size, mainly for serialization. + enableAssertions = false // HACK: disable assertions until we support JSGLR2 parsing for Stratego + // Show standard err in tests. + testLogging { + events(org.gradle.api.tasks.testing.logging.TestLogEvent.STANDARD_ERROR) + } + jvmArgs("-Xss16M") // Set required stack size, mainly for serialization. } diff --git a/lwb/spoofax.lwb.dynamicloading/build.gradle.kts b/lwb/spoofax.lwb.dynamicloading/build.gradle.kts index da1f1893f..35aefdd90 100644 --- a/lwb/spoofax.lwb.dynamicloading/build.gradle.kts +++ b/lwb/spoofax.lwb.dynamicloading/build.gradle.kts @@ -1,39 +1,39 @@ plugins { - id("org.metaborg.gradle.config.java-library") - id("org.metaborg.gradle.config.junit-testing") + id("org.metaborg.gradle.config.java-library") + id("org.metaborg.gradle.config.junit-testing") } fun compositeBuild(name: String) = "$group:$name:$version" dependencies { - api(platform(compositeBuild("spoofax.depconstraints"))) - annotationProcessor(platform(compositeBuild("spoofax.depconstraints"))) + api(platform(compositeBuild("spoofax.depconstraints"))) + annotationProcessor(platform(compositeBuild("spoofax.depconstraints"))) - api(compositeBuild("spoofax.core")) - api("com.google.dagger:dagger") - implementation("org.metaborg:pie.runtime") + api(compositeBuild("spoofax.core")) + api("com.google.dagger:dagger") + implementation("org.metaborg:pie.runtime") - compileOnly("org.checkerframework:checker-qual-android") - compileOnly("org.derive4j:derive4j-annotation") + compileOnly("org.checkerframework:checker-qual-android") + compileOnly("org.derive4j:derive4j-annotation") - annotationProcessor("com.google.dagger:dagger-compiler") - annotationProcessor("org.derive4j:derive4j") + annotationProcessor("com.google.dagger:dagger-compiler") + annotationProcessor("org.derive4j:derive4j") - testImplementation("org.slf4j:slf4j-nop:1.7.30") - testImplementation(project(":spoofax.lwb.compiler")) - testImplementation(project(":spt")) - testImplementation(project(":spt.dynamicloading")) - testImplementation("org.metaborg:pie.runtime") - testImplementation("org.metaborg:pie.serde.fst") + testImplementation("org.slf4j:slf4j-nop:1.7.30") + testImplementation(project(":spoofax.lwb.compiler")) + testImplementation(project(":spt")) + testImplementation(project(":spt.dynamicloading")) + testImplementation("org.metaborg:pie.runtime") + testImplementation("org.metaborg:pie.serde.fst") } tasks.test { - enableAssertions = false // HACK: disable assertions due to assertion in the Stratego compiler. - testLogging { - events( - //org.gradle.api.tasks.testing.logging.TestLogEvent.STANDARD_OUT, - org.gradle.api.tasks.testing.logging.TestLogEvent.STANDARD_ERROR - ) - } - jvmArgs("-Xss16M") // Set required stack size, mainly for serialization. + enableAssertions = false // HACK: disable assertions due to assertion in the Stratego compiler. + testLogging { + events( + //org.gradle.api.tasks.testing.logging.TestLogEvent.STANDARD_OUT, + org.gradle.api.tasks.testing.logging.TestLogEvent.STANDARD_ERROR + ) + } + jvmArgs("-Xss16M") // Set required stack size, mainly for serialization. } diff --git a/settings.gradle.kts b/settings.gradle.kts index fc537577d..20a2a3036 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -1,9 +1,9 @@ rootProject.name = "spoofax3.root" pluginManagement { - repositories { - maven("https://artifacts.metaborg.org/content/groups/public/") - } + repositories { + maven("https://artifacts.metaborg.org/content/groups/public/") + } } // We split the build up into one main composite build in the 'core' directory, because it builds Gradle plugins, @@ -21,13 +21,13 @@ includeBuildWithName("lwb.distrib", "spoofax3.lwb.distrib.root") includeBuildWithName("example", "spoofax3.example.root") fun includeBuildWithName(dir: String, name: String) { - includeBuild(dir) { - try { - ConfigurableIncludedBuild::class.java - .getDeclaredMethod("setName", String::class.java) - .invoke(this, name) - } catch(e: NoSuchMethodException) { - // Running Gradle < 6, no need to set the name, ignore. + includeBuild(dir) { + try { + ConfigurableIncludedBuild::class.java + .getDeclaredMethod("setName", String::class.java) + .invoke(this, name) + } catch (e: NoSuchMethodException) { + // Running Gradle < 6, no need to set the name, ignore. + } } - } }