ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ben Pracht <bpra...@nc.rr.com>
Subject Re: Trying to escape quote character in cpptasks type (repost)
Date Tue, 21 Feb 2006 19:42:30 GMT
Tommy Nordgren wrote:
> 
> On 21 feb 2006, at 18.05, Ben Pracht wrote:
> 
>> I'm trying to pass in a macro define to the command line to define  
>> the level of code being used.  Something like
>>
>> gcc -o objname.o source.c -DFIXLVL=\"FEB 17 2006\"
>>
>> the code does something like:
>> static const char mszFixLvl[] = " " __FILE__ " at " FIXLVL " on "  
>> __DATE__ " at " __TIME__ " ";
>>
>> so the value of FIXLVL must have quotes at the time preprocessing  
>> begins and cannot have been stripped off by ant, cpptasks, or any  
>> other thing in between.
>>
>> I'm using cpptasks 1.0b3, ant 1.6.5.
>>
>> I've tried
>> <defineset><define name="FIXLVL" value="&quot;FEB 17 2006&quot;"/></

>> defineset>
>>
>> and
>>
>> <compilerarg value="-D"/><compilerarg value="FIXLVL=&quot;FEB 17  
>> 2006&quot;"/>
>>
>> I've even tried defining the fix level in a property, and then  using 
>> the property name in the defineset value, but it was too  smart for that.
>>
>> How can I force this thing to listen to me?
>>
>> Thanks,
>> Ben
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>> For additional commands, e-mail: user-help@ant.apache.org
>>
>     Try value="'FIXLVL=&quot;FEB 17 2006&quot;'"
> 
> That is - put single quotes immediately inside the outer double  quotes, 
> to prevent the inner quotes from being stripped off by the  shell.
> 
> "Home is not where you are born, but where your heart finds peace" -
> Tommy Nordgren, "The dying old crone"

Thanks, but it told me it can't handle single quotes nested in double 
quotes.  FWIW, it's Windows using gcc under Cygwin.  Here's the output:

Apache Ant version 1.6.5 compiled on June 2 2005
Setting ro project property: ant.file -> C:\Documents and 
Settings\bpracht\eclipse\liblogwrtB\build.xml
Buildfile: C:\Documents and Settings\bpracht\eclipse\liblogwrtB\build.xml
+Datatype cc net.sf.antcontrib.cpptasks.CCTask
+Datatype compiler net.sf.antcontrib.cpptasks.CompilerDef
+Datatype defineset net.sf.antcontrib.cpptasks.types.DefineSet
Adding reference: ant.projectHelper
Adding reference: ant.parsing.context
Adding reference: ant.targets
parsing buildfile C:\Documents and 
Settings\bpracht\eclipse\liblogwrtB\build.xml with URI = 
file:///C:/Documents%20and%20Settings/bpracht/eclipse/liblogwrtB/build.xml
Setting ro project property: ant.project.name -> logwriter
Adding reference: logwriter
Setting ro project property: ant.file.logwriter -> C:\Documents and 
Settings\bpracht\eclipse\liblogwrtB\build.xml
Project base dir set to: C:\Documents and 
Settings\bpracht\eclipse\liblogwrtB
+Target:
+Target: defineMSVCCompiler
Adding reference: base-msvc-compiler
Adding reference: base-msvc-linker
+Target: createDirectories
+Target: logwrtB
+Target: all
Setting project property: use-debug -> true
Setting project property: outputdir -> bin
Setting project property: sourcedir -> src
Adding reference: eclipse.ant.targetVector
Build sequence for target(s) `logwrtB' is [createDirectories, logwrtB]
Complete build sequence is [createDirectories, logwrtB, all, 
defineMSVCCompiler, ]
createDirectories:
logwrtB:
Setting project property: fixlevel -> \"test\"
      [echo] fixlevel = z\"test\"z
Could not load a dependent class 
(com/sun/media/jai/codec/FileSeekableStream) for type image
Could not load a dependent class (com/jcraft/jsch/UserInfo) for type sshexec
Could not load a dependent class (com/jcraft/jsch/UserInfo) for type scp
Could not load a dependent class (jdepend/xmlui/JDepend) for type jdepend
Could not load a dependent class (junit/framework/Test) for type junit
ConditionalFileSet: Setup scanner in dir C:\Documents and 
Settings\bpracht\eclipse\liblogwrtB\src with patternSet{ includes: 
[logwrt1.c] excludes: [] }
        [cc] 1 total files to be compiled.
        [cc] BP-Command @@[Ljava.lang.String;@4ecfdd@@

BUILD FAILED
C:\Documents and Settings\bpracht\eclipse\liblogwrtB\build.xml:57: Can't 
handle single and double quotes in same argument
	at 
org.apache.tools.ant.types.Commandline.quoteArgument(Commandline.java:337)
	at org.apache.tools.ant.types.Commandline.toString(Commandline.java:367)
	at net.sf.antcontrib.cpptasks.CUtil.runCommand(CUtil.java:350)
	at 
net.sf.antcontrib.cpptasks.compiler.CommandLineCompiler.runCommand(CommandLineCompiler.java:430)
	at 
net.sf.antcontrib.cpptasks.compiler.CommandLineCompiler.compile(CommandLineCompiler.java:200)
	at 
net.sf.antcontrib.cpptasks.compiler.CommandLineCompilerConfiguration.compile(CommandLineCompilerConfiguration.java:132)
	at net.sf.antcontrib.cpptasks.CCTask.execute(CCTask.java:616)
	at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
	at org.apache.tools.ant.Task.perform(Task.java:364)
	at org.apache.tools.ant.Target.execute(Target.java:341)
	at org.apache.tools.ant.Target.performTasks(Target.java:369)
	at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216)
	at org.apache.tools.ant.Project.executeTarget(Project.java:1185)
	at 
org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:40)
	at 
org.eclipse.ant.internal.ui.antsupport.EclipseDefaultExecutor.executeTargets(EclipseDefaultExecutor.java:32)
	at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
	at 
org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.run(InternalAntRunner.java:423)
	at 
org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.main(InternalAntRunner.java:137)

Total time: 2 seconds




---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message