Right... so use the property::get-value() function. I think this is what you
need to do:
<?xml version="1.0" ?>
<project name="test">
<loadproperties file="buildLabels.properties" />
<!-- The foreach bellow will loop through the list of projects in the
Project.Build.Order in the buildLabels.properties -->
<foreach item="String" in="${Project.Build.Order}" delim=","
property="properties.project.Ord">
<echo message="${properties.project.Ord}" />
<call target="build.project"/>
</foreach>
<target name="build.project">
<property name="ProjectName" value="${
property::get-value(properties.project.Ord+'.ProjectName')}"/>
<property name="ViewName" value="${
property::get-value(properties.project.Ord +'.ViewName')}"/>
<property name="Label" value="${
property::get-value(properties.project.Ord +'.Label')}"/>
<echo>${ProjectName} ${ViewName} ${Label}</echo>
<call target="checkoutModuleSrc"/>
</target>
<!-- checkout src directory -->
<target name="checkoutModuleSrc">
<!--
<exec program="${starteam.cmd}">
<arg line="co -p
${STUser}:${STPassword}@${STServer}:${STPort}/${ProjectName} -o -cfgl
${Label}"/>
</exec>
-->
<echo message="${ProjectName} -o -cfgl ${Label}" />
</target>
</project>
> -----Original Message-----
> From: Labout, Douglas [mailto:[email protected]]
> Sent: Monday, June 17, 2013 2:24 PM
> To: Bob Archer; '[email protected]'
> Subject: RE: Nested variables
>
> Hmm,
> Let's see if I can explain it better...
>
> Here is the properties file that contains all the components to be built and
> their
> associated views and labels.
>
> # Projects Build Order
> Project.Name=WCFServices
> Project.Build.Directory=C:\/VisualStudio\/
> Project.Build.Order=NETComponents,NETDLLs,App
> Project.Deploy=C:\/VisualStudio\/\Windows - BuildScripts\/Deploy\/
>
> # Windows - .NET Components
> NETComponents.ProjectName=Windows - .NET Components
> NETComponents.ViewName=Windows - .NET Components
> NETComponents.Label=201261654
>
> # Windows - .NET DLLs
> NETDLLs.ProjectName=Windows - .NET DLLs
> NETDLLs.ViewName=Windows - .NET DLLs
> NETDLLs.Label=2013064494
>
> # Windows - WCFServices_NewAccounts.DataAccess
> App.ProjectName=Windows - _WCFServices
> App.ViewName=Windows - _WCFServices
> App.Label=201111781
>
> I use <loadproperties file="buildLabels.properties" /> to load the lines in
> the
> property file.
>
> Here is the loop that pulles build order:
>
> <!-- The foreach bellow will loop through the list of projects in the
> Project.Build.Order in the buildLabels.properties -->
>
> <foreach item="String" in="${Project.Build.Order}" delim=","
> property="properties.project.Ord">
> <call target="build.project"/>
> </foreach>
>
> Here is the build.project target:
>
> <target name="build.project">
> <property name="ProjectName" value="${
> properties.project.Ord+'.ProjectName'}"/>
> <property name="ViewName" value="${ properties.project.Ord'
> +'.ViewName'}"/>
> <property name="Label" value="${ properties.project.Ord'+'.Label'}"/>
> <echo>${ProjectName} ${ViewName} ${Label}</echo>
> <call target="checkoutModuleSrc"/>
>
> And finally, here is the checkoutModuleSrc target:
>
> <!-- checkout src directory -->
> <target name="checkoutModuleSrc">
>
> <exec program="${starteam.cmd}">
> <arg line="co -p
> ${STUser}:${STPassword}@${STServer}:${STPort}/${ProjectName} -o -cfgl
> ${Label}"/>
> </exec>
>
>
> You can see that I loop through the build order and pick up one of the
> projects
> to be built, then append the .Projectname, .viewname and .label and then
> check out the code.
>
> The problem is that I can get it to return the property.project.Ord, but can't
> append the .ProjectName, .ViewName, or Label without it interpreting it as
> NETDLLs.ProjectName.
>
>
> -----Original Message-----
> From: Bob Archer [mailto:[email protected]]
> Sent: Monday, June 17, 2013 10:47 AM
> To: Labout, Douglas; '[email protected]'
> Subject: RE: Nested variables
>
> Ok... I guess I'm still not understanding what is in each variable:
>
> > You are correct in that I'm trying to put together a couple of variables.
> > The build order is assigned to the variable ${properties.project.Ord}.
> > I then
>
> What is the exact text in that variable?
>
> > append to the end of that variable the .ProjectName,
>
> Is that a property, or a literal? What value is in .ProjectName (assuming
> that is
> a variable?)
>
> .ViewName, and .Label
> > and assign them to ${ProjectName}. I then pass $ProjectName to my
> > starteam checkout.
>
> Same questions...
>
> Are you trying to build a new variable name? So, when you say you want to
> append .ProjectName you mean the contents of that?
>
> If I knew what was in each variable in addition to the final value you expect
> in
> the variable, I could help you with more specific code.
>
> BOb
>
>
> >
> > The trouble is that ${properties.project.Ord} returns as "NETDLLS" but
> > when I want the variable ${NETDLLS.ProjectName} to be returned as
> > "NETDLLs.ProjectName=Windows - .NET DLLs" it instead comes back as
> > "NETDLLS.ProjectName".
> >
> > StarTeam goes looking for a NETDLLS.ProjectName and of course can't
> > find it and dies.
> >
> > Thanks for the help!
> > Much appreciated!
> > -Doug
> >
> > -----Original Message-----
> > From: Bob Archer [mailto:[email protected]]
> > Sent: Monday, June 17, 2013 9:22 AM
> > To: Labout, Douglas; '[email protected]'
> > Subject: RE: Nested variables
> >
> > > Hello,
> > > I'm working on converting an Ant script to Nant and have ran into an
> > > issue with joining several variables together in Nant.
> > >
> > > Below is the original Ant script in which it pulls information from
> > > a properties file and uses the information to feed the build. The
> > > project starts by looping through build order (NETDLLS, App) and
> > > then uses that variable to prepend to the ProjectName to check out of
> StarTeam.
> > >
> > > Project.Build.Order=NETDLLs,App
> > >
> > > # Windows - .NET DLLs
> > > NETDLLs.ProjectName=Windows - .NET DLLs NETDLLs.ViewName=Windows
> -
> > > .NET DLLs
> > > NETDLLs.Label=201300722.20130508
> > >
> > > ANT script:
> > > <target name="build.project">
> > > <property name="ProjectName"
> > > value="${buildProp.${project.Ord}.ProjectName}"/>
> > > <property name="ViewName"
> > > value="${buildProp.${project.Ord}.ViewName}"/>
> > > <property name="Label"
> > > value="${buildProp.${project.Ord}.Label}"/>
> > >
> > > <antcall target="checkoutModuleSrc" inheritall="true"/>
> > >
> > > Here is what I have come up with in Nant which doesn't seem to be
> working.
> > >
> > > NAnt script:
> > > <target name="build.project">
> > > <property name="ProjectName"
> > > value="${'properties.project.Ord'+'.ProjectName'}"/>
> > > <property name="ViewName"
> > > value="${'properties.project.Ord'+'.ViewName'}"/>
> > > <property name="Label"
> > > value="${'properties.project.Ord'+'.Label'}"/>
> > > <echo>${ProjectName} ${ViewName} ${Label}</echo>
> > > <call target="checkoutModuleSrc"/>
> > >
> >
> > I assume based on your title "nested variables" you want to do
> > something like
> > this:
> >
> >
> > <property name="ProjectName" value="${property::get-
> > value('properties.project.Ord.ProjectName')}"/>
> >
> > ?????
> >
> > BOb
> >
> >
> >
> > > Results of the script at the command line:
> > > checkoutModuleSrc:
> > >
> > > [exec] StarTeam 10.4 Command Line Interface, Build 10.4.8.36
> > > [exec] Copyright (c) 2003-2008 Borland Software Corporation.
> > > All rights res erved.
> > > [exec] Using ini file: C:\Documents and Settings\All
> > > Users\Application Data \Borland\StarTeam\ConnectionManager.ini
> > > [exec] Project not found: properties.project.Ord.ProjectName
> > >
> > > I would appreciate any help you can provide.
> > >
> > > Thanks,
> > > -Doug Labout
> > >
> > >
> > > The information contained in this electronic communication and any
> > > document attached hereto or transmitted herewith is confidential and
> > > intended for the exclusive use of the individual or entity named
> > > above. If the reader of this message is not the intended recipient
> > > or the employee or agent responsible for delivering it to the
> > > intended recipient, you are hereby notified that any examination,
> > > use, dissemination, distribution or copying of this communication or
> > > any part thereof is strictly prohibited. If you have received this
> > > communication in error, please immediately notify the sender by
> > > reply e-mail
> > and destroy this communication. Thank you.
> >
> > The information contained in this electronic communication and any
> > document attached hereto or transmitted herewith is confidential and
> > intended for the exclusive use of the individual or entity named
> > above. If the reader of this message is not the intended recipient or
> > the employee or agent responsible for delivering it to the intended
> > recipient, you are hereby notified that any examination, use,
> > dissemination, distribution or copying of this communication or any
> > part thereof is strictly prohibited. If you have received this
> > communication in error, please immediately notify the sender by reply e-mail
> and destroy this communication. Thank you.
>
> The information contained in this electronic communication and any document
> attached hereto or transmitted herewith is confidential and intended for the
> exclusive use of the individual or entity named above. If the reader of this
> message is not the intended recipient or the employee or agent responsible for
> delivering it to the intended recipient, you are hereby notified that any
> examination, use, dissemination, distribution or copying of this communication
> or any part thereof is strictly prohibited. If you have received this
> communication in error, please immediately notify the sender by reply e-mail
> and destroy this communication. Thank you.
------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:
Build for Windows Store.
http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
NAnt-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nant-users