Browse Source

Also build `npm` projects in parallel (#39945)

- extend `%(RestoreInParallel)` choice to `%(BuildInParallel)`
- then, build in parallel even less
  - passing `BuildInParallel=false` doesn't change the `$(BuildInParallel)` property
  - change the property explicitly to avoid contention in `npm` projects that reference `2` or more `npm` projects
- also, actually build `node` projects when we say
  - previously warned "building of NodeJS projects is enabled" but it wasn't

nit: remove reference to non-existent .npmproj files
Doug Bunting 4 years ago
parent
commit
d6e7ee9478
3 changed files with 10 additions and 3 deletions
  1. 8 3
      eng/Build.props
  2. 1 0
      eng/build.ps1
  3. 1 0
      eng/build.sh

+ 8 - 3
eng/Build.props

@@ -50,8 +50,12 @@
     <!-- Project selection can be overridden on the command line by passing in -projects. -->
     <When Condition="'$(ProjectToBuild)' != ''">
       <ItemGroup>
-        <ProjectToBuild Include="$(ProjectToBuild)" Exclude="@(ProjectToExclude);$(RepoRoot)**\bin\**\*;$(RepoRoot)**\obj\**\*">
-          <RestoreInParallel Condition="'%(Extension)' == '.npmproj'">false</RestoreInParallel>
+        <ProjectToBuild Include="$(ProjectToBuild)"
+            Exclude="@(ProjectToExclude);$(RepoRoot)**\bin\**\*;$(RepoRoot)**\obj\**\*">
+          <BuildInParallel Condition=" '%(Extension)' == '.npmproj' ">false</BuildInParallel>
+          <RestoreInParallel Condition=" '%(Extension)' == '.npmproj' ">false</RestoreInParallel>
+          <!-- Also do not build in parallel w/in npm projects. -->
+          <AdditionalProperties Condition=" '%(Extension)' == '.npmproj' ">BuildInParallel=false</AdditionalProperties>
         </ProjectToBuild>
       </ItemGroup>
     </When>
@@ -115,9 +119,10 @@
         <NodeJsProjects Include="
                           $(RepoRoot)src\Components\Web.JS\Microsoft.AspNetCore.Components.Web.JS.npmproj;
                           $(RepoRoot)src\SignalR\**\*.npmproj;
-                          $(RepoRoot)src\Middleware\**\*.npmproj;
                           $(RepoRoot)src\JSInterop\**\*.npmproj;
                           "
+                        AdditionalProperties="BuildInParallel=false"
+                        BuildInParallel="false"
                         RestoreInParallel="false"
                         Exclude="@(ProjectToExclude)" />
 

+ 1 - 0
eng/build.ps1

@@ -219,6 +219,7 @@ if ($BuildManaged -or ($All -and (-not $NoBuildManaged))) {
         if ($node) {
             $nodeHome = Split-Path -Parent (Split-Path -Parent $node.Path)
             Write-Host -f Magenta "Building of C# project is enabled and has dependencies on NodeJS projects. Building of NodeJS projects is enabled since node is detected in $nodeHome."
+            $BuildNodeJS = $true
         }
         else {
             Write-Host -f Magenta "Building of NodeJS projects is disabled since node is not detected on Path and no BuildNodeJs or NoBuildNodeJs setting is set explicitly."

+ 1 - 0
eng/build.sh

@@ -255,6 +255,7 @@ if [ "$build_managed" = true ] || ([ "$build_all" = true ] && [ "$build_managed"
     if [ -z "$build_nodejs" ]; then
         if [ -x "$(command -v node)" ]; then
             __warn "Building of C# project is enabled and has dependencies on NodeJS projects. Building of NodeJS projects is enabled since node is detected on PATH."
+            build_nodejs=true
         else
             __warn "Building of NodeJS projects is disabled since node is not detected on Path and no BuildNodeJs or NoBuildNodeJs setting is set explicitly."
             build_nodejs=false