From 351fbc9b97e90bc0ca27cba094753d02dd0917b6 Mon Sep 17 00:00:00 2001 From: Tom van Dijck Date: Thu, 1 Sep 2016 16:29:10 -0700 Subject: [PATCH 1/4] workaround for https://github.com/premake/premake-core/issues/572 --- src/base/api.lua | 19 +++++----- src/base/configset.lua | 13 ++++++- src/base/criteria.lua | 1 + tests/_tests.lua | 1 + tests/api/test_deprecations.lua | 65 +++++++++++++++++++++++++++++++++ 5 files changed, 88 insertions(+), 11 deletions(-) create mode 100644 tests/api/test_deprecations.lua diff --git a/src/base/api.lua b/src/base/api.lua index 83c3f009..b07dc2a5 100755 --- a/src/base/api.lua +++ b/src/base/api.lua @@ -555,15 +555,20 @@ table.foreachi(value, recurse) elseif hasDeprecatedValues and value:contains("*") then - local current = configset.fetch(target, field) + local current = configset.fetch(target, field, { + matcher = function(cset, block, filter) + local current = cset.current + return criteria.matches(current._criteria, block._criteria.terms or {}) or + criteria.matches(block._criteria, current._criteria.terms or {}) + end + }) + local mask = path.wildcards(value) for _, item in ipairs(current) do if item:match(mask) == item then recurse(item) end end - table.insert(removes, value) - else local value, err, additional = api.checkValue(field, value) if err then @@ -1100,9 +1105,7 @@ function configuration(terms) if terms then - if (type(terms) == "table" and #terms == 1 and terms[1] == "*") or - (terms == "*") - then + if (type(terms) == "table" and #terms == 1 and terms[1] == "*") or (terms == "*") then terms = nil end configset.addblock(api.scope.current, {terms}, os.getcwd()) @@ -1119,9 +1122,7 @@ function filter(terms) if terms then - if (type(terms) == "table" and #terms == 1 and terms[1] == "*") or - (terms == "*") - then + if (type(terms) == "table" and #terms == 1 and terms[1] == "*") or (terms == "*") then terms = nil end local ok, err = configset.addFilter(api.scope.current, {terms}, os.getcwd()) diff --git a/src/base/configset.lua b/src/base/configset.lua index 20f7e30d..a6e835cf 100644 --- a/src/base/configset.lua +++ b/src/base/configset.lua @@ -81,6 +81,15 @@ end + function configset._dofilter(cset, block, filter) + if not filter.matcher then + return (cset.compiled or criteria.matches(block._criteria, filter)) + else + return filter.matcher(cset, block, filter) + end + end + + function configset._fetchDirect(cset, field, filter, ctx, origin) -- If the originating configset hasn't been compiled, then the value will still -- be on that configset. @@ -107,7 +116,7 @@ filter.files = path.getrelative(basedir, abspath) end - if value ~= nil and (cset.compiled or criteria.matches(block._criteria, filter)) then + if value ~= nil and configset._dofilter(cset, block, filter) then -- If value is an object, return a copy of it so that any -- changes later made to it by the caller won't alter the -- original value (that was a tough bug to find) @@ -181,7 +190,7 @@ filter.files = path.getrelative(basedir, abspath) end - if cset.compiled or criteria.matches(block._criteria, filter) then + if configset._dofilter(cset, block, filter) then if block._removes and block._removes[key] then remove(block._removes[key]) end diff --git a/src/base/criteria.lua b/src/base/criteria.lua index 643020cc..7c224fbe 100644 --- a/src/base/criteria.lua +++ b/src/base/criteria.lua @@ -94,6 +94,7 @@ local crit = {} crit.patterns = patterns crit.data = criteria._compile(patterns) + crit.terms = terms return crit end diff --git a/tests/_tests.lua b/tests/_tests.lua index 4d778e26..83dd4ca0 100644 --- a/tests/_tests.lua +++ b/tests/_tests.lua @@ -49,6 +49,7 @@ return { "api/test_register.lua", "api/test_string_kind.lua", "api/test_table_kind.lua", + "api/test_deprecations.lua", -- Control system tests "test_premake.lua", diff --git a/tests/api/test_deprecations.lua b/tests/api/test_deprecations.lua new file mode 100644 index 00000000..13323e51 --- /dev/null +++ b/tests/api/test_deprecations.lua @@ -0,0 +1,65 @@ +-- +-- tests/api/test_table_kind.lua +-- Tests the table API value type. +-- Copyright (c) 2012-2014 Jason Perkins and the Premake project +-- + + local suite = test.declare("api_deprecations") + local api = premake.api + + + function suite.setup() + workspace("MyWorkspace") + configurations { "Debug", "Release" } + end + + function suite.setsNewValue_whenOldValueIsRemovedViaWildcard_inSubConfig() + local prj = project "MyProject" + filter { "configurations:Debug" } + flags { "Symbols" } + + filter { "*" } + removeflags { "*" } + + -- test output. + local cfg = test.getconfig(prj, "Debug", platform) + test.isequal("Default", cfg.Symbols) + end + + + function suite.setsNewValue_whenOldValueIsRemovedInOtherConfig_inSubConfig() + local prj = project "MyProject" + flags { "Symbols" } + + filter { "configurations:Release" } + removeflags { "*" } + + -- test output. + test.isequal("On", test.getconfig(prj, "Debug", platform).Symbols) + test.isequal("Default", test.getconfig(prj, "Release", platform).Symbols) + end + + + function suite.dontRemoveFlagIfSetThroughNewApi() + local prj = project "MyProject" + floatingpoint "Fast" + removeflags "*" + + -- test output. + local cfg = test.getconfig(prj, "Debug", platform) + test.isequal("Fast", cfg.floatingpoint) + end + + + function suite.setsNewValue_whenOldValueFromParentIsRemovedInOtherConfig_inSubConfig() + flags { "Symbols" } + + local prj = project "MyProject" + filter { "configurations:Release" } + removeflags { "*" } + + -- test output. + test.isequal("On", test.getconfig(prj, "Debug", platform).Symbols) + test.isequal("Default", test.getconfig(prj, "Release", platform).Symbols) + end + From 98fa40dad33df7d43d78c7003669a44d50e39036 Mon Sep 17 00:00:00 2001 From: Jason Perkins Date: Tue, 4 Oct 2016 18:09:37 -0400 Subject: [PATCH 2/4] Update submodules to latest versions --- modules/codelite | 2 +- modules/d | 2 +- modules/monodevelop | 2 +- modules/xcode | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/codelite b/modules/codelite index 236ee785..c72dbdf9 160000 --- a/modules/codelite +++ b/modules/codelite @@ -1 +1 @@ -Subproject commit 236ee78540e3aa83c689ca441447dabdaf2881ba +Subproject commit c72dbdf9e0db9f6673410ef07cad1e5e8fcbefaf diff --git a/modules/d b/modules/d index e854b35c..fa856f1a 160000 --- a/modules/d +++ b/modules/d @@ -1 +1 @@ -Subproject commit e854b35cf1d0bedfe16239c27a69909996af12d0 +Subproject commit fa856f1a937a997bdcec8abe59f0114f2a7e029d diff --git a/modules/monodevelop b/modules/monodevelop index 4a9f26f9..dd5aa488 160000 --- a/modules/monodevelop +++ b/modules/monodevelop @@ -1 +1 @@ -Subproject commit 4a9f26f9a46795cb46492f32f1814ff74c23a339 +Subproject commit dd5aa488966b901f6d72e7f4e8b3297d9171b941 diff --git a/modules/xcode b/modules/xcode index 9427f337..9fdde343 160000 --- a/modules/xcode +++ b/modules/xcode @@ -1 +1 @@ -Subproject commit 9427f3373074795b16d25d2efcc836c2a2501902 +Subproject commit 9fdde3430c41a7cad42bc9b70bcb11c31b30f2c3 From f7ad169c70355cd1244c11be426115ad76da259b Mon Sep 17 00:00:00 2001 From: Jason Perkins Date: Tue, 4 Oct 2016 18:18:00 -0400 Subject: [PATCH 3/4] Update support files and bump version to alpha10 --- CHANGES.txt | 8 ++++++++ CONTRIBUTORS.txt | 4 ++++ scripts/RELEASE.txt | 2 +- src/host/premake.h | 2 +- 4 files changed, 14 insertions(+), 2 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index 8817a400..ecd7c920 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -5,6 +5,14 @@ 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-alpha9: + +* New: `symbols()`, replaces and extends flags {"Symbols"} +* New: `symbolspath()` to specify location of symbol database +* New: `table.shallowcopy()` +* New: `vectorextensions` value "IA32" +* Fix: --start-group/--end-group now only enclose project libraries + Since 5.0-alpha8: * New: `buildcustomizations()` imports custom .props files for VS diff --git a/CONTRIBUTORS.txt b/CONTRIBUTORS.txt index 7416ef07..a2fa379c 100644 --- a/CONTRIBUTORS.txt +++ b/CONTRIBUTORS.txt @@ -23,6 +23,8 @@ Patch contributors: Damien Courtois * module loading fixes * bug fixes + David Ely + * symbols() API and flag deprecation Gabi Davar * added file.directory to token environment João Matos (joao@tritao.eu) @@ -37,6 +39,8 @@ Patch contributors: * path.join() fixes Mark Chandler * prevent self-linking + Matthew Endsley + * File matching improvements Mark Sararu * Makefile bug fixes Mihai Sebea diff --git a/scripts/RELEASE.txt b/scripts/RELEASE.txt index 14252f0e..35c44bea 100644 --- a/scripts/RELEASE.txt +++ b/scripts/RELEASE.txt @@ -9,7 +9,7 @@ PREP * Update CHANGES.txt and CONTRIBUTORS.txt - * Update version in src/host/premake.c and commit + * Update version in src/host/premake.h and commit * Push release branch to GitHub; wait for CI to pass diff --git a/src/host/premake.h b/src/host/premake.h index c52e2693..977afef9 100644 --- a/src/host/premake.h +++ b/src/host/premake.h @@ -9,7 +9,7 @@ #include "lauxlib.h" #include "lualib.h" -#define PREMAKE_VERSION "5.0.0-dev" +#define PREMAKE_VERSION "5.0.0-alpha10" #define PREMAKE_COPYRIGHT "Copyright (C) 2002-2016 Jason Perkins and the Premake Project" #define PREMAKE_PROJECT_URL "https://github.com/premake/premake-core/wiki" From 152bfbfd089f7facf6bacbe2a709fb14daf22168 Mon Sep 17 00:00:00 2001 From: Jason Perkins Date: Tue, 4 Oct 2016 19:09:00 -0400 Subject: [PATCH 4/4] Restore dev version --- src/host/premake.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/host/premake.h b/src/host/premake.h index 977afef9..c52e2693 100644 --- a/src/host/premake.h +++ b/src/host/premake.h @@ -9,7 +9,7 @@ #include "lauxlib.h" #include "lualib.h" -#define PREMAKE_VERSION "5.0.0-alpha10" +#define PREMAKE_VERSION "5.0.0-dev" #define PREMAKE_COPYRIGHT "Copyright (C) 2002-2016 Jason Perkins and the Premake Project" #define PREMAKE_PROJECT_URL "https://github.com/premake/premake-core/wiki"