Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » OutputConfigurationProvider with empty output-directory
OutputConfigurationProvider with empty output-directory [message #996980] Thu, 03 January 2013 10:35 Go to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
Hi,

In my project I want the generator to write file directly to the
project-folder instead of some subfolder.

I tried the following settings: "", "." but they all lead to an
exception, the only possible solution for now is that I define "src" and
then when creating the path in the generator i prefix it with "../".

The exception thrown is:
> !STACK 0
> java.lang.IllegalArgumentException: Path must include project and resource name: /my.fx.test
> at org.eclipse.core.runtime.Assert.isLegal(Assert.java:63)
> at org.eclipse.core.internal.resources.Workspace.newResource(Workspace.java:2163)
> at org.eclipse.core.internal.resources.Container.getFolder(Container.java:215)
> at org.eclipse.xtext.builder.BuilderParticipant.refreshOutputFolders(BuilderParticipant.java:231)
> at org.eclipse.xtext.builder.BuilderParticipant.build(BuilderParticipant.java:125)
> at org.eclipse.xtext.builder.impl.RegistryBuilderParticipant.build(RegistryBuilderParticipant.java:60)
> at org.eclipse.xtext.builder.impl.XtextBuilder.doBuild(XtextBuilder.java:161)
> at org.eclipse.xtext.builder.impl.XtextBuilder.incrementalBuild(XtextBuilder.java:141)
> at org.eclipse.xtext.builder.impl.XtextBuilder.build(XtextBuilder.java:91)
> at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:728)
> at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
> at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:199)
> at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:239)
> at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:292)
> at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
> at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:295)
> at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:351)
> at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:374)
> at org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:143)
> at org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:241)
> at org.eclipse.core.internal.jobs.Worker.run(Worker.java:53)


The drawback with this is that if the user does not have src-directory
it gets created.

Is there a possibility to make the xtext generate relative to the
root-folder?

Tom
Re: OutputConfigurationProvider with empty output-directory [message #998038 is a reply to message #996980] Wed, 09 January 2013 08:42 Go to previous messageGo to next message
Lorenzo Bettini is currently offline Lorenzo BettiniFriend
Messages: 1812
Registered: July 2009
Location: Firenze, Italy
Senior Member
Hi

I have exactly the same problem (I'd like to generate a
plugin.xml_my_gen) in the root folder...

the trick of "../" does not work for me either could you please share to
code Tom?

thanks
cheers
Lorenzo

On 01/03/2013 11:35 AM, Tom Schindl wrote:
> Hi,
>
> In my project I want the generator to write file directly to the
> project-folder instead of some subfolder.
>
> I tried the following settings: "", "." but they all lead to an
> exception, the only possible solution for now is that I define "src" and
> then when creating the path in the generator i prefix it with "../".
>
> The exception thrown is:
>> !STACK 0
>> java.lang.IllegalArgumentException: Path must include project and resource name: /my.fx.test
>> at org.eclipse.core.runtime.Assert.isLegal(Assert.java:63)
>> at org.eclipse.core.internal.resources.Workspace.newResource(Workspace.java:2163)
>> at org.eclipse.core.internal.resources.Container.getFolder(Container.java:215)
>> at org.eclipse.xtext.builder.BuilderParticipant.refreshOutputFolders(BuilderParticipant.java:231)
>> at org.eclipse.xtext.builder.BuilderParticipant.build(BuilderParticipant.java:125)
>> at org.eclipse.xtext.builder.impl.RegistryBuilderParticipant.build(RegistryBuilderParticipant.java:60)
>> at org.eclipse.xtext.builder.impl.XtextBuilder.doBuild(XtextBuilder.java:161)
>> at org.eclipse.xtext.builder.impl.XtextBuilder.incrementalBuild(XtextBuilder.java:141)
>> at org.eclipse.xtext.builder.impl.XtextBuilder.build(XtextBuilder.java:91)
>> at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:728)
>> at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
>> at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:199)
>> at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:239)
>> at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:292)
>> at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
>> at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:295)
>> at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:351)
>> at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:374)
>> at org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:143)
>> at org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:241)
>> at org.eclipse.core.internal.jobs.Worker.run(Worker.java:53)
>
>
> The drawback with this is that if the user does not have src-directory
> it gets created.
>
> Is there a possibility to make the xtext generate relative to the
> root-folder?
>
> Tom
>


--
Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
ICQ# lbetto, 16080134 (GNU/Linux User # 158233)
HOME: http://www.lorenzobettini.it MUSIC: http://www.purplesucker.com
http://www.myspace.com/supertrouperabba
BLOGS: http://tronprog.blogspot.com http://longlivemusic.blogspot.com
http://www.gnu.org/software/src-highlite
http://www.gnu.org/software/gengetopt
http://www.gnu.org/software/gengen http://doublecpp.sourceforge.net


Re: OutputConfigurationProvider with empty output-directory [message #998251 is a reply to message #998038] Wed, 09 January 2013 16:46 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
Hi Lorenzo,

All my code is opensource.

The generator:
https://github.com/tomsontom/e-fx-clipse/blob/master/at.bestsolution.efxclipse.tooling.fxgraph/src/at/bestsolution/efxclipse/tooling/fxgraph/generator/FXGraphGenerator.xtend

The outputconfig provider:
https://github.com/tomsontom/e-fx-clipse/blob/master/at.bestsolution.efxclipse.tooling.fxgraph/src/at/bestsolution/efxclipse/tooling/fxgraph/compiler/FXGraphOutputConfigurationProvider.java

Tom

Am 09.01.13 09:42, schrieb Lorenzo Bettini:
> Hi
>
> I have exactly the same problem (I'd like to generate a
> plugin.xml_my_gen) in the root folder...
>
> the trick of "../" does not work for me either could you please share to
> code Tom?
>
> thanks
> cheers
> Lorenzo
>
> On 01/03/2013 11:35 AM, Tom Schindl wrote:
>> Hi,
>>
>> In my project I want the generator to write file directly to the
>> project-folder instead of some subfolder.
>>
>> I tried the following settings: "", "." but they all lead to an
>> exception, the only possible solution for now is that I define "src" and
>> then when creating the path in the generator i prefix it with "../".
>>
>> The exception thrown is:
>>> !STACK 0
>>> java.lang.IllegalArgumentException: Path must include project and resource name: /my.fx.test
>>> at org.eclipse.core.runtime.Assert.isLegal(Assert.java:63)
>>> at org.eclipse.core.internal.resources.Workspace.newResource(Workspace.java:2163)
>>> at org.eclipse.core.internal.resources.Container.getFolder(Container.java:215)
>>> at org.eclipse.xtext.builder.BuilderParticipant.refreshOutputFolders(BuilderParticipant.java:231)
>>> at org.eclipse.xtext.builder.BuilderParticipant.build(BuilderParticipant.java:125)
>>> at org.eclipse.xtext.builder.impl.RegistryBuilderParticipant.build(RegistryBuilderParticipant.java:60)
>>> at org.eclipse.xtext.builder.impl.XtextBuilder.doBuild(XtextBuilder.java:161)
>>> at org.eclipse.xtext.builder.impl.XtextBuilder.incrementalBuild(XtextBuilder.java:141)
>>> at org.eclipse.xtext.builder.impl.XtextBuilder.build(XtextBuilder.java:91)
>>> at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:728)
>>> at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
>>> at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:199)
>>> at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:239)
>>> at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:292)
>>> at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
>>> at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:295)
>>> at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:351)
>>> at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:374)
>>> at org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:143)
>>> at org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:241)
>>> at org.eclipse.core.internal.jobs.Worker.run(Worker.java:53)
>>
>>
>> The drawback with this is that if the user does not have src-directory
>> it gets created.
>>
>> Is there a possibility to make the xtext generate relative to the
>> root-folder?
>>
>> Tom
>>
>
>
Re: OutputConfigurationProvider with empty output-directory [message #998541 is a reply to message #998251] Thu, 10 January 2013 07:45 Go to previous messageGo to next message
Sebastian Zarnekow is currently offline Sebastian ZarnekowFriend
Messages: 3118
Registered: July 2009
Senior Member
Hi Tom,

would you mind filing a ticket with a patch attached? That would be great.

Best regards,
Sebastian
--
Looking for professional support for Xtext, Xtend or Eclipse Modeling?
Go visit: http://xtext.itemis.com

Am 09.01.13 17:46, schrieb Tom Schindl:
> Hi Lorenzo,
>
> All my code is opensource.
>
> The generator:
> https://github.com/tomsontom/e-fx-clipse/blob/master/at.bestsolution.efxclipse.tooling.fxgraph/src/at/bestsolution/efxclipse/tooling/fxgraph/generator/FXGraphGenerator.xtend
>
> The outputconfig provider:
> https://github.com/tomsontom/e-fx-clipse/blob/master/at.bestsolution.efxclipse.tooling.fxgraph/src/at/bestsolution/efxclipse/tooling/fxgraph/compiler/FXGraphOutputConfigurationProvider.java
>
> Tom
>
> Am 09.01.13 09:42, schrieb Lorenzo Bettini:
>> Hi
>>
>> I have exactly the same problem (I'd like to generate a
>> plugin.xml_my_gen) in the root folder...
>>
>> the trick of "../" does not work for me either could you please share to
>> code Tom?
>>
>> thanks
>> cheers
>> Lorenzo
>>
>> On 01/03/2013 11:35 AM, Tom Schindl wrote:
>>> Hi,
>>>
>>> In my project I want the generator to write file directly to the
>>> project-folder instead of some subfolder.
>>>
>>> I tried the following settings: "", "." but they all lead to an
>>> exception, the only possible solution for now is that I define "src" and
>>> then when creating the path in the generator i prefix it with "../".
>>>
>>> The exception thrown is:
>>>> !STACK 0
>>>> java.lang.IllegalArgumentException: Path must include project and resource name: /my.fx.test
>>>> at org.eclipse.core.runtime.Assert.isLegal(Assert.java:63)
>>>> at org.eclipse.core.internal.resources.Workspace.newResource(Workspace.java:2163)
>>>> at org.eclipse.core.internal.resources.Container.getFolder(Container.java:215)
>>>> at org.eclipse.xtext.builder.BuilderParticipant.refreshOutputFolders(BuilderParticipant.java:231)
>>>> at org.eclipse.xtext.builder.BuilderParticipant.build(BuilderParticipant.java:125)
>>>> at org.eclipse.xtext.builder.impl.RegistryBuilderParticipant.build(RegistryBuilderParticipant.java:60)
>>>> at org.eclipse.xtext.builder.impl.XtextBuilder.doBuild(XtextBuilder.java:161)
>>>> at org.eclipse.xtext.builder.impl.XtextBuilder.incrementalBuild(XtextBuilder.java:141)
>>>> at org.eclipse.xtext.builder.impl.XtextBuilder.build(XtextBuilder.java:91)
>>>> at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:728)
>>>> at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
>>>> at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:199)
>>>> at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:239)
>>>> at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:292)
>>>> at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
>>>> at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:295)
>>>> at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:351)
>>>> at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:374)
>>>> at org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:143)
>>>> at org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:241)
>>>> at org.eclipse.core.internal.jobs.Worker.run(Worker.java:53)
>>>
>>>
>>> The drawback with this is that if the user does not have src-directory
>>> it gets created.
>>>
>>> Is there a possibility to make the xtext generate relative to the
>>> root-folder?
>>>
>>> Tom
>>>
>>
>>
>
Re: OutputConfigurationProvider with empty output-directory [message #999228 is a reply to message #996980] Fri, 11 January 2013 15:49 Go to previous messageGo to next message
Lorenzo Bettini is currently offline Lorenzo BettiniFriend
Messages: 1812
Registered: July 2009
Location: Firenze, Italy
Senior Member
On 01/03/2013 11:35 AM, Tom Schindl wrote:
> Hi,
>
> In my project I want the generator to write file directly to the
> project-folder instead of some subfolder.
>
> I tried the following settings: "", "." but they all lead to an
> exception, the only possible solution for now is that I define "src" and
> then when creating the path in the generator i prefix it with "../".
>

OK, now this hack works for me, but there's a drawback of this approach:
if I remove an element in my program which corresponds to a generated
resource, the previously generated file is not removed.

I have set

projectRootOutput.setOutputDirectory("src");
projectRootOutput.setOverrideExistingResources(true);
projectRootOutput.setCreateOutputDirectory(true);
projectRootOutput.setCanClearOutputDirectory(false);
projectRootOutput.setCleanUpDerivedResources(true);
projectRootOutput.setSetDerivedProperty(true);

but when the build participant executes these lines

Map<OutputConfiguration, Iterable<IMarker>> generatorMarkers =
newHashMap();
for (OutputConfiguration config : outputConfigurations.values()) {
if (config.isCleanUpDerivedResources()) {
final IFolder outputFolder =
builtProject.getFolder(config.getOutputDirectory());
final Iterable<IMarker> markers =
derivedResourceMarkers.findDerivedResourceMarkers(outputFolder,
generatorIdProvider.getGeneratorIdentifier());
generatorMarkers.put(config, markers);
}
}

it search for markers in the output directory (which is "src"), thus it
cannot find the generated resources in the project root...

probably a custom version of
DerivedResourceMarkers.findDerivedResourceMarkers could solve the
problem by using a modified IFolder... that would be a hack built upon
another hack ;)

has a feature request already been filed?

cheers
Lorenzo


--
Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
ICQ# lbetto, 16080134 (GNU/Linux User # 158233)
HOME: http://www.lorenzobettini.it MUSIC: http://www.purplesucker.com
http://www.myspace.com/supertrouperabba
BLOGS: http://tronprog.blogspot.com http://longlivemusic.blogspot.com
http://www.gnu.org/software/src-highlite
http://www.gnu.org/software/gengetopt
http://www.gnu.org/software/gengen http://doublecpp.sourceforge.net


Re: OutputConfigurationProvider with empty output-directory [message #1241989 is a reply to message #999228] Sat, 08 February 2014 21:47 Go to previous message
Michael Vorburger is currently offline Michael VorburgerFriend
Messages: 103
Registered: July 2009
Senior Member
Note to future readers finding this by searching for the respective error: Issue https://bugs.eclipse.org/bugs/show_bug.cgi?id=386135 dealt with this problem. It appears fixed in e.g. v2.4.3, but not in e.g. old v2.3.1. Just recording this here - not asking for any reply or suggesting any action.
Previous Topic:Tutorial question: IQualifiedNameProvider needs explicit type
Next Topic:Evicting cache based on a particular element value being modified
Goto Forum:
  


Current Time: Wed Apr 24 19:43:17 GMT 2024

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

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

Back to the top