Bug 101163 - The project's source folder is not properly handled
Summary: The project's source folder is not properly handled
Status: VERIFIED FIXED
Alias: None
Product: EMF
Classification: Modeling
Component: Tools (show other bugs)
Version: 2.1   Edit
Hardware: PC Windows XP
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Dave Steinberg CLA
QA Contact:
URL:
Whiteboard:
Keywords: contributed
Depends on: 101162
Blocks:
  Show dependency tree
 
Reported: 2005-06-21 18:24 EDT by Marcelo Paternostro CLA
Modified: 2008-05-13 17:08 EDT (History)
2 users (show)

See Also:


Attachments
patch refers to Marcelo's description (3.93 KB, patch)
2007-06-21 13:32 EDT, Jacek Pospychala CLA
no flags Details | Diff
Improvements on the previous patch (33.42 KB, patch)
2007-06-22 17:41 EDT, Marcelo Paternostro CLA
no flags Details | Diff
Some updates (33.02 KB, application/octet-stream)
2008-01-08 12:06 EST, Ed Merks CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Marcelo Paternostro CLA 2005-06-21 18:24:20 EDT
There are three scenarios we need to consider

- If the genModel.modelDirectory is "foo/src1" and the model project was already
created, the generated java files will be placed in a src1 folder while the
project's source folder is "src".

- If the modelDirectoy is set to something like "foo/src/model", "model" becomes
part of the package instead of a source folder

- If the modelDirectory is 'foo/src.model' and the editDirectory is
'foo.src.edit', the genModel will not create the plugin files (manifest and so)
as it should (it will create the files for the model project and then try to
create the files for the edit project).
Comment 1 Ed Merks CLA 2006-05-26 07:10:34 EDT
The build.properties file also has hard code assumptions about the source folder as well as about the model folder.
Comment 2 Jacek Pospychala CLA 2007-06-21 13:32:20 EDT
Created attachment 72065 [details]
patch refers to Marcelo's description

Hello,
please look at this :)

refering to bug description.
AD 1. i assume that you expected the new source folder (foo/src1) to be set as another Source Folder. As a result, there may be both "src" and "src1" source folder with the same code, making compiler confused. But i think there is no way to guess that what is now in "src1" was previously in "src"

In patch, javaSource (foo/src1) must be created as new source entry, not only when project is initially empty, but always, when folder didnt existed and was just created.

AD 2. creating folder "foo/src/model" throws exception, because resource cannot be created recursively in one step.

Instead, patch provides a way to iteratively create parent folders and finally source folder.

AD 3. i guess you meant editDirectory = "/foo/src.edit", ("foo.src.edit" is not correct because is not absolute, and EMF will prompt an error). I actually couldn't reproduce the issue with not creating plugin files. I think it might have been caused by exception in AD2. But there was another problem. If modelDirectory was "foo/src1" and editDirectory "foo/src2", then "foo/src2" wasn't set to source folder. Change in GenBaseGeneratorAdapter fixes this.

Finally i've checked with couple different setups: (model, edit, editor directory)
-default (/foo/src, /foo.edit/src, /foo.editor/src)
-setup1 (/foo/src.model, /foo/src.edit, /foo/src.editor)
-setup2 (/foo/src/model, /foo/src/edit, /foo/src/editor)
and looks like it's working...
Comment 3 Marcelo Paternostro CLA 2007-06-21 19:53:56 EDT
Thanks for providing a possible fix!  I didn't have time to analyze your changes today, but will do first thing tomorrow morning and type here my comments.
Comment 4 Marcelo Paternostro CLA 2007-06-22 17:41:51 EDT
Created attachment 72232 [details]
Improvements on the previous patch

Awesome work.  You patch is both small and precise.  Thanks.

I just made one modification to your code to add this support to the tests project.  I also changed the templates so that "src" is not hard coded in the build.properties (as Ed mentions above).

Unfortunately it is too late to commit this for 2.3.  If everything goes well, we will be committing  this change in probably 3 weeks, for our 2.4 release.
Comment 5 Jacek Pospychala CLA 2007-08-03 17:59:10 EDT
Marcelo, I wonder if now is better time to commit this enhancement.
Comment 6 Ed Merks CLA 2008-01-08 12:06:49 EST
Created attachment 86405 [details]
Some updates

I changes the GenModelImpl to avoid using IPath/Path since that will not work standalone.  I also changed the generate method to always create a source entry since generating a project when one existed before but wasn't deleted from the file system produced bad results.
Comment 7 Ed Merks CLA 2008-01-08 12:08:57 EST
[contrib email="jacek.pospychala@pl.ibm.com"/]
Comment 8 Ed Merks CLA 2008-01-08 12:10:09 EST
The changes are committed to CVS for 2.4.
Comment 9 Nick Boldt CLA 2008-01-09 10:29:45 EST
Fixed in I200801090807.
Comment 10 Nick Boldt CLA 2008-01-28 16:39:27 EST
Move to verified as per bug 206558.