From 286a1d28875d4fb27320d26414191c149c83a570 Mon Sep 17 00:00:00 2001 From: Jason Perkins Date: Tue, 11 Mar 2014 15:56:17 -0400 Subject: [PATCH] Integrate latest Premake-dev; fixes vpath scope warnings --- src/base/api.lua | 98 ++++++++++++++++++++------------------------ src/base/field.lua | 11 +++++ src/base/premake.lua | 2 +- 3 files changed, 56 insertions(+), 55 deletions(-) diff --git a/src/base/api.lua b/src/base/api.lua index 8cc4a7da..5db3f41b 100755 --- a/src/base/api.lua +++ b/src/base/api.lua @@ -423,60 +423,6 @@ --- --- Compare two values of a field to see if they are (roughly) equivalent. --- Real high-level checking right now for performance; can make it more --- exact later if there is a need. --- --- @param field --- The description of the field being checked. --- @param value1 --- The first value to be compared. --- @param value2 --- The second value to be compared. --- @return --- True if the values are (roughly) equivalent; false otherwise. --- - - function api.comparevalues(field, value1, value2) - -- both the same? - if value1 == value2 then - return true - end - - -- one nil, but not the other? - if not value1 or not value2 then - return false - end - - -- different types? - if type(value1) ~= type(value2) then - return false - end - - if type(value1) == "table" then - if #value1 ~= #value2 then - return false - end - - for k,v in pairs(value1) do - if not value2[k] then - return false - end - end - for k,v in pairs(value2) do - if not value1[k] then - return false - end - end - elseif value1 ~= value2 then - return false - end - - return true - end - - -- -- Clears all active API objects; resets to root configuration block. -- @@ -513,6 +459,9 @@ end, remove = function(field, current, value, processor) return path.getabsolute(value) + end, + compare = function(field, a, b, processor) + return (a == b) end }) @@ -538,6 +487,9 @@ end, remove = function(field, current, value, processor) return path.getabsolute(value) + end, + compare = function(field, a, b, processor) + return (a == b) end }) @@ -557,6 +509,9 @@ error { msg="expected integer; got " .. tostring(value) } end return value + end, + compare = function(field, a, b, processor) + return (a == b) end }) @@ -582,6 +537,14 @@ premake.field.kind("keyed", { store = storeKeyed, merge = storeKeyed, + compare = function(field, a, b, processor) + for k in pairs(a) do + if not processor(field, a[k], b[k]) then + return false + end + end + return true + end }) @@ -634,6 +597,17 @@ store = storeList, remove = storeList, merge = storeList, + compare = function(field, a, b, processor) + if #a ~= #b then + return false + end + for i = 1, #a do + if not processor(field, a[i], b[i]) then + return false + end + end + return true + end }) @@ -651,6 +625,9 @@ value = path.getabsolute(value) end return value + end, + compare = function(field, a, b, processor) + return (a == b) end }) @@ -667,6 +644,9 @@ error { msg="expected number; got " .. t } end return value + end, + compare = function(field, a, b, processor) + return (a == b) end }) @@ -680,6 +660,9 @@ paths = true, store = function(field, current, value, processor) return path.getabsolute(value) + end, + compare = function(field, a, b, processor) + return (a == b) end }) @@ -705,6 +688,9 @@ end return value + end, + compare = function(field, a, b, processor) + return (a == b) end }) @@ -719,6 +705,10 @@ value = { value } end return value + end, + compare = function(field, a, b, processor) + -- TODO: is there a reliable way to check this? + return true end }) diff --git a/src/base/field.lua b/src/base/field.lua index 14b267b2..ef40a877 100644 --- a/src/base/field.lua +++ b/src/base/field.lua @@ -206,6 +206,17 @@ + function field.compare(f, a, b) + local processor = field.accessor(f, "compare") + if processor then + return processor(f, a, b) + else + return (a == b) + end + end + + + --- -- Fetch a field description by name. --- diff --git a/src/base/premake.lua b/src/base/premake.lua index 52f49b50..b0b90e8e 100644 --- a/src/base/premake.lua +++ b/src/base/premake.lua @@ -389,7 +389,7 @@ -- this one needs to checked if not okay then - okay = premake.api.comparevalues(field, cfg[field.scope][name], cfg[name]) + okay = premake.field.compare(field, cfg[field.scope][name], cfg[name]) end -- found a problem?