Home » Modeling » TMF (Xtext) » Imported library source not being indexed
| |
Re: Imported library source not being indexed [message #1537087 is a reply to message #1537035] |
Tue, 30 December 2014 16:28 |
K M Messages: 7 Registered: December 2014 |
Junior Member |
|
|
Hi Christian,
I've probably got the setup wrong, but am not sure which bit...
Here's what the manifest of the lib plugin looks like:
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: com.company.foo
Bundle-Vendor: My Company
Bundle-Version: 1.0.0.qualifier
Bundle-SymbolicName: com.company.foo; singleton:=true
Bundle-ActivationPolicy: lazy
Require-Bundle: org.eclipse.xtext;visibility:=reexport,
org.eclipse.xtext.xbase;resolution:=optional;visibility:=reexport,
org.eclipse.xtext.generator;resolution:=optional,
org.apache.commons.logging;bundle-version="1.0.4";resolution:=optional,
org.eclipse.emf.codegen.ecore;resolution:=optional,
org.eclipse.emf.mwe.utils;resolution:=optional,
org.eclipse.emf.mwe2.launch;resolution:=optional,
org.eclipse.emf.ecore.xcore,
com.company.foo.model,
org.eclipse.xtext.util,
org.eclipse.xtext.xbase.lib,
org.antlr.runtime,
org.eclipse.xtext.common.types,
org.objectweb.asm;bundle-version="[5.0.1,6.0.0)";resolution:=optional
Import-Package: org.apache.log4j
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Export-Package: com.company.foo,
com.company.foo.formatting,
com.company.foo.generator,
com.company.foo.lang,
com.company.foo.parser.antlr,
com.company.foo.parser.antlr.internal,
com.company.foo.scoping,
com.company.foo.serializer,
com.company.foo.services,
com.company.foo.util,
com.company.foo.validation
The library source is in com.company.foo.lang, e.g. Library.foo
The manifest of the model project looks like this:
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Sample
Bundle-SymbolicName: Sample
Bundle-Version: 1.0.0.qualifier
Require-Bundle: com.company.foo;bundle-version="1.0.0",
org.eclipse.core.runtime;bundle-version="3.10.0",
org.eclipse.ui;bundle-version="3.106.0"
I suppose as an alternative to picking up the library source via a plugin another approach would be to explicitly add the library source to the index when it is created. But I'm not sure where the best place to add such code would be, or what the disadvantage of such an approach would be.
|
|
| | |
Re: Imported library source not being indexed [message #1537385 is a reply to message #1537250] |
Tue, 30 December 2014 20:22 |
|
what is strange.
i do the following
(1) create a new project with this dsl
Model:
greetings+=Greeting*;
Greeting:
'Hello' name=ID ('from' from=[Greeting])? '!';
i create a libary plugin project
with this manifest
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Lib
Bundle-SymbolicName: org.xtext.example.mydsl1.lib
Bundle-Version: 1.0.0.qualifier
Bundle-Activator: org.xtext.example.mydsl1.lib.Activator
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-ActivationPolicy: lazy
Export-Package: org.xtext.example.mydsl1.lib
and this model file
and this build.properties
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.,\
src/
then i start a runtime eclipse and create that model project
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Sample
Bundle-SymbolicName: sample
Bundle-Version: 1.0.0.qualifier
Bundle-Activator: sample.Activator
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
org.xtext.example.mydsl1.lib;bundle-version="1.0.0"
Bundle-ActivationPolicy: lazy
and it works fine.
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
|
|
|
Re: Imported library source not being indexed [message #1538906 is a reply to message #1535970] |
Wed, 31 December 2014 16:45 |
|
On 30/12/2014 15:33, K M wrote:
> Hi,
>
> I've been trying to add a library to my DSL using the approach described
> in Lorenzo's book. I create the library in the DSL's runtime plug-in
> project, made sure the package is exported in the manifest, ran Eclipse,
> created a new plug-in project and added as dependency my DSL plug-in. I
> created some sources in the project and built everything. If I look at
> the index I see all the sources I've created, but I don't see the
> library source. And so any references to the library fail to resolve.
> Anyone got any ideas as to why Xtext's global scoping mechanism wouldn't
> be following the project dependencies and indexing the library?
Hi
if I remember correctly, I experienced a similar problem as well if the
library files had cross references to elements of other library files;
I'm sure there's a thread in the forum I started myself with an example
to reproduce the problem. I don't remember if that was considered a
bug. In such cases, though, loading the library files in a custom
resource set worked (similar to what you have to do in a standalone
context).
However, with a single library file (or with library files without cross
references to other library files) it all works out of the box; have you
tried the example of the book? That works for me, and I followed the
same approach in other DSLs of mine.
cheers
Lorenzo
--
Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
HOME: http://www.lorenzobettini.it
Xtext Book:
http://www.packtpub.com/implementing-domain-specific-languages-with-xtext-and-xtend/book
HOME: http://www.lorenzobettini.it
TDD Book: https://leanpub.com/tdd-buildautomation-ci
Xtext Book: https://www.packtpub.com/application-development/implementing-domain-specific-languages-xtext-and-xtend-second-edition
|
|
|
Goto Forum:
Current Time: Fri Apr 19 05:48:20 GMT 2024
Powered by FUDForum. Page generated in 0.03040 seconds
|