[nant-dev] recursive includes

2003-03-30 Thread Gert Driesen



Hi,

I want to create a hierarchy of included 
configuration files, where each level of the hierarchy adds 
information.

eg. I want to have the following directory 
structure :

 examples
  
mono
  
 1.0
 
Tutorials
 
WebApp

in each directory I would want to have both a build 
file and a config file.

The buildfile in each directory would do an include 
of the config file in the same directory.

And the config file in each directory would do an 
include of the config file in the parent directory and add specific 
configuration information on it's level.

For example :

inthe examples\mono\1.0 directory, the 
nant.config would contain :

!-- Include parent configuration file 
--include buildfile="../nant.config" failonerror="true" 
/!-- Set runtime version --property 
name="project.runtime.version" value="1.0" readonly="false" 
/

inthe examples\mono directory, the 
nant.config would contain :

!-- Include parent configuration file --include 
buildfile="../nant.config" failonerror="true" /!-- Set runtime 
configuration --property name="project.runtime.config" 
value="mono" readonly="false" /

so for the buildfile in the examples\mono\1.0 directory, the following 
properties would be available :

property name="project.runtime.version" value="1.0" 
readonly="false" /
property name="project.runtime.config" value="mono" 
readonly="false" /and if I was to decide that the 
project.runtime.config for all examples in the examples\monodirectory 
should be mono-something, then I would only have to change the nant.config file 
in the examples\mono directory, and all underlying buildfiles would 
automatically get the updated property value.

So what I want is to be able to have each level manage only it's own 
configuration properties, but Nant currently does not allow recursive 
includes. Right now, I get the following exception :

[NAnt.Task:include Generated Exception - [] ]Exception: 
SourceForge.NAnt.BuildExceptionMessage: 
D:\CVS\log4net\examples\mono\nant.config(4,3):Recursive includes are 
not allowed.Source: NAnt.Core at 
SourceForge.NAnt.Tasks.IncludeTask.InitializeTask(XmlNode 
taskNode) at SourceForge.NAnt.Task.InitializeElement(XmlNode 
elementNode) at SourceForge.NAnt.Element.Initialize(XmlNode 
elementNode) at SourceForge.NAnt.Project.CreateTask(XmlNode 
taskNode, Target target) at 
SourceForge.NAnt.Project.CreateTask(XmlNode taskNode) at 
SourceForge.NAnt.Project.InitializeProjectDocument(XmlDocument 
doc) at 
SourceForge.NAnt.Tasks.IncludeTask.ExecuteTask() at 
SourceForge.NAnt.Task.Execute() at 
SourceForge.NAnt.Project.InitializeProjectDocument(XmlDocument 
doc) at 
SourceForge.NAnt.Tasks.IncludeTask.ExecuteTask() at 
SourceForge.NAnt.Task.Execute()

BUILD 
FAILEDD:\CVS\log4net\examples\mono\nant.config(4,3):Recursive 
includes are not allowed.Try 'nant -help' for more information

I never have circular references so I don't see why this shouldn't be 
possible.

Can anyone comment on this ?

Thanks,

Gert





Re: [nant-dev] recursive includes

2003-03-30 Thread Ian MacLean
I'll take a look at it. You're right it should only fail on circular 
includes - that was the idea anyway.

Ian
Hi,
 
I want to create a hierarchy of included configuration files, where each 
level of the hierarchy adds information.
 
eg.  I want to have the following directory structure :
 
examples
mono
1.0
Tutorials
WebApp
 
in each directory I would want to have both a build file and a config file.
 
The buildfile in each directory would do an include of the config file 
in the same directory.
 
And the config file in each directory would do an include of the config 
file in the parent directory and add specific configuration information 
on it's level.
 
For example :
 
in the examples\mono\1.0 directory, the nant.config would contain :
 
 !-- Include parent configuration file --
 include buildfile=../nant.config failonerror=true /
 !-- Set runtime version --
 property name=project.runtime.version value=1.0 readonly=false /
in the examples\mono directory, the nant.config would contain :
 
 !-- Include parent configuration file --
 include buildfile=../nant.config failonerror=true /
 !-- Set runtime configuration --
 property name=project.runtime.config value=mono readonly=false /
 
so for the buildfile in the examples\mono\1.0 directory, the following 
properties would be available :
 
 property name=project.runtime.version value=1.0 readonly=false /
 property name=project.runtime.config value=mono readonly=false /

and if I was to decide that the project.runtime.config for all examples 
in the examples\mono directory should be mono-something, then I would 
only have to change the nant.config file in the examples\mono directory, 
and all underlying buildfiles would automatically get the updated 
property value.
 
So what I want is to be able to have each level manage only it's own 
configuration properties, but Nant currently does not allow recursive 
includes.  Right now, I get the following exception :
 
[NAnt.Task:include Generated Exception  - [] ]
Exception: SourceForge.NAnt.BuildException
Message: D:\CVS\log4net\examples\mono\nant.config(4,3):
 Recursive includes are not allowed.
Source: NAnt.Core
   at SourceForge.NAnt.Tasks.IncludeTask.InitializeTask(XmlNode taskNode)
   at SourceForge.NAnt.Task.InitializeElement(XmlNode elementNode)
   at SourceForge.NAnt.Element.Initialize(XmlNode elementNode)
   at SourceForge.NAnt.Project.CreateTask(XmlNode taskNode, Target target)
   at SourceForge.NAnt.Project.CreateTask(XmlNode taskNode)
   at SourceForge.NAnt.Project.InitializeProjectDocument(XmlDocument doc)
   at SourceForge.NAnt.Tasks.IncludeTask.ExecuteTask()
   at SourceForge.NAnt.Task.Execute()
   at SourceForge.NAnt.Project.InitializeProjectDocument(XmlDocument doc)
   at SourceForge.NAnt.Tasks.IncludeTask.ExecuteTask()
   at SourceForge.NAnt.Task.Execute()
 

BUILD FAILED
D:\CVS\log4net\examples\mono\nant.config(4,3):
 Recursive includes are not allowed.
Try 'nant -help' for more information
 
I never have circular references so I don't see why this shouldn't be 
possible.
 
Can anyone comment on this ?
 
Thanks,
 
Gert
 
 

 




---
This SF.net email is sponsored by:
The Definitive IT and Networking Event. Be There!
NetWorld+Interop Las Vegas 2003 -- Register today!
http://ads.sourceforge.net/cgi-bin/redirect.pl?keyn0001en
___
Nant-developers mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/nant-developers