summaryrefslogtreecommitdiff
path: root/xmake/rules/csharp/xmake.lua
diff options
context:
space:
mode:
Diffstat (limited to 'xmake/rules/csharp/xmake.lua')
-rw-r--r--xmake/rules/csharp/xmake.lua29
1 files changed, 17 insertions, 12 deletions
diff --git a/xmake/rules/csharp/xmake.lua b/xmake/rules/csharp/xmake.lua
index 46f46bb75..56772a0e8 100644
--- a/xmake/rules/csharp/xmake.lua
+++ b/xmake/rules/csharp/xmake.lua
@@ -18,12 +18,26 @@
-- @file xmake.lua
--
-rule("csharp.build")
- set_sourcekinds("cs")
+-- handle .csproj project file
+rule("csharp.csproj")
set_extensions(".csproj")
- on_load(function (target)
+ on_config(function (target)
import("modules.csharp_common", {rootdir = os.scriptdir(), alias = "csharp_common"})
+ -- find .csproj from source files or generate one
+ local csprojfile = csharp_common.find_or_generate_csproj(target, {skip_deps = true})
+ if csprojfile then
+ target:data_set("csharp.csproj", csprojfile)
+ if not target:get("filename") and not target:get("basename") then
+ target:set("basename", path.basename(csprojfile))
+ end
+ end
+ end)
+
+rule("csharp.build")
+ set_sourcekinds("cs")
+ add_deps("csharp.csproj")
+ on_load(function (target)
-- set target extension and prefix
if target:is_shared() then
if not target:get("extension") then
@@ -33,15 +47,6 @@ rule("csharp.build")
target:set("prefixname", "")
end
end
-
- -- find or generate .csproj file
- local csprojfile = csharp_common.find_or_generate_csproj(target, {skip_deps = true})
- if csprojfile then
- target:data_set("csharp.csproj", csprojfile)
- if not target:get("filename") and not target:get("basename") then
- target:set("basename", path.basename(csprojfile))
- end
- end
end)
on_build("build.target")