From f967bf3932d27e9fac2d64f3fcd78f0a71562807 Mon Sep 17 00:00:00 2001 From: Thomas Kugler Date: Tue, 26 Apr 2016 16:07:38 +0200 Subject: [PATCH 1/5] Set DependsUpon to xsd files. Related tp #416. --- src/tools/dotnet.lua | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/tools/dotnet.lua b/src/tools/dotnet.lua index ec079ad8..84b266f7 100644 --- a/src/tools/dotnet.lua +++ b/src/tools/dotnet.lua @@ -95,9 +95,15 @@ info.DependentUpon = fname:sub(1, -4) else + local basename = fname:sub(1, -4) + + -- Is there a matching *.xsd? + testname = basename .. ".xsd" + if project.hasfile(fcfg.project, testname) then + info.DependentUpon = testname + end -- Is there a matching *.Designer.cs? - local basename = fname:sub(1, -4) testname = basename .. ".Designer.cs" if project.hasfile(fcfg.project, testname) then info.SubType = "Form" From 1dbc1ea784d368d6b695c9d2774db13854e426d4 Mon Sep 17 00:00:00 2001 From: Tom van Dijck Date: Mon, 2 May 2016 10:18:36 -0700 Subject: [PATCH 2/5] properly escape defines. --- contrib/curl/premake5.lua | 2 +- src/actions/make/_make.lua | 1 + src/tools/gcc.lua | 4 ++-- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/contrib/curl/premake5.lua b/contrib/curl/premake5.lua index ced97c01..aebdf793 100644 --- a/contrib/curl/premake5.lua +++ b/contrib/curl/premake5.lua @@ -35,7 +35,7 @@ project "curl-lib" end end if ca then - defines { "CURL_CA_BUNDLE=\\\"" .. ca .. "\\\"" } + defines { 'CURL_CA_BUNDLE="' .. ca .. '"' } end end diff --git a/src/actions/make/_make.lua b/src/actions/make/_make.lua index f7c1f695..ccd3bfbb 100644 --- a/src/actions/make/_make.lua +++ b/src/actions/make/_make.lua @@ -89,6 +89,7 @@ function make.esc(value) result = value:gsub("\\", "\\\\") + result = result:gsub("\"", "\\\"") result = result:gsub(" ", "\\ ") result = result:gsub("%(", "\\(") result = result:gsub("%)", "\\)") diff --git a/src/tools/gcc.lua b/src/tools/gcc.lua index 58e98828..c88357f4 100644 --- a/src/tools/gcc.lua +++ b/src/tools/gcc.lua @@ -136,7 +136,7 @@ function gcc.getdefines(defines) local result = {} for _, define in ipairs(defines) do - table.insert(result, '-D' .. define) + table.insert(result, '-D' .. p.esc(define)) end return result end @@ -144,7 +144,7 @@ function gcc.getundefines(undefines) local result = {} for _, undefine in ipairs(undefines) do - table.insert(result, '-U' .. undefine) + table.insert(result, '-U' .. p.esc(undefine)) end return result end From df7adbfe501ba60427f685bfc51b9a0aba569261 Mon Sep 17 00:00:00 2001 From: Jason Perkins Date: Mon, 2 May 2016 19:26:42 -0400 Subject: [PATCH 3/5] Fix casing on Visual Studio rule XML encoding entity --- src/actions/vstudio/vs2010_rules_xml.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/actions/vstudio/vs2010_rules_xml.lua b/src/actions/vstudio/vs2010_rules_xml.lua index 80c88cab..5b7b0cb4 100644 --- a/src/actions/vstudio/vs2010_rules_xml.lua +++ b/src/actions/vstudio/vs2010_rules_xml.lua @@ -18,7 +18,6 @@ m.elements.project = function(r) return { - p.xmlUtf8, m.projectSchemaDefinitions, m.rule, m.ruleItem, @@ -28,6 +27,7 @@ end function m.generate(r) + p.xmlUtf8() p.callArray(m.elements.project, r) p.out('') end From 43547450dd23c91d3a40e3c26e4be5c7ee954c3a Mon Sep 17 00:00:00 2001 From: Tom van Dijck Date: Mon, 2 May 2016 16:55:50 -0700 Subject: [PATCH 4/5] Fix precompiled header file lookup in gmake backend. --- src/actions/make/make_cpp.lua | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/src/actions/make/make_cpp.lua b/src/actions/make/make_cpp.lua index 393f2b1b..923eb2e4 100644 --- a/src/actions/make/make_cpp.lua +++ b/src/actions/make/make_cpp.lua @@ -481,14 +481,24 @@ local pch = cfg.pchheader local found = false - for _, incdir in ipairs(cfg.includedirs) do - local testname = path.join(incdir, pch) - if os.isfile(testname) then - pch = project.getrelative(cfg.project, testname) - found = true - break + + -- test locally in the project folder first (this is the most likely location) + local testname = path.join(cfg.project.basedir, pch) + if os.isfile(testname) then + pch = project.getrelative(cfg.project, testname) + found = true + else + -- else scan in all include dirs. + for _, incdir in ipairs(cfg.includedirs) do + testname = path.join(incdir, pch) + if os.isfile(testname) then + pch = project.getrelative(cfg.project, testname) + found = true + break + end end end + if not found then pch = project.getrelative(cfg.project, path.getabsolute(pch)) end From 48aea04b94672d07e6410bee921c1ae5960794fc Mon Sep 17 00:00:00 2001 From: Tom van Dijck Date: Wed, 4 May 2016 16:02:31 -0700 Subject: [PATCH 5/5] add 'io.writefile' and 'io.readfile' shortcut methods. --- src/base/io.lua | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/base/io.lua b/src/base/io.lua index cb7bd3b9..35c3c1db 100644 --- a/src/base/io.lua +++ b/src/base/io.lua @@ -20,3 +20,28 @@ end return base(fname, mode) end) + + +-- +-- Write content to a new file. +-- + function io.writefile(filename, content) + local file = io.open(filename, "w+b") + if file then + file:write(content) + file:close() + return true + end + end + +-- +-- Read content from new file. +-- + function io.readfile(filename) + local file = io.open(filename, "rb") + if file then + local content = file:read("*a") + file:close() + return content + end + end \ No newline at end of file