Merge pull request #758 from LORgames/ssurtees/whitespaceCleanup

Cleaned up inconsistencies in whitespace
This commit is contained in:
Tom van Dijck 2017-04-25 11:54:42 -07:00 committed by GitHub
commit 6cc2514737
36 changed files with 237 additions and 237 deletions

View File

@ -23,7 +23,7 @@
valid_kinds = { "ConsoleApp", "WindowedApp", "Makefile", "SharedLib", "StaticLib", "Utility" },
valid_tools = {
cc = { "gcc", "clang", "msc" }
cc = { "gcc", "clang", "msc" }
},
supports_language = function(lang)
return p.languages.isc(lang) or

View File

@ -159,8 +159,8 @@
_p('\t@echo $(notdir $<)')
_p('\t$(SILENT) $(DC) $(ALL_DFLAGS) $(OUTPUTFLAG) -c $<')
else
oldfn(prj, node)
end
oldfn(prj, node)
end
end)

View File

@ -9,7 +9,7 @@
local p = premake
local project = p.project
local config = p.config
local d = p.modules.d
local d = p.modules.d
--
-- Set default tools

View File

@ -10,7 +10,7 @@
local gdc = p.tools.gdc
local project = p.project
local config = p.config
local d = p.modules.d
local d = p.modules.d
--
-- Set default tools

View File

@ -10,7 +10,7 @@
local ldc = p.tools.ldc
local project = p.project
local config = p.config
local d = p.modules.d
local d = p.modules.d
--

View File

@ -1,14 +1,14 @@
newaction
{
trigger = "raw",
shortname = "Raw output",
description = "Generate raw representation of Premake structures",
trigger = "raw",
shortname = "Raw output",
description = "Generate raw representation of Premake structures",
onsolution = function(sln)
require('raw')
onsolution = function(sln)
require('raw')
premake.generate(sln, ".raw", premake.raw.solution)
end,
premake.generate(sln, ".raw", premake.raw.solution)
end,
}
return function(cfg)

View File

@ -4,73 +4,73 @@ local raw = p.raw
local gvisited = { }
function raw.solution(sln)
if not gvisited[sln.global] then
gvisited[sln.global] = true
raw.printTable({ global = sln.global })
end
if not gvisited[sln.global] then
gvisited[sln.global] = true
raw.printTable({ global = sln.global })
end
end
function raw.printTable(t, i)
i = i or 0
placement = raw._createPlacement(t)
raw._printTableRecursive(t, i, placement)
i = i or 0
placement = raw._createPlacement(t)
raw._printTableRecursive(t, i, placement)
end
function raw._printTableRecursive(t, i, placement)
elements = { }
for k, v in pairs(t) do
table.insert(elements, { key = k, value = v })
end
elements = { }
for k, v in pairs(t) do
table.insert(elements, { key = k, value = v })
end
table.sort(elements, function(a, b)
local n1 = type(a.key) == "number"
local n2 = type(b.key) == "number"
if n1 ~= n2 then
return n1
end
table.sort(elements, function(a, b)
local n1 = type(a.key) == "number"
local n2 = type(b.key) == "number"
if n1 ~= n2 then
return n1
end
local k1 = n1 and a.key or raw._encode(a.key)
local k2 = n2 and b.key or raw._encode(b.key)
return k1 < k2
end)
local k1 = n1 and a.key or raw._encode(a.key)
local k2 = n2 and b.key or raw._encode(b.key)
return k1 < k2
end)
for _, elem in ipairs(elements) do
p = placement[elem.value]
if p and elem.key == p.key and t == p.parent then
_p(i, "%s", raw._encode(elem.key) .. ': ' .. raw._encode(elem.value) .. ' {')
raw._printTableRecursive(elem.value, i + 1, placement)
_p(i, '} # ' .. raw._encode(elem.key))
else
_p(i, "%s", raw._encode(elem.key) .. ': ' .. raw._encode(elem.value))
end
end
for _, elem in ipairs(elements) do
p = placement[elem.value]
if p and elem.key == p.key and t == p.parent then
_p(i, "%s", raw._encode(elem.key) .. ': ' .. raw._encode(elem.value) .. ' {')
raw._printTableRecursive(elem.value, i + 1, placement)
_p(i, '} # ' .. raw._encode(elem.key))
else
_p(i, "%s", raw._encode(elem.key) .. ': ' .. raw._encode(elem.value))
end
end
end
function raw._createPlacement(tbl)
placement = { }
placementList = { tbl }
while #placementList ~= 0 do
parentList = { }
for _, parent in ipairs(placementList) do
for k, v in pairs(parent) do
if type(v) == "table" and not placement[v] then
table.insert(parentList, v)
placement[v] = {
parent = parent,
key = k
}
end
end
end
placementList = parentList
end
return placement
placement = { }
placementList = { tbl }
while #placementList ~= 0 do
parentList = { }
for _, parent in ipairs(placementList) do
for k, v in pairs(parent) do
if type(v) == "table" and not placement[v] then
table.insert(parentList, v)
placement[v] = {
parent = parent,
key = k
}
end
end
end
placementList = parentList
end
return placement
end
function raw._encode(v)
if type(v) == "string" then
return '"' .. v .. '"'
else
return tostring(v)
end
if type(v) == "string" then
return '"' .. v .. '"'
else
return tostring(v)
end
end

View File

@ -7,9 +7,9 @@
local p = premake
local xcode = p.modules.xcode
local tree = p.tree
local workspace = p.workspace
local workspace = p.workspace
local project = p.project
local config = p.config
local config = p.config
local fileconfig = p.fileconfig

View File

@ -39,33 +39,33 @@
table.insert(tr.configs, cfg)
end
-- convert localized resources from their filesystem layout (English.lproj/MainMenu.xib)
-- convert localized resources from their filesystem layout (English.lproj/MainMenu.xib)
-- to Xcode's display layout (MainMenu.xib/English).
tree.traverse(tr, {
onbranch = function(node)
if path.getextension(node.name) == ".lproj" then
local lang = path.getbasename(node.name) -- "English", "French", etc.
tree.traverse(tr, {
onbranch = function(node)
if path.getextension(node.name) == ".lproj" then
local lang = path.getbasename(node.name) -- "English", "French", etc.
-- create a new language group for each file it contains
for _, filenode in ipairs(node.children) do
local grpnode = node.parent.children[filenode.name]
if not grpnode then
grpnode = tree.insert(node.parent, tree.new(filenode.name))
grpnode.kind = "vgroup"
end
-- create a new language group for each file it contains
for _, filenode in ipairs(node.children) do
local grpnode = node.parent.children[filenode.name]
if not grpnode then
grpnode = tree.insert(node.parent, tree.new(filenode.name))
grpnode.kind = "vgroup"
end
-- convert the file node to a language node and add to the group
filenode.name = path.getbasename(lang)
tree.insert(grpnode, filenode)
end
-- convert the file node to a language node and add to the group
filenode.name = path.getbasename(lang)
tree.insert(grpnode, filenode)
end
-- remove this directory from the tree
tree.remove(node)
end
end
})
tree.remove(node)
end
end
})
-- the special folder "Frameworks" lists all linked frameworks
-- the special folder "Frameworks" lists all linked frameworks
tr.frameworks = tree.new("Frameworks")
for cfg in project.eachconfig(prj) do
for _, link in ipairs(config.getlinks(cfg, "system", "fullpath")) do
@ -73,9 +73,9 @@
if xcode.isframework(name) and not tr.frameworks.children[name] then
node = tree.insert(tr.frameworks, tree.new(name))
node.path = link
end
end
end
end
end
end
-- only add it to the tree if there are frameworks to link
if #tr.frameworks.children > 0 then
@ -84,7 +84,7 @@
-- the special folder "Products" holds the target produced by the project; this
-- is populated below
tr.products = tree.insert(tr, tree.new("Products"))
tr.products = tree.insert(tr, tree.new("Products"))
-- the special folder "Projects" lists sibling project dependencies
tr.projects = tree.new("Projects")
@ -95,31 +95,31 @@
xcode.addDependency(prj, tr, dep, false)
end
if #tr.projects.children > 0 then
tree.insert(tr, tr.projects)
end
if #tr.projects.children > 0 then
tree.insert(tr, tr.projects)
end
-- Final setup
tree.traverse(tr, {
onnode = function(node)
-- assign IDs to every node in the tree
node.id = xcode.newid(node.name, nil, node.path)
-- Final setup
tree.traverse(tr, {
onnode = function(node)
-- assign IDs to every node in the tree
node.id = xcode.newid(node.name, nil, node.path)
node.isResource = xcode.isItemResource(prj, node)
node.isResource = xcode.isItemResource(prj, node)
-- assign build IDs to buildable files
-- assign build IDs to buildable files
if xcode.getbuildcategory(node) and not node.excludefrombuild then
node.buildid = xcode.newid(node.name, "build", node.path)
end
node.buildid = xcode.newid(node.name, "build", node.path)
end
-- remember key files that are needed elsewhere
if string.endswith(node.name, "Info.plist") then
tr.infoplist = node
end
end
}, true)
-- remember key files that are needed elsewhere
if string.endswith(node.name, "Info.plist") then
tr.infoplist = node
end
end
}, true)
-- Plug in the product node into the Products folder in the tree. The node
-- Plug in the product node into the Products folder in the tree. The node
-- was built in xcode.prepareWorkspace() in xcode_common.lua; it contains IDs
-- that are necessary for inter-project dependencies
node = tree.insert(tr.products, prj.xcode.projectnode)

View File

@ -1110,7 +1110,7 @@
tokens = true,
}
api.register {
api.register {
name = "usingdirs",
scope = "config",
kind = "list:directory",

View File

@ -94,9 +94,9 @@
function cs.getresourcefilename(cfg, fname)
if path.getextension(fname) == ".resx" then
local name = cfg.buildtarget.basename .. "."
local dir = path.getdirectory(fname)
if dir ~= "." then
local name = cfg.buildtarget.basename .. "."
local dir = path.getdirectory(fname)
if dir ~= "." then
name = name .. path.translate(dir, ".") .. "."
end
return "$(OBJDIR)/" .. p.esc(name .. path.getbasename(fname)) .. ".resources"

View File

@ -318,12 +318,12 @@
-- The alias name (another string value).
---
function api.alias(original, alias)
p.alias(_G, original, alias)
if _G["remove" .. original] then
p.alias(_G, "remove" .. original, "remove" .. alias)
end
end
function api.alias(original, alias)
p.alias(_G, original, alias)
if _G["remove" .. original] then
p.alias(_G, "remove" .. original, "remove" .. alias)
end
end

View File

@ -231,7 +231,7 @@
-- An array containing the requested link target information.
--
function config.getlinks(cfg, kind, part, linkage)
function config.getlinks(cfg, kind, part, linkage)
local result = {}
-- If I'm building a list of link directories, include libdirs

View File

@ -90,7 +90,7 @@
--
function path.getextension(p)
p = path.getname(p)
p = path.getname(p)
local i = p:findlast(".", true)
if (i) then
return p:sub(i)

View File

@ -190,9 +190,9 @@
for cfg in project.eachconfig(prj) do
if not depsOnly then
for _, link in ipairs(cfg.links) do
if link ~= prj.name then
add_to_project_list(cfg, link, result)
end
if link ~= prj.name then
add_to_project_list(cfg, link, result)
end
end
end
if not linkOnly then

View File

@ -31,10 +31,10 @@ int os_islink(lua_State* L)
#else
{
struct stat buf;
if (lstat(path, &buf) == 0) {
lua_pushboolean(L, S_ISLNK(buf.st_mode));
return 1;
}
if (lstat(path, &buf) == 0) {
lua_pushboolean(L, S_ISLNK(buf.st_mode));
return 1;
}
}
#endif

View File

@ -13,7 +13,7 @@ int os_stat(lua_State* L)
struct stat s;
const char* filename = luaL_checkstring(L, 1);
if (stat(filename, &s) != 0)
if (stat(filename, &s) != 0)
{
lua_pushnil(L);
switch (errno)

View File

@ -501,8 +501,8 @@ static int run_premake_main(lua_State* L, const char* script)
* argument allowed as an override. Debug builds will look at the
* local file system first, then fall back to embedded. */
#if defined(NDEBUG)
int z = premake_test_file(L, script,
TEST_SCRIPTS | TEST_EMBEDDED);
int z = premake_test_file(L, script,
TEST_SCRIPTS | TEST_EMBEDDED);
#else
int z = premake_test_file(L, script,
TEST_LOCAL | TEST_SCRIPTS | TEST_PATH | TEST_EMBEDDED);
@ -529,10 +529,10 @@ static int run_premake_main(lua_State* L, const char* script)
* contents of the file's script.
*/
const buildin_mapping* premake_find_embedded_script(const char* filename)
{
const buildin_mapping* premake_find_embedded_script(const char* filename)
{
#if !defined(PREMAKE_NO_BUILTIN_SCRIPTS)
int i;
int i;
for (i = 0; builtin_scripts[i].name != NULL; ++i) {
if (strcmp(builtin_scripts[i].name, filename) == 0) {
return builtin_scripts + i;
@ -540,7 +540,7 @@ static int run_premake_main(lua_State* L, const char* script)
}
#endif
return NULL;
}
}

View File

@ -123,7 +123,7 @@
if fcfg.buildaction == "Component" or
fcfg.buildaction == "Form" or
fcfg.buildaction == "UserControl"
then
then
info.SubType = fcfg.buildaction
end

View File

@ -438,7 +438,7 @@
if #static_syslibs > 1 then
table.insert(static_syslibs, "-Wl,-Bdynamic")
move(static_syslibs, result)
end
end
move(shared_syslibs, result)
return result

View File

@ -41,6 +41,6 @@ ifeq ($(config),debug)
ifeq ($(origin AR), default)
AR = ar
endif
]]
]]
end

View File

@ -52,7 +52,7 @@ else
endif
$(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<"
]]
]]
end
@ -81,7 +81,7 @@ else
endif
$(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<"
]]
]]
end

View File

@ -153,38 +153,38 @@
-- Check a linking to a sibling shared library using -l and -L.
--
function suite.links_onSiblingSharedLib()
links "MyProject2"
flags { "RelativeLinks" }
function suite.links_onSiblingSharedLib()
links "MyProject2"
flags { "RelativeLinks" }
test.createproject(wks)
kind "SharedLib"
location "build"
test.createproject(wks)
kind "SharedLib"
location "build"
prepare { "ldFlags", "libs", "ldDeps" }
test.capture [[
prepare { "ldFlags", "libs", "ldDeps" }
test.capture [[
ALL_LDFLAGS += $(LDFLAGS) -Lbuild/bin/Debug -Wl,-rpath,'$$ORIGIN/../../build/bin/Debug' -s
LIBS += -lMyProject2
LDDEPS += build/bin/Debug/libMyProject2.so
]]
end
]]
end
function suite.links_onMacOSXSiblingSharedLib()
_TARGET_OS = "macosx"
links "MyProject2"
function suite.links_onMacOSXSiblingSharedLib()
_TARGET_OS = "macosx"
links "MyProject2"
flags { "RelativeLinks" }
test.createproject(wks)
kind "SharedLib"
location "build"
test.createproject(wks)
kind "SharedLib"
location "build"
prepare { "ldFlags", "libs", "ldDeps" }
test.capture [[
prepare { "ldFlags", "libs", "ldDeps" }
test.capture [[
ALL_LDFLAGS += $(LDFLAGS) -Lbuild/bin/Debug -Wl,-rpath,'@loader_path/../../build/bin/Debug' -Wl,-x
LIBS += -lMyProject2
LDDEPS += build/bin/Debug/libMyProject2.dylib
]]
end
]]
end
--
-- Check a linking multiple siblings.

View File

@ -37,7 +37,7 @@
OBJECTS := \
$(OBJDIR)/hello.o \
]]
]]
end
@ -52,7 +52,7 @@ OBJECTS := \
OBJECTS := \
$(OBJDIR)/hello.o \
]]
]]
end
@ -85,7 +85,7 @@ ifeq ($(config),release)
endif
]]
]]
end
@ -101,7 +101,7 @@ OBJECTS := \
$(OBJDIR)/hello.o \
$(OBJDIR)/hello1.o \
]]
]]
end

View File

@ -35,7 +35,7 @@
test.capture [[
all: prebuild prelink $(TARGET)
@:
]]
]]
end
@ -53,5 +53,5 @@ all: prebuild prelink $(TARGET) $(dir $(TARGETDIR))PkgInfo $(dir $(TARGETDIR))In
$(dir $(TARGETDIR))PkgInfo:
$(dir $(TARGETDIR))Info.plist:
]]
]]
end

View File

@ -31,5 +31,5 @@
make.cppTools(cfg, p.tools.gcc)
test.capture [[
RESCOMP = windres
]]
]]
end

View File

@ -32,7 +32,7 @@
make.cppFlags(cfg, p.tools.gcc)
test.capture [[
ALL_CPPFLAGS += $(CPPFLAGS) -MMD -MP -I$(LIBOGC_INC) $(MACHDEP) $(DEFINES) $(INCLUDES)
]]
]]
end
function suite.writesCorrectLinkerFlags()

View File

@ -38,8 +38,8 @@
EMBEDFILES += \
$(OBJDIR)/MyProject.Hello.resources \
]]
end
]]
end
--
@ -53,8 +53,8 @@ EMBEDFILES += \
EMBEDFILES += \
$(OBJDIR)/MyProject.Hello.resources \
]]
end
]]
end
--
@ -71,5 +71,5 @@ EMBEDFILES += \
EMBEDFILES += \
Hello.txt \
]]
end
]]
end

View File

@ -35,8 +35,8 @@
prepare()
test.capture [[
FLAGS = /noconfig
]]
end
]]
end
--
@ -48,8 +48,8 @@
prepare()
test.capture [[
FLAGS = /unsafe /noconfig
]]
end
]]
end
--
@ -61,5 +61,5 @@
prepare()
test.capture [[
FLAGS = /noconfig /win32icon:"MyProject.ico"
]]
end
]]
end

View File

@ -5,56 +5,56 @@
--
local p = premake
local suite = test.declare("make_cs_links")
local make = p.make
local cs = p.make.cs
local project = p.project
local suite = test.declare("make_cs_links")
local make = p.make
local cs = p.make.cs
local project = p.project
--
-- Setup
--
local wks, prj
local wks, prj
function suite.setup()
wks, prj = test.createWorkspace()
end
function suite.setup()
wks, prj = test.createWorkspace()
end
local function prepare()
local cfg = test.getconfig(prj, "Debug")
make.csLinkCmd(cfg, p.tools.dotnet)
end
local function prepare()
local cfg = test.getconfig(prj, "Debug")
make.csLinkCmd(cfg, p.tools.dotnet)
end
--
-- Should return an empty assignment if nothing has been specified.
--
function suite.isEmptyAssignment_onNoSettings()
prepare()
test.capture [[
function suite.isEmptyAssignment_onNoSettings()
prepare()
test.capture [[
DEPENDS =
]]
end
]]
end
--
-- Files that can be compiled should be listed here.
--
function suite.doesListLinkDependencyFiles()
links { "MyProject2", "MyProject3" }
function suite.doesListLinkDependencyFiles()
links { "MyProject2", "MyProject3" }
test.createproject(wks)
kind "SharedLib"
language "C#"
test.createproject(wks)
kind "SharedLib"
language "C#"
test.createproject(wks)
kind "SharedLib"
language "C#"
test.createproject(wks)
kind "SharedLib"
language "C#"
prepare ()
test.capture [[
prepare ()
test.capture [[
DEPENDS = bin/Debug/MyProject2.dll bin/Debug/MyProject3.dll
]]
end
]]
end

View File

@ -38,8 +38,8 @@
SOURCES += \
Hello.cs \
]]
end
]]
end
--
-- Path delimiter uses slash instead of backslash
@ -68,8 +68,8 @@ SOURCES += \
SOURCES += \
Hello.cs \
]]
end
]]
end
--
@ -86,5 +86,5 @@ SOURCES += \
SOURCES += \
Hello.txt \
]]
end
]]
end

View File

@ -44,7 +44,7 @@
function suite.writesPathIfSet()
buildlog "logs/MyCustomLogFile.log"
prepare()
test.capture [[
test.capture [[
<BuildLog>
<Path>logs\MyCustomLogFile.log</Path>
</BuildLog>

View File

@ -127,9 +127,9 @@
-- List fields should return an empty list of not set.
--
function suite.lists_returnsEmptyTable_onNotSet()
test.isequal({}, configset.fetch(cset, field.get("buildoptions"), {}))
end
function suite.lists_returnsEmptyTable_onNotSet()
test.isequal({}, configset.fetch(cset, field.get("buildoptions"), {}))
end
--

View File

@ -147,7 +147,7 @@
test.isequal("", path.getextension("filename"))
end
function suite.getextension_ReturnsEmptyString_OnPathWithDotAndNoExtension()
function suite.getextension_ReturnsEmptyString_OnPathWithDotAndNoExtension()
test.isequal("", path.getextension("/.premake/premake"))
end
@ -155,7 +155,7 @@
test.isequal(".txt", path.getextension("filename.txt"))
end
function suite.getextension_ReturnsExtension_OnPathWithDot()
function suite.getextension_ReturnsExtension_OnPathWithDot()
test.isequal(".lua", path.getextension("/.premake/premake.lua"))
end
@ -222,7 +222,7 @@
end
function suite.getrelative_ignoresTrailingSlashes()
test.isequal("c", path.getrelative("/a/b/","/a/b/c"))
test.isequal("c", path.getrelative("/a/b/","/a/b/c"))
end
function suite.getrelative_returnsAbsPath_onContactWithFileSysRoot()
@ -410,19 +410,19 @@
end
function suite.getabsolute_replaceExtensionWithDotMultipleDots()
test.isequal("/nunit.framework.foo", path.replaceextension("/nunit.framework.dll",".foo"))
test.isequal("/nunit.framework.foo", path.replaceextension("/nunit.framework.dll",".foo"))
end
function suite.getabsolute_replaceExtensionCompletePath()
test.isequal("/nunit/framework/main.foo", path.replaceextension("/nunit/framework/main.cpp",".foo"))
test.isequal("/nunit/framework/main.foo", path.replaceextension("/nunit/framework/main.cpp",".foo"))
end
function suite.getabsolute_replaceExtensionWithoutExtension()
test.isequal("/nunit/framework/main.foo", path.replaceextension("/nunit/framework/main",".foo"))
test.isequal("/nunit/framework/main.foo", path.replaceextension("/nunit/framework/main",".foo"))
end
function suite.getabsolute_replaceExtensionWithEmptyString()
test.isequal("foo", path.replaceextension("foo.lua",""))
function suite.getabsolute_replaceExtensionWithEmptyString()
test.isequal("foo", path.replaceextension("foo.lua",""))
end

View File

@ -21,7 +21,7 @@
local function prepare()
wks = test.getWorkspace(wks)
prj = test.getproject(wks, 1)
cfg = test.getconfig(prj, "Debug")
cfg = test.getconfig(prj, "Debug")
end

View File

@ -124,11 +124,11 @@
test.isequal("Headers/myproject/hello.h", run())
end
function suite.matchBaseFileName_onWildcardExtension()
files { "hello.cpp" }
vpaths { ["Sources"] = "hello.*" }
test.isequal("Sources/hello.cpp", run())
end
function suite.matchBaseFileName_onWildcardExtension()
files { "hello.cpp" }
vpaths { ["Sources"] = "hello.*" }
test.isequal("Sources/hello.cpp", run())
end
--