From 1692363fd9b1c51c90d94e7c802a654de049935d Mon Sep 17 00:00:00 2001 From: starkos Date: Mon, 21 Oct 2019 07:20:06 -0400 Subject: [PATCH] Allow wildcards in xcodebuildresources --- modules/xcode/tests/test_xcode_project.lua | 19 +++++++++++++++++++ modules/xcode/xcode_common.lua | 14 ++++---------- 2 files changed, 23 insertions(+), 10 deletions(-) diff --git a/modules/xcode/tests/test_xcode_project.lua b/modules/xcode/tests/test_xcode_project.lua index 2d4eff37..7cf664a1 100644 --- a/modules/xcode/tests/test_xcode_project.lua +++ b/modules/xcode/tests/test_xcode_project.lua @@ -98,6 +98,25 @@ end +--- +-- Verify that files listed in xcodebuildresources are marked as resources +--- + function suite.PBXBuildFile_ListsXcodeBuildResources() + files { "file1.txt", "file01.png", "file02.png", "file-3.png" } + xcodebuildresources { "file1.txt", "**.png" } + prepare() + xcode.PBXBuildFile(tr) + test.capture [[ +/* Begin PBXBuildFile section */ + 628F3826BDD08B98912AD666 /* file-3.png in Resources */ = {isa = PBXBuildFile; fileRef = 992385EEB0362120A0521C2E /* file-3.png */; }; + 93485EDEC2DA2DD09DE76D1E /* file1.txt in Resources */ = {isa = PBXBuildFile; fileRef = 9F78562642667CD8D18C5C66 /* file1.txt */; }; + C87AFEAA23BC521CF7169CEA /* file02.png in Resources */ = {isa = PBXBuildFile; fileRef = D54D8E32EC602964DC7C2472 /* file02.png */; }; + EE9FC5C849E1193A1D3B6408 /* file01.png in Resources */ = {isa = PBXBuildFile; fileRef = 989B7E70AFAE19A29FCA14B0 /* file01.png */; }; +/* End PBXBuildFile section */ + ]] + end + + --------------------------------------------------------------------------- -- PBXFileReference tests --------------------------------------------------------------------------- diff --git a/modules/xcode/xcode_common.lua b/modules/xcode/xcode_common.lua index 0a32f224..89aea613 100644 --- a/modules/xcode/xcode_common.lua +++ b/modules/xcode/xcode_common.lua @@ -48,8 +48,7 @@ end function xcode.isItemResource(project, node) - - local res; + local res if project and project.xcodebuildresources then if type(project.xcodebuildresources) == "table" then @@ -59,20 +58,15 @@ local function checkItemInList(item, list) if item then - if list then - if type(list) == "table" then - for _,v in pairs(list) do - if string.find(item, v) then - return true - end - end + for _,v in pairs(list) do + if string.find(item, path.wildcards(v)) then + return true end end end return false end - --print (node.path, node.buildid, node.cfg, res) if (checkItemInList(node.path, res)) then return true end