diff options
| author | ruki <[email protected]> | 2017-06-29 11:55:29 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2017-06-29 11:55:29 +0800 |
| commit | 2be42fdf5f7c47d70dc569d51ea947c595211830 (patch) | |
| tree | 3c3052b4d95145f92bf6b45943bb55cab0ec34f9 | |
| parent | 1c898dee704ec1c8d76da288471f95bbd68c36b8 (diff) | |
disable cache for project history/cache
| -rw-r--r-- | xmake/actions/build/main.lua | 2 | ||||
| -rw-r--r-- | xmake/actions/config/main.lua | 2 | ||||
| -rw-r--r-- | xmake/core/sandbox/modules/import.lua | 11 | ||||
| -rw-r--r-- | xmake/core/sandbox/modules/import/core/project/cache.lua | 4 | ||||
| -rw-r--r-- | xmake/core/sandbox/modules/import/core/project/history.lua | 4 | ||||
| -rw-r--r-- | xmake/plugins/macro/main.lua | 4 |
6 files changed, 17 insertions, 10 deletions
diff --git a/xmake/actions/build/main.lua b/xmake/actions/build/main.lua index c47045c59..95ea22206 100644 --- a/xmake/actions/build/main.lua +++ b/xmake/actions/build/main.lua @@ -27,7 +27,7 @@ import("core.base.option") import("core.project.task") import("core.project.config") import("core.project.project") -import("core.project.cache") +import("core.project.cache", {nocache = true}) import("core.platform.platform") import("builder") diff --git a/xmake/actions/config/main.lua b/xmake/actions/config/main.lua index d90b9bc3f..07588378c 100644 --- a/xmake/actions/config/main.lua +++ b/xmake/actions/config/main.lua @@ -28,7 +28,7 @@ import("core.project.config") import("core.project.global") import("core.project.project") import("core.platform.platform") -import("core.project.cache") +import("core.project.cache", {nocache = true}) import("lib.detect.cache", {alias = "detectcache"}) import("scanner") import("configheader") diff --git a/xmake/core/sandbox/modules/import.lua b/xmake/core/sandbox/modules/import.lua index c72013582..1d81e68c6 100644 --- a/xmake/core/sandbox/modules/import.lua +++ b/xmake/core/sandbox/modules/import.lua @@ -237,6 +237,11 @@ end -- import module -- +-- @param name the module name, .e.g core.platform +-- @param args the arguments, .e.g {alias = "", rootdir = "", inherit = false, anonymous = false, nocache = false} +-- +-- @return the module instance +-- -- .e.g -- -- import("core.platform") @@ -324,7 +329,7 @@ function sandbox_import.import(name, args) -- load it from cache first local moduleinfo = modules[modulekey] - if moduleinfo then + if moduleinfo and not args.nocache then module = moduleinfo[1] errors = moduleinfo[2] else @@ -332,7 +337,9 @@ function sandbox_import.import(name, args) module, errors = sandbox_import._load(moduledir, name, utils.ifelse(idx < #modules_directories, instance, nil)) -- last modules need not fork sandbox -- cache this module - modules[modulekey] = {module, errors} + if not args.nocache then + modules[modulekey] = {module, errors} + end end -- end diff --git a/xmake/core/sandbox/modules/import/core/project/cache.lua b/xmake/core/sandbox/modules/import/core/project/cache.lua index 4d2879c09..066ae4d03 100644 --- a/xmake/core/sandbox/modules/import/core/project/cache.lua +++ b/xmake/core/sandbox/modules/import/core/project/cache.lua @@ -22,8 +22,8 @@ -- @file cache.lua -- --- define module, @note cannot be cached, a new instance in each sandbox module -local sandbox_core_project_cache = {} +-- define module +local sandbox_core_project_cache = sandbox_core_project_cache or {} -- load modules local cache = require("project/cache") diff --git a/xmake/core/sandbox/modules/import/core/project/history.lua b/xmake/core/sandbox/modules/import/core/project/history.lua index c19607f88..b205afdf9 100644 --- a/xmake/core/sandbox/modules/import/core/project/history.lua +++ b/xmake/core/sandbox/modules/import/core/project/history.lua @@ -22,8 +22,8 @@ -- @file history.lua -- --- define module, @note cannot be cached, a new instance in each sandbox module -local sandbox_core_project_history = {} +-- define module +local sandbox_core_project_history = sandbox_core_project_history or {} -- load modules local os = require("base/os") diff --git a/xmake/plugins/macro/main.lua b/xmake/plugins/macro/main.lua index 1fbd26207..59510fc89 100644 --- a/xmake/plugins/macro/main.lua +++ b/xmake/plugins/macro/main.lua @@ -24,9 +24,9 @@ -- imports import("core.base.option") -import("core.project.cache") +import("core.project.cache", {nocache = true}) import("core.project.config") -import("core.project.history") +import("core.project.history", {nocache = true}) -- the macro directories function _directories() |
