Merge with latest development branch
This commit is contained in:
commit
1b73aaf36c
@ -159,6 +159,13 @@
|
||||
kind = "list:keyed:array:string",
|
||||
}
|
||||
|
||||
api.register {
|
||||
name = "configFile",
|
||||
scope = "config",
|
||||
kind = "string",
|
||||
tokens = true,
|
||||
}
|
||||
|
||||
api.register {
|
||||
name = "configurations",
|
||||
scope = "project",
|
||||
@ -765,6 +772,7 @@
|
||||
}
|
||||
|
||||
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
--
|
||||
-- Handlers for deprecated fields and values.
|
||||
|
@ -6,6 +6,7 @@
|
||||
|
||||
local make = premake.make
|
||||
local solution = premake.solution
|
||||
local tree = premake.tree
|
||||
local project = premake.project
|
||||
|
||||
|
||||
@ -21,10 +22,8 @@
|
||||
make.configmap(sln)
|
||||
make.projects(sln)
|
||||
|
||||
_p('.PHONY: all clean help $(PROJECTS)')
|
||||
_p('')
|
||||
_p('all: $(PROJECTS)')
|
||||
_p('')
|
||||
make.solutionPhonyRule(sln)
|
||||
make.groupRules(sln)
|
||||
|
||||
make.projectrules(sln)
|
||||
make.cleanrules(sln)
|
||||
@ -106,6 +105,59 @@
|
||||
_p('')
|
||||
end
|
||||
|
||||
--
|
||||
-- Write out the solution PHONY rule
|
||||
--
|
||||
|
||||
function make.solutionPhonyRule(sln)
|
||||
local groups = {}
|
||||
local tr = solution.grouptree(sln)
|
||||
tree.traverse(tr, {
|
||||
onbranch = function(n)
|
||||
table.insert(groups, n.path)
|
||||
end
|
||||
})
|
||||
|
||||
_p('.PHONY: all clean help $(PROJECTS) ' .. table.implode(groups, '', '', ' '))
|
||||
_p('')
|
||||
_p('all: $(PROJECTS)')
|
||||
_p('')
|
||||
end
|
||||
|
||||
--
|
||||
-- Write out the phony rules representing project groups
|
||||
--
|
||||
function make.groupRules(sln)
|
||||
-- Transform solution groups into target aggregate
|
||||
local tr = solution.grouptree(sln)
|
||||
tree.traverse(tr, {
|
||||
onbranch = function(n)
|
||||
local rule = n.path .. ":"
|
||||
local projectTargets = {}
|
||||
local groupTargets = {}
|
||||
for i, c in pairs(n.children)
|
||||
do
|
||||
if type(i) == "string"
|
||||
then
|
||||
if c.project
|
||||
then
|
||||
table.insert(projectTargets, c.name)
|
||||
else
|
||||
table.insert(groupTargets, c.path)
|
||||
end
|
||||
end
|
||||
end
|
||||
if #groupTargets > 0 then
|
||||
rule = rule .. " " .. table.concat(groupTargets, " ")
|
||||
end
|
||||
if #projectTargets > 0 then
|
||||
rule = rule .. " " .. table.concat(projectTargets, " ")
|
||||
end
|
||||
_p(rule)
|
||||
_p('')
|
||||
end
|
||||
})
|
||||
end
|
||||
|
||||
--
|
||||
-- Write out the rules to build each of the solution's projects.
|
||||
|
@ -1109,8 +1109,12 @@
|
||||
function m.imageXex(cfg)
|
||||
if cfg.system == premake.XBOX360 then
|
||||
_p(2,'<ImageXex>')
|
||||
_p(3,'<ConfigurationFile>')
|
||||
_p(3,'</ConfigurationFile>')
|
||||
if cfg.configFile then
|
||||
_p(3,'<ConfigurationFile>%s</ConfigurationFile>', cfg.configFile)
|
||||
else
|
||||
_p(3,'<ConfigurationFile>')
|
||||
_p(3,'</ConfigurationFile>')
|
||||
end
|
||||
_p(3,'<AdditionalSections>')
|
||||
_p(3,'</AdditionalSections>')
|
||||
_p(2,'</ImageXex>')
|
||||
@ -1491,7 +1495,7 @@
|
||||
|
||||
|
||||
function m.treatWarningAsError(cfg)
|
||||
if cfg.flags.FatalLinkWarnings and cfg.warnings ~= "Off" then
|
||||
if cfg.flags.FatalCompileWarnings and cfg.warnings ~= "Off" then
|
||||
p.w('<TreatWarningAsError>true</TreatWarningAsError>')
|
||||
end
|
||||
end
|
||||
|
@ -556,7 +556,17 @@
|
||||
end
|
||||
end
|
||||
|
||||
recurse(value)
|
||||
local ok, err = pcall(function ()
|
||||
recurse(value)
|
||||
end)
|
||||
|
||||
if not ok then
|
||||
if type(err) == "table" then
|
||||
err = err.msg
|
||||
end
|
||||
error(err, 3)
|
||||
end
|
||||
|
||||
configset.remove(target, field, removes)
|
||||
end
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/**
|
||||
* \file string_hash.c
|
||||
* \brief Computes a hash value for a string.
|
||||
* \author Copyright (c) 2012 Jason Perkins and the Premake project
|
||||
* \author Copyright (c) 2012-2014 Jason Perkins and the Premake project
|
||||
*/
|
||||
|
||||
#include "premake.h"
|
||||
@ -11,17 +11,18 @@
|
||||
int string_hash(lua_State* L)
|
||||
{
|
||||
const char* str = luaL_checkstring(L, 1);
|
||||
lua_pushnumber(L, (lua_Number)do_hash(str, 0));
|
||||
return 1;
|
||||
unsigned long seed = luaL_optint(L, 2, 0);
|
||||
lua_pushnumber(L, (lua_Number)do_hash(str, seed));
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
unsigned long do_hash(const char* str, int seed)
|
||||
{
|
||||
/* DJB2 hashing; see http://www.cse.yorku.ca/~oz/hash.html */
|
||||
|
||||
|
||||
unsigned long hash = 5381;
|
||||
|
||||
|
||||
if (seed != 0) {
|
||||
hash = hash * 33 + seed;
|
||||
}
|
||||
|
@ -105,6 +105,7 @@ return {
|
||||
"actions/vstudio/vc2010/test_files.lua",
|
||||
"actions/vstudio/vc2010/test_filter_ids.lua",
|
||||
"actions/vstudio/vc2010/test_filters.lua",
|
||||
"actions/vstudio/vc2010/test_imagexex_settings.lua",
|
||||
"actions/vstudio/vc2010/test_item_def_group.lua",
|
||||
"actions/vstudio/vc2010/test_link.lua",
|
||||
"actions/vstudio/vc2010/test_manifest.lua",
|
||||
@ -137,6 +138,7 @@ return {
|
||||
-- Makefile solutions
|
||||
"actions/make/solution/test_config_maps.lua",
|
||||
"actions/make/solution/test_default_config.lua",
|
||||
"actions/make/solution/test_group_rule.lua",
|
||||
"actions/make/solution/test_help_rule.lua",
|
||||
"actions/make/solution/test_project_rule.lua",
|
||||
|
||||
|
59
tests/actions/make/solution/test_group_rule.lua
Normal file
59
tests/actions/make/solution/test_group_rule.lua
Normal file
@ -0,0 +1,59 @@
|
||||
--
|
||||
-- tests/actions/make/solution/test_group_rule.lua
|
||||
-- Validate generation of group rules
|
||||
-- Copyright (c) 2012-2014 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
T.make_group_rule = {}
|
||||
local suite = T.make_group_rule
|
||||
local make = premake.make
|
||||
|
||||
|
||||
--
|
||||
-- Setup/teardown
|
||||
--
|
||||
|
||||
local sln
|
||||
|
||||
function suite.setup()
|
||||
sln = test.createsolution()
|
||||
group "MainGroup"
|
||||
test.createproject(sln)
|
||||
group "MainGroup/SubGroup1"
|
||||
test.createproject(sln)
|
||||
group "MainGroup/SubGroup2"
|
||||
test.createproject(sln)
|
||||
test.createproject(sln)
|
||||
end
|
||||
|
||||
local function prepare()
|
||||
sln = premake.oven.bakeSolution(sln)
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Groups should be added to solution's PHONY
|
||||
--
|
||||
|
||||
function suite.groupRule_groupAsPhony()
|
||||
prepare()
|
||||
make.solutionPhonyRule(sln)
|
||||
test.capture [[
|
||||
.PHONY: all clean help $(PROJECTS) MainGroup MainGroup/SubGroup1 MainGroup/SubGroup2
|
||||
]]
|
||||
end
|
||||
|
||||
--
|
||||
-- Transform solution groups into target aggregate
|
||||
--
|
||||
function suite.groupRule_groupRules()
|
||||
prepare()
|
||||
make.groupRules(sln)
|
||||
test.capture [[
|
||||
MainGroup: MainGroup/SubGroup1 MainGroup/SubGroup2 MyProject2
|
||||
|
||||
MainGroup/SubGroup1: MyProject3
|
||||
|
||||
MainGroup/SubGroup2: MyProject4 MyProject5
|
||||
]]
|
||||
end
|
@ -352,7 +352,7 @@
|
||||
--
|
||||
|
||||
function suite.treatWarningsAsError_onFatalWarnings()
|
||||
flags { "FatalWarnings" }
|
||||
flags { "FatalCompileWarnings" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ClCompile>
|
||||
|
56
tests/actions/vstudio/vc2010/test_imagexex_settings.lua
Normal file
56
tests/actions/vstudio/vc2010/test_imagexex_settings.lua
Normal file
@ -0,0 +1,56 @@
|
||||
--
|
||||
-- tests/actions/vstudio/vc2010/test_compile_settings.lua
|
||||
-- Validate Xbox 360 XEX image settings in Visual Studio 2010 C/C++ projects.
|
||||
-- Copyright (c) 2011-2013 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
local suite = test.declare("vstudio_vs2010_imagexex_settings")
|
||||
local vc2010 = premake.vstudio.vc2010
|
||||
local project = premake.project
|
||||
|
||||
|
||||
--
|
||||
-- Setup
|
||||
--
|
||||
|
||||
local sln, prj
|
||||
|
||||
function suite.setup()
|
||||
sln, prj = test.createsolution()
|
||||
platforms "xbox360"
|
||||
end
|
||||
|
||||
local function prepare(platform)
|
||||
local cfg = test.getconfig(prj, "Debug", "xbox360")
|
||||
vc2010.imageXex(cfg)
|
||||
end
|
||||
|
||||
--
|
||||
-- Test default ImageXex settings
|
||||
--
|
||||
function suite.defaultSettings()
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ImageXex>
|
||||
<ConfigurationFile>
|
||||
</ConfigurationFile>
|
||||
<AdditionalSections>
|
||||
</AdditionalSections>
|
||||
</ImageXex>
|
||||
]]
|
||||
end
|
||||
|
||||
--
|
||||
-- Ensure configuration file is output in ImageXex block
|
||||
--
|
||||
function suite.defaultSettings()
|
||||
configFile "testconfig.xml"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ImageXex>
|
||||
<ConfigurationFile>testconfig.xml</ConfigurationFile>
|
||||
<AdditionalSections>
|
||||
</AdditionalSections>
|
||||
</ImageXex>
|
||||
]]
|
||||
end
|
@ -383,7 +383,7 @@
|
||||
|
||||
function suite.fatalWarnings_onDynamicLink()
|
||||
kind "ConsoleApp"
|
||||
flags { "FatalWarnings" }
|
||||
flags { "FatalLinkWarnings" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Link>
|
||||
@ -396,7 +396,7 @@
|
||||
|
||||
function suite.fatalWarnings_onStaticLink()
|
||||
kind "StaticLib"
|
||||
flags { "FatalWarnings" }
|
||||
flags { "FatalLinkWarnings" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Link>
|
||||
|
Reference in New Issue
Block a user