From 713df1c9f3663823fc993c07c2b015198b8de582 Mon Sep 17 00:00:00 2001 From: Sam Surtees Date: Thu, 20 Apr 2017 01:04:10 +1000 Subject: [PATCH 1/3] Bootstrap makefile now cleans up previous builds before building --- Bootstrap.mak | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Bootstrap.mak b/Bootstrap.mak index d089654b..db0cc106 100644 --- a/Bootstrap.mak +++ b/Bootstrap.mak @@ -45,6 +45,9 @@ none: @echo " osx linux" mingw: $(SRC) + $(SILENT) rm -rf ./bin + $(SILENT) rm -rf ./build + $(SILENT) rm -rf ./obj mkdir -p build/bootstrap $(CC) -o build/bootstrap/premake_bootstrap -DPREMAKE_NO_BUILTIN_SCRIPTS -I"$(LUA_DIR)" $? -lole32 ./build/bootstrap/premake_bootstrap embed @@ -52,6 +55,9 @@ mingw: $(SRC) $(MAKE) -C build/bootstrap osx: $(SRC) + $(SILENT) rm -rf ./bin + $(SILENT) rm -rf ./build + $(SILENT) rm -rf ./obj mkdir -p build/bootstrap $(CC) -o build/bootstrap/premake_bootstrap -DPREMAKE_NO_BUILTIN_SCRIPTS -DLUA_USE_MACOSX -I"$(LUA_DIR)" -framework CoreServices -framework Foundation -framework Security $? ./build/bootstrap/premake_bootstrap embed @@ -59,6 +65,9 @@ osx: $(SRC) $(MAKE) -C build/bootstrap -j`getconf _NPROCESSORS_ONLN` linux: $(SRC) + $(SILENT) rm -rf ./bin + $(SILENT) rm -rf ./build + $(SILENT) rm -rf ./obj mkdir -p build/bootstrap $(CC) -o build/bootstrap/premake_bootstrap -DPREMAKE_NO_BUILTIN_SCRIPTS -DLUA_USE_POSIX -DLUA_USE_DLOPEN -I"$(LUA_DIR)" $? -lm -ldl -lrt ./build/bootstrap/premake_bootstrap embed @@ -66,6 +75,9 @@ linux: $(SRC) $(MAKE) -C build/bootstrap -j`getconf _NPROCESSORS_ONLN` bsd: $(SRC) + $(SILENT) rm -rf ./bin + $(SILENT) rm -rf ./build + $(SILENT) rm -rf ./obj mkdir -p build/bootstrap $(CC) -o build/bootstrap/premake_bootstrap -DPREMAKE_NO_BUILTIN_SCRIPTS -DLUA_USE_POSIX -DLUA_USE_DLOPEN -I"$(LUA_DIR)" $? -lm ./build/bootstrap/premake_bootstrap embed @@ -73,6 +85,9 @@ bsd: $(SRC) $(MAKE) -C build/bootstrap -j`getconf _NPROCESSORS_ONLN` windows-base: $(SRC) + $(SILENT) if exist .\bin rmdir /s /q .\bin + $(SILENT) if exist .\build rmdir /s /q .\build + $(SILENT) if exist .\obj rmdir /s /q .\obj if not exist build\bootstrap (mkdir build\bootstrap) cl /Fo.\build\bootstrap\ /Fe.\build\bootstrap\premake_bootstrap.exe /DPREMAKE_NO_BUILTIN_SCRIPTS /I"$(LUA_DIR)" user32.lib ole32.lib advapi32.lib $** .\build\bootstrap\premake_bootstrap.exe embed From 537392428d54e225933bed1733809c29e90b6b6c Mon Sep 17 00:00:00 2001 From: Sam Surtees Date: Thu, 20 Apr 2017 02:05:27 +1000 Subject: [PATCH 2/3] os.translateCommands now supports multiple tokens --- src/base/os.lua | 25 +++++++++++++++++-------- tests/base/test_os.lua | 7 +++++++ 2 files changed, 24 insertions(+), 8 deletions(-) diff --git a/src/base/os.lua b/src/base/os.lua index f52bf538..bd1aa547 100644 --- a/src/base/os.lua +++ b/src/base/os.lua @@ -535,15 +535,24 @@ end local processOne = function(cmd) - local token = cmd:match("^{.+}") - if token then - token = token:sub(2, #token - 1):lower() - local args = cmd:sub(#token + 4) - local func = map[token] or os.commandTokens["_"][token] - if func then - cmd = func(args) + local i, j, prev + repeat + i, j = cmd:find("{.-}") + if i then + if i == prev then + break + end + + local token = cmd:sub(i + 1, j - 1):lower() + local args = cmd:sub(j + 2) + local func = map[token] or os.commandTokens["_"][token] + if func then + cmd = cmd:sub(1, i -1) .. func(args) + end + + prev = i end - end + until i == nil return cmd end diff --git a/tests/base/test_os.lua b/tests/base/test_os.lua index c3748546..98e5ddad 100644 --- a/tests/base/test_os.lua +++ b/tests/base/test_os.lua @@ -177,6 +177,13 @@ test.isequal("test a b", os.translateCommands("{COPY} a b", "test")) end + function suite.translateCommand_callsProcessor_multipleTokens() + os.commandTokens.test = { + copy = function(value) return "test " .. value end + } + test.isequal("test a b; test c d; test e f;", os.translateCommands("{COPY} a b; {COPY} c d; {COPY} e f;", "test")) + end + -- -- os.translateCommand() windows COPY tests -- From 438949a7a188a0c850328a8342cfc0f47ce00176 Mon Sep 17 00:00:00 2001 From: Sam Surtees Date: Fri, 21 Apr 2017 02:37:31 +1000 Subject: [PATCH 3/3] Updated packaging script - Find all occurrences of files wanting to be deleted rather than assuming locations - Added vs2017 and bsd to project file generation --- scripts/package.lua | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/scripts/package.lua b/scripts/package.lua index bf354325..8cd1b71d 100644 --- a/scripts/package.lua +++ b/scripts/package.lua @@ -127,18 +127,16 @@ print("Cleaning up the source tree...") os.rmdir("packages") + os.rmdir(".git") - local modules = table.join(".", os.matchdirs("modules/*")) - for _, module in ipairs(modules) do - for _, name in ipairs { ".git" } do - os.rmdir(path.join(module, name)) - end - for _, name in ipairs { ".DS_Store", ".git", ".gitignore", ".gitmodules", ".travis.yml", ".editorconfig", "Bootstrap.mak" } do - os.remove(path.join(module, name)) + local removelist = { ".DS_Store", ".git", ".gitignore", ".gitmodules", ".travis.yml", ".editorconfig", "appveyor.yml", "Bootstrap.mak" } + for _, removeitem in ipairs(removelist) do + local founditems = os.matchfiles("**" .. removeitem) + for _, item in ipairs(founditems) do + os.remove(item) end end - -- -- Generate a source package. -- @@ -152,9 +150,11 @@ if kind == "source" then execQuiet("premake5 /to=build/vs2012 vs2012") execQuiet("premake5 /to=build/vs2013 vs2013") execQuiet("premake5 /to=build/vs2015 vs2015") + execQuiet("premake5 /to=build/vs2017 vs2017") execQuiet("premake5 /to=build/gmake.windows /os=windows gmake") execQuiet("premake5 /to=build/gmake.unix /os=linux gmake") execQuiet("premake5 /to=build/gmake.macosx /os=macosx gmake") + execQuiet("premake5 /to=build/gmake.bsd /os=bsd gmake") print("Creating source code package...") os.chdir("..")