diff options
| author | ruki <[email protected]> | 2018-11-28 22:33:34 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2018-11-28 09:21:28 +0800 |
| commit | 6b51f7f0a60dbe3553273fa8a450f8349a51e8e5 (patch) | |
| tree | 6fffd2087e1b9365ba991b5a62b735c0d0a2f69a /xmake/core/project/project.lua | |
| parent | dcb7e33ca401239c3690ced264c241f10195510a (diff) | |
fix on_load for require
Diffstat (limited to 'xmake/core/project/project.lua')
| -rw-r--r-- | xmake/core/project/project.lua | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/xmake/core/project/project.lua b/xmake/core/project/project.lua index b2e102833..241c6068f 100644 --- a/xmake/core/project/project.lua +++ b/xmake/core/project/project.lua @@ -524,7 +524,7 @@ function project._load_requires() alias = extrainfo.alias end - -- load it from cache first + -- load it from cache first (@note will discard scripts in extrainfo) local instance = requireinfo.load(alias or packagename) if not instance then @@ -536,6 +536,17 @@ function project._load_requires() instance._INFO = { __requirestr = requirestr, __extrainfo = extrainfo } end + -- move scripts of extrainfo (e.g. on_load ..) + if extrainfo then + for k, v in pairs(extrainfo) do + if type(v) == "function" then + instance._SCRIPTS = instance._SCRIPTS or {} + instance._SCRIPTS[k] = v + extrainfo[k] = nil + end + end + end + -- add require info requires[alias or packagename] = instance end |
