Added support for debug arguments to the C# VS/XS projects generators.

Obsoletes pull request #113, thanks to Elias Holzer for original code.
This commit is contained in:
João Matos 2015-01-02 22:26:13 +00:00
parent b9d6ce892b
commit da75753b0d
3 changed files with 66 additions and 0 deletions

View File

@ -232,8 +232,19 @@
if cfg.flags.FatalCompileWarnings then
_p(2,'<TreatWarningsAsErrors>true</TreatWarningsAsErrors>')
end
cs2005.debugCommandParameters(cfg)
end
--
-- Write out the debug start parameters for MonoDevelop/Xamarin Studio.
--
function cs2005.debugCommandParameters(cfg)
if #cfg.debugargs > 0 then
_x(2,'<Commandlineparameters>%s</Commandlineparameters>', table.concat(cfg.debugargs, " "))
end
end
--
-- Write out the debugging and optimization flags for a configuration.
@ -367,6 +378,19 @@
end
end
---------------------------------------------------------------------------
--
-- Support functions
--
---------------------------------------------------------------------------
--
-- Format and return a Visual Studio Condition attribute.
--
function cs2005.condition(cfg)
return string.format('Condition="\'$(Configuration)|$(Platform)\'==\'%s\'"', premake.esc(vstudio.projectConfig(cfg)))
end
---------------------------------------------------------------------------
--

View File

@ -25,5 +25,22 @@
_p(2,'<ReferencePath>%s</ReferencePath>', table.concat(refpaths, ";"))
_p(' </PropertyGroup>')
for cfg in project.eachconfig(prj) do
_p(1,'<PropertyGroup %s>', cs2005.condition(cfg))
cs2005.debugsettings(cfg)
_p(1,'</PropertyGroup>')
end
_p('</Project>')
end
function cs2005.debugsettings(cfg)
cs2005.localDebuggerCommandArguments(cfg)
end
function cs2005.localDebuggerCommandArguments(cfg)
if #cfg.debugargs > 0 then
_x(2,'<StartArguments>%s</StartArguments>', table.concat(cfg.debugargs, " "))
end
end

View File

@ -48,6 +48,31 @@
]]
end
---
--- Check handling of debug parameters.
---
function suite.debugCommandParameters()
debugargs "foobar"
local cfg = test.getconfig(prj, "Debug")
cs2005.debugCommandParameters(cfg)
test.capture [[
<Commandlineparameters>foobar</Commandlineparameters>
]]
end
function suite.debugStartArguments()
debugargs "foobar"
local cfg = test.getconfig(prj, "Debug")
cs2005.debugsettings(cfg)
test.capture [[
<StartArguments>foobar</StartArguments>
]]
end
--
-- Check handling of optimization flags.