This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 212824

Summary: Adding multiple source nodes
Product: php Reporter: nicholasf
Component: ProjectAssignee: Tomas Mysik <tmysik>
Status: NEW ---    
Severity: normal    
Priority: P3    
Version: 7.2   
Hardware: All   
OS: All   
Issue Type: ENHANCEMENT Exception Reporter:

Description nicholasf 2012-05-22 10:46:53 UTC
It would be very useful to be able to add multiple source nodes to a project. By "multiple source nodes" I don't mean adding multiple sources or include paths.

I know that it is possible to add multiple include paths to a project and that's the only way right now to add some references to other external projects/libraries and I think that its the right way to do it. I also agree with the fact that a project should have a single source directory, but the thing is that a source directory may contain diffent kind of sources.

I'll just take an example to explain this feature request. Let say that we have the following project structure:

myProject
|_src
   |_main
     |_php
     |_resources
     |_webapp
   |_test
     |_php
     |_resources
     
|_3rdParty => third party libraries that should be added in include path

|_build.xml => ant build file

Note that even if there is more than one folder under the project root, the only source node is "src"

There are mainly two reasons of having this kind of project structure (just like in java or other programing language):

- Separation on concerns: for example you won't put PHP classes/files and configuration files (that could be xml/txt files or even PHP files etc) on the same level but still they are part of your project sources. You would put the first one in src/main/php and the second one in src/main/resources ... same thing with tests etc ...

- It eases the assembly/packaging of the project - you might want to package this final project like this:

|_src		   myProject.zip
   |_main	   |	
     |_php========>|_libraries         
     |_resources==>|_conf  
     |_webapp=====>|_public 

|_3rdParty========>|_libraries

   |_test => not part of packaging
     |_php 
     |_resources
     
|_build.xml => not part of packaging

Note: I am not saying that Netbeans should do that, this should be done with a project management tool or else... I'm just trying to argue the fact of using such a structure

Right now if you want to have this kind of structure your Netbeans project would look like this : 

myProject
|_Source Files
    |_src 
       |_main   
     	   |_php
     	      |_Folder1
     	      |_....
           |_resources
	      |_...
           |_webapp
	      |_...
       |_test
           |_php => does not apear if we selected this folder as "Test folder" in project properties
           |_resources
              
     |_3rdParty
     
     |_build.xml 
     
|_Test Files => represents src/test/php folder

I hope that you'll agree with me that when having this kind of project structure, it makes a lot of folders to expand and therefore it is not really pleasant or "user friendly",also you just loose one of the main advantages of using a great IDE like netbeans :) i.e. seeing your project as something organized in a specific way.

We also have the directory "3rdParty" and the build.xml file that should not be part of the "Source Files". These files and folders are useful for the project but they are not source files. They should not be visible under the "Source Files" but still you may want to edit your build.xml file for example.

This result is because right now, when you create a project the source folder cannot be dissociated from the project folder. So if you create a project to /projects/myProject, your source folder has to be /projects/myProject. Maybe that it should be allowed to select a source folder that is different from the project folder: here my project folder would be "/projects/myProject" and my source folder would be "/projects/myProject/src".

You can still tell me to ignore the "3rdParty" but I think it is simpler to select the source directory of a project and ignore the other folders as "Source Files"

So, instead of having the actual php Netbeans project structure, it could work pretty much as a Netbeans Java project (from the Project Properties > Sources panel) where you can select multiple source packages (that would be limited to the ones under the selected project source directory) and for each of them specify a label or use a default one that would be the relative path name.

We would have something like this

myProject
|_Sources Files => selected project source node: "/projects/myProject/src"
	|_src/main/php => this would be single node with the name "src/main/php" that acts as shortcut to the path src/main/php
	   |_Folder1
	   |_....
	|_src/main/resources
	   |_...
	|_src/main/webapp
	   |_...
	   
	|_src/test/php
	   |_...
	   
|_Other => all other files and folders that are not under "/projects/myProject/src"
     |_3rdParty
     
     |_build.xml 

If no source directory is defined, maybe we can assume that the source directory is the project root directory.

myProject
|_Source Files => node to project root directory
|_Other => not visible

This feature would be a really nice thing for projects which have complex structures, it would help a lot to rapidly identify the different parts of a project in a blink of an eye. This feature may seem to be a little bit "trivial" at first sight but it would make projects with Netbeans PHP much more user friendly when dealing with complex structures in source folder. 

Actual projects does contain a "Test files" node that makes it simple: when working on tests you know where to look. Maybe that you didn't add this node for this particular purpose but the thing is that it makes life a little bit more easier ... Tests are a particular kind of source but it may not be the only one in a project ...

Many php projects are using this kind of structure (not necessarily the same as in the example of course) here are some examples:

https://github.com/phpmd/phpmd
https://github.com/Graphity/graphity-core
https://github.com/phpDocumentor/phpDocumentor2
https://github.com/zendframework/zf2
... and many more


This feature request is maybe indirectly a dupplicate of those:

http://netbeans.org/bugzilla/show_bug.cgi?id=180889 
http://netbeans.org/bugzilla/show_bug.cgi?id=206258
http://netbeans.org/bugzilla/show_bug.cgi?id=160477

Sorry for dupplicating, but I wanted to be a little bit more explicit because I think it is a real need ...

Thanks !