diff --git a/.github/workflows/deploy_snapshot.yml b/.github/workflows/deploy_snapshot.yml index 32de396cc..b49d19396 100644 --- a/.github/workflows/deploy_snapshot.yml +++ b/.github/workflows/deploy_snapshot.yml @@ -15,7 +15,7 @@ on: types: [ trigger_after_upstream_deploy ] env: - GRADLE_VERSION: 8.5 # Gradle version used + GRADLE_VERSION: 8.14.4 # Gradle version used JAVA_VERSION: 21 # Java version used GRADLE_CLI_OPTS: "-Pci --build-cache -PgenTR=false -PgenTagging=true --refresh-dependencies " # CLI options passed to Gradle GRADLE_BUILD_ACTION_CACHE_KEY_JOB: "test-cache-${{ github.head_ref }}.${{ github.sha }}" diff --git a/.github/workflows/gh_release_plugins.yml b/.github/workflows/gh_release_plugins.yml index 726a4782f..736577f35 100644 --- a/.github/workflows/gh_release_plugins.yml +++ b/.github/workflows/gh_release_plugins.yml @@ -31,7 +31,7 @@ jobs: - name: Setup Gradle uses: gradle/actions/setup-gradle@v4 with: - gradle-version: 8.5 + gradle-version: 8.14.4 - name: Build with Gradle run: gradle :language-server:cd4a-intellij-plugin:buildPlugin :language-server:packageCD4AnalysisVscodePlugin -PbuildVscodePlugin=true -PbuildIntelliJPlugin=true diff --git a/.github/workflows/test_branch.yml b/.github/workflows/test_branch.yml index 451191296..923a61133 100644 --- a/.github/workflows/test_branch.yml +++ b/.github/workflows/test_branch.yml @@ -14,7 +14,7 @@ on: types: [opened, synchronize] env: - GRADLE_VERSION: 8.5 # Gradle version used + GRADLE_VERSION: 8.14.4 # Gradle version used JAVA_VERSION: 21 # Java version used GRADLE_CLI_OPTS: "-Pci --build-cache -PgenTR=false -PgenTagging=true --refresh-dependencies " # CLI options passed to Gradle GRADLE_BUILD_ACTION_CACHE_KEY_JOB: "test-cache-${{ github.head_ref }}.${{ github.sha }}" diff --git a/build.gradle b/build.gradle index d2c33388a..9fc7c18fd 100644 --- a/build.gradle +++ b/build.gradle @@ -11,7 +11,7 @@ plugins { } description = "CD4Analysis" -buildDir = file("$projectDir/target") +layout.buildDirectory = layout.projectDirectory.dir("target") ext { findbugs_version = "3.0.2" @@ -43,27 +43,25 @@ subprojects { apply plugin: 'maven-publish' apply plugin: 'de.se_rwth.codestyle' - ecj { - compilerVersion = "3.43.0" - } - - sourceCompatibility = JavaVersion.VERSION_21 + ecj { + compilerVersion = "3.43.0" + } allprojects { group = "de.monticore.lang.cd4analysis" } ext.grammarDir = 'src/main/grammars' - buildDir = file("$projectDir/target") + layout.buildDirectory = layout.projectDirectory.dir("target") repositories { if (("true").equals(getProperty('useLocalRepo'))) { mavenLocal() } maven { - credentials.username mavenUser - credentials.password mavenPassword - url repo + credentials.username = mavenUser + credentials.password = mavenPassword + url = repo } mavenCentral() } @@ -73,19 +71,19 @@ subprojects { archiveClassifier = project.name } - tasks.withType(Test) { + tasks.withType(Test).configureEach { useJUnitPlatform() testLogging { // controls whether test output is shown - showExceptions true - showCauses true - showStackTraces true - exceptionFormat TestExceptionFormat.FULL + showExceptions = true + showCauses = true + showStackTraces = true + exceptionFormat = TestExceptionFormat.FULL info { events TestLogEvent.FAILED, - TestLogEvent.PASSED, - TestLogEvent.SKIPPED, - TestLogEvent.STANDARD_OUT + TestLogEvent.PASSED, + TestLogEvent.SKIPPED, + TestLogEvent.STANDARD_OUT } } afterTest { desc, result -> @@ -100,9 +98,9 @@ subprojects { } } - tasks.withType(JavaCompile) { + tasks.withType(JavaCompile).configureEach { options.encoding = "UTF-8" - options.deprecation false + options.deprecation = false options.warnings = false options.forkOptions.jvmArgs += ["-Xmx4G"] // TODO: reevaluate with new ecj plugin @@ -141,13 +139,13 @@ publishing { .findAll { it != ':cdlang' } .each { subprojectName -> publ.artifact(project(subprojectName).tasks.jar) { - group "de.monticore.lang" + group = "de.monticore.lang" } } publ.artifact(project(":cdtool").tasks.jar) { - group "de.monticore.lang" - classifier "tool" + group = "de.monticore.lang" + classifier = "tool" } publ.artifact(project(":cdtool").tasks.shadowJar) @@ -157,13 +155,13 @@ publishing { if (("false").equals(getProperty('publishMain'))) { publ.artifact(project(":cdlang").tasks.testSourcesJar) { - group "de.monticore.lang" + group = "de.monticore.lang" } } } repositories.maven { - credentials.username mavenUser - credentials.password mavenPassword + credentials.username = mavenUser + credentials.password = mavenPassword def releasesRepoUrl = "https://nexus.se.rwth-aachen.de/content/repositories/monticore-releases/" def snapshotsRepoUrl = "https://nexus.se.rwth-aachen.de/content/repositories/monticore-snapshots/" url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl diff --git a/cd-runtime/build.gradle b/cd-runtime/build.gradle index 4d4b8641e..8e5c523ad 100644 --- a/cd-runtime/build.gradle +++ b/cd-runtime/build.gradle @@ -30,8 +30,8 @@ publishing { } } repositories.maven { - credentials.username mavenUser - credentials.password mavenPassword + credentials.username = mavenUser + credentials.password = mavenPassword def releasesRepoUrl = "https://nexus.se.rwth-aachen.de/content/repositories/monticore-releases/" def snapshotsRepoUrl = "https://nexus.se.rwth-aachen.de/content/repositories/monticore-snapshots/" url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl diff --git a/cdlang/build.gradle b/cdlang/build.gradle index 420a1bc7a..9a7a791e3 100644 --- a/cdlang/build.gradle +++ b/cdlang/build.gradle @@ -5,11 +5,14 @@ import org.gradle.api.tasks.testing.logging.TestExceptionFormat import org.gradle.api.tasks.testing.logging.TestLogEvent plugins { + id "base" id "maven-publish" // Only used to publish the trafos - everything else is published in the root project id "de.monticore.generator-withtr" version "$mc_version" // MontiCore Plugin with TR support } -archivesBaseName = "cd4analysis" +base { + archivesName = "cd4analysis" +} def var_path = "de.monticore" group = "de.monticore.lang" @@ -19,10 +22,10 @@ def withDSTLGen = ("true").equals(getProperty('genTR')) ext { grammar_classifier = "grammars" grammarDir = "src/main/grammars" - grammarOutDir = "$buildDir/generated-sources/monticore/sourcecode" - trGrammarOutDir = "$buildDir/generated-sources/monticore-tr/sourcecode" + grammarOutDir = layout.buildDirectory.dir("generated-sources/monticore/sourcecode") + trGrammarOutDir = layout.buildDirectory.dir("generated-sources/monticore-tr/sourcecode") testGrammarDir = "src/test/grammars" - testGrammarOutDir = "$buildDir/generated-test-sources/monticore/trafo-sourcecode" + testGrammarOutDir = layout.buildDirectory.dir("generated-test-sources/monticore/trafo-sourcecode") } @@ -116,31 +119,31 @@ compileTestJava { dependsOn generateTestTrafos } -tasks.withType(JavaCompile) { +tasks.withType(JavaCompile).configureEach { options.encoding = "UTF-8" - options.deprecation false + options.deprecation = false options.warnings = false options.headerOutputDirectory.convention(null) } -tasks.withType(Test) { +tasks.withType(Test).configureEach { // this won't work with setting the mills, as they can interleave and break thigs // maxParallelForks = Runtime.runtime.availableProcessors() ?: 1 } -tasks.withType(Test) { +tasks.withType(Test).configureEach { useJUnitPlatform() testLogging { // controls whether test output is shown - showExceptions true - showCauses true - showStackTraces true - exceptionFormat TestExceptionFormat.FULL + showExceptions = true + showCauses = true + showStackTraces = true + exceptionFormat = TestExceptionFormat.FULL info { events TestLogEvent.FAILED, - TestLogEvent.PASSED, - TestLogEvent.SKIPPED, - TestLogEvent.STANDARD_OUT + TestLogEvent.PASSED, + TestLogEvent.SKIPPED, + TestLogEvent.STANDARD_OUT } } afterTest { desc, result -> @@ -170,25 +173,25 @@ tasks.check.dependsOn(tasks.compileCd4cIntegTestJava) // build javadoc jar in addition -task javadocJar(type: Jar) { +tasks.register('javadocJar', Jar) { from javadoc archiveClassifier = "javadoc" } // generated java doc contains errors, disable for now -javadoc.failOnError(false) +javadoc.failOnError = false // build test sources jar in addition -task testSourcesJar(type: Jar) { +tasks.register('testSourcesJar', Jar) { from sourceSets.test.output + sourceSets.test.allSource archiveClassifier = "testSources" } -tasks.withType(Jar) { +tasks.withType(Jar).configureEach { duplicatesStrategy = DuplicatesStrategy.EXCLUDE } -task testReport(type: TestReport) { - destinationDirectory = file("$buildDir/reports/allTests") +tasks.register('testReport', TestReport) { + destinationDirectory = layout.buildDirectory.dir("reports/allTests") // Include the results from the 'test' task testResults.from(tasks.withType(Test)) } diff --git a/cdtool/build.gradle b/cdtool/build.gradle index 491bed071..e09f916fa 100644 --- a/cdtool/build.gradle +++ b/cdtool/build.gradle @@ -53,7 +53,7 @@ dependencies { } } -task toolJar(type: Jar) { +tasks.register('toolJar', Jar) { from sourceSets.main.output + sourceSets.main.allSource archiveClassifier = "tool" } @@ -78,8 +78,10 @@ sourceSets { } dependencies { - tooltestImplementation platform('org.junit:junit-bom:5.9.1') - tooltestImplementation 'org.junit.jupiter:junit-jupiter' + tooltestImplementation "org.junit.jupiter:junit-jupiter-api:$junit_version" + tooltestImplementation "org.junit.jupiter:junit-jupiter-params:$junit_version" + tooltestRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:$junit_version" + tooltestRuntimeOnly "org.junit.platform:junit-platform-launcher:$junit_version" } tasks.register('toolTest', Test) { diff --git a/cdtool/cdgradle/build.gradle b/cdtool/cdgradle/build.gradle index a4d08b5a8..6a96ae53c 100644 --- a/cdtool/cdgradle/build.gradle +++ b/cdtool/cdgradle/build.gradle @@ -16,8 +16,10 @@ dependencies { cdTool "de.monticore.lang:cd4analysis:$mc_version" compileOnly(project(":cdlang")) // As the main/cdtool dependency does not have an api dependency to cdlang - testImplementation "org.junit.jupiter:junit-jupiter:$junit_version" - testRuntimeOnly 'org.junit.platform:junit-platform-launcher' + testImplementation "org.junit.jupiter:junit-jupiter-api:$junit_version" + testImplementation "org.junit.jupiter:junit-jupiter-params:$junit_version" + testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:$junit_version" + testRuntimeOnly "org.junit.platform:junit-platform-launcher:$junit_version" testImplementation gradleTestKit() testImplementation(project(":cdlang")) // For symbol table tests, etc. } @@ -40,8 +42,8 @@ gradlePlugin { publishing { repositories.maven { - credentials.username mavenUser - credentials.password mavenPassword + credentials.username = mavenUser + credentials.password = mavenPassword def releasesRepoUrl = "https://nexus.se.rwth-aachen.de/content/repositories/monticore-releases/" def snapshotsRepoUrl = "https://nexus.se.rwth-aachen.de/content/repositories/monticore-snapshots/" url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl @@ -68,7 +70,7 @@ processResources { dependsOn generateResources } -tasks.withType(Test) { +tasks.withType(Test).configureEach { useJUnitPlatform() dependsOn project.tasks.getByPath(":cdlang:jar") dependsOn project.tasks.getByPath(":cd-runtime:jar") diff --git a/language-server/build.gradle b/language-server/build.gradle index 2521fdda1..b18395df6 100644 --- a/language-server/build.gradle +++ b/language-server/build.gradle @@ -6,17 +6,15 @@ plugins { id 'maven-publish' } -group 'de.monticore.lang' -version mc_version - -sourceCompatibility = JavaVersion.VERSION_21 +group = 'de.monticore.lang' +version = mc_version repositories { mavenCentral() maven { - credentials.username mavenUser - credentials.password mavenPassword - url repo + credentials.username = mavenUser + credentials.password = mavenPassword + url = repo } } @@ -68,7 +66,7 @@ task autoconfigure(type: de.mclsg.task.AutoconfigureTask) { languageName = "de.monticore.CD4Analysis" fileExtension = "cd" } - if(("true").equals(getProperty('buildVscodePlugin'))){ + if (("true").equals(getProperty('buildVscodePlugin'))) { including(TaskTypes.VSCODE_PLUGIN) } } @@ -78,7 +76,7 @@ task autoconfigureCD4Code(type: de.mclsg.task.AutoconfigureTask) { languageName = "de.monticore.CD4Code" fileExtension = "cd" } - if(("true").equals(getProperty('buildVscodePlugin'))){ + if (("true").equals(getProperty('buildVscodePlugin'))) { including(TaskTypes.VSCODE_PLUGIN) } } diff --git a/settings.gradle b/settings.gradle index 715b80cfc..954bfbce8 100644 --- a/settings.gradle +++ b/settings.gradle @@ -5,9 +5,9 @@ pluginManagement { mavenLocal() } maven { - credentials.username mavenUser - credentials.password mavenPassword - url repo + credentials.username = mavenUser + credentials.password = mavenPassword + url = repo } mavenCentral() gradlePluginPortal() diff --git a/symtabdefinitiontool/build.gradle b/symtabdefinitiontool/build.gradle index 3e8bcbf18..d4b5808b7 100644 --- a/symtabdefinitiontool/build.gradle +++ b/symtabdefinitiontool/build.gradle @@ -18,12 +18,11 @@ dependencies { implementation "org.antlr:antlr4-runtime:$antlr_version" testImplementation "org.junit.jupiter:junit-jupiter-api:$junit_version" testImplementation "org.junit.jupiter:junit-jupiter-params:$junit_version" - testImplementation "org.junit.vintage:junit-vintage-engine:$junit_version" testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:$junit_version" testRuntimeOnly "org.junit.platform:junit-platform-launcher:$junit_version" } -task toolJar(type: Jar) { +tasks.register('toolJar', Jar) { from sourceSets.main.output + sourceSets.main.allSource } @@ -45,8 +44,10 @@ sourceSets { } dependencies { - tooltestImplementation platform('org.junit:junit-bom:5.9.1') - tooltestImplementation 'org.junit.jupiter:junit-jupiter' + tooltestImplementation "org.junit.jupiter:junit-jupiter-api:$junit_version" + tooltestImplementation "org.junit.jupiter:junit-jupiter-params:$junit_version" + tooltestRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:$junit_version" + tooltestRuntimeOnly "org.junit.platform:junit-platform-launcher:$junit_version" } tasks.register('toolTest', Test) { diff --git a/symtabdefinitiontool/stdefgradle/build.gradle b/symtabdefinitiontool/stdefgradle/build.gradle index 0d93cf3ed..12a92f86c 100644 --- a/symtabdefinitiontool/stdefgradle/build.gradle +++ b/symtabdefinitiontool/stdefgradle/build.gradle @@ -16,7 +16,8 @@ dependencies { compileOnly(project(":cdlang")) testImplementation "org.junit.jupiter:junit-jupiter-api:$junit_version" - testImplementation "org.junit.vintage:junit-vintage-engine:$junit_version" + testImplementation "org.junit.jupiter:junit-jupiter-params:$junit_version" + testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:$junit_version" testRuntimeOnly "org.junit.platform:junit-platform-launcher:$junit_version" testImplementation gradleTestKit() } @@ -37,8 +38,8 @@ gradlePlugin { publishing { repositories.maven { - credentials.username mavenUser - credentials.password mavenPassword + credentials.username = mavenUser + credentials.password = mavenPassword def releasesRepoUrl = "https://nexus.se.rwth-aachen.de/content/repositories/monticore-releases/" def snapshotsRepoUrl = "https://nexus.se.rwth-aachen.de/content/repositories/monticore-snapshots/" url = version.endsWith("SNAPSHOT") ? snapshotsRepoUrl : releasesRepoUrl @@ -60,7 +61,7 @@ processResources { from files(generateResources) } -tasks.withType(Test) { +tasks.withType(Test).configureEach { useJUnitPlatform() dependsOn project.tasks.getByPath(':cdlang:jar') } diff --git a/symtabdefinitiontool/stdefgradle/src/test/java/de/monticore/symtabdefinitiontool/gradleplugin/SymTabDefinitionGradlePluginTest.java b/symtabdefinitiontool/stdefgradle/src/test/java/de/monticore/symtabdefinitiontool/gradleplugin/SymTabDefinitionGradlePluginTest.java index d2beb1bfd..55f6a08f3 100644 --- a/symtabdefinitiontool/stdefgradle/src/test/java/de/monticore/symtabdefinitiontool/gradleplugin/SymTabDefinitionGradlePluginTest.java +++ b/symtabdefinitiontool/stdefgradle/src/test/java/de/monticore/symtabdefinitiontool/gradleplugin/SymTabDefinitionGradlePluginTest.java @@ -1,9 +1,6 @@ /* (c) https://github.com/MontiCore/monticore */ package de.monticore.symtabdefinitiontool.gradleplugin; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertTrue; - import java.io.File; import java.io.IOException; import java.nio.file.Files; @@ -14,8 +11,11 @@ import org.gradle.testkit.runner.GradleRunner; import org.gradle.testkit.runner.TaskOutcome; import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; import org.junit.jupiter.api.io.TempDir; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.ValueSource; + +import static org.junit.jupiter.api.Assertions.*; public class SymTabDefinitionGradlePluginTest { @@ -35,21 +35,8 @@ public void setup() throws IOException { modelDir.mkdirs(); } - @Test - public void testSTDef_v7_4_2() throws IOException { - testSTDef("7.4.2"); - } - - @Test - public void testSTDef_v8_0_1() throws IOException { - this.testSTDef("8.0.1"); - } - - @Test - public void testSTDef_v8_7() throws IOException { - this.testSTDef("8.7"); - } - + @ParameterizedTest + @ValueSource(strings = { "8.5", "8.7", "8.14" }) void testSTDef(String version) throws IOException { writeFile(settingsFile, "rootProject.name = 'hello-world'"); String projVersion = loadProperties().getProperty("version"); @@ -65,7 +52,7 @@ void testSTDef(String version) throws IOException { String buildFileContent = "plugins {\n" + " id 'de.rwth.se.symtabdefinition'\n" + "}\n " + "repositories {\n" - + " maven{ url 'https://nexus.se.rwth-aachen.de/content/groups/public' }\n" + + " maven{ url = 'https://nexus.se.rwth-aachen.de/content/groups/public' }\n" + " mavenCentral()\n" + "}\n" + // We have to inject the cdlang jar for this project (as it is not yet published) "dependencies {\n" + " stdefTool files('" + cd4aJarFile.getAbsolutePath().replace("\\", @@ -79,6 +66,8 @@ void testSTDef(String version) throws IOException { // .withDebug(true) // add to debug .withPluginClasspath().withGradleVersion(version).withProjectDir(testProjectDir) .withArguments("build", "--info", "--stacktrace").build(); + assertNotNull(result.task(":generateSymbolTables"), + "'generateSymbolTables' task not found! The gradle plugin has most likely not been applied."); assertEquals(TaskOutcome.SUCCESS, result.task(":generateSymbolTables").getOutcome()); }