Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Multiple generated ecore files(Fails xtext check on generated ecore files.)
Multiple generated ecore files [message #727368] Wed, 21 September 2011 05:36 Go to next message
Varadarajan Sriram(Sri) is currently offline Varadarajan Sriram(Sri)Friend
Messages: 6
Registered: September 2011
Junior Member
We are in the process of migrating an xtext project from 1.0 to 2.0, and it appears after running mwe2 workflow there are 2 generated .ecore files. one is in the com.company.mydsl and the other in org.company.mydsl.impl folder. and they appear to be of different case mydsl.ecore and Mydsl.ecore.

the ecore file that is created in the impl folder appears to be failing xtext check.

the errors appear to be related to resolving the base dsl. in our case mydsl derives from basedsl.
the errors are of the form

The feature 'eType' of 'org.eclipse.emf.ecore.impl.EReferenceImpl@10e1efe{platform:/resource/com.company.mydsl/src-gen/com/company/mydsl/impl/mydsl.ecore#//Comp1/Comp}' contains an unresolved proxy 'org.eclipse.emf.ecore.impl.EClassImpl@136c4d1{h t t p : / / w w w . c o m p a n y . b a s e d s l#//ObjectReference}'

if i go ahead and changed the h t t p://w w w .c o m p a n y . b a s e d s l to the actual platform url in mydsl.ecore the errors go way.

even though there are errors in the project, at runtime everything appears to work fine.

what could be causing this problem? is there something that needs to be done in the workflow to generate the proper ecore files.
Re: Multiple generated ecore files [message #727371 is a reply to message #727368] Wed, 21 September 2011 05:43 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi, how do your grammar and workflow look like.
Regards Christian

P.S.: Is the basisdsl ecore installed in the eclipse the xtext dsl you complain about is within?


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

[Updated on: Wed, 21 September 2011 06:06]

Report message to a moderator

Re: Multiple generated ecore files [message #727381 is a reply to message #727371] Wed, 21 September 2011 06:32 Go to previous messageGo to next message
Varadarajan Sriram(Sri) is currently offline Varadarajan Sriram(Sri)Friend
Messages: 6
Registered: September 2011
Junior Member
here is a sample.

grammar com.mycompany.language.Basedsl hidden(WS, ML_COMMENT, SL_COMMENT)

import "h t t p://w w w . e c l i p s e . o r g/ e m f / 2 0 0 2 /E c o re" as ecore
import "classpath:/com.mycompany.language/sample.ecore" as sample
generate basedsl "h t t p: // w w w . m y c o m p a n y . c o m/ l a nguage/Basedsl"

Block:
{Block} 'Begin'
(body+=Statement)*
'End';

SampleReference:
ID;


module com.mycompany.language.Basedsl

import org.eclipse.emf.mwe.utils.*
import org.eclipse.xtext.generator.*
import org.eclipse.xtext.ui.generator.*

var grammarURI = "classpath:/com/mycompany/language/Basedsl.xtext"
var file.extensions = "expression"
var projectName = "com.mycompany.language.basedsl"
var runtimeProject = "../${projectName}"

Workflow {

bean = StandaloneSetup {
platformUri = "${runtimeProject}/.."
scanClassPath = true
registerGenModelFile = "platform:/resource/com.mycompany.language/src/com/mycompany/language/sample.genmodel"
}

component = DirectoryCleaner {
directory = "${runtimeProject}/src-gen"
}

component = DirectoryCleaner {
directory = "${runtimeProject}.ui/src-gen"
}

component = Generator
{
mergeManifest = false
pathRtProject = runtimeProject
pathUiProject = "${runtimeProject}.ui"
projectNameRt = projectName
projectNameUi = "${projectName}.ui"
language = {
uri = grammarURI
fileExtensions = file.extensions

// Java API to access grammar elements (required by several other fragments)
fragment = grammarAccess.GrammarAccessFragment {}

// generates Java API for the generated EPackages
fragment = ecore.EcoreGeneratorFragment {}

// the serialization component
fragment = parseTreeConstructor.ParseTreeConstructorFragment {}


// a custom ResourceFactory for use with EMF
fragment = resourceFactory.ResourceFactoryFragment {
fileExtensions = file.extensions
}

// The antlr parser generator fragment.
fragment = parser.antlr.XtextAntlrGeneratorFragment {
options = {
classSplitting = true
backtrack = true
}
}

// java-based API for validation
fragment = validation.JavaValidatorFragment {
composedCheck = "org.eclipse.xtext.validation.ImportUriValidator"
composedCheck = "org.eclipse.xtext.validation.NamesAreUniqueValidator"
// registerForImportedPackages = true
}

// scoping and exporting API
// fragment = scoping.ImportURIScopingFragment {}
// fragment = exporting.SimpleNamesFragment {}

// scoping and exporting API
fragment = scoping.ImportNamespacesScopingFragment {}
fragment = exporting.QualifiedNamesFragment {}
fragment = builder.BuilderIntegrationFragment {}

// formatter API
fragment = formatting.FormatterFragment {}

// labeling API
fragment = labeling.LabelProviderFragment {}

// outline API
fragment = outline.OutlineTreeProviderFragment {}
fragment = outline.QuickOutlineFragment {}

// quickfix API
fragment = quickfix.QuickfixProviderFragment {}

// content assist API
fragment = contentAssist.JavaBasedContentAssistFragment {}

// generates a more lightweight Antlr parser and lexer tailored for content assist
fragment = parser.antlr.XtextAntlrUiGeneratorFragment {
options = {
classSplitting = true
backtrack = true
}
}

// project wizard (optional)
// fragment = projectWizard.SimpleProjectWizardFragment {
// generatorProjectName = "${projectName}.generator"
// modelFileExtension = file.extensions
// }
}
}
}

the derived dsl looks like this.

grammar com.mycompany.language.Deriveddsl with com.mycompany.language.Basedsl
import "h t t p:/ / w w w . e c l i p s e . o r g / e m f / 2 0 0 2 / E c o re" as ecore
import "h t t p : / / w w w . m y c o m p a n y . c o m / B a s e d s l" as Basedsl
generate deriveddsl " h t t p : / / w w w . m y c o m p a n y . c o m / D e r i v e d d s l"


Model:
// uses the base DSL's block
//just to illustrate using SampleReference from basedsl.
derived=Block [Basedsl::SampleReference|ID];

the derived dsl's workflow looks like the following.
module com.mycompany.Deriveddsl

import org.eclipse.emf.mwe.utils.*
import org.eclipse.xtext.generator.*
import org.eclipse.xtext.ui.generator.*

var grammarURI = "classpath:/com/mycompany/deriveddsl/Deriveddsl.xtext"
var file.extensions = "ext"
var projectName = "com.mycompany.deriveddsl"
var runtimeProject = "../${projectName}"

Workflow {
bean = StandaloneSetup {
scanClassPath = true
platformUri = "${runtimeProject}/.."
registerGenModelFile = "platform:/resource/com.mycompany.basedsl/src-gen/com/mycompany/basedsl/Basedsl.genmodel"
}

component = DirectoryCleaner {
directory = "${runtimeProject}/src-gen"
}

component = DirectoryCleaner {
directory = "${runtimeProject}.ui/src-gen"
}

component = Generator {
pathRtProject = runtimeProject
pathUiProject = "${runtimeProject}.ui"
pathTestProject = "${runtimeProject}.tests"
projectNameRt = projectName
projectNameUi = "${projectName}.ui"
mergeManifest = false
language = {
uri = grammarURI
fileExtensions = file.extensions

// Java API to access grammar elements (required by several other fragments)
fragment = grammarAccess.GrammarAccessFragment {}

// generates Java API for the generated EPackages
fragment = ecore.EcoreGeneratorFragment {}

// Serializer 2.0
//fragment = serializer.SerializerFragment {}

// the serialization component (1.0)
fragment = parseTreeConstructor.ParseTreeConstructorFragment {}


// a custom ResourceFactory for use with EMF
fragment = resourceFactory.ResourceFactoryFragment {
fileExtensions = file.extensions
}

// The antlr parser generator fragment.
fragment = parser.antlr.XtextAntlrGeneratorFragment {
antlrParam = "-Xconversiontimeout" antlrParam = "300000"
options =
{
classSplitting = true
backtrack = true
// ignoreCase = true
}
}

// java-based API for validation
fragment = validation.JavaValidatorFragment {
composedCheck = "org.eclipse.xtext.validation.ImportUriValidator"
composedCheck = "org.eclipse.xtext.validation.NamesAreUniqueValidator"
}

// scoping and exporting API
// fragment = scoping.ImportURIScopingFragment {}
// fragment = exporting.SimpleNamesFragment {}

// scoping and exporting API
fragment = scoping.ImportNamespacesScopingFragment {}
fragment = exporting.QualifiedNamesFragment {}
fragment = builder.BuilderIntegrationFragment {}

// // generator API
// fragment = generator.GeneratorFragment {
// generateMwe = true
// generateJavaMain = true
// }

// formatter API
fragment = formatting.FormatterFragment {}

// labeling API
fragment = labeling.LabelProviderFragment {}

// outline API
fragment = outline.OutlineTreeProviderFragment {}
fragment = outline.QuickOutlineFragment {}

// quickfix API
fragment = quickfix.QuickfixProviderFragment {}

// content assist API
fragment = contentAssist.JavaBasedContentAssistFragment {}

// generates a more lightweight Antlr parser and lexer tailored for content assist
fragment = parser.antlr.XtextAntlrUiGeneratorFragment {
antlrParam = "-Xconversiontimeout" antlrParam = "300000"
options =
{
classSplitting = true
backtrack = true
// ignoreCase = true
}

}

}

// // generates junit test support classes into Generator#pathTestProject
// fragment = junit.Junit4Fragment {}

// project wizard (optional)
// fragment = projectWizard.SimpleProjectWizardFragment {
// generatorProjectName = "${projectName}"
// modelFileExtension = file.extensions
// }

// provides the necessary bindings for java types integration
// fragment = types.TypesGeneratorFragment {}

// // generates the required bindings only if the grammar inherits from Xbase
// fragment = xbase.XbaseGeneratorFragment {}

// provides a preference page for template proposals
// fragment = templates.CodetemplatesGeneratorFragment {}

// rename refactoring
//fragment = refactoring.RefactorElementNameFragment {}

// provides a compare view
// fragment = compare.CompareFragment {
// fileExtensions = file.extensions
// }

}
}
}


Re: Multiple generated ecore files [message #727382 is a reply to message #727381] Wed, 21 September 2011 06:38 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi,

das chaning the grammar import to platform:/resource/com.mycompany.language/src/com/mycompany/language/sample.ecore help?

~Christian


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Multiple generated ecore files [message #727388 is a reply to message #727382] Wed, 21 September 2011 07:08 Go to previous messageGo to next message
Sebastian Zarnekow is currently offline Sebastian ZarnekowFriend
Messages: 3118
Registered: July 2009
Senior Member
Hi,

the genmodel may decide to create a copy of the EPackage's contents if
your package is too large. The EPackage's implementation class will
usually contain a huge method that initializes the package itself. If
this method or the necessary fields in the class could exceed Java's
limits, the Ecore file copy is created and loaded at runtime.

Regards,
Sebastian
--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com

On 21.09.11 08:38, Christian Dietrich wrote:
> Hi,
>
> das chaning the grammar import to
> platform:/resource/com.mycompany.language/src/com/mycompany/language/sample.ecore
> help?
>
> ~Christian
Re: Multiple generated ecore files [message #727558 is a reply to message #727388] Wed, 21 September 2011 14:22 Go to previous messageGo to next message
Varadarajan Sriram(Sri) is currently offline Varadarajan Sriram(Sri)Friend
Messages: 6
Registered: September 2011
Junior Member
I tried changing the gammar import still no luck,
Sebastian, it appears the overflow deriveddsl.ecore contains a URL proxy of the form
{h t t p:// www.mycompany.com/basedsl#/ObjectReferece} shoudn't this be
{platform:/resource/com.mycompany.basedsl/src-gen/com/mycompany/basedsl/Basedsl.ecore#/ObjectReference} when i make this change there are no errors in the editor nor when I run the plugin.
Re: Multiple generated ecore files [message #727565 is a reply to message #727388] Wed, 21 September 2011 14:24 Go to previous messageGo to next message
Varadarajan Sriram(Sri) is currently offline Varadarajan Sriram(Sri)Friend
Messages: 6
Registered: September 2011
Junior Member
I tried changing the gammar import still no luck,
Sebastian, it appears the overflow deriveddsl.ecore contains a URL proxy of the form
{h t t p:// www.mycompany.com/basedsl#/ObjectReferece} shoudn't this be
{platform:/resource/com.mycompany.basedsl/src-gen/com/mycompany/basedsl/Basedsl.ecore#/ObjectReference} when i make this change there are no errors in the editor nor when I run the plugin.
Re: Multiple generated ecore files [message #727567 is a reply to message #727388] Wed, 21 September 2011 14:25 Go to previous messageGo to next message
Varadarajan Sriram(Sri) is currently offline Varadarajan Sriram(Sri)Friend
Messages: 6
Registered: September 2011
Junior Member
I tried changing the gammar import still no luck,
Sebastian, it appears the overflow deriveddsl.ecore contains a URL proxy of the form
{h t t p:// www.mycompany.com/basedsl#/ObjectReferece} shoudn't this be
{platform:/resource/com.mycompany.basedsl/src-gen/com/mycompany/basedsl/Basedsl.ecore#/ObjectReference} when i make this change there are no errors in the editor nor when I run the plugin.
Re: Multiple generated ecore files [message #727569 is a reply to message #727388] Wed, 21 September 2011 14:27 Go to previous message
Varadarajan Sriram(Sri) is currently offline Varadarajan Sriram(Sri)Friend
Messages: 6
Registered: September 2011
Junior Member
I tried changing the gammar import still no luck,
Sebastian, it appears the overflow deriveddsl.ecore contains a URL proxy of the form
{h t t p:// w w w.m y c o m p a n y.c o m /b a s e d sl#/ObjectReferece} shoudn't this be
{platform:/resource/com.mycompany.basedsl/src-gen/com/mycompany/basedsl/Basedsl.ecore#/ObjectReference} when i make this change there are no errors in the editor nor when I run the plugin.
Previous Topic:Grammar rule for a string without quotes
Next Topic:mix different extensions with different content in one project
Goto Forum:
  


Current Time: Wed Apr 24 14:32:50 GMT 2024

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

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

Back to the top