Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add dub describe --data=configs,builds #2692

Merged
merged 2 commits into from
Sep 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions changelog/describe-configs.dd
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Added `default-config`, `configs`, `default-build`, `builds` data to dub describe

- `default-config` will be a single string that is the `--config` configuration that DUB would pick when not provided any configuration such as in a simple `dub build` call
- `configs` is a list of all available configurations (default generated application and/or library, or the manually specified ones in the recipe)
- `default-build` will be a single string that is the `--build` build type that DUB would pick when not provided any (currently always "debug")
- `builds` is a list of all available build types (built-in + custom defined)
8 changes: 8 additions & 0 deletions source/dub/project.d
Original file line number Diff line number Diff line change
Expand Up @@ -1143,6 +1143,10 @@ class Project {
case "post-build-environments":
case "pre-run-environments":
case "post-run-environments":
case "default-config":
case "configs":
case "default-build":
case "builds":
enforce(false, "--data="~requestedData~" can only be used with `--data-list` or `--data-list --data-0`.");
break;

Expand Down Expand Up @@ -1194,6 +1198,10 @@ class Project {
case "post-run-environments": return listBuildSetting!"postRunEnvironments"(args);
case "requirements": return listBuildSetting!"requirements"(args);
case "options": return listBuildSetting!"options"(args);
case "default-config": return [getDefaultConfiguration(settings.platform)];
case "configs": return configurations;
case "default-build": return [builds[0]];
case "builds": return builds;

default:
enforce(false, "--data="~requestedData~
Expand Down
31 changes: 31 additions & 0 deletions test/4-describe-data-1-list.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ if ! $DUB describe --compiler=$DC --filter-versions \
--data=pre-build-commands \
--data=post-build-commands \
'--data=requirements, options' \
--data=default-config \
--data=configs \
--data=default-build \
--data=builds \
> "$temp_file"; then
die $LINENO 'Printing project data failed!'
fi
Expand Down Expand Up @@ -130,6 +134,33 @@ echo "debugMode" >> "$expected_file"
echo "debugInfo" >> "$expected_file"
echo "stackStomping" >> "$expected_file"
echo "warnings" >> "$expected_file"
echo >> "$expected_file"
# --data=default-config
echo "my-project-config" >> "$expected_file"
echo >> "$expected_file"
# --data=configs
echo "my-project-config" >> "$expected_file"
echo >> "$expected_file"
# --data=default-build
echo "debug" >> "$expected_file"
echo >> "$expected_file"
# --data=builds
echo "debug" >> "$expected_file"
echo "plain" >> "$expected_file"
echo "release" >> "$expected_file"
echo "release-debug" >> "$expected_file"
echo "release-nobounds" >> "$expected_file"
echo "unittest" >> "$expected_file"
echo "profile" >> "$expected_file"
echo "profile-gc" >> "$expected_file"
echo "docs" >> "$expected_file"
echo "ddox" >> "$expected_file"
echo "cov" >> "$expected_file"
echo "cov-ctfe" >> "$expected_file"
echo "unittest-cov" >> "$expected_file"
echo "unittest-cov-ctfe" >> "$expected_file"
echo "syntax" >> "$expected_file"
# echo >> "$expected_file"

if ! diff "$expected_file" "$temp_file"; then
echo "Result:"
Expand Down
Loading