Merge pull request #47 from starkos/vs-build-log

New API: buildlog()
This commit is contained in:
Manu Evans 2015-04-29 15:39:50 +10:00
commit 45b9e20a43
5 changed files with 75 additions and 0 deletions

View File

@ -5,6 +5,10 @@
See https://github.com/premake/premake-core/wiki/What's-New-in-5.0
for the complete list of changes from the Premake 4.x series.
Since 5.0-alpha2:
* New API: buildlog()
Since 5.0-alpha1:
* Many new debugger APIs

View File

@ -89,6 +89,15 @@
}
api.register {
name = "buildlog",
scope = { "config" },
kind = "path",
tokens = true,
pathVars = true,
}
api.register {
name = "buildmessage",
scope = { "config", "rule" },

View File

@ -256,6 +256,7 @@
m.imageXex,
m.deploy,
m.ruleVars,
m.buildLog,
}
end
end
@ -941,6 +942,16 @@
end
function m.buildLog(cfg)
if cfg.buildlog and #cfg.buildlog > 0 then
local relpath = project.getrelative(cfg.project, cfg.buildlog)
p.push('<BuildLog>')
p.x('<Path>%s</Path>', path.translate(relpath))
p.pop('</BuildLog>')
end
end
function m.characterSet(cfg)
if not vstudio.isMakefile(cfg) then
_p(2,'<CharacterSet>%s</CharacterSet>', iif(cfg.flags.Unicode, "Unicode", "MultiByte"))

View File

@ -99,6 +99,7 @@ return {
-- Visual Studio 2010-2013 C/C++ projects
"actions/vstudio/vc2010/test_assembly_refs.lua",
"actions/vstudio/vc2010/test_build_events.lua",
"actions/vstudio/vc2010/test_build_log.lua",
"actions/vstudio/vc2010/test_compile_settings.lua",
"actions/vstudio/vc2010/test_config_props.lua",
"actions/vstudio/vc2010/test_debug_settings.lua",

View File

@ -0,0 +1,50 @@
---
-- tests/actions/vstudio/vc2010/test_build_log.lua
-- Validate build log settings in Visual Studio 2010 C/C++ projects.
-- Copyright (c) 2015 Jason Perkins and the Premake project
---
local suite = test.declare("vstudio_vs2010_build_log")
local vc2010 = premake.vstudio.vc2010
--
-- Setup
--
local sln, prj
function suite.setup()
sln, prj = test.createsolution()
end
local function prepare(platform)
local cfg = test.getconfig(prj, "Debug", platform)
vc2010.buildLog(cfg)
end
--
-- Nothing should be written by default.
--
function suite.isIgnoredByDefault()
prepare()
test.isemptycapture()
end
--
-- Write out relative path if provided.
--
function suite.writesPathIfSet()
buildlog "logs/MyCustomLogFile.log"
prepare()
test.capture [[
<BuildLog>
<Path>logs\MyCustomLogFile.log</Path>
</BuildLog>
]]
end