Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » "Generate All" from a genmodel located in a git repository(I want to generate inside the workspace)
"Generate All" from a genmodel located in a git repository [message #1249849] Tue, 18 February 2014 17:51 Go to next message
nicolas h is currently offline nicolas hFriend
Messages: 60
Registered: February 2011
Location: Grenoble, France
Member
Hi there,

I have a plugin "myModelPlugin.model" that only contains my models (ecore and genmodel). This plugin is located inside a git repository and I import it inside my eclipse workspace without copying it.

In my workspace, I want to generate the code with the "generate all" from the context menu of the genmodel top-level element. To do that, I edit the genmodel model directory entry "/myModelPlugin.model/src" with "/myPlugin.model/src" to separate the generated model code in a different plugin. I did the same thing for the edit / editor / tests entry.

By doing that, I hoped to have the five plugins below:

- myModelPlugin.model (linked to my git repository)
- myPlugin.model (physically located in the workspace)
- myPlugin.edit (physically located in the workspace)
- myPlugin.editor (physically located in the workspace)
- myPlugin.tests (physically located in the workspace)

Instead, all my plugins are generated in my git repository. Is there any way to force the genmodel to generate the model / edit / editor / tests plugins into the workspace event if it is not located inside the workspace ? I tried to use variables with ${WORKSPACE_LOC}, but I raise a Resource$IOWrappedException.

Does anyone have an idea ?

Regards,

--
Nicolas
Re: "Generate All" from a genmodel located in a git repository [message #1249871 is a reply to message #1249849] Tue, 18 February 2014 18:24 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 30692
Registered: July 2009
Senior Member
Nicolas,

Comments below.

On 18/02/2014 6:51 PM, nicolas h wrote:
> Hi there,
>
> I have a plugin "myModelPlugin.model" that only contains my models
> (ecore and genmodel). This plugin is located inside a git repository
> and I import it inside my eclipse workspace without copying it.
>
> In my workspace, I want to generate the code with the "generate all"
> from the context menu of the genmodel top-level element. To do that, I
> edit the genmodel model directory entry "/myModelPlugin.model/src"
> with "/myPlugin.model/src" to separate the generated model code in a
> different plugin. I did the same thing for the edit / editor / tests
> entry.
> By doing that, I hoped to have the five plugins below:
>
> - myModelPlugin.model (linked to my git repository)
> - myPlugin.model (physically located in the workspace)
> - myPlugin.edit (physically located in the workspace)
> - myPlugin.editor (physically located in the workspace)
> - myPlugin.tests (physically located in the workspace)
>
> Instead, all my plugins are generated in my git repository.
If the generator detects that it needs to create projects, it will
create them in the same physical location as the project containing the
*.genmodel itself.
> Is there any way to force the genmodel to generate the model / edit /
> editor / tests plugins into the workspace event if it is not located
> inside the workspace ? I tried to use variables with ${WORKSPACE_LOC},
> but I raise a Resource$IOWrappedException.
If you create the projects where you want them to be, the generator
will generate into those projects. But as I said, if the generator has
to create the project, it will always put the project the same folder as
the project containing the *.genmodel
>
> Does anyone have an idea ?
I'm not sure I understand your goal of a "separate project". I assume
all these things need to end up in git eventually, so why not up front?
> Regards,
>
Re: "Generate All" from a genmodel located in a git repository [message #1250439 is a reply to message #1249871] Wed, 19 February 2014 08:42 Go to previous messageGo to next message
nicolas h is currently offline nicolas hFriend
Messages: 60
Registered: February 2011
Location: Grenoble, France
Member
Hi Ed,

Thanks for your reply,

Ed Merks wrote on Tue, 18 February 2014 13:24

If you create the projects where you want them to be, the generator
will generate into those projects. But as I said, if the generator has
to create the project, it will always put the project the same folder as
the project containing the *.genmodel


I thought about this solution. But I feel that this step could be removed if it would be possible to choose a different location of the generation. But as you said, it's not a feature of the genmodel.

Ed Merks wrote on Tue, 18 February 2014 13:24

I'm not sure I understand your goal of a "separate project". I assume
all these things need to end up in git eventually, so why not up front?


I'm not sure if if it is the good solution, but to my mind, the ecore and genmodel need to be store in the git repository, but I don't want to burden the repository with generated code I never edit. If I never edit the generated code, I think it is unnecessary it end up in the git repository but rather in the workspace location. If another user clone the repository, he can import the model plugin and then re-generate the code.

Regards,

--
Nicolas
Re: "Generate All" from a genmodel located in a git repository [message #1250528 is a reply to message #1250439] Wed, 19 February 2014 10:20 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 30692
Registered: July 2009
Senior Member
Nicolas,

Comments below.

On 19/02/2014 9:42 AM, nicolas h wrote:
> Hi Ed,
>
> Thanks for your reply,
>
> Ed Merks wrote on Tue, 18 February 2014 13:24
>> If you create the projects where you want them to be, the generator
>> will generate into those projects. But as I said, if the generator
>> has to create the project, it will always put the project the same
>> folder as the project containing the *.genmodel
>
>
> I thought about this solution. But I feel that this step could be
> removed if it would be possible to choose a different location of the
> generation.
You can choose a location. But what's bothering you is that you're
choosing a location that doesn't exist and then the generator will
create a project to make that work and you don't like the algorithm for
determining that project's physical location. But generally, if you
have a model project in Git and you generate a new *.edit project,
you'll want that *.edit project also in git, so the behavior seems what
most would want...
> But as you said, it's not a feature of the genmodel.
>
> Ed Merks wrote on Tue, 18 February 2014 13:24
>> I'm not sure I understand your goal of a "separate project". I
>> assume all these things need to end up in git eventually, so why not
>> up front?
>
>
> I'm not sure if if it is the good solution, but to my mind, the ecore
> and genmodel need to be store in the git repository, but I don't want
> to burden the repository with generated code I never edit.
Well, that's a bit questionable, and keep in mind that you can use
..gitignore to tell git to ignore the contents of folders, so not wanting
to commit source to git isn't a good enough reason to put things in a
different project. I'm not sure how you plan to make that all even
compile properly and still end up with a sensible bundle structure...
> If I never edit the generated code, I think it is unnecessary it end
> up in the git repository but rather in the workspace location.
That remains a bit questionable, but as I said, it's just not a good
argument for why it needs to be in another project. Git is happy to
allow files that aren't committed to the repo; after all, you're not
putting your .class files in a different folder; they're ending up in
the bin folder of the same project.
> If another user clone the repository, he can import the model plugin
> and then re-generate the code.
Yes, that's the questionable part. He can't just import the project, he
has to install the generator tools and know to run them before he has a
reasonable workspace state. And if you think about long term support of
your software (which you probably haven't), i.e., you have 4 year old
software that needs a bug fix to exactly that four year old state,
you'll be in the position of having to ensure that you version your
entire build system to ensure that you have the right version of the
generator to generate the same code as you had 4 years ago.

Committing your generated code to version control will make you much
more aware of when, why, and how your generated code is changing from
year to year and will make it much easier for someone to clone your
project and have a working system without having to install and invoke a
bunch of generators first. But that's just my opinion.

The bottom line is that your "I don't want to commit it to git" has led
to the conclusion "I have to put it in a different project" and that's
totally unnecessary. Generate to a src-gen folder and use Git ignore to
ignore that folder's contents.
>
> Regards,
>
Re: "Generate All" from a genmodel located in a git repository [message #1250595 is a reply to message #1250528] Wed, 19 February 2014 11:40 Go to previous message
nicolas h is currently offline nicolas hFriend
Messages: 60
Registered: February 2011
Location: Grenoble, France
Member
Ed Merks wrote on Wed, 19 February 2014 05:20

> I'm not sure if if it is the good solution, but to my mind, the ecore
> and genmodel need to be store in the git repository, but I don't want
> to burden the repository with generated code I never edit.
Well, that's a bit questionable, and keep in mind that you can use
..gitignore to tell git to ignore the contents of folders, so not wanting
to commit source to git isn't a good enough reason to put things in a
different project. I'm not sure how you plan to make that all even
compile properly and still end up with a sensible bundle structure...
> If I never edit the generated code, I think it is unnecessary it end
> up in the git repository but rather in the workspace location.
That remains a bit questionable, but as I said, it's just not a good
argument for why it needs to be in another project. Git is happy to
allow files that aren't committed to the repo; after all, you're not
putting your .class files in a different folder; they're ending up in
the bin folder of the same project.


You must be right about the fact it is unnecessary to separate the generated model code from the ecore and genmodel models. The analogy with the .class and java files is absolutely relevant.

Ed Merks wrote on Wed, 19 February 2014 05:20

> If another user clone the repository, he can import the model plugin
> and then re-generate the code.
Yes, that's the questionable part. He can't just import the project, he
has to install the generator tools and know to run them before he has a
reasonable workspace state. And if you think about long term support of
your software (which you probably haven't), i.e., you have 4 year old
software that needs a bug fix to exactly that four year old state,
you'll be in the position of having to ensure that you version your
entire build system to ensure that you have the right version of the
generator to generate the same code as you had 4 years ago.

Committing your generated code to version control will make you much
more aware of when, why, and how your generated code is changing from
year to year and will make it much easier for someone to clone your
project and have a working system without having to install and invoke a
bunch of generators first. But that's just my opinion.

The bottom line is that your "I don't want to commit it to git" has led
to the conclusion "I have to put it in a different project" and that's
totally unnecessary. Generate to a src-gen folder and use Git ignore to
ignore that folder's contents.
>
> Regards,
>


Indeed, I was reasoning in terms of development. I did not consider long term support (this is not the aim of my project) but I agree with all your arguments. Thank you for this brief exchange Smile I will consider the src-gen and the git ignore solutions.

Regards,

--
Nicolas
Previous Topic:[Texo] Modeling a OneToOne relationship
Next Topic:getting all instances of an Ecore class in the workspace
Goto Forum:
  


Current Time: Sat Dec 14 00:44:18 GMT 2019

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

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

Back to the top