Skip to content

Commit 194ad00

Browse files
committed
Quick fix: Support -all together with -projects
- remove need to specify `/p:BuildAllProjects=true` - nit: simplify some Boolean logic
1 parent 79534a7 commit 194ad00

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

build.ps1

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -185,15 +185,16 @@ if ($DumpProcesses -or $CI) {
185185
if ($All) {
186186
$MSBuildArguments += '/p:BuildAllProjects=true'
187187
}
188-
elseif ($Projects) {
188+
189+
if ($Projects) {
189190
if (![System.IO.Path]::IsPathRooted($Projects))
190191
{
191192
$Projects = Join-Path (Get-Location) $Projects
192193
}
193194
$MSBuildArguments += "/p:ProjectToBuild=$Projects"
194195
}
195196
# When adding new sub-group build flags, add them to this check.
196-
elseif((-not $BuildNative) -and (-not $BuildManaged) -and (-not $BuildNodeJS) -and (-not $BuildInstallers) -and (-not $BuildJava)) {
197+
elseif (-not ($All -or $BuildNative -or $BuildManaged -or $BuildNodeJS -or $BuildInstallers -or $BuildJava)) {
197198
Write-Warning "No default group of projects was specified, so building the 'managed' and its dependent subsets of projects. Run ``build.cmd -help`` for more details."
198199

199200
# This goal of this is to pick a sensible default for `build.cmd` with zero arguments.
@@ -203,7 +204,7 @@ elseif((-not $BuildNative) -and (-not $BuildManaged) -and (-not $BuildNodeJS) -a
203204
}
204205

205206
if ($BuildManaged -or ($All -and (-not $NoBuildManaged))) {
206-
if ((-not $BuildNodeJS) -and (-not $NoBuildNodeJS)) {
207+
if (-not ($BuildNodeJS -or $NoBuildNodeJS)) {
207208
$node = Get-Command node -ErrorAction Ignore -CommandType Application
208209

209210
if ($node) {

build.sh

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ Options:
6565
--no-build-repo-tasks Suppress building RepoTasks.
6666
6767
--all Build all project types.
68-
--[no-]build-native Build native projects (C, C++).
68+
--[no-]build-native Build native projects (C, C++). Ignored in most cases i.e. with `dotnet msbuild`.
6969
--[no-]build-managed Build managed projects (C#, F#, VB).
7070
--[no-]build-nodejs Build NodeJS projects (TypeScript, JS).
7171
--[no-]build-java Build Java projects.
@@ -74,7 +74,7 @@ Options:
7474
--ci Apply CI specific settings and environment variables.
7575
--binarylog|-bl Use a binary logger
7676
--verbosity|-v MSBuild verbosity: q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic]
77-
77+
7878
--dotnet-runtime-source-feed Additional feed that can be used when downloading .NET runtimes
7979
--dotnet-runtime-source-feed-key Key for feed that can be used when downloading .NET runtimes
8080
@@ -223,9 +223,11 @@ done
223223

224224
if [ "$build_all" = true ]; then
225225
msbuild_args[${#msbuild_args[*]}]="-p:BuildAllProjects=true"
226-
elif [ ! -z "$build_projects" ]; then
226+
fi
227+
228+
if [ ! -z "$build_projects" ]; then
227229
msbuild_args[${#msbuild_args[*]}]="-p:ProjectToBuild=$build_projects"
228-
elif [ -z "$build_managed" ] && [ -z "$build_nodejs" ] && [ -z "$build_java" ] && [ -z "$build_native" ] && [ -z "$build_installers" ]; then
230+
elif [ "$build_all" != true ] && [ -z "$build_managed$build_nodejs$build_java$build_native$build_installers" ]; then
229231
# This goal of this is to pick a sensible default for `build.sh` with zero arguments.
230232
# We believe the most common thing our contributors will work on is C#, so if no other build group was picked, build the C# projects.
231233
__warn "No default group of projects was specified, so building the 'managed' and its dependent subset of projects. Run ``build.sh --help`` for more details."
@@ -287,7 +289,7 @@ msbuild_args[${#msbuild_args[*]}]="-verbosity:$verbosity"
287289

288290
# Set up additional runtime args
289291
toolset_build_args=()
290-
if [ ! -z "$dotnet_runtime_source_feed" ] || [ ! -z "$dotnet_runtime_source_feed_key" ]; then
292+
if [ ! -z "$dotnet_runtime_source_feed$dotnet_runtime_source_feed_key" ]; then
291293
runtimeFeedArg="/p:DotNetRuntimeSourceFeed=$dotnet_runtime_source_feed"
292294
runtimeFeedKeyArg="/p:DotNetRuntimeSourceFeedKey=$dotnet_runtime_source_feed_key"
293295
msbuild_args[${#msbuild_args[*]}]=$runtimeFeedArg

0 commit comments

Comments
 (0)