|
Re: MWE2/Xtend2 and outlets [message #727183 is a reply to message #727177] |
Tue, 20 September 2011 15:20 |
|
Hi,
outlets are not sophicticated in Xtext 2.0.0/2.0.1
in 2.1.0 they ll get more like this Xpand ones.
the basic idea is to call
org.eclipse.xtext.generator.AbstractFileSystemAccess.setOutputPath(String, String)
when you configure your FileSystemAcccess
~Christian
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
|
|
|
Re: MWE2/Xtend2 and outlets [message #727200 is a reply to message #727183] |
Tue, 20 September 2011 15:40 |
Matt Campbell Messages: 11 Registered: April 2011 |
Junior Member |
|
|
[EDIT] Ah, actually I'm using 2.0.1, my mistake. That makes sense then that there isn't much to do with them in my environment then
I'm using the latest stable builds of Xtext 2.0.1 and I saw the method you mention, but I wasn't sure of the best way to pull the outletName and path from MWE2 workflow to pass into that method.
If I've got outlets defined in my MWE2 workflow as such:
component = org.eclipse.xtext.generator.GeneratorComponent {
register = my.dsl.ModelDslStandaloneSetup {}
slot = 'model'
outlet = {
outletName = "common"
path = "src-gen-common"
}
outlet = {
path = targetDir
}
}
The targetDir 'src-gen' is the default output directory for all generateFile() calls. How would I use the common outlet's name and path in my Xtend file? The method you mention seems to imply I should do something like:
override void doGenerate(Resource resource, IFileSystemAccess fsa) {
for(component : resource.allContentsIterable.filter(typeof(MyDslComponent))) {
(fsa as AbstractFileSystemAccess).setOutputPath("common", "src-gen-common")
fsa.generateFile(
component.fullyQualifiedName.toString().replace(".", "/") + ".idl",
idlGenerator.generateIdl(component))
}
}
but that disregards the outlet defined in the workflow and hard-codes that value in the template itself and I was hoping not to have to do that. I tried pulling out an outputConfiguration with the outlet name as below, but it doesn't seem outlets in the workflow get automatically translated into output configurations:
override void doGenerate(Resource resource, IFileSystemAccess fsa) {
for(component : resource.allContentsIterable.filter(typeof(MyDslComponent))) {
fsa.generateFile(
component.fullyQualifiedName.toString().replace(".", "/") + ".idl",
(fsa as AbstractFileSystemAccess).outputConfigurations.get("common").name,
idlGenerator.generateIdl(component))
}
}
We've used Xtext 1.0 for a while (and oAW for a while before that) so some of the patterns are familiar to me, but I'm still sort of new to digging around in the internals. I appreciate the fantastic tool and any pointers in the right direction here.
[Updated on: Tue, 20 September 2011 15:46] Report message to a moderator
|
|
|
|
Re: MWE2/Xtend2 and outlets [message #727233 is a reply to message #727213] |
Tue, 20 September 2011 16:50 |
Matt Campbell Messages: 11 Registered: April 2011 |
Junior Member |
|
|
Hrmm... I think there might be something strange going on with my workflow. Is there a difference between the GenereMWE.mwe2 file that gets created in the src folder (in the .generator package) and the automatic incremental building happening under the hood? I assumed that the latter was using the former for configuration, but the outlets I've defined in the workflow aren't getting translated into output configurations in the AbstractFileSystemAccess when the incremental build invokes my templates (which makes me think the incremental build isn't running that workflow). How would I go about making the incremental build use outlets?
[Updated on: Tue, 20 September 2011 16:51] Report message to a moderator
|
|
|
|
|
|
|
|
Re: MWE2/Xtend2 and outlets [message #728240 is a reply to message #728232] |
Thu, 22 September 2011 19:11 |
|
Hi,
so you are actually using the latest nightlys. this stuff is brand new and not yet done.
you find the prefs und window preferences yourdsl builder
the builder is used from within eclipse. the workflow is for calling the generation standalone. it is your choice if you want to enable it in the builder/eclipse or just call it standalone e.g. in a continous build.
~Christian
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
|
|
|
Powered by
FUDForum. Page generated in 0.04223 seconds