|
View:
New views
4 Messages
—
Rating Filter:
Alert me
|
|
|
Project vs Sub Project - Why such DesignHi,
Is there a good documentation or the details about how ant's project and sub project design. I see a protected method getNewProject() The sub project getProject() seems to give the value of parent project.. What is the senario A.xml -> calls B.xml --> c.xml When c.xml is called, is c the sub project of B and also A.. Why did ant decide to with sub project approach rather than calling each ant call as independent project by it self but it may have just one parent. I am sure this must be having some thing to do with class loaders, parallelization etc.. Any deep inputs in this would be of great help. Regards, Raja Nagendra Kumar, C.T.O www.tejasoft.com |
|
|
Re: Project vs Sub Project - Why such DesignOn 2009-11-05, Raja Nagendra Kumar <Nagendra.Raja@...> wrote:
> I see a protected method getNewProject() > The sub project getProject() seems to give the value of parent project.. Both is inside the <ant> task? <ant> is the task that creates the subproject (using getNewProject) and executes the targets inside of it. The task itself is in the calling project and thus getProject returns the parent project (like it does for any other task in that project as well). For a task inside the called build file, getProject will not return the parent but the current project. > What is the senario > A.xml -> calls B.xml --> c.xml > When c.xml is called, is c the sub project of B and also A.. c is a sub project of B, yes. > Why did ant decide to with sub project approach rather than calling each ant > call as independent project by it self but it may have just one parent. I don't think I understand the question. Are you asking why c is not a sub project of A instead of B? Why should it? If B.xml contains an <ant> task invoking c.xml the build file writer of B.xml will certainly expect that B.xml will be the parent. B.xml could be invoked directly from the command line rather than via an <ant> task in any other build file after all. > I am sure this must be having some thing to do with class loaders, > parallelization etc.. Not at all. Stefan --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@... For additional commands, e-mail: dev-help@... |
|
|
Re: Project vs Sub Project - Why such Design>For a task inside the called build file, getProject will not return the
>parent but the current project. Stefan, we are using Ant class with in a custom task and see that getProject() is returning the parents context. I went though the code and find that lot of initialisation is done with in the execute() method, which may be the reason for such behavior. May be this could be relooked.. or there is some thing wrong with our Ant object creating and preparation. Ant lAnt = new Ant(); lAnt.bindToOwner(currentTask); lAnt.setTaskName(currentTask.getTaskName()); lAnt.init(); lAnt.setDir(createFile(aDir)); lAnt.setInheritAll(false); lAnt.setInheritRefs(false); //lAnt.getProject() - when we call getProject() here.. it gives parent one.. lAnt.execute(); //due to few internal initalisations with in execute some where getProject() may be changing so that subproject would see getNewproject() value.. but not sure how such things are needed to be done with the custom task code.. however in xml script every thing is working fine. > Why did ant decide to with sub project approach rather than calling each ant > call as independent project by it self but it may have just one parent. Trying to understand why subproject was introduced with Ant.java.. it would have very well been a new independent project it self. What are we gaining as subproject and keeping its relation with parent project. Due to protected nature of getNewProject(), we had to go with inheritance of Ant and define a new class. The context of comments is w.r.t to writing of custom tasks.. Regards, Nagendra |
|
|
Re: Project vs Sub Project - Why such DesignOn 2009-11-05, Raja Nagendra Kumar <Nagendra.Raja@...> wrote:
>> For a task inside the called build file, getProject will not return the >> parent but the current project. > Stefan, we are using Ant class with in a custom task and see that > getProject() is returning the parents context. No, the context of the Ant task (which is a task inside the "parent project", not the subproject). This is the expected behavior. > //due to few internal initalisations with in execute some where getProject() > may be changing so that subproject would see getNewproject() value.. No, tasks inside the build file called by the Ant task will see the new project, the Ant task itself is not part of that new project and never becomes part of it. > Trying to understand why subproject was introduced with Ant.java.. it would > have very well been a new independent project it self. What are we gaining > as subproject and keeping its relation with parent project. It is a new Project instance, I'm not really sure what kind of relation you see that is causing any harm. One thing that would be useful would be to fork a completely separate Java VM for the subbuild but this comes with a lot of other problems (sharing of BuildListeners or references is not possible for example). Stefan --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@... For additional commands, e-mail: dev-help@... |
| Free embeddable forum powered by Nabble | Forum Help |