Added new project types:utility,blank

blank = does nothing / not a project. will use for extensions and including subprojects later
utility = performs pre/post build commands only
completely untested. just noticed this was missing
This commit is contained in:
Reece Wilson 2021-05-21 20:15:38 +01:00
parent 615bcb53b9
commit 48ab27d1f6
2 changed files with 63 additions and 33 deletions

View File

@ -1,4 +1,4 @@
local project = require("project")
local auProject = require("project")
function JsonProcessor(info)
local result, err = json.decode(io.readfile(info.path .. "/Aurora.json"))
@ -25,23 +25,34 @@ function JsonProcessor(info)
forEach(result.include, handleUserJsonInclude)
end
local tryAddDefine = function(aaa)
if (aaa) then
defines(aaa)
end
end
local handleInclude = function(this)
local result = this.result
if (result.type:lower() == "aurora") then
includedirs (info.path .. "/Include")
elseif (result.type:lower() == "lazy_free") then
elseif (result.type:lower() == "lazy_free") then
handleJSONInclude(result)
elseif (result.type:lower() == "root") then
elseif (result.type:lower() == "root") then
includedirs (info.path)
handleJSONInclude(result)
elseif (result.type:lower() == "pair") then
elseif (result.type:lower() == "pair") then
includedirs (info.srcInclude)
handleJSONInclude(result)
elseif (result.type:lower() == "generic") then
elseif (result.type:lower() == "generic") then
handleJSONInclude(result)
elseif (result.type:lower() == "empty") then
elseif (result.type:lower() == "empty") then
handleJSONInclude(result)
elseif ((result.type:lower() == "utility") or (result.type:lower() == "null")) then
return
end
tryAddDefine(result.defines)
end
local handlePostBuild = function(obj)
@ -71,11 +82,21 @@ function JsonProcessor(info)
local handleLink = function(this)
dependson(this.info.name)
if ((type:lower() == "utility") or (type:lower() == "null")) then
return
end
links(this.info.name)
handleDllImportMaybe(this)
end
local handleReference = function(this)
local type = this.result.type
if ((type:lower() == "utility") or (type:lower() == "null")) then
return
end
local cur = getProjectInfo(getCurrentProjectName())
if (cur and cur.isShared) then
@ -89,44 +110,50 @@ function JsonProcessor(info)
handleInclude(this)
end
local tryAddDefine = function (aaa)
if (aaa) then
defines(aaa)
end
end
local handleProcess = function (a)
local result = a.result
local name = a.info.name
local path = a.info.path
local isBlank = false
if (result.type:lower() == "aurora") then
local srcPath = path .. "/Source"
local incPath = path .. "/Include"
project(name, a.info.projectType, {srcPath}, {srcPath, incPath}, a.info.out, path)
auProject(name, a.info.projectType, {srcPath}, {srcPath, incPath}, a.info.out, path)
elseif (result.type:lower() == "lazy_free") then
project(name, a.info.projectType, {path .. "/*.*"}, {path .. "/"}, a.info.out, path)
auProject(name, a.info.projectType, {path .. "/*.*"}, {path .. "/"}, a.info.out, path)
elseif (result.type:lower() == "root") then
project(name, a.info.projectType, {path .. "/**.*"}, {path .. "/"}, a.info.out, path)
auProject(name, a.info.projectType, {path .. "/**.*"}, {path .. "/"}, a.info.out, path)
elseif (result.type:lower() == "pair") then
project(name, a.info.projectType, {path .. "/" .. result.srcSource .. "/**.*"}, {path .. "/" .. result.srcInclude}, a.info.out, path)
auProject(name, a.info.projectType, {path .. "/" .. result.srcSource .. "/**.*"}, {path .. "/" .. result.srcInclude}, a.info.out, path)
elseif (result.type:lower() == "generic") then
project(name, a.info.projectType, nil, nil, a.info.out, path)
print("type 'generic' is deprecated, use 'empty' instead")
print("'generic' will soon be replaced by the behaviour of 'aurora'")
auProject(name, a.info.projectType, nil, nil, a.info.out, path)
elseif (result.type:lower() == "empty") then
project(name, a.info.projectType, nil, nil, a.info.out, path)
elseif (result.type:lower() == "empty") then
auProject(name, a.info.projectType, nil, nil, a.info.out, path)
elseif (result.type:lower() == "utility") then
project(name)
kind "utility"
isBlank = true
elseif (result.type:lower() == "null") then
return
else
print "invalid project type"
print "invalid auProject type"
os.exit()
end
handleJSONInclude(result) -- include project public headers, do not use handleInclude, that could reinclude a header included in `project`
handleJSONInclude(result) -- include auProject public headers, do not use handleInclude, that could reinclude a header included in `project`
-- that could potentially fuck with #include_next
local handleFeature = function(feature)
@ -221,20 +248,23 @@ function JsonProcessor(info)
files(path .. "/" .. source)
end
forEach(result.depends, handleDepends, info.path)
forEach(result.features, handleFeature, info.path)
forEach(result.excludes, handleExcludes, info.path)
forEach(result.sources, handleSources, info.path)
forEach(result["soft-depends"], handleSoftDepends)
forEach(result.require, handleRequire)
if (a.info.projectType:lower() == "sharedlib") then
tryAddDefine(result.dllexport)
end
if (not isBlank) then
forEach(result.features, handleFeature, info.path)
forEach(result.excludes, handleExcludes, info.path)
forEach(result.sources, handleSources, info.path)
forEach(result.depends, handleDepends, info.path)
forEach(result["soft-depends"], handleSoftDepends)
tryAddDefine(result.impdefines)
if (a.info.projectType:lower() == "sharedlib") then
tryAddDefine(result.dllexport)
end
defines(result.defines)
tryAddDefine(result.impdefines)
defines(result.defines)
end
forEach(result.actions, handleAction, info.path)
forEach(result.postBuild, handlePostBuild, info.path)
@ -247,7 +277,7 @@ function JsonProcessor(info)
local subinfo = {
namespace = info.namespace,
path = info.path .. "/" .. subproj.path,
projectType = subproj.type,
projectType = subproj.projectType,
out = info.out,
name = nil,
translations = info.translations

View File

@ -7,7 +7,7 @@
"type":
{
"type": "string",
"enum": ["pair", "empty", "root", "lazy_free"],
"enum": ["pair", "empty", "root", "lazy_free", "utility", "blank"],
"description": "https://pastebin.com/ThE2t9EJ"
},
"srcSource":