Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Xtext doesn't generate files in <proj_name>.impl and <proj_name>.util
Xtext doesn't generate files in <proj_name>.impl and <proj_name>.util [message #754082] Mon, 31 October 2011 17:00 Go to next message
Nadezhda Baklanova is currently offline Nadezhda BaklanovaFriend
Messages: 9
Registered: October 2011
Junior Member
Hi,

I encountered a strange issue: Xtext doesn't generate files under src-gen/mymodel.annotations.impl and src-gen/mymodel.annotations.util. Log contains nothing criminal:
0    [main] INFO  lipse.emf.mwe.utils.StandaloneSetup  - Registering platform uri '/home/aaa/workspace'
839  [main] INFO  ipse.emf.mwe.utils.DirectoryCleaner  - Cleaning /home/aaa/workspace/mymodel/../mymodel/src-gen
842  [main] INFO  ipse.emf.mwe.utils.DirectoryCleaner  - Cleaning /home/aaa/workspace/mymodel/../mymodel.ui/src-gen
1021 [main] INFO  ipse.xtext.generator.LanguageConfig  - generating infrastructure for mymodel.Annotations with fragments : ImplicitRuntimeFragment, ImplicitUiFragment, GrammarAccessFragment, EcoreGeneratorFragment, SerializerFragment, ResourceFactoryFragment, XtextAntlrGeneratorFragment, JavaValidatorFragment, ImportNamespacesScopingFragment, QualifiedNamesFragment, BuilderIntegrationFragment, GeneratorFragment, FormatterFragment, LabelProviderFragment, OutlineTreeProviderFragment, QuickOutlineFragment, QuickfixProviderFragment, JavaBasedContentAssistFragment, XtextAntlrUiGeneratorFragment, Junit4Fragment, TypesGeneratorFragment, XbaseGeneratorFragment, CodetemplatesGeneratorFragment, RefactorElementNameFragment, CompareFragment
4460 [main] INFO  clipse.emf.mwe.utils.GenModelHelper  - Registered GenModel 'http: //mymodel/Annotations' from 'file:/home/aaa/workspace/mymodel/src-gen/mymodel/Annotations.genmodel'
9800 [main] INFO  or.validation.JavaValidatorFragment  - generating Java-based EValidator API
12907 [main] INFO  text.generator.junit.Junit4Fragment  - generating Junit4 Test support classes
12934 [main] INFO  text.generator.junit.Junit4Fragment  - generating Compare Framework infrastructure
13076 [main] INFO  .emf.mwe2.runtime.workflow.Workflow  - Done.


The only change in the generated .mwe2 was enabling backtracking
Workflow {
    bean = StandaloneSetup {
        scanClassPath = true
        platformUri = "${runtimeProject}/.."
    }

    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"
        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 {}

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

            // The antlr parser generator fragment.
            fragment = parser.antlr.XtextAntlrGeneratorFragment {
              options = {
                  backtrack = 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.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 {}

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

            // 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
            }

        }
    }
}


Is something missed in mwe2? //I tried to restart eclipse, re-create xtext project but it didn't help.

Thanks!
Re: Xtext doesn't generate files in <proj_name>.impl and <proj_name>.util [message #754086 is a reply to message #754082] Mon, 31 October 2011 17:06 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi,

why do you expect this stuff to be generated? you do this register genmodelstuff to get nothing generated Wink

maybe you want to use the org.eclipse.emf.mwe2.ecore.EcoreGenerator component

~Christian


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

[Updated on: Mon, 31 October 2011 17:09]

Report message to a moderator

Re: Xtext doesn't generate files in <proj_name>.impl and <proj_name>.util [message #754087 is a reply to message #754086] Mon, 31 October 2011 17:13 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Btw how does your grammar look like?

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Xtext doesn't generate files in <proj_name>.impl and <proj_name>.util [message #754088 is a reply to message #754087] Mon, 31 October 2011 17:27 Go to previous messageGo to next message
Nadezhda Baklanova is currently offline Nadezhda BaklanovaFriend
Messages: 9
Registered: October 2011
Junior Member
Hi Christian,

oh, actually, I don't know what the mwe2 components are responsible for. I need the packages for using in Xtend generator. It worked until today, and I didn't change mwe2 but they aren't generated more.
I wonder what component in mwe2 generates these packages since I cannot imagine why it stopped working.

Grammar is
grammar mymodel.Annotations with org.eclipse.xtext.common.Terminals
hidden(WS, ML_COMMENT, SL_COMMENT)

generate annotations "http://www.irit.fr/scj/Annotations"

Program:
	methods+=Method+
;
Method:
	declaration=MethodDeclaration methodBody=Block
;
MethodDeclaration:
	Modifier? 'static'? Type? name=ID '('Arguments?')' ('throws' QualifiedIdentifier)?
;
Annotation:
	'//@' time=INT
;
Type:
	'void'|'int'|'long'|'boolean'|'float'|'double'|ID
;
Arguments:
	Type ID (','Type ID)*
;
Statement:
	{Statement}(
	//another block
	(annotation=Annotation? block=Block)|
	//while loop
	(annotation=Annotation? name='while''('condition=Expression')' block=Block)|
	//synchronized block
	(annotation=Annotation? name='synchronized' '('object=(QualifiedIdentifier|'this')')' block=Block)|
	//if-else block
	(annotation=Annotation? name='if''('condition=Expression')' ifBlock=Block ('else' elseBlock=Block)?)|
	';'|
	//arithmetical or boolean expression
	(annotation=Annotation? Expression';')|
	//method or constructor call or assignment
	(annotation=Annotation? name='new'? MethodOrFieldCall (AssignmentOperator Expression)?)
	)
;
Block:
	{Block}('{'
		(statements+=Statement
		)*
		//nested blocks not supported
	'}')
;
MethodOrFieldCall:
	QualifiedIdentifier ('('ArgumentList?')')? ('.'QualifiedIdentifier ('('ArgumentList?')')? )*
;
Expression:
	('('Expression')' ExpressionRest)|
	(MethodOrFieldCall ExpressionRest)|
	(Literal ExpressionRest)
	//rewrite left recursion --Expression InfixOperator Expression
;
ExpressionRest:
	(InfixOperator Expression ExpressionRest)?
;
ArgumentList:
	(Expression|'this') (','(Expression|'this'))*
;
Literal:
	INT|
	(INT'.'INT)|
	'true'|'false'|
	STRING
;
terminal Modifier:
	//smth
;
AssignmentOperator: 
	//smth
;
InfixOperator:
	//smth
;
QualifiedIdentifier:
	ID ( '.' ID )*
;

//do not treat '//@' as comments
terminal SL_COMMENT :
'//' !('\n'|'\r'|'@')* ('\r'? '\n')?;

Re: Xtext doesn't generate files in <proj_name>.impl and <proj_name>.util [message #754090 is a reply to message #754088] Mon, 31 October 2011 17:35 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi,

there should actually be generated something. there must be something strange
with your grammar. i fear it is in the parts you censored out //smth

~Christian


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Xtext doesn't generate files in <proj_name>.impl and <proj_name>.util [message #754182 is a reply to message #754090] Tue, 01 November 2011 08:54 Go to previous messageGo to next message
Nadezhda Baklanova is currently offline Nadezhda BaklanovaFriend
Messages: 9
Registered: October 2011
Junior Member
Unfortunately, not. I created a new Xtext project from wizard, didn't change anything and ran "Create Xtext artifacts" for the xtext file. The generated files still miss src-gen/mymodel, src-gen/mymodel.impl, src-gen/mymodel.util packages. Obviously, the obtained java project isn't built. Where can I look at what should be generated?
Re: Xtext doesn't generate files in <proj_name>.impl and <proj_name>.util [message #754190 is a reply to message #754182] Tue, 01 November 2011 09:48 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
This is imho a Bug. Did you try your grammar with Xtext 2.1.0. Can you create a bugzilla with a reproducable example? Thanks Christian

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Xtext doesn't generate files in <proj_name>.impl and <proj_name>.util [message #754191 is a reply to message #754190] Tue, 01 November 2011 09:58 Go to previous messageGo to next message
Nadezhda Baklanova is currently offline Nadezhda BaklanovaFriend
Messages: 9
Registered: October 2011
Junior Member
Hi Christian,

I found the reason - it is dummy enough - my project was bound to CVS, then I copied it with all CVS metadata to the same workspace. From CVS point of view there were two projects with the same name, and it must have caused this strange behavior. Not Xtext issue Smile After I deleted CVS metadata, generator works as expected.

Thanks for help!
Re: Xtext doesn't generate files in &lt;proj_name&gt;.impl and &lt;proj_name&gt;.uti [message #754215 is a reply to message #754191] Tue, 01 November 2011 13:24 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

That provides insight into the bug, but doesn't explain it to me.

Ah yes it does. I expect the build did happen, and courtesy of an
absolute path somewhere the new-build write to the old folders.

I recall a similar painful experience when converting an auto-generated
Ecore model to manually generated.

However if your copy was of auto-generated material it really should work.

Ah, I recall another painful experience, MWE has a very inefficient
behaviour whereby while building New/'module'.mwe2, it ignores the file
path it is already aware of and searches the class path for
'module'.mwe2, so if your copy preserved the mwe2 module name the
execution may have swapped project half way through to perform the build
of Old/'module'.mwe2 .

Regards

Ed Willink


On 01/11/2011 10:58, Nadezhda Baklanova wrote:
> Hi Christian,
>
> I found the reason - it is dummy enough - my project was bound to CVS,
> then I copied it with all CVS metadata to the same workspace. From CVS
> point of view there were two projects with the same name, and it must
> have caused this strange behavior. Not Xtext issue :) After I deleted
> CVS metadata, generator works as expected.
>
> Thanks for help!
Re: Xtext doesn't generate files in &lt;proj_name&gt;.impl and &lt;proj_name&gt;.uti [message #754219 is a reply to message #754215] Tue, 01 November 2011 13:40 Go to previous message
Nadezhda Baklanova is currently offline Nadezhda BaklanovaFriend
Messages: 9
Registered: October 2011
Junior Member
Hi Ed,

yes, your story about mwe2 build must have happened: when I created a project with the same grammar name but another package structure (not mymodel.my.grammar but mymodel.grammar), for the first time packages were generated with correct names (mymodel.impl, mymodel.util) but for the second time the generated files were moved to mymodel.my.impl and mymodel.my.util.

So it isn't CVS plugin but two copies of grammar in the workspace. ok... Smile
Previous Topic:Basic problem with xtext grammer
Next Topic:Second GeneratorFragment
Goto Forum:
  


Current Time: Wed Apr 24 23:53:11 GMT 2024

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

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

Back to the top