summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2016-03-01 08:43:00 +0800
committerruki <[email protected]>2016-03-01 08:43:00 +0800
commitdb1a45865998fb00bf46baeaada017d9f17f9da4 (patch)
tree9d5917200172b8c10faa2ce308db66378c07c3da
parent4a0697ac5940e337019b15e0d0a570e56d0791d9 (diff)
import core
-rwxr-xr-xxmake/actions/config/main.lua27
-rwxr-xr-xxmake/actions/config/xmake.lua14
-rwxr-xr-xxmake/actions/create/xmake.lua4
-rwxr-xr-xxmake/actions/global/xmake.lua2
-rwxr-xr-xxmake/actions/package/xmake.lua2
-rw-r--r--xmake/core/sandbox/import.lua14
-rw-r--r--xmake/core/sandbox/import/core/platform.lua (renamed from xmake/core/sandbox/import/platform.lua)0
-rw-r--r--xmake/core/sandbox/import/core/project.lua (renamed from xmake/core/sandbox/import/project.lua)0
-rw-r--r--xmake/core/sandbox/import/core/template.lua (renamed from xmake/core/sandbox/import/template.lua)0
9 files changed, 49 insertions, 14 deletions
diff --git a/xmake/actions/config/main.lua b/xmake/actions/config/main.lua
new file mode 100755
index 000000000..59da0ad0a
--- /dev/null
+++ b/xmake/actions/config/main.lua
@@ -0,0 +1,27 @@
+--!The Automatic Cross-platform Build Tool
+--
+-- XMake is free software; you can redistribute it and/or modify
+-- it under the terms of the GNU Lesser General Public License as published by
+-- the Free Software Foundation; either version 2.1 of the License, or
+-- (at your option) any later version.
+--
+-- XMake is distributed in the hope that it will be useful,
+-- but WITHOUT ANY WARRANTY; without even the implied warranty of
+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+-- GNU Lesser General Public License for more details.
+--
+-- You should have received a copy of the GNU Lesser General Public License
+-- along with XMake;
+-- If not, see <a href="http://www.gnu.org/licenses/"> http://www.gnu.org/licenses/</a>
+--
+-- Copyright (C) 2015 - 2016, ruki All rights reserved.
+--
+-- @author ruki
+-- @file main.lua
+--
+
+
+function main()
+
+
+end
diff --git a/xmake/actions/config/xmake.lua b/xmake/actions/config/xmake.lua
index bb4e71ec9..811393b8e 100755
--- a/xmake/actions/config/xmake.lua
+++ b/xmake/actions/config/xmake.lua
@@ -28,9 +28,7 @@ task("config")
-- on run
on_task_run(function ()
-
- print("run")
-
+
end)
-- set menu
@@ -47,7 +45,7 @@ task("config")
-- options
, options =
{
- {'c', "clean", "k", nil, "Clean the cached configure and configure all again." }
+ {'c', "clean", "k", nil, "Clean the cached configure and configure all again." }
, {}
, {'p', "plat", "kv", "$(host)", "Compile for the given platform."
@@ -56,7 +54,7 @@ task("config")
, function ()
-- import platform
- import("platform")
+ import("core/platform")
-- make description
local description = {}
@@ -73,7 +71,7 @@ task("config")
, function ()
-- import platform
- import("platform")
+ import("core/platform")
-- make description
local description = {}
@@ -101,7 +99,7 @@ task("config")
, function ()
-- import platform
- import("project")
+ import("core/project")
-- get menu for project
return project.menu()
@@ -149,7 +147,7 @@ task("config")
, function ()
-- import platform
- import("platform")
+ import("core/platform")
-- get menu for platform
return platform.menu("config")
diff --git a/xmake/actions/create/xmake.lua b/xmake/actions/create/xmake.lua
index 9df66ae7d..e528bb842 100755
--- a/xmake/actions/create/xmake.lua
+++ b/xmake/actions/create/xmake.lua
@@ -44,7 +44,7 @@ task("create")
, function ()
-- import template
- import("template")
+ import("core/template")
-- make description
local description = {}
@@ -61,7 +61,7 @@ task("create")
, function ()
-- import template
- import("template")
+ import("core/template")
-- make description
local description = {}
diff --git a/xmake/actions/global/xmake.lua b/xmake/actions/global/xmake.lua
index 5d1abced7..3161884a7 100755
--- a/xmake/actions/global/xmake.lua
+++ b/xmake/actions/global/xmake.lua
@@ -51,7 +51,7 @@ task("global")
, function ()
-- import platform
- import("platform")
+ import("core/platform")
-- get menu for platform
return platform.menu("global")
diff --git a/xmake/actions/package/xmake.lua b/xmake/actions/package/xmake.lua
index 17dd79b9c..305cd872d 100755
--- a/xmake/actions/package/xmake.lua
+++ b/xmake/actions/package/xmake.lua
@@ -47,7 +47,7 @@ task("package")
, function ()
-- import platform
- import("platform")
+ import("core/platform")
-- make description
local description = {}
diff --git a/xmake/core/sandbox/import.lua b/xmake/core/sandbox/import.lua
index 27417a23b..236547eaf 100644
--- a/xmake/core/sandbox/import.lua
+++ b/xmake/core/sandbox/import.lua
@@ -22,6 +22,7 @@
-- load modules
local os = require("base/os")
+local path = require("base/path")
local utils = require("base/utils")
-- import module
@@ -33,17 +34,26 @@ function sandbox_import(name)
os.raise("cannot import module: %s", name)
end
+ -- get module name
+ local modulename = path.basename(name)
+ if not modulename then
+ os.raise("cannot get module name for %s", name)
+ end
+
-- get the parent scope
local scope_parent = getfenv(2)
assert(scope_parent)
-- this module has been imported?
- if rawget(scope_parent, name) then
+ if rawget(scope_parent, modulename) then
os.raise("this module: %s has been imported!", name)
end
-- import this module into the parent scope
- scope_parent[name] = module
+ scope_parent[modulename] = module
+
+ -- return it
+ return module
end
-- load module
diff --git a/xmake/core/sandbox/import/platform.lua b/xmake/core/sandbox/import/core/platform.lua
index e6de93681..e6de93681 100644
--- a/xmake/core/sandbox/import/platform.lua
+++ b/xmake/core/sandbox/import/core/platform.lua
diff --git a/xmake/core/sandbox/import/project.lua b/xmake/core/sandbox/import/core/project.lua
index 3d65b8768..3d65b8768 100644
--- a/xmake/core/sandbox/import/project.lua
+++ b/xmake/core/sandbox/import/core/project.lua
diff --git a/xmake/core/sandbox/import/template.lua b/xmake/core/sandbox/import/core/template.lua
index 980e98a52..980e98a52 100644
--- a/xmake/core/sandbox/import/template.lua
+++ b/xmake/core/sandbox/import/core/template.lua