From a20ddd8374057cf311f7877374bdd9890a3ad32e Mon Sep 17 00:00:00 2001
From: Justin Kotalik <jukotali@microsoft.com>
Date: Sat, 25 May 2019 15:20:26 -0700
Subject: [PATCH] Make Native components a non-required part for build.cmd, fix
 IIS native code check (#10435)

---
 .azure/pipelines/ci.yml                  | 2 +-
 .azure/pipelines/helix-test.yml          | 2 +-
 Directory.Build.props                    | 2 +-
 build.ps1                                | 3 +--
 build/repo.props                         | 1 +
 src/Shared/E2ETesting/E2ETesting.targets | 1 +
 6 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/.azure/pipelines/ci.yml b/.azure/pipelines/ci.yml
index 900b033f831..99b2bd9d6c3 100644
--- a/.azure/pipelines/ci.yml
+++ b/.azure/pipelines/ci.yml
@@ -328,7 +328,7 @@ jobs:
     agentOs: Windows
     isTestingJob: true
     buildScript: ./eng/scripts/cibuild.cmd
-    buildArgs: -test "/p:SkipIISBackwardsCompatibilityTests=true /p:SkipIISTests=true /p:SkipIISExpressTests=true /p:SkipIISForwardsCompatibilityTests=true /p:RunTemplateTests=false /p:BuildSiteExtensions=false"
+    buildArgs: -test -BuildNative "/p:SkipIISBackwardsCompatibilityTests=true /p:SkipIISTests=true /p:SkipIISExpressTests=true /p:SkipIISForwardsCompatibilityTests=true /p:RunTemplateTests=false /p:BuildSiteExtensions=false"
     beforeBuild:
     - powershell: "& ./src/Servers/IIS/tools/UpdateIISExpressCertificate.ps1; & ./src/Servers/IIS/tools/update_schema.ps1"
       displayName: Setup IISExpress test certificates and schema
diff --git a/.azure/pipelines/helix-test.yml b/.azure/pipelines/helix-test.yml
index 1740ceb6cb5..1b512109b1e 100644
--- a/.azure/pipelines/helix-test.yml
+++ b/.azure/pipelines/helix-test.yml
@@ -15,7 +15,7 @@ jobs:
     agentOs: Windows
     timeoutInMinutes: 240
     steps:
-    - script: .\build.cmd -all -ci /t:Helix /p:IsHelixJob=true /bl:$env:BUILD_SOURCESDIRECTORY\artifacts\log\SendToHelix.binlog
+    - script: .\build.cmd -all -ci /p:BuildNative=true /t:Helix /p:IsHelixJob=true /bl:$env:BUILD_SOURCESDIRECTORY\artifacts\log\SendToHelix.binlog
       displayName: Run build.cmd helix target
       env:
         SYSTEM_ACCESSTOKEN: $(System.AccessToken) # We need to set this env var to publish helix results to Azure Dev Ops
diff --git a/Directory.Build.props b/Directory.Build.props
index 8a8ef6d27d7..3331e894f69 100644
--- a/Directory.Build.props
+++ b/Directory.Build.props
@@ -198,7 +198,7 @@
     <!-- Projects which reference Microsoft.AspNetCore.Mvc.Testing should import this targets file to ensure dependency .deps.json files are copied into test output. -->
     <MvcTestingTargets>$(MSBuildThisFileDirectory)src\Mvc\Mvc.Testing\src\Microsoft.AspNetCore.Mvc.Testing.targets</MvcTestingTargets>
     <!-- IIS native projects can only be built on Windows for x86 and x64. -->
-    <BuildIisNativeProjects Condition="'$(BuildNative)' != 'false' AND '$(TargetOsName)' == 'win' AND ('$(TargetArchitecture)' == 'x86' OR '$(TargetArchitecture)' == 'x64')">true</BuildIisNativeProjects>
+    <BuildIisNativeProjects Condition="'$(BuildNative)' == 'true' AND '$(TargetOsName)' == 'win' AND ('$(TargetArchitecture)' == 'x86' OR '$(TargetArchitecture)' == 'x64')">true</BuildIisNativeProjects>
     <!-- This property is shared by several projects to layout the AspNetCore.App targeting pack for installers -->
     <TargetingPackLayoutRoot>$(ArtifactsObjDir)TargetingPack.Layout\$(Configuration)\</TargetingPackLayoutRoot>
     <!-- This property is shared by several projects to layout the AspNetCore.App shared framework for installers -->
diff --git a/build.ps1 b/build.ps1
index b382ae38673..726946a89b8 100644
--- a/build.ps1
+++ b/build.ps1
@@ -258,13 +258,12 @@ elseif ($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)) {
-    Write-Warning "No default group of projects was specified, so building the 'managed' and 'native' subsets of projects. Run ``build.cmd -help`` for more details."
+    Write-Warning "No default group of projects was specified, so building the 'managed' 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.
     # Now that we support subfolder invokations of build.cmd, we will be pushing to have build.cmd build everything (-all) by default
 
     $BuildManaged = $true
-    $BuildNative = $true
 }
 
 if ($BuildInstallers) { $MSBuildArguments += "/p:BuildInstallers=true" }
diff --git a/build/repo.props b/build/repo.props
index 4282500c148..16748ee70af 100644
--- a/build/repo.props
+++ b/build/repo.props
@@ -34,6 +34,7 @@
     <BuildManaged>true</BuildManaged>
     <BuildNodeJS>true</BuildNodeJS>
     <BuildJava>true</BuildJava>
+    <BuildIisNativeProjects Condition="'$(TargetOsName)' == 'win' AND ('$(TargetArchitecture)' == 'x86' OR '$(TargetArchitecture)' == 'x64')">true</BuildIisNativeProjects>
   </PropertyGroup>
 
   <!-- These projects are always excluded, even when -projects is specified on command line. -->
diff --git a/src/Shared/E2ETesting/E2ETesting.targets b/src/Shared/E2ETesting/E2ETesting.targets
index 628880eb537..3b27dc75f70 100644
--- a/src/Shared/E2ETesting/E2ETesting.targets
+++ b/src/Shared/E2ETesting/E2ETesting.targets
@@ -37,6 +37,7 @@
     </PropertyGroup>
 
     <!-- JAVA -->
+    <!-- https://github.com/aspnet/AspNetCore-Internal/issues/2555 -->
     <Message Importance="High" Text="Ensuring JAVA is available" />
     <Exec Command="java -version" />
     <Message Importance="High" Text="JAVA is available on the PATH" />
-- 
GitLab