Summary: | Floating attribute for import task | ||
---|---|---|---|
Product: | Ant | Reporter: | johan.vromans |
Component: | Core tasks | Assignee: | Ant Notifications List <notifications> |
Status: | NEW --- | ||
Severity: | enhancement | Keywords: | PatchAvailable |
Priority: | P3 | ||
Version: | 1.6.1 | ||
Target Milestone: | --- | ||
Hardware: | Other | ||
OS: | other | ||
Attachments: | Example implementation |
Description
johan.vromans
2004-04-15 08:13:09 UTC
Created attachment 11246 [details]
Example implementation
It's an interesting idea, but one that worries me as it could be confusing. I'd be happier with the option of giving a path to import, with the first one found in the path being picked up. What do you think of that option? That would be nice as well, but it would require fixed locations (hard-wired path names) which is what we try to avoid. However, in most cases, an import path of ".:..:../..:../../..:../../../.." would be sufficient to emulate the "float" behaviour to the extent needed. Do you envision the path setting as an import task attribute, or as a property setting? If we add a search-path for imports, please make sure it is not an attribute but a <path/> element (and of course a corresponding "pathref" attribute). This would be not only for consistence, but it will also allow writing custom Path implementation that does what the original user wanted (i.e., it will report path elements that go all the way back to the root of the filesystem). So could easily get the best of both worlds. :-) I'd go for a path/pathref. My use case for it would be in smartfrog.org's build, where we have separate components that we want to redist (with source), but which all depend on ..\..\common.xml that they import. So I'd have the release script copy that file into the base dir of the archive, then have <import file="common.xml"> <path path="../..;." /> </import> and have it picked up in the parent dir first. This is why it would be more powerful than a simple 'float' attr; it would be more like the include path used in C/C++ inclusion. The path nested element is pretty powerful, it also covers my use-case: <import file="common.xml"> <path path=".:${user.home}/.ant/importfiles:${ant.home}/importfile"/> </import> This could be a (standard) presetdef <presetdef name="findimport"> <import> <path> <pathelement path=".:..:../..:../../..:../../../.."/> <pathelement path="${user.home}/.ant/importfiles"/> <pathelement path="${ant.home}/.ant/importfiles"/> </path> </import> <presetdef> <findimport file="common.xml"/> Check out 'bug' 22269. It proposes adding '<fileset/>' to the import task. |