diff options
| author | ruki <[email protected]> | 2017-09-15 22:30:06 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2017-09-15 09:00:38 +0800 |
| commit | 7b0e6f7212368a31ab4a058c81ba0a7f2b223908 (patch) | |
| tree | 31d148d0305512693591bd7aa567caf30a422271 | |
| parent | b28a88e0e0bcb2c5a300fa0305c8f812f21d353f (diff) | |
improve detection of statistics
| -rw-r--r-- | xmake/actions/build/statistics.lua | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/xmake/actions/build/statistics.lua b/xmake/actions/build/statistics.lua index 7a02420a0..0bffbbe02 100644 --- a/xmake/actions/build/statistics.lua +++ b/xmake/actions/build/statistics.lua @@ -25,6 +25,26 @@ -- imports import("core.base.option") +-- statistics is enabled? +function _is_enabled() + + -- disable statistics? need not post it + local stats = (os.getenv("XMAKE_STATS") or ""):lower() + if stats == "false" then + return false + end + + -- is in ci(travis/appveyor/...)? need not post it + local ci = (os.getenv("CI") or ""):lower() + if ci == "true" then + os.setenv("XMAKE_STATS", "false") + return false + end + + -- ok + return true +end + -- post statistics info and only post once everyday when building each project -- -- clone the xmake-stats(only an empty repo) to update the traffic(git clones) info in github @@ -42,7 +62,7 @@ function post() -- has been posted today or statistics is disable? local outputdir = path.join(os.tmpdir(), "stats", os.date("%y%m%d"), projectname) local markfile = outputdir .. ".mark" - if os.isdir(outputdir) or os.isfile(markfile) or os.getenv("XMAKE_STATS") == "false" or os.getenv("CI") == "true" then + if os.isdir(outputdir) or os.isfile(markfile) or not _is_enabled() then return end |
