summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2023-03-27 17:03:56 +0800
committerGitHub <[email protected]>2023-03-27 17:03:56 +0800
commit3f94114c7d062967a9622a4dc5fca1ec5f80e690 (patch)
treecb1d9c9435fc5d54261b3fc4d67f5f599522cb1c
parent6eb7f2203ad50d475e6e720b1506e9c046b43cdd (diff)
parentfeb5d21a6e9a0b657c659a8d28840147fbd5c62d (diff)
Merge pull request #3563 from pdagobert/improve-d-projects
Improve d projects
-rw-r--r--.github/workflows/macos.yml1
-rw-r--r--tests/projects/dlang/dub_package/src/main.d7
-rw-r--r--tests/projects/dlang/dub_package/test.lua10
-rw-r--r--tests/projects/dlang/dub_package/xmake.lua8
-rw-r--r--xmake/modules/core/tools/dmd.lua4
-rw-r--r--xmake/modules/core/tools/ldc2.lua4
-rw-r--r--xmake/modules/package/manager/dub/find_package.lua2
7 files changed, 33 insertions, 3 deletions
diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml
index 3aebacf6b..63a208bb1 100644
--- a/.github/workflows/macos.yml
+++ b/.github/workflows/macos.yml
@@ -31,6 +31,7 @@ jobs:
- name: Installation
run: |
brew install dmd
+ brew install dub
- name: Tests
run: |
diff --git a/tests/projects/dlang/dub_package/src/main.d b/tests/projects/dlang/dub_package/src/main.d
new file mode 100644
index 000000000..3a9f9db79
--- /dev/null
+++ b/tests/projects/dlang/dub_package/src/main.d
@@ -0,0 +1,7 @@
+import util.log;
+
+void main()
+{
+ log = Log(stderrLogger, stdoutLogger(LogLevel.info), fileLogger("log"));
+ log.warn("test");
+} \ No newline at end of file
diff --git a/tests/projects/dlang/dub_package/test.lua b/tests/projects/dlang/dub_package/test.lua
new file mode 100644
index 000000000..92168a8c1
--- /dev/null
+++ b/tests/projects/dlang/dub_package/test.lua
@@ -0,0 +1,10 @@
+-- main entry
+function main(t)
+
+ -- build project
+ if is_host("macosx") and os.arch() ~= "arm64" then
+ t:build()
+ else
+ return t:skip("wrong host platform")
+ end
+end
diff --git a/tests/projects/dlang/dub_package/xmake.lua b/tests/projects/dlang/dub_package/xmake.lua
new file mode 100644
index 000000000..c9b82dffb
--- /dev/null
+++ b/tests/projects/dlang/dub_package/xmake.lua
@@ -0,0 +1,8 @@
+add_rules("mode.debug", "mode.release")
+
+add_requires("dub::log 0.4.3")
+
+target("test")
+ set_kind("binary")
+ add_files("src/main.d")
+ add_packages("dub::log") \ No newline at end of file
diff --git a/xmake/modules/core/tools/dmd.lua b/xmake/modules/core/tools/dmd.lua
index 99e872390..e02a1ed0a 100644
--- a/xmake/modules/core/tools/dmd.lua
+++ b/xmake/modules/core/tools/dmd.lua
@@ -72,7 +72,7 @@ function nf_strip(self, level)
end
-- make the symbol flag
-function nf_symbol(self, level)
+function nf_symbol(self, level, target)
local kind = self:kind()
if language.sourcekinds()[kind] then
local maps = _g.symbol_maps
@@ -83,6 +83,8 @@ function nf_symbol(self, level)
_g.symbol_maps = maps
end
return maps[level .. '_' .. kind] or maps[level]
+ elseif (kind == "dcld" or kind == "dcsh") and target:is_plat("windows") and level == "debug" then
+ return "-g"
end
end
diff --git a/xmake/modules/core/tools/ldc2.lua b/xmake/modules/core/tools/ldc2.lua
index 3a2dbf160..5a9f77026 100644
--- a/xmake/modules/core/tools/ldc2.lua
+++ b/xmake/modules/core/tools/ldc2.lua
@@ -49,7 +49,7 @@ function nf_optimize(self, level)
end
-- make the symbol flag
-function nf_symbol(self, level)
+function nf_symbol(self, level, target)
local kind = self:kind()
if language.sourcekinds()[kind] then
local maps = _g.symbol_maps
@@ -61,5 +61,7 @@ function nf_symbol(self, level)
_g.symbol_maps = maps
end
return maps[level .. '_' .. kind] or maps[level]
+ elseif (kind == "dcld" or kind == "dcsh") and target:is_plat("windows") and level == "debug" then
+ return "-g"
end
end
diff --git a/xmake/modules/package/manager/dub/find_package.lua b/xmake/modules/package/manager/dub/find_package.lua
index 5d49d695e..372e6bbcf 100644
--- a/xmake/modules/package/manager/dub/find_package.lua
+++ b/xmake/modules/package/manager/dub/find_package.lua
@@ -49,7 +49,7 @@ function main(name, opt)
if pkglist then
local pkgdir
for _, line in ipairs(pkglist:split('\n', {plain = true})) do
- local pkginfo = line:split(':', {plain = true})
+ local pkginfo = line:split(': ', {plain = true})
if #pkginfo == 2 then
local pkgkey = pkginfo[1]:trim():split(' ', {plain = true})
local pkgpath = pkginfo[2]:trim()