Add installer build/test to the runtime.yml pipeline (#705)
authorDavis Goodin <dagood@users.noreply.github.com>
Wed, 11 Dec 2019 00:35:29 +0000 (18:35 -0600)
committerGitHub <noreply@github.com>
Wed, 11 Dec 2019 00:35:29 +0000 (18:35 -0600)
* First pass to get an installer build integrated into runtime.yml with minimal changes to the installer jobs.

Fix paths to jobs.

Fix typos

Add platform to parameter lists.

Pass platform to all jobs.

Cleanup variable usages.

Don't pass buildConfig down to installer jobs. They use matrix strategy instead.

Fix variable usage in windows build.

Fix windows platform names.

Add missing platform parameter for Windows_NT_arm

Update last condition re parameters.dockerImage.

Rename dockerImage parameter to productBuildDockerImage to be more explicit.

Use pool and container parameters from platform-matrix in installer build.

Pass rootfs dir via crossrootfsDir to bash-build.yml.

Fix passing down container in runtime-installer pipeline.

Remove unused Linux_x64_raw config.

* Add support for clang 9 to corehost build.

* Skip tests on Linux_musl_arm64

* runtime.yml installer build with live artifacts

Includes refactoring the runtime legs to avoid duplicating artifact
transfer logic and preserve the runtime standalone build.

* Fix installer overrides: accept live CI artifacts

* Use clone-checkout-bundle-step.yml everywhere

* Try using isOfficialBuild var from template expr

* Switch from $[] to $() to fix clone template

$[] becomes empty string when a variable is undefined. $() sticks around literally if the variable doesn't exist, messing up the command. Unfortunately $[] doesn't seem to work in this context so we must use $() and define the variable as empty string.

23 files changed:
eng/pipelines/common/clone-checkout-bundle-step.yml [new file with mode: 0644]
eng/pipelines/common/platform-matrix.yml
eng/pipelines/common/variables.yml [new file with mode: 0644]
eng/pipelines/common/xplat-setup.yml
eng/pipelines/coreclr/templates/xplat-job.yml
eng/pipelines/installer/azure-pipelines.yml
eng/pipelines/installer/installer-matrix.yml [new file with mode: 0644]
eng/pipelines/installer/jobs/base-job.yml [new file with mode: 0644]
eng/pipelines/installer/jobs/bash-build.yml
eng/pipelines/installer/jobs/osx-build.yml
eng/pipelines/installer/jobs/prepare-signed-artifacts.yml
eng/pipelines/installer/jobs/run-publish-project.yml
eng/pipelines/installer/jobs/steps/upload-job-artifacts.yml
eng/pipelines/installer/jobs/windows-build.yml
eng/pipelines/libraries/base-job.yml
eng/pipelines/libraries/build-job.yml
eng/pipelines/libraries/variables.yml
eng/pipelines/runtime.yml
src/installer/corehost/build.sh
src/installer/pkg/projects/netcoreapp/src/localnetcoreapp.override.targets
src/installer/pkg/projects/netcoreapp/src/netcoreapp.depproj
src/libraries/Directory.Build.props
src/libraries/Directory.Build.targets

diff --git a/eng/pipelines/common/clone-checkout-bundle-step.yml b/eng/pipelines/common/clone-checkout-bundle-step.yml
new file mode 100644 (file)
index 0000000..e016c96
--- /dev/null
@@ -0,0 +1,13 @@
+steps:
+- checkout: none
+  clean: true
+
+- download: current
+  artifact: Checkout_bundle
+  displayName: Download Checkout.bundle
+
+- script: |
+    $(setScriptToEchoAndFailOnNonZero)
+    git clone $(Pipeline.Workspace)/Checkout_bundle/Checkout.bundle .
+    git remote set-url origin $(Build.Repository.Uri)
+  displayName: Clone the repository from Checkout.bundle
index 4852fdb..83c2951 100644 (file)
@@ -135,6 +135,8 @@ jobs:
           managedTestBuildOsGroup: OSX
         ${{ insert }}: ${{ parameters.jobParameters }}
 
+# WebAssembly
+
 - ${{ if containsValue(parameters.platforms, 'WebAssembly_wasm') }}:
   - template: xplat-setup.yml
     parameters:
diff --git a/eng/pipelines/common/variables.yml b/eng/pipelines/common/variables.yml
new file mode 100644 (file)
index 0000000..4ce7a43
--- /dev/null
@@ -0,0 +1,3 @@
+variables:
+- name: isOfficialBuild
+  value: ${{ and(ne(variables['System.TeamProject'], 'public'), notIn(variables['Build.Reason'], 'PullRequest')) }}
index 74bf515..e799ba9 100644 (file)
@@ -25,6 +25,8 @@ jobs:
           value: '\'
         - name: _msbuildCommand
           value: powershell -ExecutionPolicy ByPass -NoProfile eng\common\msbuild.ps1 -warnaserror:0 -ci
+        - name: setScriptToEchoAndFailOnNonZero
+          value: ''
 
       - ${{ if ne(parameters.osGroup, 'Windows_NT') }}:
         - name: archiveExtension
@@ -39,7 +41,10 @@ jobs:
           value: '/'
         - name: _msbuildCommand
           value: ./eng/common/msbuild.sh --warnaserror false --ci
-      
+        # Set the bash script to display each command, and stop if any command exits nonzero.
+        - name: setScriptToEchoAndFailOnNonZero
+          value: 'set -xe'
+
       - ${{ if ne(parameters.jobParameters.crossrootfsDir, '') }}:
         # This is only required for cross builds.
         - name: ROOTFS_DIR
@@ -48,6 +53,7 @@ jobs:
     osGroup: ${{ parameters.osGroup }}
     osSubgroup: ${{ parameters.osSubgroup }}
     archType: ${{ parameters.archType }}
+    platform: ${{ parameters.platform }}
 
     ${{ if ne(parameters.container, '') }}:
       ${{ if eq(parameters.container.registry, 'mcr') }}:
@@ -94,4 +100,3 @@ jobs:
     ${{ if ne(parameters.helixQueuesTemplate, '') }}:
       jobTemplate: ${{ parameters.jobTemplate }}
       jobParameters: ${{ parameters.jobParameters }}
-      platform: ${{ parameters.platform }}
index d6c297c..1d4adc0 100644 (file)
@@ -121,16 +121,6 @@ jobs:
       - ${{insert}}: ${{ variable }}
 
     steps:
-    - checkout: none
-      clean: true
-
-    - download: current
-      artifact: Checkout_bundle
-      displayName: Download Checkout.bundle
-
-    - script: |
-        git clone $(Pipeline.Workspace)/Checkout_bundle/Checkout.bundle .
-        git remote set-url origin $(Build.Repository.Uri)
-      displayName: Clone the repository from Checkout.bundle
+    - template: /eng/pipelines/common/clone-checkout-bundle-step.yml
 
     - ${{ parameters.steps }}
index 3d25f17..8504d0a 100644 (file)
@@ -44,216 +44,20 @@ pr:
 
 name: $(Date:yyyyMMdd)$(Rev:.r)
 
-variables:
-  - name: TeamName
-    value: dotnet-core-acquisition
-  # Skip Running CI tests
-  - name: SkipTests
-    value: false
-  # Set Official Build Id
-  - name: OfficialBuildId
-    value: $(Build.BuildNumber)
-
-  # Set the target blob feed for package publish during official and validation builds.
-  - name: _DotNetArtifactsCategory
-    value: .NETCore
-  - name: _DotNetValidationArtifactsCategory
-    value: .NETCoreValidation
-
-  # Produce test-signed build for PR and Public builds
-  - ${{ if or(eq(variables['System.TeamProject'], 'public'), in(variables['Build.Reason'], 'PullRequest')) }}:
-    - name: SignType
-      value: test
-
-  # Set up non-PR build from internal project
-  - ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}:
-    - name: SignType
-      value: $[ coalesce(variables.OfficialSignType, 'real') ]
-    # Values for SDLValidationParameters
-    - group: core-setup-sdl-validation
-
-  - name: pipelinesPath
-    value: /eng/pipelines/installer
-  - name: buildScriptFileName
-    value: installer
-
-stages:
-- stage: Build
-  jobs:
-  # -------- Build Bash legs (Linux and FreeBSD) --------
-  - template: ${{ variables['pipelinesPath'] }}/jobs/bash-build.yml
-    parameters:
-      crossBuild: true
-      name: Linux_Arm
-      dockerImage: mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-16.04-cross-14.04-23cacb0-20190923200213
-      additionalRunArgs: -e ROOTFS_DIR=/crossrootfs/arm
-      portableBuild: true
-      skipTests: true
-      targetArchitecture: arm
-
-  - template: ${{ variables['pipelinesPath'] }}/jobs/bash-build.yml
-    parameters:
-      crossBuild: true
-      name: Linux_Arm64
-      dockerImage: mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-16.04-cross-arm64-cfdd435-20190923200213
-      additionalRunArgs: -e ROOTFS_DIR=/crossrootfs/arm64
-      portableBuild: true
-      skipTests: true
-      targetArchitecture: arm64
-
-  # # Tizen build only for PR build
-  # - ${{ if eq(variables['Build.Reason'], 'PullRequest') }}:
-  #   - template: ${{ variables['pipelinesPath'] }}/jobs/bash-build.yml
-  #     parameters:
-  #       additionalMSBuildArgs: /p:OverridePackageSource=https:%2F%2Ftizen.myget.org/F/dotnet-core/api/v3/index.json /p:OutputRid=tizen.5.0.0-armel
-  #       additionalRunArgs: -e ROOTFS_DIR=/crossrootfs/armel.tizen.build
-  #       crossBuild: true
-  #       name: Linux_ArmRel_Tizen
-  #       disableCrossgen: true
-  #       dockerImage: tizendotnet/dotnet-buildtools-prereqs:ubuntu-16.04-cross-e435274-20180426002255-tizen-rootfs-5.0m1
-  #       portableBuild: false
-  #       skipTests: true
-  #       targetArchitecture: armel
-
-  - template: ${{ variables['pipelinesPath'] }}/jobs/bash-build.yml
-    parameters:
-      additionalMSBuildArgs: /p:OutputRid=linux-musl-arm64
-      crossBuild: true
-      name: Linux_Arm64_Alpine37
-      dockerImage: mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-16.04-cross-arm64-alpine-406629a-20190923200213
-      additionalRunArgs: -e ROOTFS_DIR=/crossrootfs/arm64
-      portableBuild: false
-      skipTests: true
-      targetArchitecture: arm64
-
-  - template: ${{ variables['pipelinesPath'] }}/jobs/bash-build.yml
-    parameters:
-      additionalMSBuildArgs: /p:OutputRid=linux-musl-x64
-      name: Linux_x64_Alpine39
-      dockerImage: mcr.microsoft.com/dotnet-buildtools/prereqs:alpine-3.9-WithNode-0fc54a3-20190918214015
-      portableBuild: false
-      targetArchitecture: x64
-
-  - template: ${{ variables['pipelinesPath'] }}/jobs/bash-build.yml
-    parameters:
-      name: Linux_x64_glibc
-      dockerImage: mcr.microsoft.com/dotnet-buildtools/prereqs:centos-7-50f0d02-20190918214028
-      packageDistroList:
-      - image: mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-14.04-debpkg-e5cf912-20175003025046
-        imageRid: ubuntu.14.04
-        rids: []
-      - image: mcr.microsoft.com/dotnet-buildtools/prereqs:rhel-7-rpmpkg-c982313-20174116044113
-        imageRid: rhel.7
-        rids:
-        - centos.7
-        - fedora.27
-        - opensuse.42
-        - oraclelinux.7
-        - sles.12
-      portableBuild: true
-      targetArchitecture: x64
-
-  # -------- Build OSX (macOS) leg --------
-  - template: ${{ variables['pipelinesPath'] }}/jobs/osx-build.yml
-    parameters:
-      name: OSX
-
-  # -------- Build Windows legs --------
-  # Windows Arm
-  - template: ${{ variables['pipelinesPath'] }}/jobs/windows-build.yml
-    parameters:
-      name: Windows_Arm
-      skipTests: true
-      targetArchitecture: arm
-
-  # Windows Arm64
-  - template: ${{ variables['pipelinesPath'] }}/jobs/windows-build.yml
-    parameters:
-      name: Windows_Arm64
-      skipTests: true
-      targetArchitecture: arm64
-
-  # Windows x64
-  - template: ${{ variables['pipelinesPath'] }}/jobs/windows-build.yml
-    parameters:
-      name: Windows_x64
-      publishRidAgnosticPackages: true
-      targetArchitecture: x64
-
-  # Windows x86
-  - template: ${{ variables['pipelinesPath'] }}/jobs/windows-build.yml
-    parameters:
-      name: Windows_x86
-      targetArchitecture: x86
-
-- ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}:
-  - stage: PrepareForPublish
-    displayName: Prepare for Publish
-    dependsOn: Build
-    jobs:
-    # Prep artifacts: sign them and upload pipeline artifacts expected by stages-based publishing.
-    - template: ${{ variables['pipelinesPath'] }}/jobs/prepare-signed-artifacts.yml
-      parameters:
-        PublishRidAgnosticPackagesFromJobName: Windows_x64
-    # Publish to Build Asset Registry in order to generate the ReleaseConfigs artifact.
-    - template: /eng/common/templates/job/publish-build-assets.yml
-      parameters:
-        publishUsingPipelines: true
-        dependsOn: PrepareSignedArtifacts
-        pool:
-          name: NetCoreInternal-Pool
-          queue: buildpool.windows.10.amd64.vs2017
-
-  - template: ${{ variables['pipelinesPath'] }}/stages/publish.yml
-    parameters:
-      pipelinesPath: ${{ variables['pipelinesPath'] }}
-      # Publish channel configuration. The publish template wraps Arcade publishing and adds some
-      # extras that aren't implemented in Arcade yet.
-      #
-      # - dependsOn: <ID of the Arcade stage that finalization should run after>
-      #   channel:
-      #     name: <Name of this channel, for logging and readability>
-      #     bar: <Name of the Arcade variable that contains the ID of this channel in BAR>
-      #     storage: <Name of the Latest channel to publish to in dotnetcli blob storage>
-      dependsOnPublishStages:
-
-      - dependsOn: NetCore_Release30_Publish
-        channel:
-          name: .NET Core 3 Release
-          bar: PublicRelease_30_Channel_Id
-          storage: release/3.0-preview9
-          public: true
-      - dependsOn: NetCore_30_Internal_Servicing_Publishing
-        channel:
-          name: .NET Core 3 Internal Servicing
-          bar: InternalServicing_30_Channel_Id
-          storage: internal/release/3.0
-          public: false
-
-      - dependsOn: NetCore_Dev31_Publish
-        channel:
-          name: .NET Core 3.1 Dev
-          bar: PublicDevRelease_31_Channel_Id
-          storage: release/3.1
-          public: true
-
-      - dependsOn: NetCore_Release31_Publish
-        channel:
-          name: .NET Core 3.1 Release
-          bar: PublicRelease_31_Channel_Id
-          storage: release/3.1-preview1
-          public: true
-
-      - dependsOn: NetCore_Dev5_Publish
-        channel:
-          name: .NET Core 5 Dev
-          bar: NetCore_5_Dev_Channel_Id
-          storage: master
-          public: true
-
-      - dependsOn: PVR_Publish
-        channel:
-          name: .NET Tools - Validation
-          bar: NetCore_Tools_Validation_Channel_Id
-          storage: dev/validation
-          public: true
+jobs:
+#
+# Checkout repository
+#
+- template: /eng/pipelines/common/checkout-job.yml
+
+#
+# Build and Test
+#
+- template: /eng/pipelines/installer/installer-matrix.yml
+  parameters:
+    strategy:
+      matrix:
+        debug:
+          _BuildConfig: Debug
+        release:
+          _BuildConfig: Release
diff --git a/eng/pipelines/installer/installer-matrix.yml b/eng/pipelines/installer/installer-matrix.yml
new file mode 100644 (file)
index 0000000..886eee6
--- /dev/null
@@ -0,0 +1,100 @@
+parameters:
+  # Allow entry points to skip certain platforms. Note: only implemented for platforms that are
+  # known to sometimes need skipping. (Adds boilerplate.)
+  skipPlatforms: []
+
+jobs:
+
+- template: /eng/pipelines/common/platform-matrix.yml
+  parameters:
+    jobTemplate: /eng/pipelines/installer/jobs/windows-build.yml
+    platforms:
+    - Windows_NT_arm
+    - Windows_NT_arm64
+    jobParameters:
+      ${{ insert }}: ${{ parameters }}
+      skipTests: true
+
+- template: /eng/pipelines/common/platform-matrix.yml
+  parameters:
+    jobTemplate: /eng/pipelines/installer/jobs/windows-build.yml
+    platforms:
+    - Windows_NT_x86
+    jobParameters:
+      ${{ insert }}: ${{ parameters }}
+
+- template: /eng/pipelines/common/platform-matrix.yml
+  parameters:
+    jobTemplate: /eng/pipelines/installer/jobs/windows-build.yml
+    platforms:
+    - Windows_NT_x64
+    jobParameters:
+      ${{ insert }}: ${{ parameters }}
+      publicRidAgnosticPackages: true
+
+- template: /eng/pipelines/common/platform-matrix.yml
+  parameters:
+    jobTemplate: /eng/pipelines/installer/jobs/bash-build.yml
+    platforms:
+    - Linux_arm
+    - ${{ if not(containsValue(parameters.skipPlatforms, 'Linux_arm64')) }}:
+      - Linux_arm64
+    jobParameters:
+      ${{ insert }}: ${{ parameters }}
+      portableBuild: true
+      skipTests: true
+      crossBuild: true
+
+- template: /eng/pipelines/common/platform-matrix.yml
+  parameters:
+    jobTemplate: /eng/pipelines/installer/jobs/bash-build.yml
+    platforms:
+    - ${{ if not(containsValue(parameters.skipPlatforms, 'Linux_musl_x64')) }}:
+      - Linux_musl_x64
+    jobParameters:
+      ${{ insert }}: ${{ parameters }}
+      additionalMSBuildArgs: /p:OutputRid=linux-musl-x64
+      portableBuild: false
+
+- template: /eng/pipelines/common/platform-matrix.yml
+  parameters:
+    jobTemplate: /eng/pipelines/installer/jobs/bash-build.yml
+    platforms:
+    - ${{ if not(containsValue(parameters.skipPlatforms, 'Linux_musl_arm64')) }}:
+      - Linux_musl_arm64
+    jobParameters:
+      ${{ insert }}: ${{ parameters }}
+      additionalMSBuildArgs: /p:OutputRid=linux-musl-arm64
+      portableBuild: false
+      crossBuild: true
+      skipTests: true
+
+- template: /eng/pipelines/common/platform-matrix.yml
+  parameters:
+    jobTemplate: /eng/pipelines/installer/jobs/osx-build.yml
+    platforms:
+    - OSX_x64
+    jobParameters:
+      ${{ insert }}: ${{ parameters }}
+
+- template: /eng/pipelines/common/platform-matrix.yml
+  parameters:
+    jobTemplate: /eng/pipelines/installer/jobs/bash-build.yml
+    platforms:
+    - Linux_x64
+    jobParameters:
+      ${{ insert }}: ${{ parameters }}
+      name: Linux_x64_glibc
+      packageDistroList:
+      - image: mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-14.04-debpkg-e5cf912-20175003025046
+        imageRid: ubuntu.14.04
+        rids: []
+      - image: mcr.microsoft.com/dotnet-buildtools/prereqs:rhel-7-rpmpkg-c982313-20174116044113
+        imageRid: rhel.7
+        rids:
+        - centos.7
+        - fedora.27
+        - opensuse.42
+        - oraclelinux.7
+        - sles.12
+      portableBuild: true
diff --git a/eng/pipelines/installer/jobs/base-job.yml b/eng/pipelines/installer/jobs/base-job.yml
new file mode 100644 (file)
index 0000000..033c518
--- /dev/null
@@ -0,0 +1,173 @@
+parameters:
+  buildConfig: ''
+  osGroup: ''
+  archType: ''
+  osSubgroup: ''
+  timeoutInMinutes: 120
+  condition: true
+  container: ''
+  prepareSteps: []
+  buildSteps: []
+  dependsOn: []
+  variables: []
+  buildVariables: {}
+  name: ''
+  displayName: ''
+  pool: ''
+  workspace:
+    clean: all
+  strategy:
+    matrix:
+      release:
+        _BuildConfig: Release
+
+  buildCommandSourcesDirectory: '$(Build.SourcesDirectory)/'
+
+  liveCoreClrBuildConfig: ''
+  liveLibrariesBuildConfig: ''
+
+jobs:
+- job: ${{ format('installer_{0}', coalesce(parameters.name, parameters.platform)) }}
+  displayName: ${{ format('Installer Build and Test {0}', coalesce(parameters.name, parameters.platform)) }}
+
+  condition: and(succeeded(), ${{ parameters.condition }})
+  pool: ${{ parameters.pool }}
+  strategy: ${{ parameters.strategy }}
+  timeoutInMinutes: ${{ parameters.timeoutInMinutes }}
+
+  ${{ if ne(parameters.workspace, '') }}:
+    workspace: ${{ parameters.workspace }}
+
+  variables:
+  - ${{ parameters.variables }}
+  - ${{ each variable in parameters.buildVariables }}:
+    - name: ${{ variable.key }}
+      value: ${{ variable.value }}
+
+  # Produce test-signed build for PR and Public builds
+  - ${{ if or(eq(variables['System.TeamProject'], 'public'), in(variables['Build.Reason'], 'PullRequest')) }}:
+    - name: SignType
+      value: test
+
+  # Set up non-PR build from internal project
+  - ${{ if eq(variables.isOfficialBuild, true) }}:
+    - name: SignType
+      value: $[ coalesce(variables.OfficialSignType, 'real') ]
+
+  - name: LiveOverridePathArgs
+    value: >-
+      $(CoreCLROverridePathArg)
+      $(CoreFXOverridePathArg)
+
+  - name: CoreCLROverridePathArg
+    value: ''
+  - name: CoreFXOverridePathArg
+    value: ''
+
+  - name: CoreClrDownloadPath
+    value: ''
+  - name: LibrariesDownloadPath
+    value: ''
+
+  - ${{ if ne(parameters.liveCoreClrBuildConfig, '') }}:
+    - name: liveCoreClrLegName
+      value: ${{ format('{0}{1}_{2}_{3}',
+        parameters.osGroup,
+        parameters.osSubgroup,
+        parameters.archType,
+        parameters.liveCoreClrBuildConfig) }}
+    - name: CoreClrDownloadPath
+      value: 'artifacts/transport/coreclr'
+    - name: CoreCLROverridePathArg
+      value: /p:CoreCLROverridePath=${{ parameters.buildCommandSourcesDirectory }}$(CoreClrDownloadPath)
+    - name: CoreClrArtifactName
+      value: CoreCLRProduct_$(liveCoreClrLegName)
+
+  - ${{ if ne(parameters.liveLibrariesBuildConfig, '') }}:
+    - name: liveLibrariesLegName
+      value: ${{ format('{0}{1}_{2}_{3}',
+        parameters.osGroup,
+        parameters.osSubgroup,
+        parameters.archType,
+        parameters.liveLibrariesBuildConfig) }}
+    - name: LibrariesDownloadPath
+      value: 'artifacts/transport/libraries'
+    - name: CoreFXOverridePathArg
+      value: /p:CoreFXOverridePath=${{ parameters.buildCommandSourcesDirectory }}$(LibrariesDownloadPath)
+    - name: LibrariesArtifactName
+      value: libraries_bin_$(liveLibrariesLegName)
+
+  dependsOn:
+  - checkout
+  - ${{ parameters.dependsOn }}
+  - ${{ if ne(parameters.liveCoreClrBuildConfig, '') }}:
+    - coreclr_product_build_${{ format('{0}{1}_{2}_{3}',
+        parameters.osGroup,
+        parameters.osSubgroup,
+        parameters.archType,
+        parameters.liveCoreClrBuildConfig) }}
+  - ${{ if ne(parameters.liveLibrariesBuildConfig, '') }}:
+    - libraries_build_netcoreapp_${{ format('{0}{1}_{2}_{3}',
+        parameters.osGroup,
+        parameters.osSubgroup,
+        parameters.archType,
+        parameters.liveLibrariesBuildConfig) }}
+
+  steps:
+
+  - ${{ parameters.prepareSteps }}
+
+  - ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}:
+    - task: NuGetAuthenticate@0
+
+    - ${{ if eq(parameters.osGroup, 'Windows_NT') }}:
+      # NuGet's http cache lasts 30 minutes. If we're on a static machine, this may interfere with
+      # auto-update PRs by preventing the CI build from fetching the new version. Delete the cache.
+      - powershell: Remove-Item -Recurse -ErrorAction Ignore "$env:LocalAppData\NuGet\v3-cache"
+        displayName: Clear NuGet http cache (if exists)
+
+      - task: MicroBuildSigningPlugin@2
+        displayName: Install MicroBuild plugin for Signing
+        inputs:
+          signType: $(SignType)
+          zipSources: false
+          feedSource: https://dnceng.pkgs.visualstudio.com/_packaging/MicroBuildToolset/nuget/v3/index.json
+        continueOnError: false
+        condition: and(succeeded(), in(variables['SignType'], 'real', 'test'))
+
+  - template: /eng/pipelines/common/clone-checkout-bundle-step.yml
+
+  - ${{ if ne(parameters.liveCoreClrBuildConfig, '') }}:
+    - template: /eng/pipelines/common/download-artifact-step.yml
+      parameters:
+        unpackFolder: $(Build.SourcesDirectory)/$(CoreClrDownloadPath)
+        artifactFileName: '$(CoreClrArtifactName)$(archiveExtension)'
+        artifactName: '$(CoreClrArtifactName)'
+        displayName: 'CoreCLR artifacts'
+
+  - ${{ if ne(parameters.liveLibrariesBuildConfig, '') }}:
+    - template: /eng/pipelines/common/download-artifact-step.yml
+      parameters:
+        unpackFolder: $(Build.SourcesDirectory)/$(LibrariesDownloadPath)
+        artifactFileName: '$(LibrariesArtifactName)$(archiveExtension)'
+        artifactName: '$(LibrariesArtifactName)'
+        displayName: 'Libraries artifacts'
+
+  - ${{ parameters.buildSteps }}
+
+  - template: steps/upload-job-artifacts.yml
+    parameters:
+      name: ${{ coalesce(parameters.name, parameters.platform) }}
+      skipTests: ${{ parameters.skipTests }}
+
+  - ${{ if ne(parameters.osGroup, 'Windows_NT') }}:
+    - script: set -x && df -h
+      displayName: Check remaining storage space
+      condition: always()
+      continueOnError: true
+
+    # Force clean up machine in case any docker images are left behind
+    - ${{ if ne(parameters.container, '') }}:
+      - script: docker system prune -af && df -h
+        displayName: Run Docker clean up
+        condition: succeededOrFailed()
index 42661f0..0812658 100644 (file)
@@ -1,50 +1,46 @@
 parameters:
+  platform: ''
+  dependsOn: []
   additionalMSBuildArgs: ''
   additionalRunArgs: ''
   crossBuild: false
   disableCrossgen: false
-  displayName: null
-  dockerImage: null
+  container: ''
   packageDistroList: null
-  skipTests: $(SkipTests)
-  strategy:
-    matrix:
-      debug:
-        _BuildConfig: Debug
-      release:
-        _BuildConfig: Release
-  targetArchitecture: x64
+  skipTests: false
+  archType: x64
   timeoutInMinutes: 120
+  pool: ''
+  crossrootfsDir: ''
+
 jobs:
-  - job: ${{ parameters.name }}
-    displayName: ${{ parameters.name }}
-    timeoutInMinutes: ${{ parameters.timeoutInMinutes }}
-    pool:
-      ${{ if and(eq(parameters.name, 'FreeBSD_x64'), ne(variables['System.TeamProject'], 'public')) }}:
-        name: dnceng-freebsd-internal
-      ${{ if ne(parameters.name, 'FreeBSD_x64') }}:
-        ${{ if eq(variables['System.TeamProject'], 'public') }}:
-          name: NetCorePublic-Pool
-          queue: buildpool.ubuntu.1604.amd64.open
-        ${{ if ne(variables['System.TeamProject'], 'public') }}:
-          name: NetCoreInternal-Pool
-          queue: buildpool.ubuntu.1604.amd64
-    strategy: ${{ parameters.strategy }}
-    variables:
+- template: base-job.yml
+  parameters:
+    ${{ insert }}: ${{ parameters }}
+
+    # Do not attempt to clean workspace: the agent might not be able to remove the files because
+    # they may be owned by "root" due to the way this job uses Docker. This job does its own cleanup
+    # as a prepare step.
+    workspace: ''
+
+    # This job runs within several Docker containers, so Build.SourcesDirectory is not accurate.
+    buildCommandSourcesDirectory: '/root/runtime/'
+
+    buildVariables:
       # Preserve the NuGet authentication env vars into the Docker container.
       # The 'NuGetAuthenticate' build step may have set these.
       PreserveNuGetAuthDockerArgs: >-
         -e VSS_NUGET_URI_PREFIXES
         -e VSS_NUGET_ACCESSTOKEN
 
-      ${{ if ne(parameters.name, 'FreeBSD_x64')}}:
+      ${{ if ne(parameters.container, '') }}:
         RunArguments: >-
           docker run --privileged --rm
           -v "$(Build.SourcesDirectory):/root/runtime"
           -w="/root/runtime"
           $(PreserveNuGetAuthDockerArgs)
-          ${{ parameters.additionalRunArgs }}
-          ${{ parameters.dockerImage }}
+          -e ROOTFS_DIR=${{ parameters.crossrootfsDir }}
+          ${{ parameters.container }}
 
       ${{ if eq(parameters.name, 'FreeBSD_x64')}}:
         RunArguments: export DotNetBootstrapCliTarPath=/dotnet-sdk-freebsd-x64.tar &&
@@ -54,13 +50,13 @@ jobs:
         MSBuildScript: /root/runtime/eng/install-nuget-credprovider-then-msbuild.sh
 
       ${{ if not(and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest'))) }}:
-        BuildScript: ./$(buildScriptFileName).sh
+        BuildScript: ./installer.sh
         MSBuildScript: /root/runtime/eng/common/msbuild.sh
 
       CommonMSBuildArgs: >-
         /p:Configuration=$(_BuildConfig)
-        /p:OfficialBuildId=$(OfficialBuildId)
-        /p:TargetArchitecture=${{ parameters.targetArchitecture }}
+        /p:OfficialBuildId=$(Build.BuildNumber)
+        /p:TargetArchitecture=${{ parameters.archType }}
 
       # Don't put additionalMSBuildArgs as the last line. It may or may not have extra args. If the
       # parameter is empty, AzDO replaces it with empty space without chomping the extra newline.
@@ -71,6 +67,7 @@ jobs:
         /p:DisableCrossgen=${{ parameters.disableCrossgen }}
         /p:PortableBuild=${{ parameters.portableBuild }}
         /p:SkipTests=${{ parameters.skipTests }}
+        $(LiveOverridePathArgs)
         $(CommonMSBuildArgs)
         ${{ parameters.additionalMSBuildArgs }}
         /p:StripSymbols=true
@@ -96,25 +93,24 @@ jobs:
 
       installersSubsetArg: --subset Installers
 
-    steps:
-
-    - ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}:
-      - task: NuGetAuthenticate@0
-
-    # Builds don't set user ID, so files might be owned by root and unable to be cleaned up by AzDO.
-    # Clean up the build dirs ourselves in another Docker container to avoid failures.
-    # Using hosted agents is tracked by https://github.com/dotnet/core-setup/issues/4997
-    - script: |
-        set -x
-        docker run --rm \
-          -v "$(Agent.BuildDirectory):/root/build" \
-          -w /root/build \
-          ${{ parameters.dockerImage }} \
-          bash -c '
-            rm -v -rf a b
-            cd s
-            git clean -xdf'
-      displayName: Clean up old artifacts owned by root
+    prepareSteps:
+
+    - ${{ if ne(parameters.container, '') }}:
+      # Builds don't set user ID, so files might be owned by root and unable to be cleaned up by AzDO.
+      # Clean up the build dirs ourselves in another Docker container to avoid failures.
+      # Using hosted agents is tracked by https://github.com/dotnet/core-setup/issues/4997
+      - script: |
+          set -x
+          docker run --rm \
+            -v "$(Agent.BuildDirectory):/root/build" \
+            -w /root/build \
+            ${{ parameters.container }} \
+            bash -c '
+              rm -v -rf a b s'
+          mkdir "$(Agent.BuildDirectory)/s"
+        displayName: Clean up old artifacts owned by root
+
+    buildSteps:
 
     # Build binary and nuget packages
     - script: |
@@ -149,36 +145,22 @@ jobs:
             parameters:
               distroRid: ${{ rid }}
               image: ${{ packageBuild.image }}
-              outputRidArg: /p:OutputRid=${{ rid }}-${{ parameters.targetArchitecture }}
+              outputRidArg: /p:OutputRid=${{ rid }}-${{ parameters.archType }}
               packageStepDescription: Runtime Deps installers
               packagingArgs: /p:BuildDistroIndependentInstallers=false
               subsetArg: $(installersSubsetArg)
 
-    # Files may be owned by root because builds don't set user ID. The next AzDO step runs 'find' in
-    # the source tree, which fails due to permissions in the 'NetCore*-Int-Pool' queues. This step
-    # prevents the failure by using chown to clean up our source tree.
-    - script: |
-        set -x
-        docker run --rm \
-          -v "$(Agent.BuildDirectory):/root/build" \
-          -w /root/build \
-          ${{ parameters.dockerImage }} \
-          bash -c "chown -R $(id -u):$(id -g) *"
-      displayName: Update file ownership from root to build agent account
-      continueOnError: true
-      condition: succeededOrFailed()
-
-    - template: steps/upload-job-artifacts.yml
-      parameters:
-        name: ${{ parameters.name }}
-
-    - script: df -h
-      displayName: Check space (df -h)
-      condition: always()
-      continueOnError: true
-
-    # Force clean up machine in case any docker images are left behind
-    - ${{ if ne(parameters.name, 'FreeBSD_x64')}}:
-      - script: docker system prune -af && df -h
-        displayName: Run Docker clean up
+    - ${{ if ne(parameters.container, '') }}:
+      # Files may be owned by root because builds don't set user ID. Later build steps run 'find' in
+      # the source tree, which fails due to permissions in the 'NetCore*-Int-Pool' queues. This step
+      # prevents the failure by using chown to clean up our source tree.
+      - script: |
+          set -x
+          docker run --rm \
+            -v "$(Agent.BuildDirectory):/root/build" \
+            -w /root/build \
+            ${{ parameters.container }} \
+            bash -c "chown -R $(id -u):$(id -g) *"
+        displayName: Update file ownership from root to build agent account
+        continueOnError: true
         condition: succeededOrFailed()
index a3f79a8..6c663d3 100644 (file)
@@ -1,38 +1,25 @@
 parameters:
   name: ''
+  platform: ''
+  pool: ''
 
 jobs:
-- job: ${{ parameters.name }}
-  pool:
-    ${{ if eq(variables['System.TeamProject'], 'public') }}:
-      name: Hosted macOS
-    ${{ if ne(variables['System.TeamProject'], 'public') }}:
-      name: Hosted Mac internal
-  strategy:
-    matrix: 
-      debug:
-        _BuildConfig: Debug
-      release:
-        _BuildConfig: Release
-  workspace:
-    clean: all
-  variables: 
-    CommonMSBuildArgs: >-
-      /p:Configuration=$(_BuildConfig)
-      /p:PortableBuild=true
-  steps:
+- template: base-job.yml
+  parameters:
+    ${{ insert }}: ${{ parameters }}
 
-  - ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}:
-    - task: NuGetAuthenticate@0
+    buildVariables:
+      CommonMSBuildArgs: >-
+        /p:Configuration=$(_BuildConfig)
+        /p:PortableBuild=true
 
-  - script: >-
-      $(Build.SourcesDirectory)/$(buildScriptFileName).sh --restore --build --ci --test
-      /p:OfficialBuildId=$(OfficialBuildId)
-      /p:StripSymbols=true
-      $(CommonMSBuildArgs)
-    displayName: Build 
-    condition: succeeded()
+    buildSteps:
 
-  - template: steps/upload-job-artifacts.yml
-    parameters:
-      name: ${{ parameters.name }}
+    - script: >-
+        $(Build.SourcesDirectory)/installer.sh --restore --build --ci --test
+        /p:OfficialBuildId=$(Build.BuildNumber)
+        /p:StripSymbols=true
+        $(LiveOverridePathArgs)
+        $(CommonMSBuildArgs)
+      displayName: Build
+      condition: succeeded()
index 90b7502..0634047 100644 (file)
@@ -16,7 +16,7 @@ jobs:
 
   steps:
 
-  - ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}:
+  - ${{ if eq(variables.isOfficialBuild, true) }}:
     - task: NuGetAuthenticate@0
 
   - task: MicroBuildSigningPlugin@2
index d8a7bdf..c4a4d3b 100644 (file)
@@ -106,7 +106,7 @@ jobs:
 
   steps:
 
-  - ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}:
+  - ${{ if eq(variables.isOfficialBuild, true) }}:
     - task: NuGetAuthenticate@0
 
   - task: DownloadBuildArtifacts@0
index 8b9e42f..c966084 100644 (file)
@@ -1,9 +1,10 @@
 parameters:
   name: ''
+  skipTests: false
 
 steps:
 # Upload build outputs as build artifacts only if internal and not PR, to save storage space.
-- ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}:
+- ${{ if eq(variables.isOfficialBuild, true) }}:
   - task: CopyFiles@2
     displayName: Prepare job-specific Artifacts subdirectory
     inputs:
@@ -23,17 +24,17 @@ steps:
       artifactType: container
     condition: and(succeeded(), eq(variables._BuildConfig, 'Release'))
 
-# Always upload test outputs and build logs.
-- task: PublishTestResults@2
-  displayName: Publish Test Results
-  inputs:
-    testResultsFormat: 'xUnit'
-    testResultsFiles: '*.xml'
-    searchFolder: '$(Build.SourcesDirectory)/artifacts/TestResults/$(_BuildConfig)'
-    mergeTestResults: true
-    testRunTitle: ${{ parameters.name }}-$(_BuildConfig)
-  continueOnError: true
-  condition: always()
+- ${{ if eq(parameters.skipTests, false) }}:
+  - task: PublishTestResults@2
+    displayName: Publish Test Results
+    inputs:
+      testResultsFormat: 'xUnit'
+      testResultsFiles: '*.xml'
+      searchFolder: '$(Build.SourcesDirectory)/artifacts/TestResults/$(_BuildConfig)'
+      mergeTestResults: true
+      testRunTitle: Installer-${{ parameters.name }}-$(_BuildConfig)
+    continueOnError: true
+    condition: always()
 
 - task: CopyFiles@2
   displayName: Prepare BuildLogs staging directory
@@ -51,6 +52,6 @@ steps:
   displayName: Publish BuildLogs
   inputs:
     PathtoPublish: '$(Build.StagingDirectory)/BuildLogs'
-    ArtifactName: Logs-${{ parameters.name }}-$(_BuildConfig)
+    ArtifactName: Installer-Logs-${{ parameters.name }}-$(_BuildConfig)
   continueOnError: true
   condition: succeededOrFailed()
index aa90d94..82f1a63 100644 (file)
@@ -1,69 +1,39 @@
 parameters:
   additionalMSBuildArguments: ''
-  displayName: ''
   publishRidAgnosticPackages: false
-  skipTests: $(SkipTests)
-  targetArchitecture: null
+  skipTests: false
+  archType: null
   timeoutInMinutes: 120
+  platform: ''
+  pool: ''
 
 jobs:
-  - job: ${{ parameters.name }}
-    displayName: ${{ parameters.name }}
-    timeoutInMinutes: ${{ parameters.timeoutInMinutes }}
-    pool:
-      # Use a hosted pool when possible.
-      ${{ if eq(variables['System.TeamProject'], 'public') }}:
-        name: NetCorePublic-Pool
-        queue: buildpool.windows.10.amd64.vs2019.open
-      ${{ if ne(variables['System.TeamProject'], 'public') }}:
-        name: NetCoreInternal-Pool
-        queue: buildpool.windows.10.amd64.vs2019
-    strategy:
-      matrix: 
-        debug:
-          _BuildConfig: Debug
-        release:
-          _BuildConfig: Release
-    workspace:
-      clean: all
-    variables: 
+- template: base-job.yml
+  parameters:
+    ${{ insert }}: ${{ parameters }}
+
+    buildVariables:
       CommonMSBuildArgs: >-
         /p:Configuration=$(_BuildConfig)
-        /p:OfficialBuildId=$(OfficialBuildId)
-        /p:TargetArchitecture=${{ parameters.targetArchitecture }}
+        /p:OfficialBuildId=$(Build.BuildNumber)
+        /p:TargetArchitecture=${{ parameters.archType }}
         /p:PortableBuild=true
         /p:SkipTests=${{ parameters.skipTests }}
       MsbuildSigningArguments: >-
         /p:CertificateId=400
         /p:DotNetSignType=$(SignType)
-      TargetArchitecture: ${{ parameters.targetArchitecture }}
-
-    steps:
-
-    - ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}:
-      - task: NuGetAuthenticate@0
+      TargetArchitecture: ${{ parameters.archType }}
 
-      - task: MicroBuildSigningPlugin@2
-        displayName: Install MicroBuild plugin for Signing
-        inputs:
-          signType: $(SignType)
-          zipSources: false
-          feedSource: https://dnceng.pkgs.visualstudio.com/_packaging/MicroBuildToolset/nuget/v3/index.json
-        continueOnError: false
-        condition: and(succeeded(), in(variables['SignType'], 'real', 'test'))
-
-    # NuGet's http cache lasts 30 minutes. If we're on a static machine, this may interfere with
-    # auto-update PRs by preventing the CI build from fetching the new version. Delete the cache.
-    - powershell: Remove-Item -Recurse -ErrorAction Ignore "$env:LocalAppData\NuGet\v3-cache"
-      displayName: Clear NuGet http cache (if exists)
+    buildSteps:
 
     - script: >-
-        $(buildScriptFileName).cmd -restore -build -ci -test
+        installer.cmd -restore -build -ci -test
+        $(LiveOverridePathArgs)
         $(CommonMSBuildArgs)
         $(MsbuildSigningArguments)
       displayName: Build
 
-    - ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}:
+    - ${{ if eq(variables.isOfficialBuild, true) }}:
       - task: NuGetCommand@2
         displayName: Push Visual Studio NuPkgs
         inputs:
@@ -75,7 +45,3 @@ jobs:
           succeeded(),
           eq(variables['_BuildConfig'], 'Release'),
           ne(variables['DisableVSPublish'], 'true'))
-
-    - template: steps/upload-job-artifacts.yml
-      parameters:
-        name: ${{ parameters.name }}
index ef9400b..6f9fc4d 100644 (file)
@@ -103,17 +103,7 @@ jobs:
       timeoutInMinutes: ${{ parameters.timeoutInMinutes }}
 
       steps:
-      - checkout: none
-        clean: true
-
-      - download: current
-        artifact: Checkout_bundle
-        displayName: Download Checkout.bundle
-
-      - script: |
-          git clone $(Pipeline.Workspace)/Checkout_bundle/Checkout.bundle .
-          git remote set-url origin $(Build.Repository.Uri)
-        displayName: Clone the repository from Checkout.bundle
+      - template: /eng/pipelines/common/clone-checkout-bundle-step.yml
 
       - ${{ if ne(parameters.liveCoreClrBuildConfig, '') }}:
         - template: /eng/pipelines/common/download-artifact-step.yml
index 36dd396..76a615f 100644 (file)
@@ -110,7 +110,19 @@ jobs:
             inputs:
               sourceFolder: $(Build.SourcesDirectory)/artifacts/bin/runtime
               targetFolder: $(Build.ArtifactStagingDirectory)/artifacts/bin/runtime
-          
+
+          - task: CopyFiles@2
+            displayName: Prepare framework runtime folder to publish
+            inputs:
+              sourceFolder: $(Build.SourcesDirectory)/artifacts/bin/pkg/${{ parameters.framework }}/runtime
+              targetFolder: $(Build.ArtifactStagingDirectory)/artifacts/bin/pkg/${{ parameters.framework }}/runtime
+
+          - task: CopyFiles@2
+            displayName: Prepare native folder to publish
+            inputs:
+              sourceFolder: $(Build.SourcesDirectory)/artifacts/bin/native
+              targetFolder: $(Build.ArtifactStagingDirectory)/artifacts/bin/native
+
           - task: CopyFiles@2
             displayName: Prepare testhost folder to publish
             inputs:
index ca932a8..9bb89d7 100644 (file)
@@ -1,12 +1,11 @@
 variables:
+  - template: /eng/pipelines/common/variables.yml
   - name: buildScriptFileName
     value: libraries
   - name: sourcesRoot
     value: $(Build.SourcesDirectory)/src/libraries
   - name: pipelinesPath
     value: /eng/pipelines/libraries
-  - name: isOfficialBuild
-    value: ${{ and(ne(variables['System.TeamProject'], 'public'), notIn(variables['Build.Reason'], 'PullRequest')) }}
   - name: isFullMatrix
     value: ${{ notIn(variables['Build.Reason'], 'PullRequest') }}
   - name: includeWindowsOuterloop
index 7ef2211..e4f5135 100644 (file)
@@ -148,3 +148,16 @@ jobs:
       liveCoreClrBuildConfig: checked
       dependsOnBuildConfiguration: Release
       condition: false
+
+#
+# Installer Build and Test
+#
+- template: /eng/pipelines/installer/installer-matrix.yml
+  parameters:
+    liveCoreClrBuildConfig: checked
+    liveLibrariesBuildConfig: Release
+    skipPlatforms:
+    # Not built by CoreCLR and Libraries yet.
+    - Linux_arm64
+    - Linux_musl_x64
+    - Linux_musl_arm64
index c634fda..372be22 100755 (executable)
@@ -227,12 +227,15 @@ elif command -v "clang-3.9" > /dev/null 2>&1; then
 elif command -v "clang-5.0" > /dev/null 2>&1; then
     export CC="$(command -v clang-5.0)"
     export CXX="$(command -v clang++-5.0)"
+elif command -v "clang-9" > /dev/null 2>&1; then
+    export CC="$(command -v clang-9)"
+    export CXX="$(command -v clang++-9)"
 elif command -v clang > /dev/null 2>&1; then
     export CC="$(command -v clang)"
     export CXX="$(command -v clang++)"
 else
     echo "Unable to find Clang Compiler"
-    echo "Install clang-3.5 or clang3.6 or clang3.9 or clang5.0"
+    echo "Install clang-3.5 or clang3.6 or clang3.9 or clang5.0 or clang9"
     exit 1
 fi
 
@@ -249,11 +252,14 @@ pushd $__intermediateOutputPath
 echo "Building Corehost from $DIR to $(pwd)"
 set -x # turn on trace
 if [ $__CrossBuild == 1 ]; then
-    # clang-3.9 or clang-4.0 are default compilers for cross compilation
+    # clang-3.9 or clang-9 are default compilers for cross compilation
     if [[ "$__build_arch" != "arm" && "$__build_arch" != "armel" ]]; then
         if command -v "clang-3.9" > /dev/null 2>&1; then
             export CC="$(command -v clang-3.9)"
             export CXX="$(command -v clang++-3.9)"
+        elif command -v "clang-9" > /dev/null 2>&1; then
+            export CC="$(command -v clang-9)"
+            export CXX="$(command -v clang++-9)"
         fi
     elif command -v "clang-4.0" > /dev/null 2>&1; then
         export CC="$(command -v clang-4.0)"
@@ -261,9 +267,12 @@ if [ $__CrossBuild == 1 ]; then
     elif command -v "clang-5.0" > /dev/null 2>&1; then
         export CC="$(command -v clang-5.0)"
         export CXX="$(command -v clang++-5.0)"
+    elif command -v "clang-9" > /dev/null 2>&1; then
+        export CC="$(command -v clang-9)"
+        export CXX="$(command -v clang++-9)"
     else
-        echo "Unable to find Clang 3.9 or Clang 4.0 or Clang 5.0 Compiler"
-        echo "Install clang-3.9 or clang-4.0 or clang-5.0 for cross compilation"
+        echo "Unable to find Clang 3.9 or Clang 4.0 or Clang 5.0 or Clang 9 Compiler"
+        echo "Install clang-3.9 or clang-4.0 or clang-5.0 or clang-9 for cross compilation"
         exit 1
     fi
     export TARGET_BUILD_ARCH=$__build_arch_lowcase
index 33d8634..401fd10 100644 (file)
       <CoreCLRCrossTargetComponentDirName Condition="'$(TargetArchitecture)' == 'arm' and '$(BuildArchitecture)' != 'arm' and '$(TargetsLinux)' == 'true'">x64</CoreCLRCrossTargetComponentDirName>
       <CoreCLRSharedFrameworkDir>$([MSBuild]::NormalizeDirectory('$(CoreCLROverridePath)','sharedFramework'))</CoreCLRSharedFrameworkDir>
       <CoreCLRCrossTargetComponentDir
-        Condition="'$(CoreCLRCrossTargetComponentDirName)' != ''">$([MSBuild]::NormalizeDirectory('$(CoreCLROverridePath)','$(CoreCLRCrossTargetComponentDir)','sharedFramework'))</CoreCLRCrossTargetComponentDir>
+        Condition="'$(CoreCLRCrossTargetComponentDirName)' != ''">$([MSBuild]::NormalizeDirectory('$(CoreCLROverridePath)','$(CoreCLRCrossTargetComponentDirName)','sharedFramework'))</CoreCLRCrossTargetComponentDir>
     </PropertyGroup>
     <ItemGroup>
       <CoreCLRFiles Include="$(CoreCLRSharedFrameworkDir)*.*" />
-      <CoreCLRCrossTargetFiles Condition="'$(CoreCLRCrossTargetComponentDir)' != ''" Include="$(CoreCLRCrossTargetComponentDir)*.*" />
+      <CoreCLRCrossTargetFiles
+        Include="$(CoreCLRCrossTargetComponentDir)*.*"
+        Condition="'$(CoreCLRCrossTargetComponentDir)' != ''"
+        IsNative="true" />
       <CoreCLRFiles Include="$(CoreCLROverridePath)Redist/**/*.dll" />
       <CoreCLRFiles>
         <IsNative>true</IsNative>
           $(CoreCLRSharedFrameworkDir)PDB/*.pdb;
           $(CoreCLRSharedFrameworkDir)PDB/*.dbg;
           $(CoreCLRSharedFrameworkDir)PDB/*.dwarf" />
+      <CoreCLRFiles Include="$(CoreCLROverridePath)PDB/System.Private.CoreLib.pdb" />
+
+      <CoreCLRSystemPrivateCoreLibNiSymbolFiles
+        Include="$(CoreCLROverridePath)PDB/System.Private.CoreLib.ni.pdb" />
       <CoreCLRFiles
-        Include="$(CoreCLROverridePath)PDB/System.Private.CoreLib.pdb;$(CoreCLROverridePath)PDB/System.Private.CoreLib.ni.pdb" />
+        Include="@(CoreCLRSystemPrivateCoreLibNiSymbolFiles)"
+        Condition="Exists('%(Identity)')" />
+
       <CoreCLRCrossTargetFiles Condition="'$(CoreCLRCrossTargetComponentDir)' != ''"
         Include="
           $(CoreCLRCrossTargetComponentDir)PDB/*.pdb;
           $(CoreCLRCrossTargetComponentDir)PDB/*.dbg;
           $(CoreCLRCrossTargetComponentDir)PDB/*.dwarf" />
 
-      <CoreCLRFiles>
-        <TargetPath>runtime/$(RuntimeIdentifier)/native</TargetPath>
-      </CoreCLRFiles>
-
       <CoreCLRCrossTargetFiles>
-        <TargetPath>runtime/$(CoreCLRCrossTargetComponentDirName)_$(TargetArchitecture)/native</TargetPath>
+        <TargetPath>runtimes/$(CoreCLRCrossTargetComponentDirName)_$(TargetArchitecture)/native</TargetPath>
       </CoreCLRCrossTargetFiles>
 
       <CoreCLRFiles Include="@(CoreCLRCrossTargetFiles)" />
 
-      <ReferenceCopyLocalPaths Remove="@(ReferenceCopyLocalPaths)" Condition="'@(CoreCLRFiles->'%(FileName)%(Extension)')' == '%(FileName)%(Extension)'"/>
+      <!--
+        Remove files we want to override from ReferenceCopyLocalPaths.
+
+        Use distinct filenames: we may have a target arch file as well as cross-arch (build machine
+        arch). In that case, the typical match-up condition fails:
+
+          '@(CoreCLRFiles->'%(FileName)%(Extension)')' == '%(FileName)%(Extension)'
+
+        We get 'clrjit.dll;clrjit.dll' == 'clrjit.dll', preventing clrjit.dll from being removed.
+        Filtering CoreCLRFiles down to unique FileName+Extension items makes it work.
+      -->
+      <CoreCLRFileFileNameExtensions Include="@(CoreCLRFiles -> '%(FileName)%(Extension)')" />
+      <ReferenceCopyLocalPaths
+        Remove="@(ReferenceCopyLocalPaths)"
+        Condition="'@(CoreCLRFileFileNameExtensions->Distinct())' == '%(FileName)%(Extension)'"/>
+
       <ReferenceCopyLocalPaths Remove="@(ReferenceCopyLocalPaths)" Condition="$([System.String]::Copy('%(FileName)').StartsWith('mscordaccore_'))" />
-      <ReferenceCopyLocalPaths Include="@(CoreCLRFiles)" />
+
+      <ReferenceCopyLocalPaths Include="@(CoreCLRFiles)" NuGetPackageId="$(MicrosoftNETCoreRuntimeCoreCLRPackage)" />
     </ItemGroup>
 
     <Error Condition="'@(CoreCLRFiles)' == ''" Text="The path provided to CoreCLROverridePath ($(CoreCLROverridePath)) does not contain any files." />
   <Target Name="OverrideFrameworkFilesFromPackageResolve" Condition="'$(CoreFXOverridePath)' != ''" BeforeTargets="GetFilesFromPackageResolve">
     <Error Condition="!Exists('$(CoreFXOverridePath)')" Text="The path provided to CoreFXOverridePath ($(CoreFXOverridePath)) does not exist." />
 
+    <!-- Determine Libraries OSGroup for this build. Copied from "local live-live" PR. -->
     <PropertyGroup>
-      <CoreFXSharedFrameworkPackageSpec>$(CoreFXOverridePath)/specs/$(MicrosoftPrivateCoreFxNETCoreAppPackage).nuspec</CoreFXSharedFrameworkPackageSpec>
-      <CoreFXSharedFrameworkImplementationPackageSpec Condition="'$(PackageRID)' != ''">$(CoreFXOverridePath)/specs/runtime.$(PackageRID).$(MicrosoftPrivateCoreFxNETCoreAppPackage).nuspec</CoreFXSharedFrameworkImplementationPackageSpec>
+      <CoreCLROSGroup Condition="'$(TargetsWindows)' == 'true'">Windows_NT</CoreCLROSGroup>
+      <CoreCLROSGroup Condition="'$(TargetsLinux)' == 'true'">Linux</CoreCLROSGroup>
+      <CoreCLROSGroup Condition="'$(TargetsOSX)' == 'true'">OSX</CoreCLROSGroup>
+      <CoreCLROSGroup Condition="'$(TargetsFreeBSD)' == 'true'">FreeBSD</CoreCLROSGroup>
+      <LibrariesOSGroup>$(CoreCLROSGroup)</LibrariesOSGroup>
     </PropertyGroup>
-    
-    <Error Condition="!Exists('$(CoreFXSharedFrameworkPackageSpec)')" Text="The nuspec for the reference $(MicrosoftPrivateCoreFxNETCoreAppPackage) package does not exist." />
-    <Message Condition="'$(CoreFXSharedFrameworkImplementationPackageSpec)' != '' And !Exists('$(CoreFXSharedFrameworkImplementationPackageSpec)')"
-      Text="The nuspec for the implementation runtime.$(PackageRID).$(MicrosoftPrivateCoreFxNETCoreAppPackage) package does not exist. Falling back to packaged CoreFX." />
-
-    <XmlPeek
-      Namespaces="&lt;Namespace Prefix='nuget' Uri='http://schemas.microsoft.com/packaging/2013/01/nuspec.xsd' /&gt;"
-      Query="nuget:package/nuget:files/nuget:file/@src"
-      XmlInputPath="$(CoreFXSharedFrameworkPackageSpec)">
-      <Output TaskParameter="Result" ItemName="CoreFXReferenceItems" />
-    </XmlPeek>
-
-    <XmlPeek
-      Condition="'$(CoreFXSharedFrameworkImplementationPackageSpec)' != '' And Exists($(CoreFXSharedFrameworkImplementationPackageSpec))"
-      Namespaces="&lt;Namespace Prefix='nuget' Uri='http://schemas.microsoft.com/packaging/2013/01/nuspec.xsd' /&gt;"
-      Query="nuget:package/nuget:files/nuget:file/@src"
-      XmlInputPath="$(CoreFXSharedFrameworkImplementationPackageSpec)">
-      <Output TaskParameter="Result" ItemName="CoreFXReferenceCopyLocalItems" />
-    </XmlPeek>
-    
+
     <ItemGroup>
-      <CoreFXReferenceItems NuGetPackageId="$(MicrosoftPrivateCoreFxNETCoreAppPackage)" />
-      <CoreFXReferenceCopyLocalItems NuGetPackageId="runtime.$(PackageRID).$(MicrosoftPrivateCoreFxNETCoreAppPackage)" />
+      <CoreFXReferenceItems
+        Include="$([MSBuild]::NormalizeDirectory('$(CoreFXOverridePath)', 'bin', 'ref', 'microsoft.netcore.app', '$(Configuration)'))*"
+        NuGetPackageId="$(MicrosoftPrivateCoreFxNETCoreAppPackage)" />
+
+      <CoreFXReferenceCopyLocalItems
+        Include="
+          $([MSBuild]::NormalizeDirectory('$(CoreFXOverridePath)', 'bin', 'pkg', 'netcoreapp', 'runtime', '$(LibrariesOSGroup)-$(Configuration)-$(TargetArchitecture)'))*;
+          $([MSBuild]::NormalizeDirectory('$(CoreFXOverridePath)', 'bin', 'native', 'netcoreapp-$(LibrariesOSGroup)-$(Configuration)-$(TargetArchitecture)'))*"
+        NuGetPackageId="runtime.$(PackageRID).$(MicrosoftPrivateCoreFxNETCoreAppPackage)" />
     </ItemGroup>
 
+    <Error Condition="'@(CoreFXReferenceItems)' == ''" Text="The path provided to CoreFXOverridePath ($(CoreFXOverridePath)) has no CoreFXReferenceItems." />
+    <Error Condition="'@(CoreFXReferenceCopyLocalItems)' == ''" Text="The path provided to CoreFXOverridePath ($(CoreFXOverridePath)) has no CoreFXReferenceCopyLocalItems." />
+
     <ItemGroup>
       <OverriddenFrameworkReferenceFiles
         Include="@(Reference)"
   <Target Name="OverrideCrossgenToolPaths" DependsOnTargets="GetCorePackagePaths" AfterTargets="GetCrossgenToolPaths" BeforeTargets="CreateCrossGenImages">  
     <PropertyGroup Condition="'$(CoreCLROverridePath)' != ''">
       <_runtimeDirectory>$(CoreCLROverridePath)</_runtimeDirectory>
-      <_crossgenPath>$(CoreCLROverridePath)/crossgen$(ApplicationFileExtension)</_crossgenPath>
+      <_crossgenPath>$([MSBuild]::NormalizePath('$(CoreCLROverridePath)', '$(_crossHostArch)', 'crossgen$(ApplicationFileExtension)'))</_crossgenPath>
       <_CoreLibSharedDirectory>$(CoreCLROverridePath)</_CoreLibSharedDirectory>
-      <_jitPath>$(CoreClrOverridePath)/$(_crossHostArch)/$(LibraryFilePrefix)clrjit$(LibraryFileExtension)</_jitPath>
+      <_jitPath>$([MSBuild]::NormalizePath('$(CoreCLROverridePath)', '$(_crossHostArch)', '$(LibraryFilePrefix)clrjit$(LibraryFileExtension)'))</_jitPath>
     </PropertyGroup>
+  </Target>
+
+  <!-- !!!BEGIN PATCHING Sharedfx SDK target -->
+  <Target Name="GetFilesFromPackageResolve">
+    <ItemGroup>
+      <!-- RID-specific: include all runtime files. -->
+      <RidSpecificFilesToPackage Include="@(ReferenceCopyLocalPaths)">
+        <!-- ResolveNugetPackageAssets doesn't preserve the asset type (native),
+             calculate it by looking for native in the path -->
+        <IsNative Condition="$([System.String]::new('%(Identity)').ToLowerInvariant().Replace('\', '/').Contains('/native/'))">true</IsNative>
+      </RidSpecificFilesToPackage>
+      <!-- !!!BEGIN CHANGE Persist existing TargetPath. -->
+      <RidSpecificFilesToPackage Condition="'%(RidSpecificFilesToPackage.TargetPath)' == ''">
+      <!-- !!!END CHANGE -->
+        <TargetPath Condition="'%(RidSpecificFilesToPackage.IsNative)' != 'true'">runtimes/$(PackageRID)/lib/$(PackageTargetFramework)</TargetPath>
+        <TargetPath Condition="'%(RidSpecificFilesToPackage.IsNative)' == 'true'">runtimes/$(PackageRID)/native</TargetPath>
+      </RidSpecificFilesToPackage>
+      <!-- Ensure localization resource files make it to their subdirs. -->
+      <RidSpecificFilesToPackage Condition="'%(RidSpecificFilesToPackage.DestinationSubDirectory)' != ''">
+        <TargetPath>%(RidSpecificFilesToPackage.TargetPath)/%(RidSpecificFilesToPackage.DestinationSubDirectory)</TargetPath>
+      </RidSpecificFilesToPackage>
+    </ItemGroup>
+
+    <ItemGroup Condition="'$(PackageTargetRuntime)' != ''">
+      <FilesToPackage Include="@(RidSpecificFilesToPackage)" />
+    </ItemGroup>
 
+    <ItemGroup Condition="'$(PackageTargetRuntime)' == ''">
+      <!-- Not RID-specific: include all reference files. -->
+      <FilesToPackage Include="@(Reference)">
+        <TargetPath>ref/$(PackageTargetFramework)</TargetPath>
+      </FilesToPackage>
+
+      <!-- include all doc files -->
+      <_docFilesToPackage Include="%(FilesToPackage.RootDir)%(FilesToPackage.Directory)**\%(FilesToPackage.FileName).xml" />
+
+      <FilesToPackage Include="@(_docFilesToPackage)">
+        <TargetPath>ref/$(PackageTargetFramework)/%(RecursiveDir)</TargetPath>
+      </FilesToPackage>
+    </ItemGroup>
+
+    <!-- Add versions file with the hashes of the repos we consume -->
+    <ItemGroup Condition="'$(FrameworkPackageName)' != ''">
+      <FilesToPackage Include="$(IntermediateOutputPath)\$(FrameworkPackageName).versions.txt">
+        <TargetPath></TargetPath>
+      </FilesToPackage>
+    </ItemGroup>
   </Target>
+  <!-- !!!END PATCHING -->
 
 </Project>
index 91ea562..cc80981 100644 (file)
@@ -1,4 +1,5 @@
-<Project Sdk="Microsoft.NET.Sdk">
+<Project>
+  <Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />
 
   <PropertyGroup>
     <FrameworkPackageName>Microsoft.NETCore.App</FrameworkPackageName>
@@ -78,6 +79,7 @@
       </FilesToPackage>
     </ItemGroup>
   </Target>
-  
+
+  <Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" />
   <Import Project="localnetcoreapp.override.targets" />
 </Project>
index 6c3d9c1..8c12bd1 100644 (file)
   <PropertyGroup>
     <BuildingNETCoreAppVertical Condition="'$(BuildingNETCoreAppVertical)' == '' and ('$(_bc_TargetGroup)'=='netcoreapp' or '$(BuildAllConfigurations)' == 'true')">true</BuildingNETCoreAppVertical>
     <BuildingNETFxVertical Condition="'$(BuildingNETFxVertical)' == '' and ('$(_bc_TargetGroup)'=='netfx' or '$(BuildAllConfigurations)' == 'true')">true</BuildingNETFxVertical>
+    <BinPlaceNETCoreAppPackage Condition="'$(BuildingNETCoreAppVertical)' == 'true'">true</BinPlaceNETCoreAppPackage>
   </PropertyGroup>
 
   <!--
index 6b65645..04cb558 100644 (file)
@@ -52,8 +52,8 @@
     <BinPlaceConfiguration Condition="'$(IsNETCoreApp)' == 'true' and '$(BuildingNETCoreAppVertical)' == 'true'" Include="netcoreapp-$(_bc_OSGroup)">
       <PackageFileRefPath Condition="'$(IsNETCoreAppRef)' == 'true'">$(NETCoreAppPackageRefPath)</PackageFileRefPath>
       <PackageFileRuntimePath>$(NETCoreAppPackageRuntimePath)</PackageFileRuntimePath>
-      <RuntimePath Condition="'$(BinPlaceNETCoreAppPackage)' == 'true'">$(NETCoreAppPackageRuntimePath)\..\runtime</RuntimePath>
-      <RefPath Condition="'$(BinPlaceNETCoreAppPackage)' == 'true' and '$(IsNETCoreAppRef)' == 'true'">$(RefRootPath)microsoft.netcore.app</RefPath>
+      <RuntimePath Condition="'$(BinPlaceNETCoreAppPackage)' == 'true'">$(NETCoreAppPackageRuntimePath)\..\runtime\$(_bc_OSGroup)-$(ConfigurationGroup)-$(ArchGroup)</RuntimePath>
+      <RefPath Condition="'$(BinPlaceNETCoreAppPackage)' == 'true' and '$(IsNETCoreAppRef)' == 'true'">$(RefRootPath)microsoft.netcore.app\$(ConfigurationGroup)</RefPath>
       <!-- enable trimming for any runtime project that's part of the shared framework and hasn't already set ILLinkTrimAssembly -->
       <SetProperties Condition="'$(BinPlaceRuntime)' == 'true' and '$(ILLinkTrimAssembly)' == ''">ILLinkTrimAssembly=true</SetProperties>
     </BinPlaceConfiguration>