Adding a library to an Xbase DSL [message #1767309] |
Tue, 04 July 2017 10:49  |
Eclipse User |
|
|
|
Hello everyone,
I want to add a library to an Xbase-DSL to provide some additional functions / classes.
I already did this in a non-Xbase-DSL, following the approach suggested in the book "Implementing Domain-Specific Languages with Xtext and Xtend" (great read btw!) and it worked out of the box.
It suggests to added a lib.mydsl-file into the source folder of the x.y.mydsl-Plugin and the content of this file (e.g. some pre-defined functions or classes /entities) will be available at runtime.
However, when I do this, using Xbase, it does not work and I dont know why (maybe it is not indexed / added to the scope?) and where to start looking for a solution.
What I did so far:
Using the domainmodel-example i created a file lib.dmodel with the following content:
and added it to the package "org.eclipse.xtext.example.domainmodel" ( the package is exported by the plugin by default).
Then I started a runtime-eclipse-application and created a test plugin-project and added a dependency to the org.eclipse.xtext.example.domainmodel plugin.
But when i create a test.dmodel file, entity a is not available.
entity b extends a //Missing supertype a
{}
How can I make this work in Xbase?
Or is there a better way to provide some library functions / library types for an Xbase DSL?
Best regards,
Marco
|
|
|
|
Re: Adding a library to an Xbase DSL [message #1767312 is a reply to message #1767311] |
Tue, 04 July 2017 11:10   |
Eclipse User |
|
|
|
Hi Christian,
thank you for your help! (:
I will add it to a library-plugin as soon as I get it working that way.
I think I got it right (I simply added the file and the dependencies as mentioned above).
Did I missed a step?
Here are the Manifest.MF`s
of the org.eclipse.xtext.example.domainmodel-Plugin (the DSL-Plugin)
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Xtext Domainmodel Example
Bundle-Vendor: Eclipse Xtext
Bundle-Version: 2.12.0.qualifier
Bundle-SymbolicName: org.eclipse.xtext.example.domainmodel; singleton:=true
Bundle-ActivationPolicy: lazy
Require-Bundle: org.eclipse.xtext,
org.eclipse.xtext.xbase,
org.eclipse.equinox.common;bundle-version="3.5.0",
org.eclipse.emf.ecore,
org.eclipse.xtext.xbase.lib,
org.antlr.runtime,
org.eclipse.xtext.util,
org.eclipse.xtend.lib,
org.eclipse.emf.common,
org.eclipse.xtext.common.types,
org.objectweb.asm;bundle-version="[5.0.1,6.0.0)";resolution:=optional
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Export-Package: dmodel.lang,
org.eclipse.xtext.example.domainmodel,
org.eclipse.xtext.example.domainmodel.domainmodel,
org.eclipse.xtext.example.domainmodel.domainmodel.impl,
org.eclipse.xtext.example.domainmodel.domainmodel.util,
org.eclipse.xtext.example.domainmodel.formatting2,
org.eclipse.xtext.example.domainmodel.jvmmodel,
org.eclipse.xtext.example.domainmodel.parser.antlr,
org.eclipse.xtext.example.domainmodel.parser.antlr.internal,
org.eclipse.xtext.example.domainmodel.scoping,
org.eclipse.xtext.example.domainmodel.serializer,
org.eclipse.xtext.example.domainmodel.services,
org.eclipse.xtext.example.domainmodel.validation
Import-Package: org.apache.log4j
And the runtime-plugin (DmodelTest):
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: DmodelTest
Bundle-SymbolicName: DmodelTest
Bundle-Version: 1.0.0.qualifier
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Require-Bundle: org.eclipse.xtext.xbase.lib;bundle-version="2.12.0",
org.eclipse.xtext.example.domainmodel;bundle-version="2.12.0"
|
|
|
|
|
Re: Adding a library to an Xbase DSL [message #1767343 is a reply to message #1767341] |
Tue, 04 July 2017 15:05  |
Eclipse User |
|
|
|
no,
it will be filtered in org.eclipse.xtext.builder.BuilderParticipant.getRelevantDeltas(IBuildContext)
=> you would need to subclass BuilderParticipant, adapt that method, and bind the subclass as IXtextBuilderParticipant
|
|
|
Powered by
FUDForum. Page generated in 0.07911 seconds