summaryrefslogtreecommitdiff
path: root/xmake/core/project/project.lua
diff options
context:
space:
mode:
Diffstat (limited to 'xmake/core/project/project.lua')
-rw-r--r--xmake/core/project/project.lua37
1 files changed, 35 insertions, 2 deletions
diff --git a/xmake/core/project/project.lua b/xmake/core/project/project.lua
index 6c844e4f0..d57721d76 100644
--- a/xmake/core/project/project.lua
+++ b/xmake/core/project/project.lua
@@ -209,6 +209,9 @@ function project.interpreter()
"set_project"
, "set_version"
, "set_modes"
+ -- add_xxx
+ , "add_requires"
+ , "add_repositories"
-- target.set_xxx
, "target.set_kind"
, "target.set_strip"
@@ -235,8 +238,8 @@ function project.interpreter()
-- option.add_xxx
, "option.add_deps"
, "option.add_vectorexts"
- , "option.add_bindings" -- deprecated
- , "option.add_rbindings" -- deprecated
+ , "option.add_bindings" -- deprecated
+ , "option.add_rbindings" -- deprecated
}
, pathes =
{
@@ -633,6 +636,36 @@ function project.tasks()
return results, interp
end
+-- get packages
+function project.packages()
+
+ -- get it from cache first
+ if project._PACKAGES then
+ return project._PACKAGES, interp
+ end
+
+ -- get interpreter
+ local interp = project.interpreter()
+ assert(interp)
+
+ -- the project file is not found?
+ if not os.isfile(os.projectfile()) then
+ return {}, nil
+ end
+
+ -- load the tasks from the the project file and disable filter, we will process filter after a while
+ local results, errors = interp:load(os.projectfile(), "package", true, false)
+ if not results then
+ return nil, errors
+ end
+
+ -- save results to cache
+ project._PACKAGES = results
+
+ -- ok?
+ return results, interp
+end
+
-- get the mtimes
function project.mtimes()
return project.interpreter():mtimes()