[*] Mo work
This commit is contained in:
parent
2709754718
commit
3e3dade158
@ -2,7 +2,7 @@ local isUnixPremake = os.host() == "linux" or os.host() == "mac"
|
||||
local isWin32 = os.host() == "windows"
|
||||
local isCmakeToolChain = false
|
||||
|
||||
local getExeFileExt = function()
|
||||
local function getExeFileExt()
|
||||
if isWin32 then
|
||||
return ".exe"
|
||||
end
|
||||
@ -10,7 +10,7 @@ local getExeFileExt = function()
|
||||
return ""
|
||||
end
|
||||
|
||||
local testPath = function(cwd, exe, ext)
|
||||
local function testPath(cwd, exe, ext)
|
||||
local path = cwd .. "/" .. exe .. ext
|
||||
if (not os.isfile(path)) then
|
||||
return nil
|
||||
|
@ -14,6 +14,7 @@ local triggers =
|
||||
"binscript",
|
||||
"luascript",
|
||||
"cwd",
|
||||
"cmd",
|
||||
"settings",
|
||||
"project_name",
|
||||
"project_arch",
|
||||
@ -51,18 +52,29 @@ if (cwd) then
|
||||
os.chdir(projRoot)
|
||||
else
|
||||
os.chdir(Aurora.Settings.sAbsRoot)
|
||||
end
|
||||
|
||||
local binScript = _OPTIONS["binscript"]
|
||||
if (binScript) then
|
||||
os.exit(os.execute(path.join(Aurora.Settings.sAbsRoot, binScript)))
|
||||
end
|
||||
end
|
||||
|
||||
local args = _OPTIONS["additional"]
|
||||
if (args) then
|
||||
args = base64.decode(args)
|
||||
end
|
||||
|
||||
local binSuffx = ""
|
||||
if (args) then
|
||||
binSuffx = " " .. binSuffx
|
||||
end
|
||||
|
||||
local binScript = _OPTIONS["binscript"]
|
||||
if (binScript) then
|
||||
os.exit(os.execute(path.join(Aurora.Settings.sAbsRoot, binScript) .. binSuffx))
|
||||
end
|
||||
|
||||
|
||||
local cmd = _OPTIONS["cmd"]
|
||||
if (cmd) then
|
||||
os.exit(os.execute(cmd .. binSuffx))
|
||||
end
|
||||
|
||||
local projName = _OPTIONS["project_name"]
|
||||
local projType = _OPTIONS["project_type"]
|
||||
local projPlatform = _OPTIONS["project_platform"]
|
||||
|
@ -0,0 +1,3 @@
|
||||
return {
|
||||
project = auRequire("Core/JSON/jsonProject")
|
||||
}
|
@ -0,0 +1,203 @@
|
||||
|
||||
local function __pushFilter(obj, key, callback, expandArray)
|
||||
if (not obj) then
|
||||
return
|
||||
end
|
||||
|
||||
local function runCallbackFe(value, key, callback, expandArray, isArray)
|
||||
if (expandArray and isArray) then
|
||||
auForEach(value, function(val)
|
||||
__pushFilter(val, key, callback, false)
|
||||
end)
|
||||
else
|
||||
callback(value)
|
||||
end
|
||||
end
|
||||
|
||||
if (type(obj) == "table") then
|
||||
local value = nil
|
||||
local isArray = false
|
||||
|
||||
if (auIsArray(obj)) then
|
||||
value = obj
|
||||
isArray = true
|
||||
else
|
||||
value = obj[key]
|
||||
|
||||
if (not value) then
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
if (obj.filter) then
|
||||
filter(auFilterOf(obj.filter))
|
||||
end
|
||||
|
||||
runCallbackFe(value, key, callback, expandArray, isArray)
|
||||
|
||||
if (obj.filter) then
|
||||
filter {}
|
||||
end
|
||||
else
|
||||
if (expandArray) then -- fast path. we can skip this, if false. the if and statment doesnt optimize away the auIsArray anymore
|
||||
runCallbackFe(obj, key, callback, true, auIsArray(obj))
|
||||
else
|
||||
callback(obj)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function __handleIncludeCallback(thisProject, includeProject, callback)
|
||||
|
||||
if (type(project) == "table")
|
||||
auForEachKV(project, function(projectName, soft)
|
||||
if (type(projectName) == "number") then
|
||||
projectName = soft
|
||||
soft = false
|
||||
end
|
||||
|
||||
if (type(projectName) ~= "string") then
|
||||
auFatal("what is my project name?")
|
||||
end
|
||||
|
||||
callback(projectName, not soft)
|
||||
|
||||
end)
|
||||
else
|
||||
if (type(project) ~= "string") then
|
||||
auFatal("what is my project name? [2]")
|
||||
end
|
||||
|
||||
callback(projectName, true)
|
||||
end
|
||||
end
|
||||
|
||||
local function __translate(project, key)
|
||||
|
||||
if (project.info.translations) then
|
||||
local override = project.info.translations[key]
|
||||
if (override) then
|
||||
key = override
|
||||
end
|
||||
end
|
||||
|
||||
return key
|
||||
end
|
||||
|
||||
local function auBlockProjectKeyDefines(project, value)
|
||||
__pushFilter(value, "value", defines)
|
||||
end
|
||||
|
||||
local function auBlockProjectKeyIncludes(project, value)
|
||||
|
||||
end
|
||||
|
||||
local function auBlockProjectKeyFeatures(project, value)
|
||||
__pushFilter(obj, "feature", auAddFeature, true)
|
||||
end
|
||||
|
||||
local function auBlockProjectKeyExcludes(project, value)
|
||||
|
||||
end
|
||||
|
||||
local function auBlockProjectKeySources(project, value)
|
||||
|
||||
end
|
||||
|
||||
local function auBlockProjectKeySourcePaths(project, value)
|
||||
|
||||
end
|
||||
|
||||
local function auBlockProjectKeyEval(project, value, tasksMask)
|
||||
tasksMask:remove("eval")
|
||||
end
|
||||
|
||||
local function auBlockProjectKeyImplDefines(project, value)
|
||||
|
||||
end
|
||||
|
||||
local function auBlockProjectKeyImplIncludes(project, value)
|
||||
|
||||
end
|
||||
|
||||
local function auBlockProjectKeyClangIgnore(project, value)
|
||||
|
||||
end
|
||||
|
||||
local function auBlockProjectKeyMSVCIgnore(project, value)
|
||||
|
||||
end
|
||||
|
||||
local function auBlockProjectKeyDepends(project, value)
|
||||
|
||||
end
|
||||
|
||||
local function auBlockProjectKeyLinks(obj)
|
||||
__pushFilter(obj, "value", links)
|
||||
end
|
||||
|
||||
local function auHeaderProjectKeyIncludeDepends(thisProject, includeProject)
|
||||
__handleIncludeCallback(jsonProcessor, includeProject, function(projectName, hard)
|
||||
auIncludeProject(__translate(thisProject, projectName), not hard)
|
||||
end)
|
||||
end
|
||||
|
||||
local function auHeaderProjectKeyLinkDepends(thisProject, includeProject)
|
||||
__handleIncludeCallback(jsonProcessor, includeProject, function(projectName, hard)
|
||||
auLinkProject(__translate(thisProject, projectName), not hard)
|
||||
end)
|
||||
end
|
||||
|
||||
local function auHeaderProjectKeyRequire(project, script)
|
||||
auUserRequire(script)
|
||||
end
|
||||
|
||||
local auProjectHeaderHandlers =
|
||||
{
|
||||
require = auHeaderProjectKeyRequire,
|
||||
linkDepends = auHeaderProjectKeyLinkDepends
|
||||
includeDepends = auHeaderProjectKeyIncludeDepends
|
||||
}
|
||||
|
||||
local auProjectBlockHandlers =
|
||||
{
|
||||
links = auBlockProjectKeyLinks,
|
||||
sourcePaths = auBlockProjectKeySourcePaths,
|
||||
sources = auBlockProjectKeySources,
|
||||
excludes = auBlockProjectKeyExcludes,
|
||||
eval = auBlockProjectKeyEval,
|
||||
impDefines = auBlockProjectKeyImplDefines,
|
||||
implDefines = auBlockProjectKeyImplDefines,
|
||||
implementationDefines = auBlockProjectKeyImplDefines,
|
||||
impInclude = auBlockProjectKeyImplIncludes,
|
||||
implInclude = auBlockProjectKeyImplIncludes,
|
||||
clangIgnore = auBlockProjectKeyClangIgnore,
|
||||
msvcIgnore = auBlockProjectKeyMSVCIgnore,
|
||||
depends = auBlockProjectKeyDepends
|
||||
}
|
||||
|
||||
local kGenericTasks = {"eval", "features", "sourcePaths", "sources", "excludes",
|
||||
"impDefines", "implDefines", "implementationDefines",
|
||||
"impInclude", "implInclude", "implInclude", "clangIgnore",
|
||||
"msvcIgnore", "depends" }
|
||||
|
||||
|
||||
local function __pRunTasks(object, tasks)
|
||||
auForEachKV(object, function(key, value)
|
||||
if (not auContains(tasks, key)) then
|
||||
return
|
||||
end
|
||||
|
||||
auProjectBlockHandlers[key](object, value, tasks)
|
||||
end)
|
||||
end
|
||||
|
||||
local function __pRunLinkTasks(object)
|
||||
__pRunTasks(object, {"eval", "links", "depends"})
|
||||
end
|
||||
|
||||
local function __pRunMainTasks(object)
|
||||
__pRunTasks(object, kGenericTasks)
|
||||
end
|
||||
|
||||
return auCopyTables(auProjectHeaderHandlers, auProjectBlockHandlers)
|
@ -7,6 +7,16 @@ function auAddBuildAction(...)
|
||||
buildAction(...)
|
||||
end
|
||||
|
||||
function auAddBuildAction(...)
|
||||
local type = {
|
||||
-- stage: pre, post
|
||||
-- filter: ...
|
||||
-- lua/bin/targetName/command: relative path - lua script; relative path - executable; project name; command line
|
||||
-- args: lua private passthrough; binary or target name command args
|
||||
-- cwd: sln(default),prj
|
||||
}
|
||||
end
|
||||
|
||||
function auStart()
|
||||
if (_auStart) then return end
|
||||
_auStart = true
|
||||
@ -19,6 +29,7 @@ function auStartSolution(sln)
|
||||
end
|
||||
|
||||
function auStartProject(project)
|
||||
auStart()
|
||||
auRequire("Core").project.start(project)
|
||||
end
|
||||
|
||||
|
@ -2,6 +2,16 @@ function auEnum(...)
|
||||
return nil
|
||||
end
|
||||
|
||||
function auBuildActionO()
|
||||
return {
|
||||
stage = "post" -- pre, post,
|
||||
-- filter: ...,
|
||||
-- lua/bin/targetName/command: relative path - lua script; relative path - executable; project name; command line
|
||||
-- args: lua private passthrough; binary or target name command args
|
||||
cwd = "sln" -- sln, prj
|
||||
}
|
||||
end
|
||||
|
||||
function auProjectInfoO() -- extends auHeaderProject
|
||||
return auMergeTable(auHeaderProject(), {})
|
||||
end
|
||||
@ -34,6 +44,8 @@ end
|
||||
function auVisitO() -- extends auProjectInfoO
|
||||
return {
|
||||
translations = nil
|
||||
-- TODO: options
|
||||
-- TODO: null import shim
|
||||
}
|
||||
end
|
||||
|
||||
@ -74,14 +86,45 @@ function auHeaderProjectO()
|
||||
return {
|
||||
projectType = "ConsoleApp",
|
||||
name = "AuroraProject",
|
||||
namespace = ""
|
||||
namespace = "",
|
||||
require = nil -- := auHeaderProjectKeyRequire(...)
|
||||
}
|
||||
end
|
||||
|
||||
--
|
||||
|
||||
function auBlockProjectKeyDefines()
|
||||
local function __pushFilter(obj, key, callback)
|
||||
if (not obj) then
|
||||
return
|
||||
end
|
||||
|
||||
local value = obj[key]
|
||||
|
||||
if (not value) then
|
||||
return
|
||||
end
|
||||
|
||||
if (obj.filter) then
|
||||
filter(auFilterOf(obj.filter))
|
||||
end
|
||||
|
||||
callback(value)
|
||||
|
||||
if (obj.filter) then
|
||||
filter {}
|
||||
end
|
||||
end
|
||||
|
||||
local function __pushFilterString(obj, key, callback)
|
||||
if (type(obj) == "string") then
|
||||
callback(obj)
|
||||
else
|
||||
__pushFilter(obj, key, defines)
|
||||
end
|
||||
end
|
||||
|
||||
function auBlockProjectKeyDefines(obj)
|
||||
__pushFilterString(obj, "value", defines)
|
||||
end
|
||||
|
||||
function auBlockProjectKeyIncludes()
|
||||
@ -100,26 +143,32 @@ function auBlockProjectKeySources()
|
||||
|
||||
end
|
||||
|
||||
function auBlockProjectKeyLinks()
|
||||
function auBlockProjectKeyLinks(obj)
|
||||
__pushFilterString(obj, "value", links)
|
||||
end
|
||||
|
||||
function auHeaderProjectKeyIncludeDepends()
|
||||
|
||||
end
|
||||
|
||||
function auBlockProjectKeyIncludeDepends()
|
||||
function auHeaderProjectKeyIncludeSoftDepends()
|
||||
|
||||
end
|
||||
|
||||
function auBlockProjectKeyIncludeSoftDepends()
|
||||
function auHeaderProjectKeyLinkDepends()
|
||||
|
||||
end
|
||||
|
||||
function auBlockProjectKeyLinkDepends()
|
||||
function auHeaderProjectKeyLinkSoftDepends()
|
||||
|
||||
end
|
||||
|
||||
function auBlockProjectKeyLinkSoftDepends()
|
||||
|
||||
function auHeaderProjectKeyRequire(script)
|
||||
auUserRequire(script)
|
||||
end
|
||||
|
||||
|
||||
-- Root JSON element and sub-documents
|
||||
function auBlockProjectO()
|
||||
|
||||
|
@ -7,6 +7,16 @@ function auMergeTable(dest, src)
|
||||
return dest
|
||||
end
|
||||
|
||||
function auCopyTables(...)
|
||||
local dest = {}
|
||||
local args = table.pack(...)
|
||||
for i=1, args.n do
|
||||
local tbl = args[i]
|
||||
auForEachKV(tbl, function(key, value) dest[key] = value end)
|
||||
end
|
||||
return dest
|
||||
end
|
||||
|
||||
-- Alternative to auConcatArrays
|
||||
-- Copies src into dest
|
||||
function auMergeArray(dest, src)
|
||||
|
@ -1,9 +1,19 @@
|
||||
function auUserRequire(path)
|
||||
local script = auGetSetting("sAbsRepoScripts")
|
||||
local script = "./" .. path
|
||||
|
||||
if (not os.isfile(script)) then
|
||||
return
|
||||
if (not script:ends(".lua")) then
|
||||
script = script .. ".lua"
|
||||
end
|
||||
|
||||
if (os.isfile(script)) then
|
||||
return auRequireAbs(script)
|
||||
end
|
||||
|
||||
script = auGetSetting("sAbsRepoScripts") .. path
|
||||
|
||||
if (os.isfile(script)) then
|
||||
return auRequireAbs(script)
|
||||
end
|
||||
|
||||
return auRequireAbs(script)
|
||||
return nil
|
||||
end
|
Loading…
Reference in New Issue
Block a user