Skip to content

Commit

Permalink
Quick fix: Support -all together with -projects
Browse files Browse the repository at this point in the history
- remove need to specify `/p:BuildAllProjects=true`
- nit: simplify some Boolean logic
  • Loading branch information
dougbu committed Apr 21, 2020
1 parent 85879f8 commit b29de9c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
7 changes: 4 additions & 3 deletions build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -185,15 +185,16 @@ if ($DumpProcesses -or $CI) {
if ($All) {
$MSBuildArguments += '/p:BuildAllProjects=true'
}
elseif ($Projects) {

if ($Projects) {
if (![System.IO.Path]::IsPathRooted($Projects))
{
$Projects = Join-Path (Get-Location) $Projects
}
$MSBuildArguments += "/p:ProjectToBuild=$Projects"
}
# When adding new sub-group build flags, add them to this check.
elseif((-not $BuildNative) -and (-not $BuildManaged) -and (-not $BuildNodeJS) -and (-not $BuildInstallers) -and (-not $BuildJava)) {
elseif (-not ($All -or $BuildNative -or $BuildManaged -or $BuildNodeJS -or $BuildInstallers -or $BuildJava)) {
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."

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

if ($BuildManaged -or ($All -and (-not $NoBuildManaged))) {
if ((-not $BuildNodeJS) -and (-not $NoBuildNodeJS)) {
if (-not ($BuildNodeJS -or $NoBuildNodeJS)) {
$node = Get-Command node -ErrorAction Ignore -CommandType Application

if ($node) {
Expand Down
12 changes: 7 additions & 5 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ Options:
--no-build-repo-tasks Suppress building RepoTasks.
--all Build all project types.
--[no-]build-native Build native projects (C, C++).
--[no-]build-native Build native projects (C, C++). Ignored in most cases i.e. with `dotnet msbuild`.
--[no-]build-managed Build managed projects (C#, F#, VB).
--[no-]build-nodejs Build NodeJS projects (TypeScript, JS).
--[no-]build-java Build Java projects.
Expand All @@ -74,7 +74,7 @@ Options:
--ci Apply CI specific settings and environment variables.
--binarylog|-bl Use a binary logger
--verbosity|-v MSBuild verbosity: q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic]
--dotnet-runtime-source-feed Additional feed that can be used when downloading .NET runtimes
--dotnet-runtime-source-feed-key Key for feed that can be used when downloading .NET runtimes
Expand Down Expand Up @@ -223,9 +223,11 @@ done

if [ "$build_all" = true ]; then
msbuild_args[${#msbuild_args[*]}]="-p:BuildAllProjects=true"
elif [ ! -z "$build_projects" ]; then
fi

if [ ! -z "$build_projects" ]; then
msbuild_args[${#msbuild_args[*]}]="-p:ProjectToBuild=$build_projects"
elif [ -z "$build_managed" ] && [ -z "$build_nodejs" ] && [ -z "$build_java" ] && [ -z "$build_native" ] && [ -z "$build_installers" ]; then
elif [ "$build_all" != true ] && [ -z "$build_managed$build_nodejs$build_java$build_native$build_installers" ]; then
# This goal of this is to pick a sensible default for `build.sh` with zero arguments.
# 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.
__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."
Expand Down Expand Up @@ -287,7 +289,7 @@ msbuild_args[${#msbuild_args[*]}]="-verbosity:$verbosity"

# Set up additional runtime args
toolset_build_args=()
if [ ! -z "$dotnet_runtime_source_feed" ] || [ ! -z "$dotnet_runtime_source_feed_key" ]; then
if [ ! -z "$dotnet_runtime_source_feed$dotnet_runtime_source_feed_key" ]; then
runtimeFeedArg="/p:DotNetRuntimeSourceFeed=$dotnet_runtime_source_feed"
runtimeFeedKeyArg="/p:DotNetRuntimeSourceFeedKey=$dotnet_runtime_source_feed_key"
msbuild_args[${#msbuild_args[*]}]=$runtimeFeedArg
Expand Down

0 comments on commit b29de9c

Please sign in to comment.