summaryrefslogtreecommitdiff
path: root/xmake/rules/csharp/clean.lua
diff options
context:
space:
mode:
authorJassJam <[email protected]>2026-02-24 18:04:11 +0000
committerruki <[email protected]>2026-03-14 00:10:13 +0800
commit454997b0d4e7775ea70f81986528e7fc21dc50f9 (patch)
tree7e3de8d1eb422980927527887f964d15359aba79 /xmake/rules/csharp/clean.lua
parentbe2de5598c80f9b9960909aa876d4a4e533b9710 (diff)
feat: split C# rule into multiple modules
Diffstat (limited to 'xmake/rules/csharp/clean.lua')
-rw-r--r--xmake/rules/csharp/clean.lua40
1 files changed, 40 insertions, 0 deletions
diff --git a/xmake/rules/csharp/clean.lua b/xmake/rules/csharp/clean.lua
new file mode 100644
index 000000000..6de720709
--- /dev/null
+++ b/xmake/rules/csharp/clean.lua
@@ -0,0 +1,40 @@
+--!A cross-platform build utility based on Lua
+--
+-- Licensed under the Apache License, Version 2.0 (the "License");
+-- you may not use this file except in compliance with the License.
+-- You may obtain a copy of the License at
+--
+-- http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+--
+-- Copyright (C) 2015-present, Xmake Open Source Community.
+--
+-- @author JassJam
+-- @file clean.lua
+--
+
+import("target.action.clean", {alias = "_do_clean_target"})
+local csharp_common = import("csharp_common", {anonymous = true})
+
+function main(target, opt)
+ _do_clean_target(target)
+
+ local targetfile = target:targetfile()
+ if targetfile then
+ os.tryrm(target:dependfile(targetfile))
+ end
+ os.tryrm(target:targetdir())
+
+ -- also remove the bin/obj folders next to the .csproj file
+ local csprojfile = csharp_common.find_csproj(target)
+ if csprojfile then
+ local csprojdir = path.directory(csprojfile)
+ os.tryrm(path.join(csprojdir, "bin"))
+ os.tryrm(path.join(csprojdir, "obj"))
+ end
+end