diff options
| author | ruki <[email protected]> | 2019-06-30 13:27:31 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2019-06-30 13:27:31 +0800 |
| commit | ff067fda68bf431a4d46ce0149d425c7665aa2e7 (patch) | |
| tree | f92d697dcfdafdd4e078b379aef73816b5b2b3a7 /xmake/core/project/target.lua | |
| parent | 782068ccf675fb9846708b549b2ef3888701472b (diff) | |
add protobuf rules
Diffstat (limited to 'xmake/core/project/target.lua')
| -rw-r--r-- | xmake/core/project/target.lua | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/xmake/core/project/target.lua b/xmake/core/project/target.lua index 1745e08a4..a4c194a15 100644 --- a/xmake/core/project/target.lua +++ b/xmake/core/project/target.lua @@ -90,8 +90,8 @@ function _instance:_load_rules(suffix) return true end --- do load target and rules -function _instance:_load() +-- load all +function _instance:_load_all() -- do before_load with target rules local ok, errors = self:_load_rules("before") @@ -119,8 +119,29 @@ function _instance:_load() if not ok then return false, errors end + return true +end - -- ok +-- do load target and rules +function _instance:_load() + + -- enter the environments of the target packages + local oldenvs = {} + for name, values in pairs(self:pkgenvs()) do + oldenvs[name] = os.getenv(name) + os.addenv(name, unpack(values)) + end + + -- load all + local ok, errors = self:_load_all() + if not ok then + return false, errors + end + + -- leave the environments of the target packages + for name, values in pairs(oldenvs) do + os.setenv(name, values) + end return true end |
