From 6c1a8793685c4dd4bdad8d41bc70a35ab06b7306 Mon Sep 17 00:00:00 2001 From: Yuri Blankenstein Date: Tue, 26 May 2026 11:33:31 +0200 Subject: [PATCH 1/8] Changes in target platform in fresh dev-env --- releng/nl.esi.xplus.target/nl.esi.xplus.target.target | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/releng/nl.esi.xplus.target/nl.esi.xplus.target.target b/releng/nl.esi.xplus.target/nl.esi.xplus.target.target index 74a98c1..09739c0 100644 --- a/releng/nl.esi.xplus.target/nl.esi.xplus.target.target +++ b/releng/nl.esi.xplus.target/nl.esi.xplus.target.target @@ -2,6 +2,7 @@ + @@ -25,7 +26,6 @@ - @@ -63,6 +63,7 @@ + @@ -71,11 +72,11 @@ - + - + @@ -86,6 +87,5 @@ - - \ No newline at end of file + From bf0c12300bdce580bad33c6ebe5cdda771326f4b Mon Sep 17 00:00:00 2001 From: Yuri Blankenstein Date: Tue, 26 May 2026 15:13:37 +0200 Subject: [PATCH 2/8] Fixing Oomph setup redirect --- XPlus.setup | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/XPlus.setup b/XPlus.setup index 968f63c..cf41b4c 100644 --- a/XPlus.setup +++ b/XPlus.setup @@ -57,7 +57,7 @@ Set an Oomph redirection system property to redirect the logical location of this setup to its physical location in the Git clone. @@ -116,13 +116,13 @@ value="false"/> - - + xsi:type="setup:CompoundTask" + name="Java Development"> + + From 5cb3461243903e606ea4e97180677e2ee5152f71 Mon Sep 17 00:00:00 2001 From: Yuri Blankenstein Date: Tue, 26 May 2026 15:14:06 +0200 Subject: [PATCH 3/8] Fixing renaming left-overs --- bundles/nl.esi.xtext.types/plugin.xml | 30 +--------------- .../schema/xplusValidator.exsd | 2 +- .../generator/XPlusFileSystemAccess.xtend | 24 ++++++------- .../esi/xtext/types/generator/XPlusMain.xtend | 34 +++++++++---------- .../types/utilities/XPlusUtilities.xtend | 4 +-- .../types/validation/TypesValidator.xtend | 2 +- 6 files changed, 34 insertions(+), 62 deletions(-) diff --git a/bundles/nl.esi.xtext.types/plugin.xml b/bundles/nl.esi.xtext.types/plugin.xml index 70aa20e..5ccb6de 100644 --- a/bundles/nl.esi.xtext.types/plugin.xml +++ b/bundles/nl.esi.xtext.types/plugin.xml @@ -12,39 +12,11 @@ --> - + - - - - - - - - - - - - - - diff --git a/bundles/nl.esi.xtext.types/schema/xplusValidator.exsd b/bundles/nl.esi.xtext.types/schema/xplusValidator.exsd index e6fd46f..1b7bbfb 100644 --- a/bundles/nl.esi.xtext.types/schema/xplusValidator.exsd +++ b/bundles/nl.esi.xtext.types/schema/xplusValidator.exsd @@ -123,7 +123,7 @@ - <extension point="nl.esi.xtext.types.commaValidator"> + <extension point="nl.esi.xtext.types.xplusValidator"> <customValidator class="nl.esi.xplus.project.dynamics.validation.InterfaceValidator" language="InterfaceDefinition"> diff --git a/bundles/nl.esi.xtext.types/src/nl/esi/xtext/types/generator/XPlusFileSystemAccess.xtend b/bundles/nl.esi.xtext.types/src/nl/esi/xtext/types/generator/XPlusFileSystemAccess.xtend index 1c38a57..9f5d441 100644 --- a/bundles/nl.esi.xtext.types/src/nl/esi/xtext/types/generator/XPlusFileSystemAccess.xtend +++ b/bundles/nl.esi.xtext.types/src/nl/esi/xtext/types/generator/XPlusFileSystemAccess.xtend @@ -25,12 +25,12 @@ class XPlusFileSystemAccess implements IFileSystemAccess { public String outputConfiguration = DEFAULT_OUTPUT String generationFolder - final public static String COMMA_OUTPUT_ID = "outputCommaGen" - final public static String COMMA_OUTPUT_FOLDER = "./xplus-gen" - public static val OutputConfiguration COMMA_OUTPUT_CONF = { - val config = new OutputConfiguration(COMMA_OUTPUT_ID) - config.outputDirectory = COMMA_OUTPUT_FOLDER - config.description = COMMA_OUTPUT_FOLDER + final public static String XPLUS_OUTPUT_ID = "outputXPlusGen" + final public static String XPLUS_OUTPUT_FOLDER = "./xplus-gen" + public static val OutputConfiguration XPLUS_OUTPUT_CONF = { + val config = new OutputConfiguration(XPLUS_OUTPUT_ID) + config.outputDirectory = XPLUS_OUTPUT_FOLDER + config.description = XPLUS_OUTPUT_FOLDER config.createOutputDirectory = true config.canClearOutputDirectory = true config.cleanUpDerivedResources = true @@ -56,7 +56,7 @@ class XPlusFileSystemAccess implements IFileSystemAccess { this.fileSystemAccess = fsa this.generationFolder = generationFolder if(xplusGen) { - setOutPutCommaGen + setOutPutXPlusGen } } @@ -98,17 +98,17 @@ class XPlusFileSystemAccess implements IFileSystemAccess { return sb.toString } - def setOutPutCommaGen() { + def setOutPutXPlusGen() { if (fileSystemAccess instanceof AbstractFileSystemAccess) { - outputConfiguration = COMMA_OUTPUT_ID + outputConfiguration = XPLUS_OUTPUT_ID val configurations = fileSystemAccess.outputConfigurations - if (!configurations.containsKey(COMMA_OUTPUT_ID)) { + if (!configurations.containsKey(XPLUS_OUTPUT_ID)) { val newConfigurations = new HashMap(configurations) - newConfigurations.put(COMMA_OUTPUT_ID, COMMA_OUTPUT_CONF) + newConfigurations.put(XPLUS_OUTPUT_ID, XPLUS_OUTPUT_CONF) fileSystemAccess.outputConfigurations = newConfigurations } } else { - generationFolder = FOLDER_UP + "comma-gen/" + generationFolder + generationFolder = FOLDER_UP + "xplus-gen/" + generationFolder } } diff --git a/bundles/nl.esi.xtext.types/src/nl/esi/xtext/types/generator/XPlusMain.xtend b/bundles/nl.esi.xtext.types/src/nl/esi/xtext/types/generator/XPlusMain.xtend index 7593ca0..c0178d2 100644 --- a/bundles/nl.esi.xtext.types/src/nl/esi/xtext/types/generator/XPlusMain.xtend +++ b/bundles/nl.esi.xtext.types/src/nl/esi/xtext/types/generator/XPlusMain.xtend @@ -41,7 +41,7 @@ class XPlusMain { static final String ERR_LOCATION_WRONG = 'Location could not be found. ' static final String INFO_GENERATION_FINISHED = 'Code generation finished.' - static final String INFO_COMMA_FINISHED = 'All XPlus Tasks are finished.' + static final String INFO_XPLUS_FINISHED = 'All XPlus Tasks are finished.' static final String INFO_SEARCHING = 'Searching for {0} ({1}) files in {2}' static final String INFO_OUTPUT = 'Output set: ' static final String INFO_STOP = 'Errors found, stopping generation.' @@ -219,7 +219,7 @@ class XPlusMain { // Configure and start the generator fileAccess.outputPath = outputdir.toString - setCommaGen(fileAccess, outputdir.toString) + setXPlusGen(fileAccess, outputdir.toString) generator.generate(resource, fileAccess, cliContext) } @@ -335,7 +335,7 @@ class XPlusMain { } System.out.println(INFO_GENERATION_FINISHED) System.out.println("") - System.out.println(INFO_COMMA_FINISHED) + System.out.println(INFO_XPLUS_FINISHED) } def Options createOptions() { @@ -467,7 +467,7 @@ class XPlusMain { // Configure and start the generator fileAccess.outputPath = outputdir - setCommaGen(fileAccess, outputdir) + setXPlusGen(fileAccess, outputdir) generator.generate(resource, fileAccess, cliContext) } @@ -488,7 +488,7 @@ class XPlusMain { var cliContext = new StepsParserContext(stepsPath.toString, contexts, outputdir) // Configure and start the generator fileAccess.outputPath = outputdir - setCommaGen(fileAccess, outputdir) + setXPlusGen(fileAccess, outputdir) generator.generate(resource, fileAccess, cliContext) } @@ -517,7 +517,7 @@ class XPlusMain { } // Configure and start the generator fileAccess.outputPath = outputdir - setCommaGen(fileAccess, outputdir) + setXPlusGen(fileAccess, outputdir) try { generator.generate(resource, fileAccess, new CmdLineContext) @@ -532,16 +532,16 @@ class XPlusMain { def cleanOutput(CommandLine cmdLine, Path outputdir) { if (cmdLine.hasOption(OPT_CLEAN)) { println("Start cleaning output directory.") - val commagendir = outputdir.parent.resolve(nl.esi.xtext.types.generator.XPlusFileSystemAccess.COMMA_OUTPUT_CONF.outputDirectory).normalize + val xplusgendir = outputdir.parent.resolve(nl.esi.xtext.types.generator.XPlusFileSystemAccess.XPLUS_OUTPUT_CONF.outputDirectory).normalize //clean src-gen if(new File(outputdir.toString).exists){ Files.walk(outputdir) .sorted(Comparator.reverseOrder()) .forEach[Files::delete(it)] } - //clean comma-gen - if(new File(commagendir.toString).exists){ - Files.walk(commagendir) + //clean xplus-gen + if(new File(xplusgendir.toString).exists){ + Files.walk(xplusgendir) .sorted(Comparator.reverseOrder()) .forEach[Files::delete(it)] } @@ -549,15 +549,15 @@ class XPlusMain { } } - def setCommaGen(JavaIoFileSystemAccess fileAccess, String outputdir) { - val commaConf = nl.esi.xtext.types.generator.XPlusFileSystemAccess.COMMA_OUTPUT_CONF - commaConf.outputDirectory = Paths.get(outputdir).parent.toString + commaConf.outputDirectory - fileAccess.outputConfigurations.put(nl.esi.xtext.types.generator.XPlusFileSystemAccess.COMMA_OUTPUT_ID, commaConf) + def setXPlusGen(JavaIoFileSystemAccess fileAccess, String outputdir) { + val xplusConf = nl.esi.xtext.types.generator.XPlusFileSystemAccess.XPLUS_OUTPUT_CONF + xplusConf.outputDirectory = Paths.get(outputdir).parent.toString + xplusConf.outputDirectory + fileAccess.outputConfigurations.put(nl.esi.xtext.types.generator.XPlusFileSystemAccess.XPLUS_OUTPUT_ID, xplusConf) } - def getCommaGen() { - val commaGen = fileAccess.outputConfigurations.get(nl.esi.xtext.types.generator.XPlusFileSystemAccess.COMMA_OUTPUT_ID) - commaGen.outputDirectory + def getXPlusGen() { + val xplusGen = fileAccess.outputConfigurations.get(nl.esi.xtext.types.generator.XPlusFileSystemAccess.XPLUS_OUTPUT_ID) + xplusGen.outputDirectory } def getJarDir() { diff --git a/bundles/nl.esi.xtext.types/src/nl/esi/xtext/types/utilities/XPlusUtilities.xtend b/bundles/nl.esi.xtext.types/src/nl/esi/xtext/types/utilities/XPlusUtilities.xtend index fdb13f4..66252ae 100644 --- a/bundles/nl.esi.xtext.types/src/nl/esi/xtext/types/utilities/XPlusUtilities.xtend +++ b/bundles/nl.esi.xtext.types/src/nl/esi/xtext/types/utilities/XPlusUtilities.xtend @@ -28,8 +28,8 @@ class XPlusUtilities { result } - static def commaVersion(){ - "4.0.0" + static def xplusVersion(){ + "0.1.0" } } \ No newline at end of file diff --git a/bundles/nl.esi.xtext.types/src/nl/esi/xtext/types/validation/TypesValidator.xtend b/bundles/nl.esi.xtext.types/src/nl/esi/xtext/types/validation/TypesValidator.xtend index 64e1c68..760d31e 100644 --- a/bundles/nl.esi.xtext.types/src/nl/esi/xtext/types/validation/TypesValidator.xtend +++ b/bundles/nl.esi.xtext.types/src/nl/esi/xtext/types/validation/TypesValidator.xtend @@ -252,7 +252,7 @@ class TypesValidator extends AbstractTypesValidator { @Inject override register(EValidatorRegistrar registrar) { super.register(registrar) - val VALIDATOR_ID = "nl.esi.xtext.types.commaValidator" + val VALIDATOR_ID = "nl.esi.xtext.types.xplusValidator" val reg = Platform.getExtensionRegistry() if(reg !== null){ val extensions = reg.getConfigurationElementsFor(VALIDATOR_ID) From 6a1713bfa37bc5f1047417ed6b286207fd317d48 Mon Sep 17 00:00:00 2001 From: Yuri Blankenstein Date: Wed, 27 May 2026 08:38:55 +0200 Subject: [PATCH 4/8] Removed version method --- .../src/nl/esi/xtext/types/utilities/XPlusUtilities.xtend | 5 ----- 1 file changed, 5 deletions(-) diff --git a/bundles/nl.esi.xtext.types/src/nl/esi/xtext/types/utilities/XPlusUtilities.xtend b/bundles/nl.esi.xtext.types/src/nl/esi/xtext/types/utilities/XPlusUtilities.xtend index 66252ae..90a6130 100644 --- a/bundles/nl.esi.xtext.types/src/nl/esi/xtext/types/utilities/XPlusUtilities.xtend +++ b/bundles/nl.esi.xtext.types/src/nl/esi/xtext/types/utilities/XPlusUtilities.xtend @@ -27,9 +27,4 @@ class XPlusUtilities { } result } - - static def xplusVersion(){ - "0.1.0" - } - } \ No newline at end of file From c648506c4eda37c7be0ffa2f1a2feedcd85d687a Mon Sep 17 00:00:00 2001 From: Yuri Blankenstein Date: Wed, 27 May 2026 08:39:09 +0200 Subject: [PATCH 5/8] Updated feature dependencies --- .../nl.esi.xtext.launch/Maven Re-build.launch | 2 +- .../nl.esi.xtext.launch/Maven Validate.launch | 25 +++++++++++++++++++ features/nl.esi.xplus.feature/feature.xml | 8 +++--- features/nl.esi.xplus.lsp.feature/feature.xml | 6 ++--- .../feature.xml | 4 +++ features/nl.esi.xplus.ui.feature/feature.xml | 4 +++ .../nl.esi.xplus.standard.site/category.xml | 10 ++++++++ 7 files changed, 51 insertions(+), 8 deletions(-) create mode 100644 bundles/nl.esi.xtext.launch/Maven Validate.launch diff --git a/bundles/nl.esi.xtext.launch/Maven Re-build.launch b/bundles/nl.esi.xtext.launch/Maven Re-build.launch index 1f6c661..a1fe112 100644 --- a/bundles/nl.esi.xtext.launch/Maven Re-build.launch +++ b/bundles/nl.esi.xtext.launch/Maven Re-build.launch @@ -2,7 +2,7 @@ - + diff --git a/bundles/nl.esi.xtext.launch/Maven Validate.launch b/bundles/nl.esi.xtext.launch/Maven Validate.launch new file mode 100644 index 0000000..d4f7c39 --- /dev/null +++ b/bundles/nl.esi.xtext.launch/Maven Validate.launch @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/features/nl.esi.xplus.feature/feature.xml b/features/nl.esi.xplus.feature/feature.xml index 74b8bf6..4fd37f4 100644 --- a/features/nl.esi.xplus.feature/feature.xml +++ b/features/nl.esi.xplus.feature/feature.xml @@ -31,6 +31,10 @@ Languages. %license + + + + @@ -63,8 +67,4 @@ Languages. id="nl.esi.xtext.common.lang.ide" version="0.0.0"/> - - diff --git a/features/nl.esi.xplus.lsp.feature/feature.xml b/features/nl.esi.xplus.lsp.feature/feature.xml index 473b2dd..7625288 100644 --- a/features/nl.esi.xplus.lsp.feature/feature.xml +++ b/features/nl.esi.xplus.lsp.feature/feature.xml @@ -31,9 +31,9 @@ Languages. %license - + + + + + diff --git a/features/nl.esi.xplus.ui.feature/feature.xml b/features/nl.esi.xplus.ui.feature/feature.xml index dfe8624..8b251d6 100644 --- a/features/nl.esi.xplus.ui.feature/feature.xml +++ b/features/nl.esi.xplus.ui.feature/feature.xml @@ -50,4 +50,8 @@ id="nl.esi.xtext.common.lang.ui" version="0.0.0"/> + + diff --git a/releng/nl.esi.xplus.standard.site/category.xml b/releng/nl.esi.xplus.standard.site/category.xml index 227244d..1c250cf 100644 --- a/releng/nl.esi.xplus.standard.site/category.xml +++ b/releng/nl.esi.xplus.standard.site/category.xml @@ -32,6 +32,15 @@ + + + + + + + + + XPlus Framework @@ -47,4 +56,5 @@ UI Project of XPlus + From 9132d81b5a13a105a539f168690bf018928d44a9 Mon Sep 17 00:00:00 2001 From: Yuri Blankenstein Date: Wed, 27 May 2026 12:35:32 +0200 Subject: [PATCH 6/8] Repaired languages overview graph --- .../GenerateGrammarsDiagram.launch | 18 +++ .../META-INF/MANIFEST.MF | 4 +- bundles/nl.esi.xplus.doc.design/pom.xml | 107 ++++++++++-------- .../doc/design/GenerateGrammarsDiagram.xtend | 55 ++++++--- 4 files changed, 117 insertions(+), 67 deletions(-) create mode 100644 bundles/nl.esi.xplus.doc.design/GenerateGrammarsDiagram.launch diff --git a/bundles/nl.esi.xplus.doc.design/GenerateGrammarsDiagram.launch b/bundles/nl.esi.xplus.doc.design/GenerateGrammarsDiagram.launch new file mode 100644 index 0000000..661ec8a --- /dev/null +++ b/bundles/nl.esi.xplus.doc.design/GenerateGrammarsDiagram.launch @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + diff --git a/bundles/nl.esi.xplus.doc.design/META-INF/MANIFEST.MF b/bundles/nl.esi.xplus.doc.design/META-INF/MANIFEST.MF index 456eb8a..ccb1073 100644 --- a/bundles/nl.esi.xplus.doc.design/META-INF/MANIFEST.MF +++ b/bundles/nl.esi.xplus.doc.design/META-INF/MANIFEST.MF @@ -18,4 +18,6 @@ Require-Bundle: com.google.guava, nl.esi.xtext.expressions;resolution:=optional, nl.esi.xtext.types;resolution:=optional, nl.esi.xtext.common.lang;resolution:=optional, - nl.esi.xtext.lsp.generator;resolution:=optional + nl.esi.xtext.lsp.generator;resolution:=optional, + org.eclipse.emf.codegen.ecore;resolution:=optional, + org.eclipse.emf.ecore.xmi;resolution:=optional diff --git a/bundles/nl.esi.xplus.doc.design/pom.xml b/bundles/nl.esi.xplus.doc.design/pom.xml index d25a174..61ba667 100644 --- a/bundles/nl.esi.xplus.doc.design/pom.xml +++ b/bundles/nl.esi.xplus.doc.design/pom.xml @@ -30,6 +30,24 @@ org.apache.maven.plugins maven-dependency-plugin + + unpack-ecore-models + generate-sources + + unpack-dependencies + + + true + true + true + true + true + true + nl.esi.xplus + META-INF/MANIFEST.MF,model/generated/*.*,**/*.xtext + ${project.build.directory}/meta-models/ + + unpack-adoc-resources generate-sources @@ -37,12 +55,39 @@ unpack-dependencies + true + true adoc/** ${project.build.directory}/adoc-ext + + + + + + maven-antrun-plugin + + + prepare-package + + + + + + + + + run + + + + + + org.codehaus.mojo exec-maven-plugin @@ -57,70 +102,32 @@ nl.esi.xplus.doc.design.GenerateGrammarsDiagram true - ${project.basedir}/.. + ${project.build.directory}/meta-models ${project.build.directory}/adoc-gen/xtext-grammars.plantuml - + org.eclipse.xtend org.eclipse.xtend.lib ${xtend.version} + + + + + + + org.eclipse.emf + org.eclipse.emf.codegen.ecore + 2.39.0 + - - - - - org.apache.maven.plugins - maven-resources-plugin - - - prepare-package - - copy-resources - - - - - ${project.basedir}/.. - - */model/generated/*.ecore - - - - ${project.build.directory}/meta-models - - - - - - - maven-antrun-plugin - - - prepare-package - - - - - - - - - run - - - - - - com.altran.general.emf.ecoredoc ecoredoc-maven-plugin diff --git a/bundles/nl.esi.xplus.doc.design/src/nl/esi/xplus/doc/design/GenerateGrammarsDiagram.xtend b/bundles/nl.esi.xplus.doc.design/src/nl/esi/xplus/doc/design/GenerateGrammarsDiagram.xtend index ac87f13..88ffc94 100644 --- a/bundles/nl.esi.xplus.doc.design/src/nl/esi/xplus/doc/design/GenerateGrammarsDiagram.xtend +++ b/bundles/nl.esi.xplus.doc.design/src/nl/esi/xplus/doc/design/GenerateGrammarsDiagram.xtend @@ -17,20 +17,28 @@ import java.util.jar.Manifest import java.util.regex.Pattern import java.util.stream.Collectors import java.util.stream.Stream +import org.eclipse.emf.codegen.ecore.genmodel.GenModel +import org.eclipse.emf.codegen.ecore.genmodel.GenModelPackage +import org.eclipse.emf.common.util.URI +import org.eclipse.emf.ecore.EPackage +import org.eclipse.emf.ecore.resource.Resource +import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl +import org.eclipse.emf.ecore.xmi.impl.EcoreResourceFactoryImpl import org.eclipse.xtend.lib.annotations.Accessors class GenerateGrammarsDiagram { static val TERMINALS_GRAMMAR = new Grammar => [ - bundle = 'org.eclipse.xtext.common' + bundle = 'org.eclipse.xtext' name = 'org.eclipse.xtext.common.Terminals' ] - static val GRAMMAR_PATTERN = Pattern.compile('''^grammar\s+((\w+\.)*\w+)\s+with\s+((\w+\.)*\w+)''') + static val GRAMMAR_PATTERN = Pattern.compile('''^grammar\s+((\w+\.)*\w+)(\s+with\s+((\w+\.)*\w+))?(\s+hidden\s*\((\w+(,\s*\w+)*)\))?\s*''') static val GENERATE_PATTERN = Pattern.compile('''^generate\s+(\w+)\s+"([^"]+)"''') static val IMPORT_PATTERN = Pattern.compile('''^import\s+"([^"]+)"\s+as\s+(\w+)''') - static val FILE_EXTENSIONS_PATTERN = Pattern.compile('''^\s*fileExtensions\s+=\s+"([^"]+)"''') def static void main(String[] args) { + genmodelStandaloneSetup() + if (args.size != 2) { System.err.println('Expected two arguments: [bundles_directory] [output-file]') System.exit(1) @@ -39,12 +47,14 @@ class GenerateGrammarsDiagram { val outputFile = Path.of(args.get(1)) println('''Generate diagram: «bundlesDir» => «outputFile»''') - val xtextFiles = Files.find(bundlesDir, Integer.MAX_VALUE, [$0.toString.endsWith('.xtext')]).toIterable + val xtextFiles = Files.find(bundlesDir, Integer.MAX_VALUE, [$1.regularFile && $0.toString.endsWith('.xtext')]).toIterable val grammars = xtextFiles.map[createGrammar(bundlesDir)].filterNull.toList - grammars += TERMINALS_GRAMMAR + if (!grammars.exists[name == 'org.eclipse.xtext.common.Terminals']) { + grammars += TERMINALS_GRAMMAR + } // Reduce grammar dependencies grammars.forEach[ - bundleUses.removeAll(getParentGrammar(grammars)?.bundle) + bundleUses.removeAll(getParentGrammars(grammars).map[bundle]) grammarUses.removeAll(getParentGrammars(grammars).map[uri]) ] grammars.sortInplace[a, b | @@ -60,6 +70,13 @@ class GenerateGrammarsDiagram { println(grammars.join('\n')['''${project.build.directory}/meta-models/«bundle»/model/generated/«simpleName».ecore''']) } + def static void genmodelStandaloneSetup() { + if (!EPackage.Registry.INSTANCE.containsKey(GenModelPackage.eNS_URI)) { + EPackage.Registry.INSTANCE.put(GenModelPackage.eNS_URI, GenModelPackage.eINSTANCE) + } + Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put(GenModelPackage.eNAME, new EcoreResourceFactoryImpl()); + } + def static String generatePlantUml(Iterable grammars) ''' skinparam Arrow { Color Black @@ -97,27 +114,34 @@ class GenerateGrammarsDiagram { ''' def static Grammar createGrammar(Path xtextFile, Path bundlesDir) { - if (xtextFile.contains(Path.of('target')) || xtextFile.contains(Path.of('bin'))) { - return null - } + println(xtextFile) val fileName = com.google.common.io.Files.getNameWithoutExtension(xtextFile.fileName.toString) - val xtextLines = Files.lines(xtextFile).toIterable - val mwe2Lines = Files.lines(xtextFile.resolveSibling('''Generate«fileName».mwe2''')).toIterable val bundlePath = xtextFile.getName(bundlesDir.nameCount) + + val xtextLines = Files.lines(xtextFile).toIterable + val genmodel = bundlesDir.resolve(bundlePath).resolve('''model/generated/«fileName».genmodel''') val manifest = new Manifest(bundlesDir.resolve(bundlePath).resolve('META-INF/MANIFEST.MF').read) val requiredBundles = manifest.mainAttributes.getValue('Require-Bundle') return new Grammar => [ bundle = bundlePath.toString name = xtextLines.matchAndReturn(GRAMMAR_PATTERN, '$1').head - parent = xtextLines.matchAndReturn(GRAMMAR_PATTERN, '$3').head + parent = xtextLines.matchAndReturn(GRAMMAR_PATTERN, '$4').head uri = xtextLines.matchAndReturn(GENERATE_PATTERN, '$2').head grammarUses += xtextLines.matchAndReturn(IMPORT_PATTERN, '$1') bundleUses += requiredBundles.split(',').map[split(';').head] - fileExtensions = mwe2Lines.matchAndReturn(FILE_EXTENSIONS_PATTERN, '$1').head + fileExtensions = genmodel.fileExtensions ] } + def static String getFileExtensions(Path genmodelPath) { + if (!Files.isRegularFile(genmodelPath)) { + return null + } + val genmodelResource = new ResourceSetImpl().getResource(URI.createFileURI(genmodelPath.toString), true) + return genmodelResource.contents.filter(GenModel).flatMap[genPackages].map[fileExtensions].join(', ') + } + @Accessors static class Grammar { val Set grammarUses = newLinkedHashSet @@ -137,14 +161,13 @@ class GenerateGrammarsDiagram { def Set getParentGrammars(Iterable grammars) { val parents = newLinkedHashSet var parent = this.getParentGrammar(grammars) - while (parent !== null) { - parents += parent + while (parent !== null && parents.add(parent)) { parent = parent.getParentGrammar(grammars) } return parents } - def Grammar getParentGrammar(Iterable grammars) { + def private Grammar getParentGrammar(Iterable grammars) { return grammars.findFirst[g | g.name == this.parent] } } From 0f550bcdab490a693bcc7ad5643a18f210662da9 Mon Sep 17 00:00:00 2001 From: Yuri Blankenstein Date: Wed, 27 May 2026 15:05:52 +0200 Subject: [PATCH 7/8] No need for ecore dependencies --- .../META-INF/MANIFEST.MF | 4 +- .../adoc/_section_xtext_languages.adoc | 2 - bundles/nl.esi.xplus.doc.design/pom.xml | 38 ++++++++++----- .../doc/design/GenerateGrammarsDiagram.xtend | 46 ++++++------------- 4 files changed, 40 insertions(+), 50 deletions(-) diff --git a/bundles/nl.esi.xplus.doc.design/META-INF/MANIFEST.MF b/bundles/nl.esi.xplus.doc.design/META-INF/MANIFEST.MF index ccb1073..456eb8a 100644 --- a/bundles/nl.esi.xplus.doc.design/META-INF/MANIFEST.MF +++ b/bundles/nl.esi.xplus.doc.design/META-INF/MANIFEST.MF @@ -18,6 +18,4 @@ Require-Bundle: com.google.guava, nl.esi.xtext.expressions;resolution:=optional, nl.esi.xtext.types;resolution:=optional, nl.esi.xtext.common.lang;resolution:=optional, - nl.esi.xtext.lsp.generator;resolution:=optional, - org.eclipse.emf.codegen.ecore;resolution:=optional, - org.eclipse.emf.ecore.xmi;resolution:=optional + nl.esi.xtext.lsp.generator;resolution:=optional diff --git a/bundles/nl.esi.xplus.doc.design/adoc/_section_xtext_languages.adoc b/bundles/nl.esi.xplus.doc.design/adoc/_section_xtext_languages.adoc index 0f66e51..9f1f5d8 100644 --- a/bundles/nl.esi.xplus.doc.design/adoc/_section_xtext_languages.adoc +++ b/bundles/nl.esi.xplus.doc.design/adoc/_section_xtext_languages.adoc @@ -35,8 +35,6 @@ For more information about the reuse of existing grammars, please read the (i.e. include::{gendocdir}/xtext-grammars.plantuml[] -artifact nl.esi.xtext.types.Types #white/aqua - @enduml .... diff --git a/bundles/nl.esi.xplus.doc.design/pom.xml b/bundles/nl.esi.xplus.doc.design/pom.xml index 61ba667..a01d15f 100644 --- a/bundles/nl.esi.xplus.doc.design/pom.xml +++ b/bundles/nl.esi.xplus.doc.design/pom.xml @@ -76,7 +76,7 @@ - + @@ -109,22 +109,12 @@ - + org.eclipse.xtend org.eclipse.xtend.lib ${xtend.version} - - - - - - - org.eclipse.emf - org.eclipse.emf.codegen.ecore - 2.39.0 - @@ -298,6 +288,30 @@ + + + + org.apache.maven.plugins + maven-clean-plugin + + + remove-meta-models + package + + clean + + + true + + + ${project.build.directory}/meta-models/ + + + + + + \ No newline at end of file diff --git a/bundles/nl.esi.xplus.doc.design/src/nl/esi/xplus/doc/design/GenerateGrammarsDiagram.xtend b/bundles/nl.esi.xplus.doc.design/src/nl/esi/xplus/doc/design/GenerateGrammarsDiagram.xtend index 88ffc94..88a508e 100644 --- a/bundles/nl.esi.xplus.doc.design/src/nl/esi/xplus/doc/design/GenerateGrammarsDiagram.xtend +++ b/bundles/nl.esi.xplus.doc.design/src/nl/esi/xplus/doc/design/GenerateGrammarsDiagram.xtend @@ -17,13 +17,6 @@ import java.util.jar.Manifest import java.util.regex.Pattern import java.util.stream.Collectors import java.util.stream.Stream -import org.eclipse.emf.codegen.ecore.genmodel.GenModel -import org.eclipse.emf.codegen.ecore.genmodel.GenModelPackage -import org.eclipse.emf.common.util.URI -import org.eclipse.emf.ecore.EPackage -import org.eclipse.emf.ecore.resource.Resource -import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl -import org.eclipse.emf.ecore.xmi.impl.EcoreResourceFactoryImpl import org.eclipse.xtend.lib.annotations.Accessors class GenerateGrammarsDiagram { @@ -35,10 +28,9 @@ class GenerateGrammarsDiagram { static val GRAMMAR_PATTERN = Pattern.compile('''^grammar\s+((\w+\.)*\w+)(\s+with\s+((\w+\.)*\w+))?(\s+hidden\s*\((\w+(,\s*\w+)*)\))?\s*''') static val GENERATE_PATTERN = Pattern.compile('''^generate\s+(\w+)\s+"([^"]+)"''') static val IMPORT_PATTERN = Pattern.compile('''^import\s+"([^"]+)"\s+as\s+(\w+)''') + static val FILE_EXTENSIONS_PATTERN = Pattern.compile('''^.*fileExtensions\s*=\s*"([^"]+)".*''') def static void main(String[] args) { - genmodelStandaloneSetup() - if (args.size != 2) { System.err.println('Expected two arguments: [bundles_directory] [output-file]') System.exit(1) @@ -70,13 +62,6 @@ class GenerateGrammarsDiagram { println(grammars.join('\n')['''${project.build.directory}/meta-models/«bundle»/model/generated/«simpleName».ecore''']) } - def static void genmodelStandaloneSetup() { - if (!EPackage.Registry.INSTANCE.containsKey(GenModelPackage.eNS_URI)) { - EPackage.Registry.INSTANCE.put(GenModelPackage.eNS_URI, GenModelPackage.eINSTANCE) - } - Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put(GenModelPackage.eNAME, new EcoreResourceFactoryImpl()); - } - def static String generatePlantUml(Iterable grammars) ''' skinparam Arrow { Color Black @@ -114,34 +99,29 @@ class GenerateGrammarsDiagram { ''' def static Grammar createGrammar(Path xtextFile, Path bundlesDir) { - println(xtextFile) val fileName = com.google.common.io.Files.getNameWithoutExtension(xtextFile.fileName.toString) val bundlePath = xtextFile.getName(bundlesDir.nameCount) val xtextLines = Files.lines(xtextFile).toIterable val genmodel = bundlesDir.resolve(bundlePath).resolve('''model/generated/«fileName».genmodel''') + val fileExtensions = if (Files.isRegularFile(genmodel)) { + val genmodelLines = Files.lines(genmodel).toIterable + genmodelLines.matchAndReturn(FILE_EXTENSIONS_PATTERN, '$1').head + } val manifest = new Manifest(bundlesDir.resolve(bundlePath).resolve('META-INF/MANIFEST.MF').read) val requiredBundles = manifest.mainAttributes.getValue('Require-Bundle') - return new Grammar => [ - bundle = bundlePath.toString - name = xtextLines.matchAndReturn(GRAMMAR_PATTERN, '$1').head - parent = xtextLines.matchAndReturn(GRAMMAR_PATTERN, '$4').head - uri = xtextLines.matchAndReturn(GENERATE_PATTERN, '$2').head - grammarUses += xtextLines.matchAndReturn(IMPORT_PATTERN, '$1') - bundleUses += requiredBundles.split(',').map[split(';').head] - fileExtensions = genmodel.fileExtensions + return new Grammar => [ g | + g.bundle = bundlePath.toString + g.name = xtextLines.matchAndReturn(GRAMMAR_PATTERN, '$1').head + g.parent = xtextLines.matchAndReturn(GRAMMAR_PATTERN, '$4').head + g.uri = xtextLines.matchAndReturn(GENERATE_PATTERN, '$2').head + g.grammarUses += xtextLines.matchAndReturn(IMPORT_PATTERN, '$1') + g.bundleUses += requiredBundles.split(',').map[split(';').head] + g.fileExtensions = fileExtensions ] } - def static String getFileExtensions(Path genmodelPath) { - if (!Files.isRegularFile(genmodelPath)) { - return null - } - val genmodelResource = new ResourceSetImpl().getResource(URI.createFileURI(genmodelPath.toString), true) - return genmodelResource.contents.filter(GenModel).flatMap[genPackages].map[fileExtensions].join(', ') - } - @Accessors static class Grammar { val Set grammarUses = newLinkedHashSet From 1b8f6148b0d0a897bafef8e825b73ab9db669d73 Mon Sep 17 00:00:00 2001 From: Paul Nelissen Date: Thu, 28 May 2026 08:24:42 +0200 Subject: [PATCH 8/8] Fix a reference in adoc --- .../nl.esi.xtext.expressions/adoc/nl.esi.xtext.expressions.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bundles/nl.esi.xtext.expressions/adoc/nl.esi.xtext.expressions.adoc b/bundles/nl.esi.xtext.expressions/adoc/nl.esi.xtext.expressions.adoc index 7b9ccec..bb8eee8 100644 --- a/bundles/nl.esi.xtext.expressions/adoc/nl.esi.xtext.expressions.adoc +++ b/bundles/nl.esi.xtext.expressions/adoc/nl.esi.xtext.expressions.adoc @@ -203,4 +203,4 @@ Operators are evaluated in the following order (highest to lowest): * Operator associativity: most operators are left-associative; the power operator `^` is right-associative. * Variables can be declared with optional initialization: `Type name = expression` or just `Type name`. -NOTE: When invoking functions with custom Java types, `IExpressionConverter` instances are evaluated in order until one successfully converts the argument. The first successful conversion is used. This allows custom converters to handle specific types while falling back to default converters for built-in types. See <> for details on implementing custom converters. \ No newline at end of file +NOTE: When invoking functions with custom Java types, `IExpressionConverter` instances are evaluated in order until one successfully converts the argument. The first successful conversion is used. This allows custom converters to handle specific types while falling back to default converters for built-in types. See <> for details on implementing custom converters. \ No newline at end of file