Skip to content
This repository was archived by the owner on Mar 1, 2022. It is now read-only.

Commit 85305dd

Browse files
author
WebFreak001
committed
Added list:build-types to dub
1 parent 9723cda commit 85305dd

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

source/com/dub.d

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,15 @@ auto configurations() @property
131131
return _dub.project.configurations;
132132
}
133133

134+
@arguments("subcmd", "list:build-types")
135+
auto buildTypes() @property
136+
{
137+
string[] types = ["plain", "debug", "release", "release-nobounds", "unittest", "docs", "ddox", "profile", "profile-gc", "cov", "unittest-cov"];
138+
foreach(type, info; _dub.project.rootPackage.info.buildTypes)
139+
types ~= type;
140+
return types;
141+
}
142+
134143
@arguments("subcmd", "get:configuration")
135144
auto configuration() @property
136145
{
@@ -155,13 +164,14 @@ auto buildType() @property
155164
@arguments("subcmd", "set:build-type")
156165
bool setBuildType(JSONValue request)
157166
{
158-
try
167+
assert("build-type" in request, "build-type not in request");
168+
auto type = request["build-type"].fromJSON!string;
169+
if(buildTypes.canFind(type))
159170
{
160-
assert("build-type" in request, "build-type not in request");
161-
_buildType = request["build-type"].str;
171+
_buildType = type;
162172
return updateImportPaths(false);
163173
}
164-
catch (Exception e)
174+
else
165175
{
166176
return false;
167177
}

0 commit comments

Comments
 (0)