diff options
| author | ruki <[email protected]> | 2018-08-25 00:55:50 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2018-08-24 23:35:00 +0800 |
| commit | 3b88e27a78ac27480ce931023b47cfc40e754b46 (patch) | |
| tree | 23a224d4182003a5e61bd73eef8fc8cc0870a118 | |
| parent | 3834432a2fa50afc439288a4f7862261aedf41ae (diff) | |
fix remove repo
| -rw-r--r-- | xmake/core/package/package.lua | 3 | ||||
| -rw-r--r-- | xmake/core/package/repository.lua | 47 | ||||
| -rw-r--r-- | xmake/plugins/repo/main.lua | 2 |
3 files changed, 30 insertions, 22 deletions
diff --git a/xmake/core/package/package.lua b/xmake/core/package/package.lua index 24f15a2f7..a282c59d3 100644 --- a/xmake/core/package/package.lua +++ b/xmake/core/package/package.lua @@ -558,6 +558,9 @@ function package.load_from_repository(packagename, repo, packagedir, packagefile return package._PACKAGES[packagename] end + -- load repository first for checking the xmake minimal version + repo:load() + -- find the package script path local scriptpath = packagefile if not packagefile and packagedir then diff --git a/xmake/core/package/repository.lua b/xmake/core/package/repository.lua index fdce0b7af..dd6983294 100644 --- a/xmake/core/package/repository.lua +++ b/xmake/core/package/repository.lua @@ -53,25 +53,8 @@ end -- get the repository configure function _instance:get(name) - -- the info - local info = self._INFO - if not info then - - -- attempt to load info from the repository script (xmake.lua) - local scriptpath = path.join(self:directory(), "xmake.lua") - if os.isfile(scriptpath) then - - -- load repository and disable filter - local results, errors = repository._interpreter():load(scriptpath, nil, true, false) - if not results and os.isfile(scriptpath) then - os.raise(errors) - end - - -- save repository info - info = results - self._INFO = info - end - end + -- load info + local info = self:load() -- get if from info local value = info and info[name] or nil @@ -100,6 +83,29 @@ function _instance:directory() return self._DIRECTORY end +-- load the repository info in xmake.lua +function _instance:load() + + -- do not loaded? + if not self._INFO then + + -- attempt to load info from the repository script (xmake.lua) + local scriptpath = path.join(self:directory(), "xmake.lua") + if os.isfile(scriptpath) then + + -- load repository and disable filter + local results, errors = repository._interpreter():load(scriptpath, nil, true, false) + if not results and os.isfile(scriptpath) then + os.raise("load repo(%s) failed, " .. errors, self:name()) + end + + -- save repository info + self._INFO = results + end + end + return self._INFO +end + -- get cache function repository._cache(is_global) @@ -149,8 +155,7 @@ function repository.apis() values = { -- set_xxx - "set_xmakever" - , "set_description" + "set_description" } } end diff --git a/xmake/plugins/repo/main.lua b/xmake/plugins/repo/main.lua index 91c64225c..494cb66f5 100644 --- a/xmake/plugins/repo/main.lua +++ b/xmake/plugins/repo/main.lua @@ -69,7 +69,7 @@ function _remove(name, is_global) end -- trace - cprint("${bright}remove %s repository(%s): %s ok!", ifelse(is_global, "global", "local"), name, url) + cprint("${bright}remove %s repository(%s): ok!", ifelse(is_global, "global", "local"), name) end -- update repositories |
