summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2016-02-19 09:30:55 +0800
committerruki <[email protected]>2016-02-19 09:30:55 +0800
commit9a9dbb9a9bd34fb4f5cf85ab86d8fc7402515683 (patch)
treebdcd02cbb1c0c62419222477aea12869684154fe
parent0d6ebe7b964bdcec0a224dd491da5b3418d9b805 (diff)
fix template api
-rw-r--r--xmake/core/base/template.lua32
-rw-r--r--xmake/templates/c++/console_tbox/project/xmake.lua2
-rw-r--r--xmake/templates/c++/console_tbox/template.lua2
-rw-r--r--xmake/templates/c++/shared_library_tbox/project/xmake.lua4
-rw-r--r--xmake/templates/c++/shared_library_tbox/template.lua2
-rw-r--r--xmake/templates/c++/static_library_tbox/project/xmake.lua4
-rw-r--r--xmake/templates/c++/static_library_tbox/template.lua2
-rw-r--r--xmake/templates/c/console_tbox/project/xmake.lua2
-rw-r--r--xmake/templates/c/console_tbox/template.lua2
-rw-r--r--xmake/templates/c/shared_library_tbox/project/xmake.lua4
-rw-r--r--xmake/templates/c/shared_library_tbox/template.lua2
-rw-r--r--xmake/templates/c/static_library_tbox/project/xmake.lua4
-rw-r--r--xmake/templates/c/static_library_tbox/template.lua2
13 files changed, 32 insertions, 32 deletions
diff --git a/xmake/core/base/template.lua b/xmake/core/base/template.lua
index 0440753fb..8e739a3fe 100644
--- a/xmake/core/base/template.lua
+++ b/xmake/core/base/template.lua
@@ -24,15 +24,15 @@
local template = template or {}
-- load modules
-local os = require("base/os")
-local io = require("base/io")
-local path = require("base/path")
-local table = require("base/table")
-local utils = require("base/utils")
-local string = require("base/string")
-local filter = require("base/filter")
-local sandbox = require("base/sandbox")
-local interpreter = require("base/interpreter")
+local os = require("base/os")
+local io = require("base/io")
+local path = require("base/path")
+local table = require("base/table")
+local utils = require("base/utils")
+local string = require("base/string")
+local filter = require("base/filter")
+local sandbox = require("base/sandbox")
+local interpreter = require("base/interpreter")
-- get interpreter
function template._interpreter()
@@ -46,18 +46,18 @@ function template._interpreter()
local interp = interpreter.init()
assert(interp)
- -- register api: set_values() for root
+ -- register api: set_description() and set_projectdir()
interp:api_register_set_values(nil, nil, "description"
, "projectdir")
- -- register api: add_values() for root
+ -- register api: add_macrofiles()
interp:api_register_add_values(nil, nil, "macrofiles")
- -- register api: add_keyvalues() for root
+ -- register api: add_macros()
interp:api_register_add_keyvalues(nil, nil, "macros")
- -- register api: set_script() for root
- interp:api_register_set_script(nil, nil, "createscript")
+ -- register api: on_create()
+ interp:api_register_on_script(nil, nil, "create")
-- save interpreter
template._INTERPRETER = interp
@@ -239,8 +239,8 @@ function template.create(language, templateid, targetname)
end
-- create project
- if module.createscript then
- local ok, errors = sandbox.load(module.createscript)
+ if module.create then
+ local ok, errors = sandbox.load(module.create)
if not ok then
utils.errors(errors)
return false
diff --git a/xmake/templates/c++/console_tbox/project/xmake.lua b/xmake/templates/c++/console_tbox/project/xmake.lua
index aab73814f..048bb99ba 100644
--- a/xmake/templates/c++/console_tbox/project/xmake.lua
+++ b/xmake/templates/c++/console_tbox/project/xmake.lua
@@ -82,7 +82,7 @@ if not is_arch("i386", "x86_64") then
end
-- for the windows platform (msvc)
-if plats("windows") then
+if is_plat("windows") then
-- the release mode
if is_mode("release") then
diff --git a/xmake/templates/c++/console_tbox/template.lua b/xmake/templates/c++/console_tbox/template.lua
index 0b63ab745..43928ba4e 100644
--- a/xmake/templates/c++/console_tbox/template.lua
+++ b/xmake/templates/c++/console_tbox/template.lua
@@ -11,7 +11,7 @@ add_macros("targetname", "$(targetname)")
add_macrofiles("src/xmake.lua")
-- set create script
-set_createscript(function ()
+on_create(function ()
-- copy packages
os.cp("$(packagesdir)/tbox.pkg", "pkg/tbox.pkg")
diff --git a/xmake/templates/c++/shared_library_tbox/project/xmake.lua b/xmake/templates/c++/shared_library_tbox/project/xmake.lua
index 20ab67394..808c17645 100644
--- a/xmake/templates/c++/shared_library_tbox/project/xmake.lua
+++ b/xmake/templates/c++/shared_library_tbox/project/xmake.lua
@@ -82,7 +82,7 @@ if not is_arch("i386", "x86_64") then
end
-- for the windows platform (msvc)
-if plats("windows") then
+if is_plat("windows") then
-- the release mode
if is_mode("release") then
@@ -116,4 +116,4 @@ add_pkgdirs("pkg")
-- add projects
add_subdirs("src/[targetname]")
-if options("demo") then add_subdirs("src/demo") end
+if is_option("demo") then add_subdirs("src/demo") end
diff --git a/xmake/templates/c++/shared_library_tbox/template.lua b/xmake/templates/c++/shared_library_tbox/template.lua
index 56cff2596..d8fc84ee0 100644
--- a/xmake/templates/c++/shared_library_tbox/template.lua
+++ b/xmake/templates/c++/shared_library_tbox/template.lua
@@ -14,7 +14,7 @@ add_macrofiles("src/_demo/xmake.lua")
add_macrofiles("src/_library/xmake.lua")
-- set create script
-set_createscript(function ()
+on_create(function ()
-- rename target directory
os.mv("src/_library", "src/$(targetname)")
diff --git a/xmake/templates/c++/static_library_tbox/project/xmake.lua b/xmake/templates/c++/static_library_tbox/project/xmake.lua
index 20ab67394..808c17645 100644
--- a/xmake/templates/c++/static_library_tbox/project/xmake.lua
+++ b/xmake/templates/c++/static_library_tbox/project/xmake.lua
@@ -82,7 +82,7 @@ if not is_arch("i386", "x86_64") then
end
-- for the windows platform (msvc)
-if plats("windows") then
+if is_plat("windows") then
-- the release mode
if is_mode("release") then
@@ -116,4 +116,4 @@ add_pkgdirs("pkg")
-- add projects
add_subdirs("src/[targetname]")
-if options("demo") then add_subdirs("src/demo") end
+if is_option("demo") then add_subdirs("src/demo") end
diff --git a/xmake/templates/c++/static_library_tbox/template.lua b/xmake/templates/c++/static_library_tbox/template.lua
index 97e9fc089..6a1a6c732 100644
--- a/xmake/templates/c++/static_library_tbox/template.lua
+++ b/xmake/templates/c++/static_library_tbox/template.lua
@@ -14,7 +14,7 @@ add_macrofiles("src/_demo/xmake.lua")
add_macrofiles("src/_library/xmake.lua")
-- set create script
-set_createscript(function ()
+on_create(function ()
-- rename target directory
os.mv("src/_library", "src/$(targetname)")
diff --git a/xmake/templates/c/console_tbox/project/xmake.lua b/xmake/templates/c/console_tbox/project/xmake.lua
index aab73814f..048bb99ba 100644
--- a/xmake/templates/c/console_tbox/project/xmake.lua
+++ b/xmake/templates/c/console_tbox/project/xmake.lua
@@ -82,7 +82,7 @@ if not is_arch("i386", "x86_64") then
end
-- for the windows platform (msvc)
-if plats("windows") then
+if is_plat("windows") then
-- the release mode
if is_mode("release") then
diff --git a/xmake/templates/c/console_tbox/template.lua b/xmake/templates/c/console_tbox/template.lua
index 0b63ab745..43928ba4e 100644
--- a/xmake/templates/c/console_tbox/template.lua
+++ b/xmake/templates/c/console_tbox/template.lua
@@ -11,7 +11,7 @@ add_macros("targetname", "$(targetname)")
add_macrofiles("src/xmake.lua")
-- set create script
-set_createscript(function ()
+on_create(function ()
-- copy packages
os.cp("$(packagesdir)/tbox.pkg", "pkg/tbox.pkg")
diff --git a/xmake/templates/c/shared_library_tbox/project/xmake.lua b/xmake/templates/c/shared_library_tbox/project/xmake.lua
index 20ab67394..808c17645 100644
--- a/xmake/templates/c/shared_library_tbox/project/xmake.lua
+++ b/xmake/templates/c/shared_library_tbox/project/xmake.lua
@@ -82,7 +82,7 @@ if not is_arch("i386", "x86_64") then
end
-- for the windows platform (msvc)
-if plats("windows") then
+if is_plat("windows") then
-- the release mode
if is_mode("release") then
@@ -116,4 +116,4 @@ add_pkgdirs("pkg")
-- add projects
add_subdirs("src/[targetname]")
-if options("demo") then add_subdirs("src/demo") end
+if is_option("demo") then add_subdirs("src/demo") end
diff --git a/xmake/templates/c/shared_library_tbox/template.lua b/xmake/templates/c/shared_library_tbox/template.lua
index 56cff2596..d8fc84ee0 100644
--- a/xmake/templates/c/shared_library_tbox/template.lua
+++ b/xmake/templates/c/shared_library_tbox/template.lua
@@ -14,7 +14,7 @@ add_macrofiles("src/_demo/xmake.lua")
add_macrofiles("src/_library/xmake.lua")
-- set create script
-set_createscript(function ()
+on_create(function ()
-- rename target directory
os.mv("src/_library", "src/$(targetname)")
diff --git a/xmake/templates/c/static_library_tbox/project/xmake.lua b/xmake/templates/c/static_library_tbox/project/xmake.lua
index 20ab67394..808c17645 100644
--- a/xmake/templates/c/static_library_tbox/project/xmake.lua
+++ b/xmake/templates/c/static_library_tbox/project/xmake.lua
@@ -82,7 +82,7 @@ if not is_arch("i386", "x86_64") then
end
-- for the windows platform (msvc)
-if plats("windows") then
+if is_plat("windows") then
-- the release mode
if is_mode("release") then
@@ -116,4 +116,4 @@ add_pkgdirs("pkg")
-- add projects
add_subdirs("src/[targetname]")
-if options("demo") then add_subdirs("src/demo") end
+if is_option("demo") then add_subdirs("src/demo") end
diff --git a/xmake/templates/c/static_library_tbox/template.lua b/xmake/templates/c/static_library_tbox/template.lua
index 97e9fc089..6a1a6c732 100644
--- a/xmake/templates/c/static_library_tbox/template.lua
+++ b/xmake/templates/c/static_library_tbox/template.lua
@@ -14,7 +14,7 @@ add_macrofiles("src/_demo/xmake.lua")
add_macrofiles("src/_library/xmake.lua")
-- set create script
-set_createscript(function ()
+on_create(function ()
-- rename target directory
os.mv("src/_library", "src/$(targetname)")