Hart, Leo wrote:
Oh, I didn't realize I could still use the comma-delimited list in the
<imports><import/></imports> syntax. I'll use that as a workaround
for now and request the desired functionality in an enhancement request.
And its definately somthing I'd like to see happen. I've just been
looking at how msbuild defines common targets to be importted for cc,
vbc etc - very similar to the way you've done it. This looks like a very
useful approach if you have common settings across many subprojects and
only the <sources>, <references> etc child elements are changing. I
would be great to have common targets like that available on the wiki or
even as part of the std NAnt package.
Ian
-----Original Message-----
*From:* Gert Driesen [mailto:[EMAIL PROTECTED]
*Sent:* Tuesday, January 04, 2005 3:40 PM
*To:* Hart, Leo; [email protected]
*Subject:* RE: [Nant-users] Using RefId with <vbc><imports/></vbc>
Leo,
This is something we'll need to look into after the 0.85 release.
Right now, the only thing you can do is use one <import> element
and set its namespace attribute to a comma delimited list of
namespaces to import (which is not optimal ofcourse).
Gert
------------------------------------------------------------------------
*From:* [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] *On Behalf Of
*Hart, Leo
*Sent:* dinsdag 4 januari 2005 20:50
*To:* [email protected]
*Subject:* [Nant-users] Using RefId with <vbc><imports/></vbc>
Hello,
I have a question regarding the <imports> section of the <vbc>
task. I currently have 1 common build file that contains
common tasks used by all of my sub-application build files and
then additional build files, 1 per sub-application.
In 0.84 in order to specify your imports you did so by
including a comma-delimited string. So in my common build
file I had:
<target name="globalDefineImportsList" depends="prepare">
<echo>**********************************************************</echo>
<echo>* Defining Imports
List: *</echo>
<echo>**********************************************************</echo>
<call target="defineImportsList"/>
</target>
<target name="globalDefineSourcesPath" depends="prepare">
<echo>**********************************************************</echo>
<echo>* Defining Sources
Path: *</echo>
<echo>**********************************************************</echo>
<call target="defineSourcesPath"/>
</target>
<target name="buildLibrary">
<echo>**********************************************************</echo>
<echo>* Building
Library: *</echo>
<echo>**********************************************************</echo>
<!--Create .NET Library Assembly-->
<vbc target="library"
define="${define.set}"
warnaserror="${warnAsError.set}"
nowarn=""
debug="${debugMode.set}"
output="${build.bin.dir}/${app.name}.dll"
doc="${build.doc.dir}/${app.name}.xml"
imports="${imports.list}"
rootnamespace="${app.name}">
<sources refid="sources.path"/>
<resources refid="resources.path"/>
<references refid="references.path"/>
</vbc>
</target>
And in my per-application build file I had:
<target name="defineImportsList">
<description>
REQUIRED:
Use this target to specify your project-level import list.
</description>
<property name="imports.list"
value="Microsoft.VisualBasic,System,System.Collections,System.Data,System.Diagnostics,System.Drawing,System.Windows.Forms"
/>
</target>
<target name="defineSourcesPath">
<description>
REQUIRED:
Use this target to specify all .NET source files that
should be compiled and included
in this project binary.
</description>
<fileset id="sources.path" basedir=".">
<includes name="**/*.vb" />
</fileset>
</target>
The thing I liked about this is I could create app-specific
imports, sources, etc in my app-specific build file, while
leaving the common file generic. I didn't like that the
imports section was a comma-delimited list.
Now in 0.85 they've moved imports out of VBC as an attribute
and made it an element, which I like, but I can no longer
split out the import-building logic like I had before. Now
the syntax is:
<vbc>
<imports>
<import.../>
<import.../>
<import.../>
</imports>
</vbc>
But there is no container object I can create and give an ID,
so I could use it in my common build file. For example, my
common might look like:
<target name="buildLibrary">
<echo>**********************************************************</echo>
<echo>* Building
Library: *</echo>
<echo>**********************************************************</echo>
<!--Create .NET Library Assembly-->
<vbc target="library"
define="${define.set}"
warnaserror="${warnAsError.set}"
nowarn=""
debug="${debugMode.set}"
output="${build.bin.dir}/${app.name}.dll"
doc="${build.doc.dir}/${app.name}.xml"
rootnamespace="${app.name}">
<imports refid="imports.path"/>
<sources refid="sources.path"/>
<resources refid="resources.path"/>
<references refid="references.path"/>
</vbc>
<!--Set Library Extension for Binary-->
<property name="buildBinaryExtension.ext" value="dll"/>
</target>
And my app-specific might look like:
<target name="defineImportsList">
<description>
REQUIRED:
Use this target to specify your project-level import list.
</description>
<imports id="imports.path">
<import name="System"/>
</imports>
</target>
Currently this returns an error as <imports> cannot be
stand-alone and must be under <vbc>.
Any suggestions?
Thanks,
Leo
-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues
Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek.
It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt
_______________________________________________
Nant-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nant-users