Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Exclude Directories from the builder
Exclude Directories from the builder [message #824160] Mon, 19 March 2012 10:30 Go to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6548
Registered: July 2009
Senior Member
Hi,

I have a custom DSL (.fxgraph) which gets translated by the configured
IGenerator into FXML-Files.

A project layout looks like this:

MyProject
+ src
+ my.package.bla
+ My.fxgraph
+ My.fxml (generated file)

Now the problem is that when people e.g. package things up using ant
(and some of them use the project location itself) so and so get another
new structure in it.

MyProject
+ src
+ my.package.bla
+ My.fxgraph
+ My.fxml (generated file)
+ build
+ build
+ build
+ classes.bla
+ My.fxgraph
+ My.fxml

and now the builder kicks in and generates FXML-Files once more in the
src-Folder

MyProject
+ src
+ my.package.bla
+ My.fxgraph
+ My.fxml (generated file)
+ MyProject.build
+ build
+ classes.bla
+ Test.fxml
+ build
+ build
+ build
+ classes.bla
+ My.fxgraph
+ My.fxml

I hope you get the problem with this description.

So my question from the title is it somehow possible to restrict the
builder to only look at src-directories, or do have to check this
manually in the IGenerator#doGenerate() which would have the draw back
that I create a dependency on JDT there because need to check if the
given Resource is found inside the source-container.

Tom
Re: Exclude Directories from the builder [message #824272 is a reply to message #824160] Mon, 19 March 2012 13:19 Go to previous messageGo to next message
Meinte Boersma is currently offline Meinte BoersmaFriend
Messages: 434
Registered: July 2009
Location: Leiden, Netherlands
Senior Member
Another possibility would be to exclude the .fxgraph files from being copied to the build target (as is quite common with non-generated/-compiled artifacts).


Re: Exclude Directories from the builder [message #824649 is a reply to message #824160] Mon, 19 March 2012 22:40 Go to previous messageGo to next message
Jan Koehnlein is currently offline Jan KoehnleinFriend
Messages: 760
Registered: July 2009
Location: Hamburg
Senior Member
If that's language specific, the easiest way is to provide your own
IResourceDescription.Manager that returns an empty IResourceDescription
on getResourceDescription(Resource) for build dir files and returns
false on isAffected, if the candidate is in your build directory.

If it should be for all languages, you could hook in earlier in the
XtextBuilder or ToBeBuildComputer. In this case, you have to modify the
SharedStateModule.


Am 19.03.12 11:30, schrieb Tom Schindl:
> Hi,
>
> I have a custom DSL (.fxgraph) which gets translated by the configured
> IGenerator into FXML-Files.
>
> A project layout looks like this:
>
> MyProject
> + src
> + my.package.bla
> + My.fxgraph
> + My.fxml (generated file)
>
> Now the problem is that when people e.g. package things up using ant
> (and some of them use the project location itself) so and so get another
> new structure in it.
>
> MyProject
> + src
> + my.package.bla
> + My.fxgraph
> + My.fxml (generated file)
> + build
> + build
> + build
> + classes.bla
> + My.fxgraph
> + My.fxml
>
> and now the builder kicks in and generates FXML-Files once more in the
> src-Folder
>
> MyProject
> + src
> + my.package.bla
> + My.fxgraph
> + My.fxml (generated file)
> + MyProject.build
> + build
> + classes.bla
> + Test.fxml
> + build
> + build
> + build
> + classes.bla
> + My.fxgraph
> + My.fxml
>
> I hope you get the problem with this description.
>
> So my question from the title is it somehow possible to restrict the
> builder to only look at src-directories, or do have to check this
> manually in the IGenerator#doGenerate() which would have the draw back
> that I create a dependency on JDT there because need to check if the
> given Resource is found inside the source-container.
>
> Tom


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


---
Get professional support from the Xtext committers at www.typefox.io
Re: Exclude Directories from the builder [message #824713 is a reply to message #824160] Tue, 20 March 2012 00:52 Go to previous message
Sebastian Zarnekow is currently offline Sebastian ZarnekowFriend
Messages: 3107
Registered: July 2009
Senior Member
Hi Tom,

you may want to override
org.eclipse.xtext.ui.resource.DefaultResourceUIServiceProvider.canHandle(URI)
and return false if the uri does not point to a source folder.

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

Am 19.03.12 11:30, schrieb Tom Schindl:
> Hi,
>
> I have a custom DSL (.fxgraph) which gets translated by the configured
> IGenerator into FXML-Files.
>
> A project layout looks like this:
>
> MyProject
> + src
> + my.package.bla
> + My.fxgraph
> + My.fxml (generated file)
>
> Now the problem is that when people e.g. package things up using ant
> (and some of them use the project location itself) so and so get another
> new structure in it.
>
> MyProject
> + src
> + my.package.bla
> + My.fxgraph
> + My.fxml (generated file)
> + build
> + build
> + build
> + classes.bla
> + My.fxgraph
> + My.fxml
>
> and now the builder kicks in and generates FXML-Files once more in the
> src-Folder
>
> MyProject
> + src
> + my.package.bla
> + My.fxgraph
> + My.fxml (generated file)
> + MyProject.build
> + build
> + classes.bla
> + Test.fxml
> + build
> + build
> + build
> + classes.bla
> + My.fxgraph
> + My.fxml
>
> I hope you get the problem with this description.
>
> So my question from the title is it somehow possible to restrict the
> builder to only look at src-directories, or do have to check this
> manually in the IGenerator#doGenerate() which would have the draw back
> that I create a dependency on JDT there because need to check if the
> given Resource is found inside the source-container.
>
> Tom
Previous Topic:Generating operation code Xtend/Xtend
Next Topic:From IResource to EObject and back
Goto Forum:
  


Current Time: Tue Apr 07 08:09:16 GMT 2020

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

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

Back to the top