xtext / seven-languages-xtext

Seven Languages in Seven Weeks (with Xtext)
69 stars 47 forks source link

An example DSL importing another DSL #28

Open ashpak-shaikh opened 1 year ago

ashpak-shaikh commented 1 year ago

Can we have an example project where one DSL(Lang1) is imported into another DSL(Lang2) OR if there is one that already exists?

I am also looking to get the eclipse-feature project in Lang2 work with this setup.

miklossy commented 1 year ago

You can take a look at the Eclipse GEF DOT project, where the DOTHTMLLabel.xtext language is embedded into the DOT.xtext language.

cdietrich commented 1 year ago

in general it depends on what you mean by

DSL(Lang1) is imported into another DSL(Lang2)

ashpak-shaikh commented 1 year ago

Thanks for the quick reply on this issue @cdietrich @miklossy. To provide some more context. I want to reference the dsl elements defined in graphql xtext language into a internal xtext DSL I am creating.

I followed @cdietrich 's blog to achieve this and I have got the language to work out but seeing the following error with the eclipse-feature project.

_Could not resolve dependencies for project com.intuit.dsl.flow:com.intuit.dsl.flow.feature:eclipse-feature:1.0.0-SNAPSHOT: The following artifacts could not be resolved: p2.eclipse.plugin:com.google.guava:jar:30.1.0.v20221112-0806, p2.eclipse.plugin:com.google.inject:jar:5.0.1.v20221112-0806, p2.eclipse.plugin:javax.inject:jar:1.0.0.v20220405-0441, p2.eclipse.plugin:org.aopalliance:jar:1.0.0.v20220404-1927, p2.eclipse.plugin:org.eclipse.equinox.common:jar:3.17.100.v20230202-1341, p2.eclipse.plugin:org.eclipse.emf.ecore:jar:2.33.0.v20230226-0921, p2.eclipse.plugin:org.eclipse.emf.common:jar:2.28.0.v20230223-0922, p2.eclipse.plugin:org.antlr.runtime:jar:3.2.0.v20220404-1927, p2.eclipse.plugin:org.apache.log4j:jar:1.2.24.v20221221-2012, p2.eclipse.plugin:com.sun.jna:jar:5.12.1.v20221103-2317, p2.eclipse.plugin:com.sun.jna.platform:jar:5.12.1.v20221103-2317, p2.eclipse.plugin:io.github.classgraph:jar:4.8.149.v20220915-0556, p2.eclipse.plugin:javax.annotation:jar:1.3.5.v20221203-1659, p2.eclipse.plugin:org.eclipse.osgi:jar:3.18.300.v20230220-1352, p2.eclipse.plugin:org.apache.batik.constants:jar:1.16.0.v20221027-0840, p2.eclipse.plugin:org.apache.batik.css:jar:1.16.0.v20221027-0840, p2.eclipse.plugin:org.apache.batik.util:jar:1.16.0.v20221027-0840, p2.eclipse.plugin:org.apache.batik.i18n:jar:1.16.0.v20221027-0840, p2.eclipse.plugin:org.apache.xmlgraphics:jar:2.7.0.v20221018-0736, p2.eclipse.plugin:org.w3c.dom.svg:jar:1.1.0.v201011041433, p2.eclipse.plugin:org.w3c.dom.events:jar:3.0.0.draft20060413_v201105210656, p2.eclipse.plugin:org.w3c.css.sac:jar:1.3.1.v200903091627, p2.eclipse.plugin:org.apache.commons.io:jar:2.8.0.v20210415-0900, p2.eclipse.plugin:org.apache.commons.jxpath:jar:1.3.0.v200911051830, p2.eclipse.plugin:org.apache.commons.logging:jar:1.2.0.v20180409-1502, p2.eclipse.plugin:org.eclipse.core.commands:jar:3.10.400.v20230220-0932, p2.eclipse.plugin:org.eclipse.core.contenttype:jar:3.8.200.v20220817-1539, p2.eclipse.plugin:org.eclipse.equinox.preferences:jar:3.10.200.v20230120-0604, p2.eclipse.plugin:org.eclipse.equinox.registry:jar:3.11.200.v20220817-1601, p2.eclipse.plugin:org.eclipse.core.databinding:jar:1.12.0.v20230214-1401, p2.eclipse.plugin:org.eclipse.core.databinding.observable:jar:1.12.200.v20230220-0932, p2.eclipse.plugin:org.eclipse.core.databinding.property:jar:1.9.200.v20230220-0932, p2.eclipse.plugin:org.eclipse.core.databinding.beans:jar:1.9.100.v20230214-1401, p2.eclipse.plugin:org.eclipse.core.expressions:jar:3.8.200.v20220613-1047, p2.eclipse.plugin:org.eclipse.core.runtime:jar:3.26.100.v20221021-0005, p2.eclipse.plugin:org.eclipse.core.jobs:jar:3.13.300.v20230111-0823, p2.eclipse.plugin:org.eclipse.equinox.app:jar:1.6.200.v20220720-2012, p2.eclipse.plugin:org.eclipse.e4.core.commands:jar:1.0.400.v20230220-0932, p2.eclipse.plugin:org.eclipse.e4.core.di:jar:1.8.300.v20220817-1539, p2.eclipse.plugin:org.eclipse.e4.core.contexts:jar:1.11.0.v20220716-0839, p2.eclipse.plugin:org.eclipse.e4.core.services:jar:2.3.400.v20220915-1347, p2.eclipse.plugin:org.eclipse.e4.core.di.annotations:jar:1.7.200.v20220613-1008, p2.eclipse.plugin:org.eclipse.e4.core.di.extensions:jar:0.17.200.v20220613-1008, p2.eclipse.plugin:org.eclipse.e4.core.di.extensions.supplier:jar:0.16.400.v20220613-1047, p2.eclipse.plugin:org.eclipse.osgi.services:jar:3.11.100.v20221006-1531, p2.eclipse.plugin:org.eclipse.e4.emf.xpath:jar:0.3.200.v20230220-1427, p2.eclipse.plugin:org.eclipse.e4.ui.workbench.swt:jar:0.16.800.v20230220-0932, p2.eclipse.plugin:org.eclipse.e4.ui.bindings:jar:0.13.300.v20230220-0932, p2.eclipse.plugin:org.eclipse.e4.ui.model.workbench:jar:2.3.0.v20230220-1021, p2.eclipse.plugin:org.eclipse.e4.ui.progress:jar:0.3.700.v20230214-1401, p2.eclipse.plugin:org.eclipse.e4.ui.services:jar:1.5.200.v20230220-0932, p2.eclipse.plugin:org.eclipse.e4.ui.workbench.renderers.swt:jar:0.15.800.v20230214-1401, p2.eclipse.plugin:org.eclipse.e4.ui.workbench:jar:1.14.100.v20230220-1021, p2.eclipse.plugin:org.eclipse.e4.ui.css.core:jar:0.13.500.v20230220-0932, p2.eclipse.plugin:org.eclipse.e4.ui.css.swt:jar:0.14.800.v20230220-0932, p2.eclipse.plugin:org.w3c.dom.smil:jar:1.0.1.v200903091627, p2.eclipse.plugin:org.eclipse.e4.ui.css.swt.theme:jar:0.13.300.v20230220-0932, p2.eclipse.plugin:org.eclipse.e4.ui.di:jar:1.4.200.v20230220-0932, p2.eclipse.plugin:org.eclipse.e4.ui.widgets:jar:1.3.200.v20230220-0932, p2.eclipse.plugin:org.eclipse.e4.ui.workbench.renderers.swt.cocoa:jar:0.13.100.v20230214-1401, p2.eclipse.plugin:org.eclipse.equinox.event:jar:1.6.200.v20230120-0604, p2.eclipse.plugin:org.eclipse.equinox.launcher:jar:1.6.400.v20210924-0641, p2.eclipse.plugin:org.eclipse.equinox.simpleconfigurator:jar:1.4.200.v20221111-1340, p2.eclipse.plugin:org.eclipse.osgi.compatibility.state:jar:1.2.800.v20221116-1440, p2.eclipse.plugin:org.eclipse.osgi.util:jar:3.7.200.v20230103-1101, p2.eclipse.plugin:org.eclipse.equinox.launcher.cocoa.macosx.x86_64:jar:1.2.700.v20221108-1024, p2.eclipse.plugin:org.eclipse.swt:jar:3.123.0.v20230220-1431, p2.eclipse.plugin:org.eclipse.swt.cocoa.macosx.x86_64:jar:3.123.0.v20230220-1431, p2.eclipse.plugin:org.eclipse.jface:jar:3.29.0.v20230214-1401, p2.eclipse.plugin:org.eclipse.jface.databinding:jar:1.14.100.v20230214-1401, p2.eclipse.plugin:org.eclipse.e4.ui.workbench3:jar:0.16.200.v20230220-0932, p2.eclipse.plugin:org.eclipse.equinox.console:jar:1.4.500.v20211021-1418, p2.eclipse.plugin:org.eclipse.e4.ui.workbench.addons.swt:jar:1.4.600.v20230220-0932, p2.eclipse.plugin:org.eclipse.equinox.bidi:jar:1.4.200.v20220710-1223, p2.eclipse.plugin:org.eclipse.e4.ui.dialogs:jar:1.3.500.v20230220-0932, p2.eclipse.plugin:org.eclipse.urischeme:jar:1.2.300.v20230220-0932, p2.eclipse.plugin:org.eclipse.jface.notifications:jar:0.5.200.v20230220-0932, p2.eclipse.feature:org.eclipse.e4.rcp:jar:4.27.0.v20230220-1431, p2.eclipse.plugin:org.eclipse.emf.ecore.change:jar:2.15.0.v20230211-1150, p2.eclipse.plugin:org.eclipse.emf.ecore.xmi:jar:2.18.0.v20230211-1150, p2.eclipse.feature:org.eclipse.emf.common:jar:2.29.0.v20230223-0922, p2.eclipse.feature:org.eclipse.emf.ecore:jar:2.31.0.v20230226-0921, p2.eclipse.plugin:org.eclipse.help:jar:3.9.100.v20210721-0601, p2.eclipse.plugin:org.eclipse.ui:jar:3.202.0.v20230214-1401, p2.eclipse.plugin:org.eclipse.ui.workbench:jar:3.128.0.v20230220-1021, p2.eclipse.plugin:org.eclipse.update.configurator:jar:3.4.1000.v20221114-1512, p2.eclipse.plugin:org.eclipse.rcp:jar:4.27.0.v20230302-0300, p2.eclipse.plugin:org.eclipse.ui.cocoa:jar:1.3.100.v20230214-1401, p2.eclipse.feature:org.eclipse.rcp:jar:4.27.0.v20230302-0300, p2.p2.installable.unit:org.eclipse.rcp_root:zip:4.27.0.v20230302-0300, p2.eclipse.plugin:org.objectweb.asm:jar:9.4.0.v20221107-1714, p2.eclipse.plugin:org.eclipse.xtext.logging:jar:1.2.24.v20230227-1159, p2.eclipse.plugin:org.eclipse.equinox.launcher.win32.win32.x86_64:jar:1.2.700.v20221108-1024, p2.eclipse.plugin:org.eclipse.swt.win32.win32.x86_64:jar:3.123.0.v20230220-1431, p2.eclipse.plugin:org.eclipse.e4.ui.swt.win32:jar:1.1.200.v20230214-1401, p2.eclipse.plugin:org.eclipse.equinox.launcher.gtk.linux.x86_64:jar:1.2.700.v20221108-1024, p2.eclipse.plugin:org.eclipse.swt.gtk.linux.x8664:jar:3.123.0.v20230220-1431, p2.eclipse.plugin:org.eclipse.e4.ui.swt.gtk:jar:1.1.300.v20230220-0932: Could not find artifact p2.eclipse.plugin:com.google.guava:jar:30.1.0.v20221112-0806 at specified path /home/runner/.m2/repository/p2/osgi/bundle/com.google.guava/30.1.0.v20221112-0806/com.google.guava-30.1.0.v20221112-0806.jar

cdietrich commented 1 year ago

you would need to provide a complete example. do you see the probloem in maven only? did you run maven with -U? which tycho version do you use?

ashpak-shaikh commented 1 year ago

For both the languages, I am following the new project flow for xtext version 2.30.0 which has the tycho version set to 2.7.5. The problem exists with -U as well.

I will push the second language to git as well with instructions to reproduce and update the thread.

cdietrich commented 1 year ago

so you see this problem independent of any cross language use? the code you shared works fine for me with mvn clean install -Dmaven.repo.local=.m2