I've got the following DSL written in Xtext:
import "http://www.eclipse.org/xtext/common/JavaVMTypes" as types
generate mydsl "http://www.test.de/mydsl/MyDsl"
MyModel:
'mymodel' name=ID '{'
allSubsystem+=Subsystem*
'}'
;
Subsystem:
name=ID '{'
(messages="messages" '{'
allMessage+=Message*
'}')?
'}'
;
Message:
'error' name=ID (allLanguage+=MessageLang (','? allLanguage+=MessageLang)* )
;
MessageLang:
lang=MessageLanguage '=>' message=STRING
;
enum MessageLanguage: DE | EN;
My default workflow looks like this:
Workflow {
component = org.eclipse.xtext.mwe.Reader {
// lookup all resources on the classpath
useJavaClassPath = true
// or define search scope explicitly
path = modelPath
// this class will be generated by the xtext generator
register = de.db.kolt.ribdsl.RibDslStandaloneSetup {}
load = {
slot = "allMyModel"
type = "MyModel"
}
}
component = org.eclipse.xpand2.Generator {
expand = "templates::Main::processMain FOREACH allMyModel"
outlet = {
path = targetDir
}
fileEncoding = fileEncoding
}
}
Not really spectacular. But now my question. If I run the workflow and my Xpand file looks like this
«DEFINE processMain FOR MyModel-»
«EXPAND processMessage»
«ENDDEFINE»
«DEFINE processMessage FOR MyModel»
«FILE "messages.properties"»
«FOREACH allSubsystem.allMessage AS message»
«FOREACH message.allLanguage AS entry»
«REM»the entry is unique by the name of the subsystem + "." + name of the mesage«ENDREM»
«((Subsystem)message.eContainer()).name».«message.name»=«entry.message»
«ENDFOREACH»
«ENDFOREACH»
«ENDFILE»
«ENDDEFINE»
the generator only produces one output file with the first model of one file. But I have more than one file in my source-directory. In every file (model) are several messages.
Who can I create only one output file ("messages.properties") which contains all messages from all models out of many files?
Than you
Michael