summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2021-09-14 00:47:07 +0800
committerruki <[email protected]>2021-09-14 00:47:07 +0800
commit3abbb1c004c0c56bf34c9155098e1844e0483581 (patch)
treea8a19e4b771eb4fff452f43e794b5c7218eea8b5
parent8c8030ba48cda0c12ed7934b6dd4ffff5b191a33 (diff)
remove before_load
-rw-r--r--tests/projects/other/multiplats_vs/xmake.lua2
-rw-r--r--xmake/core/project/project.lua6
-rw-r--r--xmake/core/project/rule.lua1
-rw-r--r--xmake/core/project/target.lua11
-rw-r--r--xmake/rules/cuda/env/xmake.lua2
-rw-r--r--xmake/rules/cuda/gencodes/xmake.lua2
-rw-r--r--xmake/rules/luarocks/module/xmake.lua2
-rw-r--r--xmake/rules/utils/symbols/export_all/xmake.lua2
-rw-r--r--xmake/rules/wdk/env/xmake.lua2
-rw-r--r--xmake/rules/wdk/inf/xmake.lua2
-rw-r--r--xmake/rules/wdk/man/xmake.lua2
-rw-r--r--xmake/rules/wdk/mc/xmake.lua2
-rw-r--r--xmake/rules/wdk/mof/xmake.lua2
-rw-r--r--xmake/rules/wdk/sign/xmake.lua2
-rw-r--r--xmake/rules/wdk/tracewpp/xmake.lua2
-rw-r--r--xmake/rules/winsdk/dotnet/xmake.lua2
-rw-r--r--xmake/rules/winsdk/mfc/env/xmake.lua2
-rw-r--r--xmake/rules/winsdk/xmake.lua2
-rw-r--r--xmake/rules/xcode/application/xmake.lua2
-rw-r--r--xmake/rules/xcode/bundle/xmake.lua2
-rw-r--r--xmake/rules/xcode/framework/xmake.lua2
-rw-r--r--xmake/rules/xmake_cli/xmake.lua2
22 files changed, 19 insertions, 37 deletions
diff --git a/tests/projects/other/multiplats_vs/xmake.lua b/tests/projects/other/multiplats_vs/xmake.lua
index 4e61a20a1..255e2e913 100644
--- a/tests/projects/other/multiplats_vs/xmake.lua
+++ b/tests/projects/other/multiplats_vs/xmake.lua
@@ -1,7 +1,7 @@
add_rules("mode.debug", "mode.release")
rule("vs2015_x86")
- before_load(function (target)
+ on_load(function (target)
target:set("arch", "x86")
target:set("toolchains", "msvc", {vs = "2015"})
end)
diff --git a/xmake/core/project/project.lua b/xmake/core/project/project.lua
index 311a9a260..411845056 100644
--- a/xmake/core/project/project.lua
+++ b/xmake/core/project/project.lua
@@ -431,12 +431,6 @@ function project._load_targets()
end
end
- -- do before_load()
- ok, errors = t:_load_before()
- if not ok then
- return nil, nil, errors
- end
-
-- we need call on_load() before building deps/rules,
-- so we can use `target:add("deps", "xxx")` to add deps in on_load
ok, errors = t:_load()
diff --git a/xmake/core/project/rule.lua b/xmake/core/project/rule.lua
index c155a813f..534bb5f8a 100644
--- a/xmake/core/project/rule.lua
+++ b/xmake/core/project/rule.lua
@@ -180,7 +180,6 @@ function rule.apis()
, "rule.on_buildcmd_files"
-- rule.before_xxx
, "rule.before_run"
- , "rule.before_load"
, "rule.before_link"
, "rule.before_build"
, "rule.before_build_file"
diff --git a/xmake/core/project/target.lua b/xmake/core/project/target.lua
index c7d2adc5f..8cfbf0a12 100644
--- a/xmake/core/project/target.lua
+++ b/xmake/core/project/target.lua
@@ -105,17 +105,6 @@ function _instance:_load_rules(suffix)
return true
end
--- do before_load target and rules
-function _instance:_load_before()
-
- -- do before_load with target rules
- local ok, errors = self:_load_rules("before")
- if not ok then
- return false, errors
- end
- return true
-end
-
-- do load target and rules
function _instance:_load()
diff --git a/xmake/rules/cuda/env/xmake.lua b/xmake/rules/cuda/env/xmake.lua
index e6e802d71..96d587e41 100644
--- a/xmake/rules/cuda/env/xmake.lua
+++ b/xmake/rules/cuda/env/xmake.lua
@@ -21,7 +21,7 @@
-- define rule: environment
rule("cuda.env")
- before_load(function (target)
+ on_load(function (target)
-- imports
import("detect.sdks.find_cuda")
diff --git a/xmake/rules/cuda/gencodes/xmake.lua b/xmake/rules/cuda/gencodes/xmake.lua
index 0845178fe..b5ebc22d1 100644
--- a/xmake/rules/cuda/gencodes/xmake.lua
+++ b/xmake/rules/cuda/gencodes/xmake.lua
@@ -34,7 +34,7 @@ rule("cuda.gencodes")
-- if no available device is found, no `-gencode` flags will be added
-- @seealso xmake/modules/lib/detect/find_cudadevices
--
- before_load(function (target)
+ on_load(function (target)
-- imports
import("core.platform.platform")
diff --git a/xmake/rules/luarocks/module/xmake.lua b/xmake/rules/luarocks/module/xmake.lua
index e74080912..530e35070 100644
--- a/xmake/rules/luarocks/module/xmake.lua
+++ b/xmake/rules/luarocks/module/xmake.lua
@@ -19,7 +19,7 @@
--
rule("luarocks.module")
- before_load(function (target)
+ on_load(function (target)
-- imports
import("core.cache.detectcache")
diff --git a/xmake/rules/utils/symbols/export_all/xmake.lua b/xmake/rules/utils/symbols/export_all/xmake.lua
index f804e3c3e..b808d63a9 100644
--- a/xmake/rules/utils/symbols/export_all/xmake.lua
+++ b/xmake/rules/utils/symbols/export_all/xmake.lua
@@ -26,7 +26,7 @@
-- @see https://github.com/xmake-io/xmake/issues/1123
--
rule("utils.symbols.export_all")
- before_load(function (target)
+ on_load(function (target)
-- @note it only supports windows/dll now
assert(target:is_shared(), 'rule("utils.symbols.export_all"): only for shared target(%s)!', target:name())
if target:is_plat("windows") then
diff --git a/xmake/rules/wdk/env/xmake.lua b/xmake/rules/wdk/env/xmake.lua
index 6b7690933..a9089dc5e 100644
--- a/xmake/rules/wdk/env/xmake.lua
+++ b/xmake/rules/wdk/env/xmake.lua
@@ -22,7 +22,7 @@
rule("wdk.env")
-- before load
- before_load(function (target)
+ on_load(function (target)
-- imports
import("os.winver", {alias = "os_winver"})
diff --git a/xmake/rules/wdk/inf/xmake.lua b/xmake/rules/wdk/inf/xmake.lua
index fe060a10a..6ad91e62d 100644
--- a/xmake/rules/wdk/inf/xmake.lua
+++ b/xmake/rules/wdk/inf/xmake.lua
@@ -28,7 +28,7 @@ rule("wdk.inf")
set_extensions(".inf", ".inx")
-- before load
- before_load(function (target)
+ on_load(function (target)
-- imports
import("core.project.config")
diff --git a/xmake/rules/wdk/man/xmake.lua b/xmake/rules/wdk/man/xmake.lua
index 25cce9f34..7843542d7 100644
--- a/xmake/rules/wdk/man/xmake.lua
+++ b/xmake/rules/wdk/man/xmake.lua
@@ -28,7 +28,7 @@ rule("wdk.man")
set_extensions(".man")
-- before load
- before_load(function (target)
+ on_load(function (target)
-- imports
import("core.project.config")
diff --git a/xmake/rules/wdk/mc/xmake.lua b/xmake/rules/wdk/mc/xmake.lua
index 32653dfc2..abc75fdf7 100644
--- a/xmake/rules/wdk/mc/xmake.lua
+++ b/xmake/rules/wdk/mc/xmake.lua
@@ -28,7 +28,7 @@ rule("wdk.mc")
set_extensions(".mc")
-- before load
- before_load(function (target)
+ on_load(function (target)
-- imports
import("core.project.config")
diff --git a/xmake/rules/wdk/mof/xmake.lua b/xmake/rules/wdk/mof/xmake.lua
index 319eec5d7..8be25de20 100644
--- a/xmake/rules/wdk/mof/xmake.lua
+++ b/xmake/rules/wdk/mof/xmake.lua
@@ -28,7 +28,7 @@ rule("wdk.mof")
set_extensions(".mof")
-- before load
- before_load(function (target)
+ on_load(function (target)
-- imports
import("core.project.config")
diff --git a/xmake/rules/wdk/sign/xmake.lua b/xmake/rules/wdk/sign/xmake.lua
index 7dcc28785..dd137c5ec 100644
--- a/xmake/rules/wdk/sign/xmake.lua
+++ b/xmake/rules/wdk/sign/xmake.lua
@@ -34,7 +34,7 @@ rule("wdk.sign")
add_deps("wdk.env")
-- before load
- before_load(function (target)
+ on_load(function (target)
-- imports
import("core.project.config")
diff --git a/xmake/rules/wdk/tracewpp/xmake.lua b/xmake/rules/wdk/tracewpp/xmake.lua
index 0c49bf5d0..52d72827f 100644
--- a/xmake/rules/wdk/tracewpp/xmake.lua
+++ b/xmake/rules/wdk/tracewpp/xmake.lua
@@ -25,7 +25,7 @@ rule("wdk.tracewpp")
add_deps("wdk.env")
-- before load
- before_load(function (target)
+ on_load(function (target)
-- imports
import("core.project.config")
diff --git a/xmake/rules/winsdk/dotnet/xmake.lua b/xmake/rules/winsdk/dotnet/xmake.lua
index 5274f040a..1cfef7b58 100644
--- a/xmake/rules/winsdk/dotnet/xmake.lua
+++ b/xmake/rules/winsdk/dotnet/xmake.lua
@@ -22,7 +22,7 @@
rule("win.sdk.dotnet")
-- before load
- before_load(function (target)
+ on_load(function (target)
-- imports
import("core.project.config")
diff --git a/xmake/rules/winsdk/mfc/env/xmake.lua b/xmake/rules/winsdk/mfc/env/xmake.lua
index f603ebfe2..f553618b5 100644
--- a/xmake/rules/winsdk/mfc/env/xmake.lua
+++ b/xmake/rules/winsdk/mfc/env/xmake.lua
@@ -22,5 +22,5 @@
rule("win.sdk.mfc.env")
-- TODO: before load need check of vs's minverion, if defined
- before_load(function (target)
+ on_load(function (target)
end)
diff --git a/xmake/rules/winsdk/xmake.lua b/xmake/rules/winsdk/xmake.lua
index 0a3b105cc..297dfda75 100644
--- a/xmake/rules/winsdk/xmake.lua
+++ b/xmake/rules/winsdk/xmake.lua
@@ -27,7 +27,7 @@ rule("win.sdk.resource")
rule("win.sdk.application")
-- before load
- before_load(function (target)
+ on_load(function (target)
target:set("kind", "binary")
end)
diff --git a/xmake/rules/xcode/application/xmake.lua b/xmake/rules/xcode/application/xmake.lua
index 51232f033..7d5edc668 100644
--- a/xmake/rules/xcode/application/xmake.lua
+++ b/xmake/rules/xcode/application/xmake.lua
@@ -25,7 +25,7 @@ rule("xcode.application")
add_deps("xcode.info_plist", "xcode.storyboard", "xcode.xcassets", "xcode.metal")
-- we must set kind before target.on_load(), may we will use target in on_load()
- before_load("load")
+ on_load("load")
-- build *.app
after_build("build")
diff --git a/xmake/rules/xcode/bundle/xmake.lua b/xmake/rules/xcode/bundle/xmake.lua
index bd8e4329e..1c1cecf99 100644
--- a/xmake/rules/xcode/bundle/xmake.lua
+++ b/xmake/rules/xcode/bundle/xmake.lua
@@ -25,7 +25,7 @@ rule("xcode.bundle")
add_deps("xcode.info_plist")
-- we must set kind before target.on_load(), may we will use target in on_load()
- before_load(function (target)
+ on_load(function (target)
-- get bundle directory
local targetdir = target:targetdir()
diff --git a/xmake/rules/xcode/framework/xmake.lua b/xmake/rules/xcode/framework/xmake.lua
index b112dcaf1..6b46b3c97 100644
--- a/xmake/rules/xcode/framework/xmake.lua
+++ b/xmake/rules/xcode/framework/xmake.lua
@@ -25,7 +25,7 @@ rule("xcode.framework")
add_deps("xcode.info_plist")
-- we must set kind before target.on_load(), may we will use target in on_load()
- before_load(function (target)
+ on_load(function (target)
-- get framework directory
local targetdir = target:targetdir()
diff --git a/xmake/rules/xmake_cli/xmake.lua b/xmake/rules/xmake_cli/xmake.lua
index 2375c9e3b..a7e21a9e1 100644
--- a/xmake/rules/xmake_cli/xmake.lua
+++ b/xmake/rules/xmake_cli/xmake.lua
@@ -20,7 +20,7 @@
-- define rule: xmake cli program
rule("xmake.cli")
- before_load(function (target)
+ on_load(function (target)
target:set("kind", "binary")
assert(target:pkg("libxmake"), 'please add_packages("libxmake") to target(%s) first!', target:name())
end)