Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Dsl runtime library
Dsl runtime library [message #1850087] Tue, 15 February 2022 13:57 Go to next message
Yannick DAVELUY is currently offline Yannick DAVELUYFriend
Messages: 39
Registered: July 2020
Member
Hello,

I would like to have a runtime library for my Dsl.

In the dev Eclipse I created a new plugin project mydsl.lib in which I added the file library.mydsl in a source folder.

In the runtime eclipse I created a project with a dependecy in the manifest on mydsl.lib. It is not possible to refers to types defined in library.mydsl.

If I import the mydsl.lib project inside the runtime eclipse it works. Is it possible to avoid this import ?

Regards

Yannick

Re: Dsl runtime library [message #1850088 is a reply to message #1850087] Tue, 15 February 2022 14:03 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
If you model project is a plugin project
And the lib project is a plugin project too, then it should work
If you add dependency to manifest as you would do it for normal plugin development

=> am not sure what your question exactly is about


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de

[Updated on: Tue, 15 February 2022 14:21]

Report message to a moderator

Re: Dsl runtime library [message #1850089 is a reply to message #1850088] Tue, 15 February 2022 14:29 Go to previous messageGo to next message
Yannick DAVELUY is currently offline Yannick DAVELUYFriend
Messages: 39
Registered: July 2020
Member
Ok thanks Christian

Maybe something is wrong in my conf.

- This is my plugin library (on dev Eclipse)
META-INF/MANIFEST.MF
Manifest-Version: 1.0
Automatic-Module-Name: mydsl.lib
Bundle-ManifestVersion: 2
Bundle-Name: MyDsl Runtime Library
Bundle-Version: 1.0.0.qualifier
Bundle-SymbolicName: mydsl.lib;singleton:=true
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-11


build.properties
bin.includes = .,\
               META-INF/,\
               lib/
source.. = lib/

my library file test.mydsl is in lib folder

- in the Test project (runtime Eclipse)
META-INF/MANIFEST.MF
Manifest-Version: 1.0
Automatic-Module-Name: Test
Bundle-ManifestVersion: 2
Bundle-Name: Test
Bundle-Version: 1.0.0.qualifier
Bundle-SymbolicName: Test; singleton:=true
Bundle-ActivationPolicy: lazy
Require-Bundle: mydsl.lib


In the Plug-in dependencies of Test project I see :
Plug-in dependencies
     classes - /path/to/mydsl.lib/target
            test.mydsl


Both project are plugin project with the xtext nature/builder.

I don't understand why it's not working.

Thanks

Yannick
Re: Dsl runtime library [message #1850090 is a reply to message #1850089] Tue, 15 February 2022 14:38 Go to previous messageGo to next message
Yannick DAVELUY is currently offline Yannick DAVELUYFriend
Messages: 39
Registered: July 2020
Member
I will try to clarify what I need:

I need a dsl library that will contain some predefined types. This library will be installed with all other xtext plugins (mydsl, mydsl.ide, mydsl.ui, ...).

On the eclipse with installed mydsl language and lib, I would like to be able to add a dependency on mydsl.lib in the Manifest to access predefined types.

The problem seems to be that the library is visible but not built.
Re: Dsl runtime library [message #1850092 is a reply to message #1850090] Tue, 15 February 2022 15:06 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
maybe you need exports on lib project and put stuff into source folder
can you please provide a complete reproducer


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de

[Updated on: Tue, 15 February 2022 15:24]

Report message to a moderator

Re: Dsl runtime library [message #1850093 is a reply to message #1850092] Tue, 15 February 2022 15:35 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
index.php/fa/41675/0/

with my simple experiments i cannot reproduce your problem



Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Dsl runtime library [message #1850096 is a reply to message #1850088] Tue, 15 February 2022 16:41 Go to previous message
Yannick DAVELUY is currently offline Yannick DAVELUYFriend
Messages: 39
Registered: July 2020
Member
Ok I found the problem.

I had a custom DefaultResourceUIServiceProvider (see https://www.eclipse.org/forums/index.php/t/1109970/) and the IStorage ".org.eclipse.jdt.core.external.folders" was not built.

I patched the canBuild method and now it's working
  @Override
  public boolean canBuild(URI uri, IStorage storage)
  {
    if (storage instanceof IFile)
    {
      final var file = (IFile) storage;
      final var project = file.getProject();
      final var javaProject = JavaCore.create(project);
      if (".org.eclipse.jdt.core.external.folders".equals(project.getName()))
      {
        return true;
      }
      return isInSourceFolder(javaProject, file);
    }
    // everything non local shouldn't be indexed at all, as we are going to link against Java.
    return false;
  }


Thanks

[Updated on: Tue, 15 February 2022 16:43]

Report message to a moderator

Previous Topic:How to have both cross references and non cross references for a rule?
Next Topic:Convert RCP plugin project to a Maven project
Goto Forum:
  


Current Time: Sat Apr 20 15:57:03 GMT 2024

Powered by FUDForum. Page generated in 0.02959 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top