diff options
| author | ruki <[email protected]> | 2022-11-01 23:35:02 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2022-11-01 23:35:02 +0800 |
| commit | 1912c580ec4f817ef40aa44dc893cbf4c1d8db8e (patch) | |
| tree | 47d5ff5309a5ed549c9da407189a2001dd3c5575 /xmake/modules/private/tools/cl/parse_deps_json.lua | |
| parent | e3f66afa1533661eda37f934357623134dd0e467 (diff) | |
| parent | 3abe482e186a3851f9349d5011e93d8c529de2d8 (diff) | |
Merge pull request #3001 from xmake-io/modules
Incremental compilation support for modules #3000
Diffstat (limited to 'xmake/modules/private/tools/cl/parse_deps_json.lua')
| -rw-r--r-- | xmake/modules/private/tools/cl/parse_deps_json.lua | 45 |
1 files changed, 42 insertions, 3 deletions
diff --git a/xmake/modules/private/tools/cl/parse_deps_json.lua b/xmake/modules/private/tools/cl/parse_deps_json.lua index f274dc382..459a8b112 100644 --- a/xmake/modules/private/tools/cl/parse_deps_json.lua +++ b/xmake/modules/private/tools/cl/parse_deps_json.lua @@ -80,15 +80,54 @@ function _normailize_dep(dep, projectdir) end -- parse depsfiles from string +-- +--[[ +{ + "Version": "1.2", + "Data": { + "Source": "c:\users\ruki\desktop\user_headerunit\src\main.cpp", + "ProvidedModule": "", + "Includes": [], + "ImportedModules": [ + { + "Name": "hello", + "BMI": "c:\users\ruki\desktop\user_headerunit\src\hello.ifc" + } + ], + "ImportedHeaderUnits": [ + { + "Header": "c:\users\ruki\desktop\user_headerunit\src\header.hpp", + "BMI": "c:\users\ruki\desktop\user_headerunit\src\header.hpp.ifc" + } + ] + } +}]] function main(depsdata) -- decode json data first depsdata = json.decode(depsdata) -- get includes - local includes - if depsdata and depsdata.Data then - includes = depsdata.Data.Includes + local data + if depsdata then + data = depsdata.Data + end + if data then + includes = data.Includes + for _, item in ipairs(data.ImportedModules) do + local bmifile = item.BMI + if bmifile then + includes = includes or {} + table.insert(includes, bmifile) + end + end + for _, item in ipairs(data.ImportedHeaderUnits) do + local bmifile = item.BMI + if bmifile then + includes = includes or {} + table.insert(includes, bmifile) + end + end end -- translate it |
