Skip to content

Commit

Permalink
Merge branch 'runtime-fix' into 'dev'
Browse files Browse the repository at this point in the history
Test up-to-date-checks, Future-Port Reporting

See merge request monticore/monticore!1043
  • Loading branch information
MisterErwin committed Oct 18, 2024
2 parents c361213 + ded284f commit 7f4fed2
Show file tree
Hide file tree
Showing 19 changed files with 958 additions and 115 deletions.
8 changes: 8 additions & 0 deletions monticore-generator/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<!-- (c) https://github.com/MontiCore/monticore -->

This subproject contains fixes from the current monticore-runtime snapshot,
which are also required in the currently used, last stable, monticore-runtime.
These "future-ports" are required due to us using the latest se-commons snapshot with the last stable runtime.

The following changes are included:
* Adapt reporting to be based on LogHooks (shipped with runtime 7.7.0)
2 changes: 1 addition & 1 deletion monticore-generator/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ dependencies {

implementation "de.se_rwth.commons:se-commons-gradle:$se_commons_version"

implementation "de.monticore:monticore-runtime:$previous_mc_version"
implementation project(":monticore-runtime-fix") // The previous runtime, but with future-ported fixes
implementation "de.monticore:monticore-grammar:$previous_mc_version"
implementation "de.se_rwth.commons:se-commons-groovy:$se_commons_version"
implementation "de.se_rwth.commons:se-commons-logging:$se_commons_version"
Expand Down
56 changes: 56 additions & 0 deletions monticore-generator/monticore-runtime-fix/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/* (c) https://github.com/MontiCore/monticore */
plugins {
id "java-library"
id "maven-publish"
}
group = "de.monticore"

dependencies {
// Use the previous monticore runtime
implementation "de.monticore:monticore-runtime:$previous_mc_version"
// but the current se-commons
implementation 'de.se_rwth.commons:se-commons-logging:' + se_commons_version
// Due to this, some fixes are required - see src/main/java
}

repositories {
if (("true").equals(getProperty('useLocalRepo'))) {
mavenLocal()
}
maven {
url repo
}
mavenCentral()
}

tasks.withType(JavaCompile) {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
options.encoding = "UTF-8"
options.deprecation false
options.warnings = false
}
java {
withSourcesJar()
toolchain {
languageVersion = JavaLanguageVersion.of(11)
}
}

publishing {
publications {
maven(MavenPublication) {
groupId = project.group
artifactId = 'monticore-previous-runtime-fix'
version = project.version
from components.java
}
}
repositories.maven {
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
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
* Facade for all reporting activities. Invoking a report method causes all
* AReporter implementing this method to execute it.
*/
public class ReportingFix extends Log {
@SuppressWarnings("unused")
public class Reporting extends Log {

/* whether reporting is enabled at the moment */
protected static boolean enabled = false;
Expand Down Expand Up @@ -54,6 +55,7 @@ public static void init(String outputDirectory, String reportDirectory, ReportMa

public static void init(String reportDirectory, ReportManagerFactory factory) {
Log.ensureInitialization();
getReportHooks().clear();
addReportHook(new ReportLogHookFix(reportDirectory, factory));
wasInitialized = true;
}
Expand Down Expand Up @@ -552,36 +554,6 @@ public static void reportTemplateReplacement(String oldTemplate, List<? extends
}
}


/**
* Reports the assignment of hook points to a template via
* {@link de.monticore.generating.templateengine.GlobalExtensionManagement#setBeforeTemplate(String, List)}.
* This does not include any other assignment or replacement.
*/
/* TODO: Re-add once #4095 is upstream (7.7.0 release)
public static void reportSetBeforeTemplate(String template, Optional<ASTNode> ast, List<? extends HookPoint> beforeHps) {
if (isEnabled()) {
for (ReportLogHookFix hook : getReportHooks()) {
hook.reportSetBeforeTemplate(template, ast, beforeHps);
}
}
}
/**
* Reports the addition of hook points to a template via
* {@link de.monticore.generating.templateengine.GlobalExtensionManagement#setAfterTemplate(String, List)}.
* This does not include any other assignment or replacement.
*/
/* TODO: Re-add once #4095 is upstream (7.7.0 release)
public static void reportSetAfterTemplate(String template, Optional<ASTNode> ast, List<? extends HookPoint> afterHps) {
if (isEnabled()) {
for (ReportLogHookFix hook : getReportHooks()) {
hook.reportSetAfterTemplate(template, ast, afterHps);
}
}
}
*/

/**
* Reports the assignment of hook points to a template via
* {@link de.monticore.generating.templateengine.GlobalExtensionManagement#setBeforeTemplate(String, List)}.
Expand All @@ -590,7 +562,7 @@ public static void reportSetAfterTemplate(String template, Optional<ASTNode> ast
public static void reportSetBeforeTemplate(String template, List<? extends HookPoint> beforeHps) {
if (isEnabled()) {
for (ReportLogHookFix hook : getReportHooks()) {
hook.reportSetBeforeTemplate(template, beforeHps);
hook.reportSetBeforeTemplate(template, Optional.empty(), beforeHps);
}
}
}
Expand All @@ -603,7 +575,7 @@ public static void reportSetBeforeTemplate(String template, List<? extends HookP
public static void reportSetAfterTemplate(String template, List<? extends HookPoint> afterHps) {
if (isEnabled()) {
for (ReportLogHookFix hook : getReportHooks()) {
hook.reportSetAfterTemplate(template, afterHps);
hook.reportSetAfterTemplate(template, Optional.empty(), afterHps);
}
}
}
Expand All @@ -617,11 +589,11 @@ public static void reportUseHandwrittenCodeFile(Path parentDir, Path fileName) {
}


/**
/**
* Reports the assignment of hook points to a template via
* {@link de.monticore.generating.templateengine.GlobalExtensionManagement#setAfterTemplate(String, List)}.
* This does not include any other assignment or replacement.
*/ /* TODO: Re-add once #4095 is upstream (7.7.0 release)
*/
public static void reportAddAfterTemplate(String template, Optional<ASTNode> ast, List<? extends HookPoint> afterHps) {
if (isEnabled()) {
for (ReportLogHookFix hook : getReportHooks()) {
Expand All @@ -634,25 +606,25 @@ public static void reportAddAfterTemplate(String template, Optional<ASTNode> ast
* Reports the assignment of hook points to a template via
* {@link de.monticore.generating.templateengine.GlobalExtensionManagement#setAfterTemplate(String, List)}.
* This does not include any other assignment or replacement.
*/ /* TODO: Re-add once #4095 is upstream (7.7.0 release)
public static void reportAddBeforeTemplate(String template, Optional<ASTNode> ast, List<? extends HookPoint> afterHps) {
*/
@Deprecated
public static void reportAddAfterTemplate(String template, List<? extends HookPoint> afterHps) {
if (isEnabled()) {
for (ReportLogHookFix hook : getReportHooks()) {
hook.reportAddBeforeTemplate(template, ast, afterHps);
hook.reportAddAfterTemplate(template, Optional.empty(), afterHps);
}
}
}
*/

/**
* Reports the assignment of hook points to a template via
* {@link de.monticore.generating.templateengine.GlobalExtensionManagement#setAfterTemplate(String, List)}.
* This does not include any other assignment or replacement.
*/ /* TODO: Re-add once #4095 is upstream (7.7.0 release)
public static void reportAddAfterTemplate(String template, Optional<ASTNode> ast, List<? extends HookPoint> afterHps) {
*/
public static void reportAddBeforeTemplate(String template, Optional<ASTNode> ast, List<? extends HookPoint> afterHps) {
if (isEnabled()) {
for (ReportLogHookFix hook : getReportHooks()) {
hook.reportAddAfterTemplate(template, ast, afterHps);
hook.reportAddBeforeTemplate(template, ast, afterHps);
}
}
}
Expand All @@ -661,11 +633,12 @@ public static void reportAddAfterTemplate(String template, Optional<ASTNode> ast
* Reports the assignment of hook points to a template via
* {@link de.monticore.generating.templateengine.GlobalExtensionManagement#setAfterTemplate(String, List)}.
* This does not include any other assignment or replacement.
*/ /* TODO: Re-add once #4095 is upstream (7.7.0 release)
public static void reportAddBeforeTemplate(String template, Optional<ASTNode> ast, List<? extends HookPoint> afterHps) {
*/
@Deprecated
public static void reportAddBeforeTemplate(String template, List<? extends HookPoint> afterHps) {
if (isEnabled()) {
for (ReportLogHookFix hook : getReportHooks()) {
hook.reportAddBeforeTemplate(template, ast, afterHps);
hook.reportAddBeforeTemplate(template,Optional.empty(), afterHps);
}
}
}
Expand Down
Loading

0 comments on commit 7f4fed2

Please sign in to comment.