• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

separate build file for initialization

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hey,
Sorry about asking two questions.. i hate it when people do that eheh.
Anyway, i want to have a separate build file for all of my initializations, and I cant seem to find a task that will do that for me.
LoadProperties doesnt work (i dont think), because i want to set up patternsets with refid's in the init file.
And since the Ant task doesnt let properties in the sub-project be available in the main-project, the only way it will work is if i have main call init, and then init call main... but thats ugly and unintuitive.
So... anyone know of another way?
Thanks,
RighteousRaven
 
Sheriff
Posts: 3063
12
Mac IntelliJ IDE Python VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There's nothing wrong with asking two questions! If we didn't like answering questions, we wouldn't be here. Actually, I get more annoyed by people going all E.E. Cummings with personal pronouns, but it's a minor compulsion, and I can deal with it when I have to.
You're right: properties set in the sub-projects (i.e. other ant files with targets called with the ant task) are not available to the main project after the sub-project target completes. However, properties set in the main project are available to the sub-projects. Ref IDs are too, but not by default. You have to set inheritRefs=true in the ant task.
You should always have targets in the main ant build file that call targets in the sub-projects. After all, that's what makes them sub-projects. Your init task should exist in the main build file, and the properties will be propagated when you "ant" execute targets in the sub-projects.
I'm not sure what you mean by main calling init and init calling main. If you sometimes need to be able to call targets in the sub-projects without going through the main file, I'm afraid you will have to do what you can with properties files, and cut and paste the rest into init tasks in the sub-projects. You may find that you don't need all those filesets and such in all the sub-projects anyway.
 
Righteous Raven
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
what i meant by main calling init and init calling main is that properties are passed from project to sub-project.. so main must be a sub-project of init. However, it doesnt make sense to be calling the sub-project in order to call the project.. so init must also be a sub-project of main...
so the solution would be to have the default target in main call the subproject, and then once the sub-project is finished executing, it calls a different target in main which continues through the execution of the project.
-RighteousRaven
 
Greg Charles
Sheriff
Posts: 3063
12
Mac IntelliJ IDE Python VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think I follow you. What I think we're both saying is there should be an init target in the main build file. All the targets in the main build should have init as a dependency, either directly or indirectly. The targets can then call other targets even in other build files (what I would call sub-projects) and pass along all the initial parameters.
If you had the init target in its own build file, you would have to execute that task and have it call the "main" target. You're right. That doesn't make sense.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic