[GRADLE-2943] Incorrect quoting of linker arguments with spaces, single and double quotes Created: 01/Nov/13  Updated: 24/Feb/14  Resolved: 24/Feb/14

Status: Resolved
Project: Gradle
Affects Version/s: None
Fix Version/s: 1.12-rc-1

Type: Bug
Reporter: Gradle Forums Assignee: Daz DeBoer
Resolution: Fixed Votes: 0


 Description   

I'm trying to set a linker flag for VisualCpp which gradle escaped with quotes:

apply plugin: 'cpp-lib'
libraries {
main {
binaries.all {
if (toolChain in VisualCpp) {
linkerArgs <funny arg>
}
}
}
}

The funny arg is:
linkerArgs '/MANIFESTUAC:"level=\'asInvoker\' uiAccess=\'false\'"'
or see [1]http://pastebin.com/3XWupFPN for the full text.

This end up in the compiler-options.txt as:
"/MANIFESTUAC:"level='asInvoker' uiAccess='false'""
and causes the linker to fail.
----------------------------------------------------------------------------------------
[1] http://pastebin.com/3XWupFPN



 Comments   
Comment by Gradle Forums [ 01/Nov/13 ]

What exactly do you want to be passed on the command line to link.exe?
What would be the correct value in the link.exe options file?

Comment by Gradle Forums [ 01/Nov/13 ]

I think the correct value would be:

/MANIFESTUAC:"level='asInvoker' uiAccess='false'"

The problem is that gradle adds quotes around it which confuses the linker.

Comment by Gradle Forums [ 01/Nov/13 ]

I'm going over what Visual Studio says it is passing on the command line to the linker. Thought I would try and keep the difference between what gradle passes to the linker and what Visual Studio pass to a minimum.

Comment by Daz DeBoer [ 24/Feb/14 ]

This should now be fixed for most cases: the reported arg should be supplied as:
linker.args "/MANIFESTUAC:level='asInvoker' uiAccess='false'"

Generated at Wed Jun 30 12:35:36 CDT 2021 using Jira 8.4.2#804003-sha1:d21414fc212e3af190e92c2d2ac41299b89402cf.