diff options
| author | ruki <[email protected]> | 2017-08-24 18:12:19 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2017-08-24 18:12:19 +0800 |
| commit | 35e1d95ced10a2311e9ee96030b8aeb7a2e4bf8b (patch) | |
| tree | c254218406e38a8faf0505d9b8a0fd30b14e342b /xmake | |
| parent | 7187dc72fa1909168213283ecd651fed35c1daae (diff) | |
support build version
Diffstat (limited to 'xmake')
| -rw-r--r-- | xmake/actions/config/configheader.lua | 6 | ||||
| -rw-r--r-- | xmake/core/sandbox/modules/import/core/project/project.lua | 18 |
2 files changed, 21 insertions, 3 deletions
diff --git a/xmake/actions/config/configheader.lua b/xmake/actions/config/configheader.lua index c16f1b429..789f7982e 100644 --- a/xmake/actions/config/configheader.lua +++ b/xmake/actions/config/configheader.lua @@ -47,7 +47,7 @@ function _make_for_target(files, target) file:print("") -- make version - local version = project.version() + local version, version_build = project.version() if version then file:print("// version") file:print("#define %s_VERSION \"%s\"", configprefix, version) @@ -58,7 +58,9 @@ function _make_for_target(files, target) i = i + 1 if i > 3 then break end end - file:print("#define %s_VERSION_BUILD %s", configprefix, os.date("%Y%m%d%H%M", os.time())) + if version_build then + file:print("#define %s_VERSION_BUILD %s", configprefix, version_build) + end file:print("") end diff --git a/xmake/core/sandbox/modules/import/core/project/project.lua b/xmake/core/sandbox/modules/import/core/project/project.lua index bae02f7a0..715b3d83d 100644 --- a/xmake/core/sandbox/modules/import/core/project/project.lua +++ b/xmake/core/sandbox/modules/import/core/project/project.lua @@ -149,7 +149,23 @@ end -- get the project version function sandbox_core_project.version() - return project.get("version") + + -- get version and build version + local version = project.get("version") + local version_build = sandbox_core_project._version_build + if version then + local version_extra = project.get("__extra_version") + if version_extra then + version_build = table.wrap(version_extra[version]).build + if type(version_build) == "string" then + version_build = os.date(version_build, os.time()) + sandbox_core_project._version_build = version_build + end + end + end + + -- ok? + return version, version_build end -- get the project name |
