diff options
| author | ruki <[email protected]> | 2019-05-05 21:50:48 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2019-05-05 21:50:48 +0800 |
| commit | f97082c4db805cf7989eb6a2a1cd549a1d6d49a5 (patch) | |
| tree | 7530d05a74a058c137b1e15cdd839b37fb0a2d32 /xmake/core/package/package.lua | |
| parent | dfdbe5da7702606001a2141082708f6ed5acd733 (diff) | |
improve fetch package and envs
Diffstat (limited to 'xmake/core/package/package.lua')
| -rw-r--r-- | xmake/core/package/package.lua | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/xmake/core/package/package.lua b/xmake/core/package/package.lua index 2687a4fd4..6e160ac93 100644 --- a/xmake/core/package/package.lua +++ b/xmake/core/package/package.lua @@ -270,16 +270,19 @@ end -- load the manifest file of this package function _instance:manifest_load() - local manifest_file = self:manifest_file() - if os.isfile(manifest_file) then - - -- load manifest - local manifest, errors = io.load(manifest_file) - if not manifest then - os.raise(errors) + local manifest = self._MANIFEST + if not manifest then + local manifest_file = self:manifest_file() + if os.isfile(manifest_file) then + local errors = nil + manifest, errors = io.load(manifest_file) + if not manifest then + os.raise(errors) + end + self._MANIFEST = manifest end - return manifest end + return manifest end -- save the manifest file of this package @@ -340,6 +343,17 @@ function _instance:envs() return envs end +-- load the package environments from the manifest +function _instance:envs_load() + local manifest = self:manifest_load() + if manifest then + local envs = self:envs() + for name, values in pairs(manifest.envs) do + envs[name] = values + end + end +end + -- enter the package environments function _instance:envs_enter() |
