diff options
| author | ruki <[email protected]> | 2019-09-15 20:11:23 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2019-09-15 20:11:23 +0800 |
| commit | 860f2ddcfee2546ec9feeb8749fc5e5acd2a5b43 (patch) | |
| tree | a0d3592164d5725c8610b3f6d66bb015e1ab9e5c | |
| parent | 074d2607f20aa675e6835c0e31e8876d2f05da57 (diff) | |
compatible with old version template
| -rw-r--r-- | xmake/core/project/template.lua | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/xmake/core/project/template.lua b/xmake/core/project/template.lua index 1d61e0572..4dae83130 100644 --- a/xmake/core/project/template.lua +++ b/xmake/core/project/template.lua @@ -32,6 +32,7 @@ local option = require("base/option") local sandbox = require("sandbox/sandbox") local project = require("project/project") local interpreter = require("base/interpreter") +local deprecated = require("base/deprecated") -- the interpreter function template._interpreter() @@ -207,18 +208,28 @@ function template.create(language, templateid, targetname) -- load all templates for the given language local templates = template.templates(language) + -- TODO: deprecated + -- in order to be compatible with the old version template + local templates_old = { quickapp_qt = "qt.quickapp", + widgetapp_qt = "qt.widgetapp", + console_qt = "qt.console", + static_qt = "qt.static", + shared_qt = "qt.shared", + console_tbox = "tbox.console", + static_tbox = "tbox.static", + shared_tbox = "tbox.shared"} + if templates_old[templateid] then + deprecated.add("template(" .. templates_old[templateid] .. ")", "template(" .. templateid .. ")") + templateid = templates_old[templateid] + end + -- get the given template module local module = nil if templates then - local id = tonumber(templateid) - if type(id) == "number" then - module = templates[id] - else - for _, t in ipairs(templates) do - if t.name == templateid then - module = t - break - end + for _, t in ipairs(templates) do + if t.name == templateid then + module = t + break end end end |
