Port VC 200x user files to new indentation APIs, fix a few indentation bugs from previous commit

This commit is contained in:
Jason Perkins 2014-01-31 14:29:58 -05:00
parent 93949df3fc
commit 46e3a06330
5 changed files with 58 additions and 57 deletions

View File

@ -180,7 +180,7 @@
_p(3,'<Link>%s</Link>', path.translate(link)) _p(3,'<Link>%s</Link>', path.translate(link))
end end
if #contents > 0 then if #contents > 0 then
io.printf("%s", contents) _p("%s", contents)
end end
_p(2,'</%s>', info.action) _p(2,'</%s>', info.action)
else else

View File

@ -103,6 +103,7 @@
if thisName == testName then if thisName == testName then
m.configuration(cfg) m.configuration(cfg)
m.tools(cfg) m.tools(cfg)
p.pop('</Configuration>')
-- Otherwise, check the list of valid configurations I built -- Otherwise, check the list of valid configurations I built
-- earlier. If this configuration is in the list, then I will -- earlier. If this configuration is in the list, then I will
@ -113,10 +114,9 @@
elseif not isRealConfig[testName] then elseif not isRealConfig[testName] then
-- this is a fake config to make VS happy -- this is a fake config to make VS happy
m.emptyConfiguration(cfg, arch) m.emptyConfiguration(cfg, arch)
p.pop('</Configuration>')
end end
p.pop('</Configuration>')
end end
end end

View File

@ -4,32 +4,33 @@
-- Copyright (c) 2011-2013 Jason Perkins and the Premake project -- Copyright (c) 2011-2013 Jason Perkins and the Premake project
-- --
local p = premake
local vstudio = premake.vstudio local vstudio = premake.vstudio
local vc200x = premake.vstudio.vc200x local project = p.project
local project = premake.project
local m = p.vstudio.vc200x
-- --
-- Generate a Visual Studio 200x C++ user file, with support for the new platforms API. -- Generate a Visual Studio 200x C++ user file, with support for the new platforms API.
-- --
function vc200x.generate_user(prj) function m.generate_user(prj)
vc200x.xmlElement() m.xmlElement()
_p('<VisualStudioUserFile') p.push('<VisualStudioUserFile')
_p(1,'ProjectType="Visual C++"') p.w('ProjectType="Visual C++"')
vc200x.version() m.version()
_p(1,'ShowAllFiles="false"') p.w('ShowAllFiles="false"')
_p(1,'>') p.w('>')
_p(1,'<Configurations>') p.push('<Configurations>')
for cfg in project.eachconfig(prj) do for cfg in project.eachconfig(prj) do
vc200x.userconfiguration(cfg) m.userconfiguration(cfg)
vc200x.debugdir(cfg) m.debugdir(cfg)
_p(2,'</Configuration>') p.pop('</Configuration>')
end end
_p(1,'</Configurations>') p.pop('</Configurations>')
p.pop('</VisualStudioUserFile>')
_p('</VisualStudioUserFile>')
end end
@ -38,10 +39,10 @@
-- build configuration/platform pairing. -- build configuration/platform pairing.
-- --
function vc200x.userconfiguration(cfg) function m.userconfiguration(cfg)
_p(2,'<Configuration') p.push('<Configuration')
_x(3,'Name="%s"', vstudio.projectConfig(cfg)) p.x('Name="%s"', vstudio.projectConfig(cfg))
_p(3,'>') p.w('>')
end end
@ -49,29 +50,29 @@
-- Write out the debug settings for this project. -- Write out the debug settings for this project.
-- --
function vc200x.debugdir(cfg) function m.debugdir(cfg)
_p(3,'<DebugSettings') p.push('<DebugSettings')
if cfg.debugcommand then if cfg.debugcommand then
local command = project.getrelative(cfg.project, cfg.debugcommand) local command = project.getrelative(cfg.project, cfg.debugcommand)
_x(4,'Command="%s"', path.translate(command)) p.x('Command="%s"', path.translate(command))
end end
if cfg.debugdir then if cfg.debugdir then
local debugdir = project.getrelative(cfg.project, cfg.debugdir) local debugdir = project.getrelative(cfg.project, cfg.debugdir)
_x(4,'WorkingDirectory="%s"', path.translate(debugdir)) p.x('WorkingDirectory="%s"', path.translate(debugdir))
end end
if #cfg.debugargs > 0 then if #cfg.debugargs > 0 then
_x(4,'CommandArguments="%s"', table.concat(cfg.debugargs, " ")) p.x('CommandArguments="%s"', table.concat(cfg.debugargs, " "))
end end
if #cfg.debugenvs > 0 then if #cfg.debugenvs > 0 then
_p(4,'Environment="%s"', table.concat(premake.esc(cfg.debugenvs), "&#x0A;")) p.x('Environment="%s"', table.concat(cfg.debugenvs, "\n"))
if cfg.flags.DebugEnvsDontMerge then if cfg.flags.DebugEnvsDontMerge then
_p(4,'EnvironmentMerge="false"') p.x('EnvironmentMerge="false"')
end end
end end
_p(3,'/>') p.pop('/>')
end end

View File

@ -384,7 +384,7 @@
end) end)
if #contents > 0 then if #contents > 0 then
_p(2,'<Lib>') _p(2,'<Lib>')
io.printf("%s", contents) _p("%s", contents)
_p(2,'</Lib>') _p(2,'</Lib>')
end end
end end
@ -530,7 +530,7 @@
if #contents > 0 then if #contents > 0 then
_x(2,'<ClCompile Include=\"%s\">', path.translate(file.relpath)) _x(2,'<ClCompile Include=\"%s\">', path.translate(file.relpath))
io.printf("%s", contents) _p("%s", contents)
_p(2,'</ClCompile>') _p(2,'</ClCompile>')
else else
_x(2,'<ClCompile Include=\"%s\" />', path.translate(file.relpath)) _x(2,'<ClCompile Include=\"%s\" />', path.translate(file.relpath))

View File

@ -33,8 +33,8 @@
function suite.emptyBlock_onNoSettings() function suite.emptyBlock_onNoSettings()
prepare() prepare()
test.capture [[ test.capture [[
<DebugSettings <DebugSettings
/> />
]] ]]
end end
@ -49,9 +49,9 @@
debugcommand "bin/emulator.exe" debugcommand "bin/emulator.exe"
prepare() prepare()
test.capture [[ test.capture [[
<DebugSettings <DebugSettings
Command="..\bin\emulator.exe" Command="..\bin\emulator.exe"
/> />
]] ]]
end end
@ -66,9 +66,9 @@
debugdir "bin/debug" debugdir "bin/debug"
prepare() prepare()
test.capture [[ test.capture [[
<DebugSettings <DebugSettings
WorkingDirectory="..\bin\debug" WorkingDirectory="..\bin\debug"
/> />
]] ]]
end end
@ -81,9 +81,9 @@
debugargs { "arg1", "arg2" } debugargs { "arg1", "arg2" }
prepare() prepare()
test.capture [[ test.capture [[
<DebugSettings <DebugSettings
CommandArguments="arg1 arg2" CommandArguments="arg1 arg2"
/> />
]] ]]
end end
@ -96,9 +96,9 @@
debugenvs { "key=value" } debugenvs { "key=value" }
prepare() prepare()
test.capture [[ test.capture [[
<DebugSettings <DebugSettings
Environment="key=value" Environment="key=value"
/> />
]] ]]
end end
@ -111,9 +111,9 @@
debugenvs { 'key="value"' } debugenvs { 'key="value"' }
prepare() prepare()
test.capture [[ test.capture [[
<DebugSettings <DebugSettings
Environment="key=&quot;value&quot;" Environment="key=&quot;value&quot;"
/> />
]] ]]
end end
@ -127,9 +127,9 @@
debugenvs { "key=value", "foo=bar" } debugenvs { "key=value", "foo=bar" }
prepare() prepare()
test.capture [[ test.capture [[
<DebugSettings <DebugSettings
Environment="key=value&#x0A;foo=bar" Environment="key=value&#x0A;foo=bar"
/> />
]] ]]
end end
@ -144,9 +144,9 @@
flags { "DebugEnvsDontMerge" } flags { "DebugEnvsDontMerge" }
prepare() prepare()
test.capture [[ test.capture [[
<DebugSettings <DebugSettings
Environment="key=value" Environment="key=value"
EnvironmentMerge="false" EnvironmentMerge="false"
/> />
]] ]]
end end