Project/
dub.sdl/
source/
examples/
test/
source/
app.d
dub.sdl
项目/ dub.sdl
...
subpackage "./examples/test"
...
项目/实施例/试验/ dub.sdl
name "test"
targetType "executeable"
如果我尝试执行dub run test
,如果收到以下错误
Failed to parse package description for test in Project/examples/test.
Failed to find a package named 'test'.
如果我尝试执行dub run :test
,也会发生同样的情况。
答案 0 :(得分:2)
在命令中,您应该在子包名称前加上根包名称。
dub run rootpackagename:test
您似乎需要明确指定run
(或build
或其他命令)。
答案 1 :(得分:0)
截至2017年,配音版本为1.3.0:<rootpackagename>
是可选的。例如,我正在测试jsoniopipe包,如下所示:
# Add dependency which is not found on dub's repo:
git clone https://github.com/schveiguy/iopipe ../iopipe
dub add-local ../iopipe
dub.sdl文件:
name "jsoniopipe"
description "JSON parser for iopipe"
authors "Steven Schveighoffer"
copyright "Copyright © 2017, Steven Schveighoffer"
license "boost"
targetType "library"
dependency "iopipe" version="*"
subPackage {
name "formatjson"
targetType "executable"
sourcePaths "examples/formatjson"
dependency "jsoniopipe" version="*"
}
testjson.json的内容
{
"name": "myproject",
"authors": [
"My Name"
],
"description": "My first project",
"copyright": "Copyright © 2017, imadev",
"license": "Boost"
}
运行命令:
dub run :formatjson -- ./testjson.json