diff options
author | Oliver Schneider <oliver@assarbad.net> | 2017-03-22 00:45:26 +0300 |
---|---|---|
committer | Oliver Schneider <oliver@assarbad.net> | 2017-03-22 00:45:26 +0300 |
commit | b8625c05bc96cc03d1d940aa7a7682029473f228 (patch) | |
tree | bd8befb61cd8c55ffd9ad3b55312552ada6a0786 /src/base | |
parent | a5cd805e4532da682f363e283dd6c49819173fcd (diff) |
Removing trailing spaces and tabs on lines within the premake4 Lua scripts
(purely cosmetic)
--HG--
branch : WDS-build
Diffstat (limited to 'src/base')
-rw-r--r-- | src/base/action.lua | 16 | ||||
-rw-r--r-- | src/base/bake.lua | 182 | ||||
-rw-r--r-- | src/base/cmdline.lua | 11 | ||||
-rw-r--r-- | src/base/config.lua | 14 | ||||
-rw-r--r-- | src/base/globals.lua | 59 | ||||
-rw-r--r-- | src/base/help.lua | 10 | ||||
-rw-r--r-- | src/base/io.lua | 16 | ||||
-rw-r--r-- | src/base/solution.lua | 6 | ||||
-rw-r--r-- | src/base/string.lua | 6 | ||||
-rw-r--r-- | src/base/table.lua | 21 | ||||
-rw-r--r-- | src/base/tree.lua | 28 | ||||
-rw-r--r-- | src/base/validate.lua | 34 |
12 files changed, 200 insertions, 203 deletions
diff --git a/src/base/action.lua b/src/base/action.lua index 6adbcad..80bfce4 100644 --- a/src/base/action.lua +++ b/src/base/action.lua @@ -12,14 +12,14 @@ -- premake.action.list = { } - + -- -- Register a new action. -- -- @param a -- The new action object. --- +-- function premake.action.add(a) -- validate the action object, at least a little bit @@ -29,13 +29,13 @@ missing = field end end - + if (missing) then error("action needs a " .. missing, 3) end -- add it to the master list - premake.action.list[a.trigger] = a + premake.action.list[a.trigger] = a end @@ -60,7 +60,7 @@ end end end - + if a.execute then a.execute() end @@ -77,8 +77,8 @@ function premake.action.current() return premake.action.get(_ACTION) end - - + + -- -- Retrieve an action by name. -- @@ -104,7 +104,7 @@ table.insert(keys, action.trigger) end table.sort(keys) - + local i = 0 return function() i = i + 1 diff --git a/src/base/bake.lua b/src/base/bake.lua index 9276af8..20aad72 100644 --- a/src/base/bake.lua +++ b/src/base/bake.lua @@ -2,8 +2,8 @@ -- base/bake.lua -- -- Takes all the configuration information provided by the project scripts --- and stored in the solution->project->block hierarchy and flattens it all --- down into one object per configuration. These objects are cached with the +-- and stored in the solution->project->block hierarchy and flattens it all +-- down into one object per configuration. These objects are cached with the -- project, and can be retrieved by calling the getconfig() or eachconfig(). -- -- Copyright (c) 2008-2011 Jason Perkins and the Premake project @@ -15,7 +15,7 @@ -- do not copy these fields into the configurations - local nocopy = + local nocopy = { blocks = true, keywords = true, @@ -25,11 +25,11 @@ -- do not cascade these fields from projects to configurations - local nocascade = + local nocascade = { makesettings = true, } - + -- leave these paths as absolute, rather than converting to project relative local keeprelative = @@ -47,7 +47,7 @@ function premake.getactiveterms() local terms = { _action = _ACTION:lower(), os = os.get() } - + -- add option keys or values for key, value in pairs(_OPTIONS) do if value ~= "" then @@ -56,15 +56,15 @@ table.insert(terms, key:lower()) end end - + return terms end - - + + -- -- Test a single configuration block keyword against a list of terms. -- The terms are a mix of key/value pairs. The keyword is tested against --- the values; on a match, the corresponding key is returned. This +-- the values; on a match, the corresponding key is returned. This -- enables testing for required values in iskeywordsmatch(), below. -- @@ -73,7 +73,7 @@ if keyword:startswith("not ") then return not premake.iskeywordmatch(keyword:sub(5), terms) end - + for _, pattern in ipairs(keyword:explode(" or ")) do for termkey, term in pairs(terms) do if term:match(pattern) == term then @@ -82,9 +82,9 @@ end end end - - - + + + -- -- Checks a set of configuration block keywords against a list of terms. -- The required flag is used by the file configurations: only blocks @@ -104,7 +104,7 @@ hasrequired = true end end - + if terms.required and not hasrequired then return false else @@ -125,15 +125,15 @@ local function adjustpaths(location, obj) function adjustpathlist(list) for i, p in ipairs(list) do - list[i] = path.getrelative(location, p) + list[i] = path.getrelative(location, p) end end - + for name, value in pairs(obj) do local field = premake.fields[name] if field and value and not keeprelative[name] then if field.kind == "path" then - obj[name] = path.getrelative(location, value) + obj[name] = path.getrelative(location, value) elseif field.kind == "dirlist" or field.kind == "filelist" then adjustpathlist(value) elseif field.kind == "keypath" then @@ -144,8 +144,8 @@ end end end - - + + -- -- Merge all of the fields from one object into another. String values are overwritten, @@ -173,13 +173,13 @@ end return tbl end - + local function mergeobject(dest, src) -- if there's nothing to add, quick out - if not src then - return + if not src then + return end - + for fieldname, value in pairs(src) do if not nocopy[fieldname] then -- fields that are included in the API are merged... @@ -190,7 +190,7 @@ else dest[fieldname] = value end - + -- ...everything else is just copied as-is else dest[fieldname] = value @@ -198,8 +198,8 @@ end end end - - + + -- -- Merges the settings from a solution's or project's list of configuration blocks, @@ -228,33 +228,33 @@ if pltname ~= "Native" then key = key .. pltname end - + -- add the configuration and platform to the block filter terms terms.config = (cfgname or ""):lower() terms.platform = pltname:lower() - + -- build the configuration base by merging the solution and project level settings local cfg = {} mergeobject(cfg, basis[key]) adjustpaths(obj.location, cfg) mergeobject(cfg, obj) - + -- add `kind` to the filter terms - if (cfg.kind) then + if (cfg.kind) then terms['kind']=cfg.kind:lower() end - + -- now add in any blocks that match the filter terms for _, blk in ipairs(obj.blocks) do if (premake.iskeywordsmatch(blk.keywords, terms))then mergeobject(cfg, blk) - if (cfg.kind and not cfg.terms.kind) then + if (cfg.kind and not cfg.terms.kind) then cfg.terms['kind'] = cfg.kind:lower() terms['kind'] = cfg.kind:lower() end end end - + -- package it all up and add it to the result set cfg.name = cfgname cfg.platform = pltname @@ -263,9 +263,9 @@ end dest[key] = cfg end - - - + + + -- -- Collapse a solution or project object down to a canonical set of configuration settings, -- keyed by configuration block/platform pairs, and taking into account the current @@ -283,15 +283,15 @@ local function collapse(obj, basis) local result = {} basis = basis or {} - + -- find the solution, which contains the configuration and platform lists local sln = obj.solution or obj - -- build a set of configuration filter terms; only those configuration blocks + -- build a set of configuration filter terms; only those configuration blocks -- with a matching set of keywords will be included in the merged results local terms = premake.getactiveterms() - -- build a project-level configuration. + -- build a project-level configuration. merge(result, obj, basis, terms)--this adjusts terms -- now build configurations for each build config/platform pair @@ -305,7 +305,7 @@ end end end - + return result end @@ -322,12 +322,12 @@ local function builduniquedirs() local num_variations = 4 - + -- Start by listing out each possible object directory for each configuration. -- Keep a count of how many times each path gets used across the session. local cfg_dirs = {} local hit_counts = {} - + for sln in premake.solution.each() do for _, prj in ipairs(sln.projects) do for _, cfg in pairs(prj.__configs) do @@ -338,7 +338,7 @@ dirs[3] = path.join(dirs[2], cfg.name) dirs[4] = path.join(dirs[3], cfg.project.name) cfg_dirs[cfg] = dirs - + -- configurations other than the root should bias toward a more -- description path, including the platform or config name local start = iif(cfg.name, 2, 1) @@ -350,7 +350,7 @@ end end end - + -- Now assign an object directory to each configuration, skipping those -- that are in use somewhere else in the session for sln in premake.solution.each() do @@ -366,10 +366,10 @@ cfg.objectsdir = path.getrelative(cfg.location, dir) end end - end - + end + end - + -- @@ -393,24 +393,24 @@ end end - end + end end - + local function getCfgKind(cfg) if(cfg.kind) then return cfg.kind; end - + if(cfg.project.__configs[""] and cfg.project.__configs[""].kind) then return cfg.project.__configs[""].kind; end - + return nil end - + local function getprojrec(dstArray, foundList, cfg, cfgname, searchField, bLinkage) if(not cfg) then return end - + local foundUsePrjs = {}; for _, useName in ipairs(cfg[searchField]) do local testName = useName:lower(); @@ -426,7 +426,7 @@ end end end - + --Must connect to a usage project. if(theUseProj) then foundList[testName] = true; @@ -441,7 +441,7 @@ end end end - + for _, usePrj in ipairs(foundUsePrjs) do --Links can only recurse through static libraries. if((searchField ~= "links") or @@ -451,7 +451,7 @@ end end end - + -- -- This function will recursively get all projects that the given configuration has in its "uses" -- field. The return values are a list of tables. Each table in that list contains the following: @@ -469,27 +469,27 @@ local dstArray = {}; local foundList = {}; foundList[cfg.project.name:lower()] = true; - + --First, follow the uses recursively. getprojrec(dstArray, foundList, cfg, cfgname, "uses", false); - + --Next, go through all of the usage projects and recursively get their links. --But only if they're not already there. Get the links as linkage-only. local linkArray = {}; for prjName, prjEntry in pairs(dstArray) do - getprojrec(linkArray, foundList, prjEntry.usageProj.__configs[cfgname], cfgname, + getprojrec(linkArray, foundList, prjEntry.usageProj.__configs[cfgname], cfgname, "links", true); end - + --Copy from linkArray into dstArray. for prjName, prjEntry in pairs(linkArray) do dstArray[prjName] = prjEntry; end - + return dstArray; end - - + + local function isnameofproj(cfg, strName) local sln = cfg.project.solution; local strTest = strName:lower(); @@ -498,18 +498,18 @@ return true; end end - + return false; end - - + + -- -- Copies the field from dstCfg to srcCfg. -- local function copydependentfield(srcCfg, dstCfg, strSrcField) local srcField = premake.fields[strSrcField]; local strDstField = strSrcField; - + if type(srcCfg[strSrcField]) == "table" then --handle paths. if (srcField.kind == "dirlist" or srcField.kind == "filelist") and @@ -543,8 +543,8 @@ end end end - - + + -- -- This function will take the list of project entries and apply their usage project data -- to the given configuration. It will copy compiling information for the projects that are @@ -552,15 +552,15 @@ -- the source project is not a static library. It won't copy linking information -- if the project is in this solution; instead it will add that project to the configuration's -- links field, expecting that Premake will handle the rest. - -- + -- local function copyusagedata(cfg, cfgname, linkToProjs) local myPrj = cfg.project; local bIsStaticLib = (getCfgKind(cfg) == "StaticLib"); - + for prjName, prjEntry in pairs(linkToProjs) do local srcPrj = prjEntry.usageProj; local srcCfg = srcPrj.__configs[cfgname]; - + for name, field in pairs(premake.fields) do if(srcCfg[name]) then if(field.usagecopy) then @@ -577,7 +577,7 @@ end end end - + if((not bIsStaticLib) and prjEntry.proj) then table.insert(cfg.links, prjEntry.proj.name); end @@ -588,9 +588,9 @@ -- -- Main function, controls the process of flattening the configurations. -- - + function premake.bake.buildconfigs() - + -- convert project path fields to be relative to project location for sln in premake.solution.each() do for _, prj in ipairs(sln.projects) do @@ -602,9 +602,9 @@ end sln.location = sln.location or sln.basedir end - + -- collapse configuration blocks, so that there is only one block per build - -- configuration/platform pair, filtered to the current operating environment + -- configuration/platform pair, filtered to the current operating environment for sln in premake.solution.each() do local basis = collapse(sln) for _, prj in ipairs(sln.projects) do @@ -613,8 +613,8 @@ bake.postprocess(prj, cfg) end end - end - + end + -- This loop finds the projects that a configuration is connected to -- via its "uses" field. It will then copy any usage project information from that -- usage project to the configuration in question. @@ -627,7 +627,7 @@ end end end - end + end -- Remove all usage projects. for sln in premake.solution.each() do @@ -637,20 +637,20 @@ table.insert(removeList, 1, index); --Add in reverse order. end end - + for _, index in ipairs(removeList) do table.remove(sln.projects, index); end end - + -- assign unique object directories to each configuration builduniquedirs() - + -- walk it again and build the targets and unique directories buildtargets(cfg) end - + -- -- Post-process a project configuration, applying path fix-ups and other adjustments @@ -666,10 +666,10 @@ cfg.project = prj cfg.shortname = premake.getconfigname(cfg.name, cfg.platform, true) cfg.longname = premake.getconfigname(cfg.name, cfg.platform) - + -- set the project location, if not already set cfg.location = cfg.location or cfg.basedir - + -- figure out the target system local platform = premake.platforms[cfg.platform] if platform.iscrosscompiler then @@ -677,12 +677,12 @@ else cfg.system = os.get() end - + -- adjust the kind as required by the target system if cfg.kind == "SharedLib" and platform.nosharedlibs then cfg.kind = "StaticLib" end - + -- remove excluded files from the file list local files = { } for _, fname in ipairs(cfg.files) do @@ -691,14 +691,14 @@ excluded = (fname == exclude) if (excluded) then break end end - + if (not excluded) then table.insert(files, fname) end end cfg.files = files - -- fixup the data + -- fixup the data for name, field in pairs(premake.fields) do -- re-key flag fields for faster lookups if field.isflags then diff --git a/src/base/cmdline.lua b/src/base/cmdline.lua index 5bfe02d..0dda002 100644 --- a/src/base/cmdline.lua +++ b/src/base/cmdline.lua @@ -9,7 +9,7 @@ -- Built-in command line options -- - newoption + newoption { trigger = "cc", value = "VALUE", @@ -38,13 +38,13 @@ value = "FILE", description = "Read FILE as a Premake script; default is 'premake4.lua'" } - + newoption { trigger = "help", description = "Display this information" } - + newoption { trigger = "os", @@ -75,14 +75,14 @@ { "xbox360", "Xbox 360 (experimental)" }, } } - + newoption { trigger = "scripts", value = "path", description = "Search for additional scripts on the given path" } - + newoption { trigger = "version", @@ -94,4 +94,3 @@ trigger = "generate_user", description = "Generate (and remove when cleaning) .user VStudio files" } -
\ No newline at end of file diff --git a/src/base/config.lua b/src/base/config.lua index 4be034a..949da97 100644 --- a/src/base/config.lua +++ b/src/base/config.lua @@ -11,7 +11,7 @@ local config = premake.config --- +-- -- Determine if a configuration represents a "debug" or "release" build. -- This controls the runtime library selected for Visual Studio builds -- (and might also be useful elsewhere). @@ -32,10 +32,10 @@ -- -- Determines if this configuration can be linked incrementally. --- - +-- + function premake.config.isincrementallink(cfg) - if cfg.kind == "StaticLib" + if cfg.kind == "StaticLib" or config.isoptimizedbuild(cfg.flags) or cfg.flags.NoIncrementalLink then return false @@ -45,11 +45,11 @@ -- --- Determine if this configuration uses one of the optimize flags. --- Optimized builds get different treatment, such as full linking +-- Determine if this configuration uses one of the optimize flags. +-- Optimized builds get different treatment, such as full linking -- instead of incremental. -- - + function premake.config.isoptimizedbuild(flags) return flags.Optimize or flags.OptimizeSize or flags.OptimizeSpeed end diff --git a/src/base/globals.lua b/src/base/globals.lua index 99c8ac7..a0253b9 100644 --- a/src/base/globals.lua +++ b/src/base/globals.lua @@ -3,43 +3,43 @@ -- Global tables and variables, replacements and extensions to Lua's global functions. -- Copyright (c) 2002-2009 Jason Perkins and the Premake project -- - - + + -- A top-level namespace for support functions premake = { } - + -- The list of supported platforms; also update list in cmdline.lua - premake.platforms = + premake.platforms = { - Native = - { + Native = + { cfgsuffix = "", }, - x32 = - { + x32 = + { cfgsuffix = "32", }, - x64 = - { + x64 = + { cfgsuffix = "64", }, - Universal = - { + Universal = + { cfgsuffix = "univ", }, - Universal32 = - { + Universal32 = + { cfgsuffix = "univ32", }, - Universal64 = - { + Universal64 = + { cfgsuffix = "univ64", }, - PS3 = - { + PS3 = + { cfgsuffix = "ps3", iscrosscompiler = true, nosharedlibs = true, @@ -51,8 +51,8 @@ iscrosscompiler = true, namestyle = "PS3", }, - Xbox360 = - { + Xbox360 = + { cfgsuffix = "xbox360", iscrosscompiler = true, namestyle = "windows", @@ -83,14 +83,14 @@ -- use the absolute path to the script file, to avoid any file name -- ambiguity if an error should arise _SCRIPT = path.getabsolute(fname) - + -- switch the working directory to the new script location local newcwd = path.getdirectory(_SCRIPT) os.chdir(newcwd) - + -- run the chunk. How can I catch variable return values? local a, b, c, d, e, f = builtin_dofile(_SCRIPT) - + -- restore the previous working directory when done _SCRIPT = oldfile os.chdir(oldcwd) @@ -110,9 +110,9 @@ return falseval end end - - - + + + -- -- A shortcut for including another "premake4.lua" file, often used for projects. -- @@ -131,14 +131,14 @@ print(string.format(msg, unpack(arg))) end - - + + -- -- An extension to type() to identify project object types by reading the -- "__type" field from the metatable. -- - local builtin_type = type + local builtin_type = type function type(t) local mt = getmetatable(t) if (mt) then @@ -148,4 +148,3 @@ end return builtin_type(t) end -
\ No newline at end of file diff --git a/src/base/help.lua b/src/base/help.lua index 2235826..7998ff3 100644 --- a/src/base/help.lua +++ b/src/base/help.lua @@ -6,7 +6,7 @@ function premake.showhelp() - + -- display the basic usage printf("Premake %s, a build script generator", _PREMAKE_VERSION) printf(_PREMAKE_COPYRIGHT) @@ -15,7 +15,7 @@ printf("Usage: premake4 [options] action [arguments]") printf("") - + -- display all options printf("OPTIONS") printf("") @@ -24,8 +24,8 @@ local description = option.description if (option.value) then trigger = trigger .. "=" .. option.value end if (option.allowed) then description = description .. "; one of:" end - - printf(" --%-15s %s", trigger, description) + + printf(" --%-15s %s", trigger, description) if (option.allowed) then for _, value in ipairs(option.allowed) do printf(" %-14s %s", value[1], value[2]) @@ -45,7 +45,7 @@ -- see more printf("For additional information, see http://industriousone.com/premake") - + end diff --git a/src/base/io.lua b/src/base/io.lua index b694adf..164647e 100644 --- a/src/base/io.lua +++ b/src/base/io.lua @@ -6,16 +6,16 @@ -- --- Prepare to capture the output from all subsequent calls to io.printf(), +-- Prepare to capture the output from all subsequent calls to io.printf(), -- used for automated testing of the generators. -- function io.capture() io.captured = '' end - - - + + + -- -- Returns the captured text and stops capturing. -- @@ -25,8 +25,8 @@ io.captured = nil return captured end - - + + -- -- Open an overload of the io.open() function, which will create any missing -- subdirectories in the filename if "mode" is set to writeable. @@ -48,7 +48,7 @@ --- +-- -- A shortcut for printing formatted output to an output stream. -- @@ -66,7 +66,7 @@ else s = string.format(msg, unpack(arg)) end - + if io.captured then io.captured = io.captured .. s .. io.eol else diff --git a/src/base/solution.lua b/src/base/solution.lua index 5094ede..5d69c5f 100644 --- a/src/base/solution.lua +++ b/src/base/solution.lua @@ -25,12 +25,12 @@ -- add to master list keyed by both name and index table.insert(premake.solution.list, sln) premake.solution.list[name] = sln - + -- attach a type descriptor setmetatable(sln, { __type="solution" }) sln.name = name - sln.basedir = os.getcwd() + sln.basedir = os.getcwd() sln.projects = { } sln.blocks = { } sln.configurations = { } @@ -106,7 +106,7 @@ -- the global (not configuration specific) settings collapsed local prj = sln.projects[idx] local cfg = premake.getconfig(prj) - + -- root configuration doesn't have a name; use the project's cfg.name = prj.name return cfg diff --git a/src/base/string.lua b/src/base/string.lua index 56fae4d..4163f72 100644 --- a/src/base/string.lua +++ b/src/base/string.lua @@ -8,7 +8,7 @@ -- -- Returns an array of strings, each of which is a substring of s -- formed by splitting on boundaries formed by `pattern`. --- +-- function string.explode(s, pattern, plain) if (pattern == '') then return false end @@ -21,7 +21,7 @@ table.insert(arr, s:sub(pos)) return arr end - + -- @@ -36,7 +36,7 @@ until (not next) if (curr > 0) then return curr - end + end end diff --git a/src/base/table.lua b/src/base/table.lua index 3076cb0..93cae03 100644 --- a/src/base/table.lua +++ b/src/base/table.lua @@ -3,7 +3,7 @@ -- Additions to Lua's built-in table functions. -- Copyright (c) 2002-2008 Jason Perkins and the Premake project -- - + -- -- Returns true if the table contains the specified value. @@ -17,8 +17,8 @@ end return false end - - + + -- -- Enumerates an array of objects and returns a new table containing -- only the value of one particular field. @@ -31,8 +31,8 @@ end return result end - - + + -- -- Flattens a hierarchy of tables into a single array containing all @@ -41,7 +41,7 @@ function table.flatten(arr) local result = { } - + local function flatten(arr) for _, v in ipairs(arr) do if type(v) == "table" then @@ -51,7 +51,7 @@ end end end - + flatten(arr) return result end @@ -75,7 +75,7 @@ -- -- Inserts a value of array of values into a table. If the value is --- itself a table, its contents are enumerated and added instead. So +-- itself a table, its contents are enumerated and added instead. So -- these inputs give these outputs: -- -- "x" -> { "x" } @@ -154,7 +154,7 @@ end return result end - + -- @@ -177,5 +177,4 @@ end return result end - -
\ No newline at end of file + diff --git a/src/base/tree.lua b/src/base/tree.lua index 73c85af..d4947f8 100644 --- a/src/base/tree.lua +++ b/src/base/tree.lua @@ -43,7 +43,7 @@ if p == "." then return tr end - + -- Look for the immediate parent for this new node, creating it if necessary. -- Recurses to create as much of the tree as necessary. local parentnode = tree.add(tr, path.getdirectory(p), onaddfunc) @@ -53,7 +53,7 @@ if childname == ".." then return parentnode end - + -- Create the child if necessary. If two children with the same name appear -- at the same level, make sure they have the same path to prevent conflicts -- i.e. ../Common and ../../Common can both appear at the top of the tree @@ -66,7 +66,7 @@ onaddfunc(childnode) end end - + return childnode end @@ -176,32 +176,32 @@ -- process an individual node donode = function(node, fn, depth) - if node.isremoved then - return + if node.isremoved then + return end - if fn.onnode then - fn.onnode(node, depth) + if fn.onnode then + fn.onnode(node, depth) end - + if #node.children > 0 then if fn.onbranchenter then fn.onbranchenter(node, depth) end - if fn.onbranch then - fn.onbranch(node, depth) + if fn.onbranch then + fn.onbranch(node, depth) end dochildren(node, fn, depth + 1) if fn.onbranchexit then fn.onbranchexit(node, depth) end else - if fn.onleaf then - fn.onleaf(node, depth) + if fn.onleaf then + fn.onleaf(node, depth) end end end - + -- this goofy iterator allows nodes to be removed during the traversal dochildren = function(parent, fn, depth) local i = 1 @@ -213,7 +213,7 @@ end end end - + -- set a default initial traversal depth, if one wasn't set if not initialdepth then initialdepth = 0 diff --git a/src/base/validate.lua b/src/base/validate.lua index 0274186..82f235f 100644 --- a/src/base/validate.lua +++ b/src/base/validate.lua @@ -6,32 +6,32 @@ -- --- Performs a sanity check of all of the solutions and projects +-- Performs a sanity check of all of the solutions and projects -- in the session to be sure they meet some minimum requirements. -- function premake.checkprojects() local action = premake.action.current() - + for sln in premake.solution.each() do - + -- every solution must have at least one project if (#sln.projects == 0) then return nil, "solution '" .. sln.name .. "' needs at least one project" end - + -- every solution must provide a list of configurations if (#sln.configurations == 0) then return nil, "solution '" .. sln.name .. "' needs configurations" end - + for prj in premake.solution.eachproject(sln) do -- every project must have a language if (not prj.language) then return nil, "project '" ..prj.name .. "' needs a language" end - + -- and the action must support it if (action.valid_languages) then if (not table.contains(action.valid_languages, prj.language)) then @@ -39,29 +39,29 @@ end end - for cfg in premake.eachconfig(prj) do - + for cfg in premake.eachconfig(prj) do + -- every config must have a kind if (not cfg.kind) then return nil, "project '" ..prj.name .. "' needs a kind in configuration '" .. cfg.name .. "'" end - + -- and the action must support it if (action.valid_kinds) then if (not table.contains(action.valid_kinds, cfg.kind)) then return nil, "the " .. action.shortname .. " action does not support " .. cfg.kind .. " projects" end end - + end - + -- some actions have custom validation logic if action.oncheckproject then action.oncheckproject(prj) end - + end - end + end return true end @@ -73,10 +73,10 @@ function premake.checktools() local action = premake.action.current() - if (not action.valid_tools) then - return true + if (not action.valid_tools) then + return true end - + for tool, values in pairs(action.valid_tools) do if (_OPTIONS[tool]) then if (not table.contains(values, _OPTIONS[tool])) then @@ -86,6 +86,6 @@ _OPTIONS[tool] = values[1] end end - + return true end |