Fix internal yaml build. (#29)
authorMike McLaughlin <mikem@microsoft.com>
Thu, 28 Jun 2018 05:05:54 +0000 (22:05 -0700)
committerGitHub <noreply@github.com>
Thu, 28 Jun 2018 05:05:54 +0000 (22:05 -0700)
Update common eng scripts and files from arcade. Add missing is-vsts.* ones.

12 files changed:
eng/Build-Native.cmd
eng/build-native.sh
eng/build.yml
eng/common/CIBuild.cmd
eng/common/build.ps1
eng/common/build.sh
eng/common/cibuild.sh
eng/common/is-vsts.ps1 [new file with mode: 0644]
eng/common/is-vsts.sh [new file with mode: 0644]
eng/common/templates/phases/base.yml
eng/common/templates/steps/telemetry.yml
src/Directory.Build.targets [deleted file]

index d384909bf9456528dd05a7ccbd4632b50cf7f476..ac57defbd8466975e491df82503b61bf5d5707fe 100644 (file)
@@ -88,6 +88,7 @@ if /i "%1" == "-rebuild"             (set processedArgs=!processedArgs! %1&shift
 if /i "%1" == "-sign"                (set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
 if /i "%1" == "-restore"             (set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
 if /i "%1" == "-pack"                (set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
+if /i "%1" == "-publish"             (set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
 if /i "%1" == "-preparemachine"      (set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
 
 if [!processedArgs!]==[] (
index c6e571c74fbfef3b6a5320f3a9468d5973349329..70f208ac9596a2d6f3661bd3bc45be0e9b7d5549 100755 (executable)
@@ -192,7 +192,7 @@ while :; do
             ;;
 
         # Ignored for a native build
-        --rebuild|--sign|--restore|--pack|--preparemachine)
+        --rebuild|--sign|--restore|--pack|--publish|--preparemachine)
             ;;
 
         --configuration)
index 94befe55c4a80fa745d05b92ee012f3cf954310f..959c4fe1965c48a8cdbf4d9c4b0dcba60b2bf5b0 100644 (file)
@@ -19,27 +19,30 @@ parameters:
 phases:
 - template: /eng/common/templates/phases/base.yml
   parameters:
-    phaseName: ${{ parameters.phaseName }}
     agentOs: ${{ parameters.agentOs }}
     buildReason: ${{ parameters.buildReason }}
+    buildConfig: $(_BuildConfig)
+    phaseName: ${{ parameters.phaseName }}
     enableTelemetry: ${{ parameters.enableTelemetry }}
+    fetchDepth: 5
+    helixType: build/product
+    ${{ if notIn(parameters.buildReason, 'IndividualCI', 'BatchedCI', 'PullRequest') }}:
+      helixSource: official/dotnet/arcade/$(Build.SourceBranch)
+    ${{ if in(parameters.buildReason, 'IndividualCI', 'BatchedCI', 'PullRequest') }}:
+      helixSource: pr/dotnet/arcade/$(Build.SourceBranch)
     phase:
       queue: ${{ parameters.queue }}
       variables: 
-        _HelixType: build/product
         _DockerImageName: ${{ parameters.dockerImage }}
-
         ${{ if notIn(parameters.buildReason, 'IndividualCI', 'BatchedCI', 'PullRequest') }}:
           _PublishBlobFeedUrl: https://dotnetfeed.blob.core.windows.net/dotnet-tools-internal/index.json
           _TeamName: DotNetCore
           _UseEsrpSigning: ${{ parameters.useEsrpSigning }}
-          _HelixSource: official/dotnet/arcade/$(Build.SourceBranch)
+        ${{ if notIn(parameters.buildReason, 'IndividualCI', 'BatchedCI', 'PullRequest') }}:
           _PublishArgs: /p:PB_PublishBlobFeedKey=$(dotnetfeed-storage-access-key-1) 
             /p:PB_PublishBlobFeedUrl=$(_PublishBlobFeedUrl) 
             /p:PB_PublishType=$(_PublishType) 
-
         ${{ if in(parameters.buildReason, 'IndividualCI', 'BatchedCI', 'PullRequest') }}:
-          _HelixSource: pr/dotnet/arcade/$(Build.SourceBranch)
           _PublishArgs: ''
 
       steps:
@@ -68,6 +71,7 @@ phases:
               -architecture $(_BuildArch)
               -prepareMachine 
               /p:SignType=$(_SignType)
+              $(_PublishArgs)
             displayName: Build / Test
             env:
               OfficialBuildId: $(BUILD.BUILDNUMBER)
@@ -83,6 +87,7 @@ phases:
             --architecture $(_BuildArch)
             --prepareMachine 
             /p:SignType=$(_SignType)
+            $(_PublishArgs)
           displayName: Docker Build / Test
           env:
             OfficialBuildId: $(BUILD.BUILDNUMBER)
@@ -95,6 +100,7 @@ phases:
             --architecture $(_BuildArch)
             --prepareMachine
             /p:SignType=$(_SignType)
+            $(_PublishArgs)
           displayName: Build / Test
           env:
             OfficialBuildId: $(BUILD.BUILDNUMBER)
@@ -114,8 +120,12 @@ phases:
           displayName: Publish Logs to VSTS
           inputs:
             PathtoPublish: '$(Build.StagingDirectory)/BuildLogs'
-            ArtifactName: $(parameters.agentOs)_$(Agent.JobName)
             PublishLocation: Container
+            # Should be able to use a single definition of ArtifactName here instead of conditioned on 
+            # agentOs once variables are available in the template evaluation context.  
+            ${{ if eq(parameters.agentOs, 'Windows_NT') }}:
+              ArtifactName: Windows_NT_$(Agent.JobName)
+            ${{ if ne(parameters.agentOs, 'Windows_NT') }}:
+              ArtifactName: Linux_$(Agent.JobName)
           continueOnError: true
           condition: succeededOrFailed()
-          
index 42bb58ba2dde8570930ee83c3d6d693a41548268..6544b0cd54f3649c83cdd2348e71b9a0badc5a75 100644 (file)
@@ -1,3 +1,3 @@
 @echo off
-powershell -ExecutionPolicy ByPass -command "& """%~dp0Build.ps1""" -restore -build -test -sign -pack -ci %*"
+powershell -ExecutionPolicy ByPass -NoProfile -command "& """%~dp0Build.ps1""" -restore -build -test -sign -pack -publish -ci %*"
 exit /b %ErrorLevel%
index a302556394e7e93bb566a76c96b4c582d728824c..c6bebef2f4a225cb529b2980ff7b407668a4501d 100644 (file)
@@ -2,7 +2,7 @@
 Param(
   [string] $architecture = "<auto>",
   [string] $configuration = "Debug",
-  [string] $solution = "",
+  [string] $projects = "",
   [string] $verbosity = "minimal",
   [switch] $restore,
   [switch] $deployDeps,
@@ -11,8 +11,10 @@ Param(
   [switch] $deploy,
   [switch] $test,
   [switch] $integrationTest,
+  [switch] $performanceTest,
   [switch] $sign,
   [switch] $pack,
+  [switch] $publish,
   [switch] $ci,
   [switch] $prepareMachine,
   [switch] $help,
@@ -26,6 +28,7 @@ $ErrorActionPreference = "Stop"
 function Print-Usage() {
     Write-Host "Common settings:"
     Write-Host "  -configuration <value>  Build configuration Debug, Release"
+    Write-Host "  -architecture <value>   Build architecture x64, x86, arm, arm64"
     Write-Host "  -verbosity <value>      Msbuild verbosity (q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic])"
     Write-Host "  -help                   Print help and exit"
     Write-Host ""
@@ -37,13 +40,15 @@ function Print-Usage() {
     Write-Host "  -deploy                 Deploy built VSIXes"
     Write-Host "  -deployDeps             Deploy dependencies (e.g. VSIXes for integration tests)"
     Write-Host "  -test                   Run all unit tests in the solution"
+    Write-Host "  -pack                   Package build outputs into NuGet packages and Willow components"
     Write-Host "  -integrationTest        Run all integration tests in the solution"
+    Write-Host "  -performanceTest        Run all performance tests in the solution"
     Write-Host "  -sign                   Sign build outputs"
-    Write-Host "  -pack                   Package build outputs into NuGet packages and Willow components"
+    Write-Host "  -publish                Publish artifacts (e.g. symbols)"
     Write-Host ""
 
     Write-Host "Advanced settings:"
-    Write-Host "  -solution <value>       Path to solution to build"
+    Write-Host "  -projects <value>       Semi-colon delimited list of sln/proj's to build. Globbing is supported (*.sln)"
     Write-Host "  -ci                     Set when running on CI server"
     Write-Host "  -prepareMachine         Prepare machine for CI run"
     Write-Host ""
@@ -71,7 +76,7 @@ function InitializeDotNetCli {
 
   # Source Build uses DotNetCoreSdkDir variable
   if ($env:DotNetCoreSdkDir -ne $null) {
-    $env:DOTNET_INSTALL_DIR = $env:DotNetCoreSdkDir    
+    $env:DOTNET_INSTALL_DIR = $env:DotNetCoreSdkDir
   }
 
   # Use dotnet installation specified in DOTNET_INSTALL_DIR if it contains the required SDK version, 
@@ -83,22 +88,27 @@ function InitializeDotNetCli {
     $env:DOTNET_INSTALL_DIR = $dotnetRoot
     
     if ($restore) {
-      InstallDotNetCli $dotnetRoot
+      InstallDotNetSdk $dotnetRoot $GlobalJson.sdk.version
     }
   }
 
-  $global:BuildDriver = Join-Path $dotnetRoot "dotnet.exe"    
-  $global:BuildArgs = "msbuild"
+  return $dotnetRoot
 }
 
-function InstallDotNetCli([string] $dotnetRoot) {
+function GetDotNetInstallScript([string] $dotnetRoot) {
   $installScript = "$dotnetRoot\dotnet-install.ps1"
   if (!(Test-Path $installScript)) { 
     Create-Directory $dotnetRoot
     Invoke-WebRequest "https://dot.net/v1/dotnet-install.ps1" -OutFile $installScript
   }
+
+  return $installScript
+}
+
+function InstallDotNetSdk([string] $dotnetRoot, [string] $version) {
+  $installScript = GetDotNetInstallScript $dotnetRoot
   
-  & $installScript -Version $GlobalJson.sdk.version -InstallDir $dotnetRoot -Architecture $architecture
+  & $installScript -Version $version -InstallDir $dotnetRoot -Architecture $architecture
   if ($lastExitCode -ne 0) {
     Write-Host "Failed to install dotnet cli (exit code '$lastExitCode')." -ForegroundColor Red
     exit $lastExitCode
@@ -118,8 +128,7 @@ function InitializeVisualStudioBuild {
     $env:VSSDKInstall = Join-Path $vsInstallDir "VSSDK\"
   }
 
-  $global:BuildDriver = Join-Path $vsInstallDir "MSBuild\15.0\Bin\msbuild.exe"
-  $global:BuildArgs = "/nodeReuse:$(!$ci)"
+  return $vsInstallDir;
 }
 
 function LocateVisualStudio {
@@ -144,12 +153,41 @@ function LocateVisualStudio {
   return $vsInstallDir
 }
 
-function InitializeToolset {
+function GetBuildCommand() {
+  if ((Get-Member -InputObject $GlobalJson -Name "sdk") -ne $null) {  
+    $dotnetRoot = InitializeDotNetCli
+
+    # by default build with dotnet cli:
+    $buildDriver = Join-Path $dotnetRoot "dotnet.exe"
+    $buildArgs = "msbuild"
+  }
+
+  if ((Get-Member -InputObject $GlobalJson -Name "vswhere") -ne $null) {    
+    $vsInstallDir = InitializeVisualStudioBuild
+    
+    # Presence of vswhere.version indicates the repo needs to build using VS msbuild:
+    $buildDriver = Join-Path $vsInstallDir "MSBuild\15.0\Bin\msbuild.exe"
+    $buildArgs = "/nodeReuse:$(!$ci)"
+  }
+
+  if ($buildDriver -eq $null) {
+    Write-Host "/global.json must either specify 'sdk.version' or 'vswhere.version'." -ForegroundColor Red
+    exit 1
+  }
+
+  if ($ci) {
+    Write-Host "Using $buildDriver"
+  }
+
+  return $buildDriver, $buildArgs
+}
+
+function InitializeToolset([string] $buildDriver, [string]$buildArgs) {
   $toolsetVersion = $GlobalJson.'msbuild-sdks'.'RoslynTools.RepoToolset'
   $toolsetLocationFile = Join-Path $ToolsetDir "$toolsetVersion.txt"
 
   if (Test-Path $toolsetLocationFile) {
-    $path = Get-Content $toolsetLocationFile
+    $path = Get-Content $toolsetLocationFile -TotalCount 1
     if (Test-Path $path) {
       $global:ToolsetBuildProj = $path
       return
@@ -164,21 +202,58 @@ function InitializeToolset {
   $proj = Join-Path $ToolsetDir "restore.proj"  
 
   '<Project Sdk="RoslynTools.RepoToolset"/>' | Set-Content $proj
-  & $BuildDriver $BuildArgs $proj /t:__WriteToolsetLocation /m /nologo /clp:None /warnaserror /bl:$ToolsetRestoreLog /v:$verbosity /p:__ToolsetLocationOutputFile=$toolsetLocationFile
+  & $buildDriver $buildArgs $proj /t:__WriteToolsetLocation /m /nologo /clp:None /warnaserror /bl:$ToolsetRestoreLog /v:$verbosity /p:__ToolsetLocationOutputFile=$toolsetLocationFile
     
   if ($lastExitCode -ne 0) {
-    Write-Host "Failed to restore toolset (exit code '$lastExitCode')." -Color Red
+    Write-Host "Failed to restore toolset (exit code '$lastExitCode')." -ForegroundColor Red
     Write-Host "Build log: $ToolsetRestoreLog" -ForegroundColor DarkGray
     exit $lastExitCode
   }
 
- $global:ToolsetBuildProj = Get-Content $toolsetLocationFile
+  $path = Get-Content $toolsetLocationFile -TotalCount 1
+  if (!(Test-Path $path)) {
+    throw "Invalid toolset path: $path"
+  }
+
+  $global:ToolsetBuildProj = $path
 }
 
-function Build {
-  & $BuildDriver $BuildArgs $ToolsetBuildProj /m /nologo /clp:Summary /warnaserror /v:$verbosity /bl:$Log /p:Configuration=$configuration /p:Projects=$solution /p:RepoRoot=$RepoRoot /p:Restore=$restore /p:DeployDeps=$deployDeps /p:Build=$build /p:Rebuild=$rebuild /p:Deploy=$deploy /p:Test=$test /p:IntegrationTest=$integrationTest /p:Sign=$sign /p:Pack=$pack /p:CIBuild=$ci $properties
+function InitializeCustomToolset {
+  if (-not $restore) {
+    return
+  }
+
+  $script = Join-Path $EngRoot "RestoreToolset.ps1"
+
+  if (Test-Path $script) {
+    . $script
+  }
+}
+
+function Build([string] $buildDriver, [string]$buildArgs) {
+  & $buildDriver $buildArgs $ToolsetBuildProj `
+    /m /nologo /clp:Summary /warnaserror `
+    /v:$verbosity `
+    /bl:$BuildLog `
+    /p:Configuration=$configuration `
+    /p:Projects=$projects `
+    /p:RepoRoot=$RepoRoot `
+    /p:Restore=$restore `
+    /p:DeployDeps=$deployDeps `
+    /p:Build=$build `
+    /p:Rebuild=$rebuild `
+    /p:Deploy=$deploy `
+    /p:Test=$test `
+    /p:Pack=$pack `
+    /p:IntegrationTest=$integrationTest `
+    /p:PerformanceTest=$performanceTest `
+    /p:Sign=$sign `
+    /p:Publish=$publish `
+    /p:CIBuild=$ci `
+    $properties
+
   if ($lastExitCode -ne 0) {
-    Write-Host "Build log: $Log" -ForegroundColor DarkGray
+    Write-Host "Build log: $BuildLog" -ForegroundColor DarkGray
     exit $lastExitCode
   }
 }
@@ -192,16 +267,17 @@ function Stop-Processes() {
 
 try {
   $RepoRoot = Join-Path $PSScriptRoot "..\.."
+  $EngRoot = Join-Path $PSScriptRoot ".."
   $ArtifactsDir = Join-Path $RepoRoot "artifacts"
   $ToolsetDir = Join-Path $ArtifactsDir "toolset"
   $LogDir = Join-Path (Join-Path $ArtifactsDir $configuration) "log"
-  $Log = Join-Path $LogDir "Build.binlog"
+  $BuildLog = Join-Path $LogDir "Build.binlog"
   $ToolsetRestoreLog = Join-Path $LogDir "ToolsetRestore.binlog"
   $TempDir = Join-Path (Join-Path $ArtifactsDir $configuration) "tmp"
-  $GlobalJson = Get-Content(Join-Path $RepoRoot "global.json") | ConvertFrom-Json
+  $GlobalJson = Get-Content -Raw -Path (Join-Path $RepoRoot "global.json") | ConvertFrom-Json
   
-  if ($solution -eq "") {
-    $solution = Join-Path $RepoRoot "*.sln"
+  if ($projects -eq "") {
+    $projects = Join-Path $RepoRoot "*.sln"
   }
 
   if ($env:NUGET_PACKAGES -eq $null) {
@@ -219,24 +295,11 @@ try {
     $env:TEMP = $TempDir
     $env:TMP = $TempDir
   }
-    
-  # Presence of vswhere.version indicates the repo needs to build using VS msbuild
-  if ((Get-Member -InputObject $GlobalJson -Name "vswhere") -ne $null) {    
-    InitializeVisualStudioBuild
-  } elseif ((Get-Member -InputObject $GlobalJson -Name "sdk") -ne $null) {  
-    InitializeDotNetCli
-  } else {
-    Write-Host "/global.json must either specify 'sdk.version' or 'vswhere.version'." -ForegroundColor Red
-    exit 1
-  }
-
-  if ($ci) {
-    Write-Host "Using $BuildDriver"
-  }
-
-  InitializeToolset
 
-  Build
+  $driver, $args = GetBuildCommand
+  InitializeToolset $driver $args
+  InitializeCustomToolset
+  Build $driver $args
 }
 catch {
   Write-Host $_
index af7f7e18b6ecd4d974237a3f5cc0c9882f41fdc2..de864bd935dd44ad99d1a34e1e8f196a1f2124e8 100755 (executable)
@@ -12,18 +12,21 @@ while [[ -h "$source" ]]; do
 done
 repo_root="$( cd -P "$( dirname "$source" )/../.." && pwd )"
 
+help=false
+restore=false
 build=false
+rebuild=false
+test=false
+pack=false
+integration_test=false
+performance_test=false
+sign=false
+public=false
 ci=false
+
+projects=''
 configuration='Debug'
-architecture='<auto>'
-help=false
-pack=false
 prepare_machine=false
-rebuild=false
-restore=false
-sign=false
-solution=''
-test=false
 verbosity='minimal'
 properties=''
 
@@ -49,6 +52,7 @@ while (($# > 0)); do
     --help)
       echo "Common settings:"
       echo "  --configuration <value>  Build configuration Debug, Release"
+      echo "  --architecture <value>   Build architecture x64, x86, arm, arm64"
       echo "  --verbosity <value>      Msbuild verbosity (q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic])"
       echo "  --help                   Print help and exit"
       echo ""
@@ -96,6 +100,18 @@ while (($# > 0)); do
       test=true
       shift 1
       ;;
+    --integrationtest)
+      integration_test=true
+      shift 1
+      ;;
+    --performancetest)
+      performance_test=true
+      shift 1
+      ;;
+    --publish)
+      publish=true
+      shift 1
+      ;;
     --verbosity)
       verbosity=$2
       shift 2
@@ -107,11 +123,12 @@ while (($# > 0)); do
   esac
 done
 
+eng_root="$repo_root/eng"
 artifacts_dir="$repo_root/artifacts"
 artifacts_configuration_dir="$artifacts_dir/$configuration"
 toolset_dir="$artifacts_dir/toolset"
 log_dir="$artifacts_configuration_dir/log"
-log="$log_dir/Build.binlog"
+build_log="$log_dir/Build.binlog"
 toolset_restore_log="$log_dir/ToolsetRestore.binlog"
 temp_dir="$artifacts_configuration_dir/tmp"
 
@@ -165,36 +182,46 @@ function InitializeDotNetCli {
     export DOTNET_INSTALL_DIR="$dotnet_root"
 
     if [[ "$restore" == true ]]; then
-      InstallDotNetCli $dotnet_root $dotnet_sdk_version
+      InstallDotNetSdk $dotnet_root $dotnet_sdk_version $architecture
     fi
   fi
 
   build_driver="$dotnet_root/dotnet"
 }
 
-function InstallDotNetCli {
-  local dotnet_root=$1
-  local dotnet_sdk_version=$2
-  local dotnet_install_script="$dotnet_root/dotnet-install.sh"
+function InstallDotNetSdk {
+  local root=$1
+  local version=$2
+  local arch=$3
 
-  if [[ ! -a "$dotnet_install_script" ]]; then
-    mkdir -p "$dotnet_root"
+  local install_script=`GetDotNetInstallScript $root`
+
+  bash "$install_script" --version $version --install-dir $root --architecture $arch
+  local lastexitcode=$?
+
+  if [[ $lastexitcode != 0 ]]; then
+    echo "Failed to install dotnet SDK (exit code '$lastexitcode')."
+    ExitWithExitCode $lastexitcode
+  fi
+}
+
+function GetDotNetInstallScript {
+  local root=$1
+  local install_script="$root/dotnet-install.sh"
+
+  if [[ ! -a "$install_script" ]]; then
+    mkdir -p "$root"
 
     # Use curl if available, otherwise use wget
     if command -v curl > /dev/null; then
-      curl "https://raw.githubusercontent.com/dotnet/cli/release/2.1.4xx/scripts/obtain/dotnet-install.sh" -sSL --retry 10 --create-dirs -o "$dotnet_install_script"
+      curl "https://dot.net/v1/dotnet-install.sh" -sSL --retry 10 --create-dirs -o "$install_script"
     else
-      wget -q -O "$dotnet_install_script" "https://raw.githubusercontent.com/dotnet/cli/release/2.1.4xx/scripts/obtain/dotnet-install.sh"     
+      wget -q -O "$install_script" "https://dot.net/v1/dotnet-install.sh"
     fi
   fi
 
-  bash "$dotnet_install_script" --version $dotnet_sdk_version --install-dir $dotnet_root --architecture $architecture
-  local lastexitcode=$?
-
-  if [[ $lastexitcode != 0 ]]; then
-    echo "Failed to install dotnet cli (exit code '$lastexitcode')."
-    ExitWithExitCode $lastexitcode
-  fi
+  # return value
+  echo "$install_script"
 }
 
 function InitializeToolset {
@@ -227,12 +254,40 @@ function InitializeToolset {
   fi
 
   toolset_build_proj=`cat $toolset_location_file`
+
+  if [[ ! -a "$toolset_build_proj" ]]; then
+    echo "Invalid toolset path: $toolset_build_proj"
+    ExitWithExitCode 3
+  fi
+}
+
+function InitializeCustomToolset {
+  local script="$eng_root/RestoreToolset.sh"
+
+  if [[ -a "$script" ]]; then
+    . "$script"
+  fi
 }
 
 function Build {
-  "$build_driver" msbuild $toolset_build_proj /m /nologo /clp:Summary /warnaserror \
-    /v:$verbosity /bl:$log /p:Configuration=$configuration /p:Projects=$solution /p:RepoRoot="$repo_root" \
-    /p:Restore=$restore /p:Build=$build /p:Rebuild=$rebuild /p:Deploy=$deploy /p:Test=$test /p:Sign=$sign /p:Pack=$pack /p:CIBuild=$ci \
+  "$build_driver" msbuild $toolset_build_proj \
+    /m /nologo /clp:Summary /warnaserror \
+    /v:$verbosity \
+    /bl:$build_log \
+    /p:Configuration=$configuration \
+    /p:Projects=$projects \
+    /p:RepoRoot="$repo_root" \
+    /p:Restore=$restore \
+    /p:Build=$build \
+    /p:Rebuild=$rebuild \
+    /p:Deploy=$deploy \
+    /p:Test=$test \
+    /p:Pack=$pack \
+    /p:IntegrationTest=$integration_test \
+    /p:PerformanceTest=$performance_test \
+    /p:Sign=$sign \
+    /p:Publish=$publish \
+    /p:CIBuild=$ci \
     $properties
   local lastexitcode=$?
 
@@ -262,8 +317,8 @@ function Main {
     mkdir -p "$HOME"
   fi
 
-  if [[ -z $solution ]]; then
-    solution="$repo_root/*.sln"
+  if [[ -z $projects ]]; then
+    projects="$repo_root/*.sln"
   fi
 
   if [[ -z $NUGET_PACKAGES ]]; then
@@ -285,6 +340,7 @@ function Main {
 
   InitializeDotNetCli
   InitializeToolset
+  InitializeCustomToolset
 
   Build
   ExitWithExitCode $?
index b5112539e7a330cc4b1a299fc960631144bb18de..66e3b0ac61c365f8670fbd6acafdd09f6783b051 100755 (executable)
@@ -13,4 +13,4 @@ while [[ -h $source ]]; do
 done
 scriptroot="$( cd -P "$( dirname "$source" )" && pwd )"
 
-. "$scriptroot/build.sh" --restore --build --test --ci $@
\ No newline at end of file
+. "$scriptroot/build.sh" --restore --build --test --pack --publish --ci $@
diff --git a/eng/common/is-vsts.ps1 b/eng/common/is-vsts.ps1
new file mode 100644 (file)
index 0000000..f884729
--- /dev/null
@@ -0,0 +1,6 @@
+if ($env:Build_BuildNumber) {
+  return $true
+}
+else {
+  return $false
+}
diff --git a/eng/common/is-vsts.sh b/eng/common/is-vsts.sh
new file mode 100644 (file)
index 0000000..f7086fa
--- /dev/null
@@ -0,0 +1,5 @@
+if [ ! -z $BUILD_BUILDNUMBER ]; then
+  exit 0
+else
+  exit 1
+fi
index 783dcb9e1f4630344ceb2a935646c1e7ded57d29..de9c3199592516f1e1b81360ee83a0bfe8cc6b3b 100644 (file)
@@ -2,16 +2,24 @@
 # Description: Expands a phase object, applying telemetry, docker info, etc...
 # Parameters:
 #   agentOs: [Windows_NT (default), Linux, OSX] Used in templates to define variables which are OS specific
+#   buildConfig: buildConfiguration property provided to telemetry
 #   dockerImage: If defined, specifies docker image to run build steps in
 #   enableTelemetry: send telemetry if build is not a PR or CI build
+#   fetchDepth: Limit fetching to the specified number of commits from the tip of each remote branch history
+#   helixSource: telemetry source to report
+#   helixType: telemetry type to report
 #   phaseName: name of phase
 #   phase: defined phase object
 
 parameters:
   agentOs: Windows_NT
   buildReason: IndividualCI
+  buildConfig: ''
   dockerImage: ''
   enableTelemetry: ''
+  fetchDepth: ''
+  helixSource: 'undefined_defaulted_in_base.yml'
+  helixType: 'undefined_defaulted_in_base.yml'
   phaseName: ''
   phase: {}
 
@@ -27,14 +35,18 @@ phases:
   steps:
   - checkout: self
     clean: true
-    fetchDepth: 5
+    ${{ if ne(parameters.fetchDepth, '') }}:
+      fetchDepth: ${{ parameters.fetchDepth }}
   - ${{ if notIn(parameters.buildReason, 'IndividualCI', 'BatchedCI', 'PullRequest') }}:
     - ${{ if eq(parameters.enableTelemetry, 'true') }}:
       - template: /eng/common/templates/steps/telemetry.yml
         parameters:
           agentOs: ${{ parameters.agentOs }}
+          buildConfig: ${{ parameters.buildConfig }}
+          helixSource: ${{ parameters.helixSource }}
+          helixType: ${{ parameters.helixType }}
           steps: ${{ parameters.phase.steps }}
     - ${{ if not(eq(parameters.enableTelemetry, 'true')) }}:
-      - ${{ parameters.phase.steps }}          
+      - ${{ parameters.phase.steps }}
   - ${{ if in(parameters.buildReason, 'IndividualCI', 'BatchedCI', 'PullRequest') }}:
-    - ${{ parameters.phase.steps }}          
+    - ${{ parameters.phase.steps }}
index d258a216b91f77b5d1df10197f9d3c5bcc0d8f98..e3de7bc5a592c0685299c2aa7e97a13cbd340b31 100644 (file)
@@ -1,6 +1,9 @@
 
 parameters:
   agentOs: Windows_NT
+  helixSource: 'undefined_defaulted_in_telemetry.yml'
+  helixType: 'undefined_defaulted_in_telemetry.yml'
+  buildConfig: ''
   steps: []
 
 steps:
@@ -20,20 +23,21 @@ steps:
         displayName: Send Job Start Telemetry
         env:
           HelixApiAccessToken: $(HelixApiAccessToken)
-          Source: $(_HelixSource)
-          Type: $(_HelixType)
+          Source: ${{ parameters.helixSource }}
+          Type: ${{ parameters.helixType }}
           Build: $(Build.BuildNumber)
-          QueueId: $(Agent.OS)
+          QueueId: ${{ parameters.agentOs }}
           Attempt: 1
-          OperatingSystem: $(Agent.OS)
-          Configuration: $(_BuildConfig)
+          OperatingSystem: ${{ parameters.agentOs }}
+          Configuration: ${{ parameters.buildConfig }}
         condition: always()
       - bash: |
           /bin/bash ./telemetry/build/start.sh --build-uri "$BuildUri"
         workingDirectory: $(Build.SourcesDirectory)/eng/common
         displayName: Send Build Start Telemetry
         env:
-          BuildUri: https://devdiv.visualstudio.com/DevDiv/_build/index?buildId=$(Build.BuildId)&_a=summary
+          BuildUri: $(System.TaskDefinitionsUri)$(System.TeamProject)/_build/index?buildId=$(Build.BuildId)&_a=summary
+          # defined via VSTS variables in start-job.sh
           Helix_JobToken: $(Helix_JobToken)
         condition: always()
 
@@ -44,6 +48,7 @@ steps:
         workingDirectory: $(Build.SourcesDirectory)/eng/common
         displayName: Send Build End Telemetry
         env:
+          # defined via VSTS variables in start-job.sh
           Helix_JobToken: $(Helix_JobToken)
           Helix_WorkItemId: $(Helix_WorkItemId)
         condition: always()
@@ -66,13 +71,13 @@ steps:
         displayName: Send Job Start Telemetry
         env:
           HelixApiAccessToken: $(HelixApiAccessToken)
-          Source: $(HelixSource)
-          Type: $(HelixType)
+          Source: ${{ parameters.helixSource }}
+          Type: ${{ parameters.helixType }}
           Build: $(Build.BuildNumber)
-          QueueId: $(Agent.OS)
+          QueueId: ${{ parameters.agentOs }}
           Attempt: 1
-          OperatingSystem: $(Agent.OS)
-          Configuration: $(_BuildConfig)
+          OperatingSystem: ${{ parameters.agentOs }}
+          Configuration: ${{ parameters.buildConfig }}
         condition: always()
       - powershell: |
           ./telemetry/build/start.ps1 -BuildUri $env:BuildUri
@@ -82,7 +87,8 @@ steps:
         workingDirectory: $(Build.SourcesDirectory)/eng/common
         displayName: Send Build Start Telemetry
         env:
-          BuildUri: https://devdiv.visualstudio.com/DevDiv/_build/index?buildId=$(Build.BuildId)&_a=summary
+          BuildUri: $(System.TaskDefinitionsUri)$(System.TeamProject)/_build/index?buildId=$(Build.BuildId)&_a=summary
+          # defined via VSTS variables in start-job.ps1
           Helix_JobToken: $(Helix_JobToken)
         condition: always()
 
@@ -96,6 +102,7 @@ steps:
         workingDirectory: $(Build.SourcesDirectory)/eng/common
         displayName: Send Build End Telemetry
         env:
+          # defined via VSTS variables in start-job.ps1
           Helix_JobToken: $(Helix_JobToken)
           Helix_WorkItemId: $(Helix_WorkItemId)
         condition: always()
diff --git a/src/Directory.Build.targets b/src/Directory.Build.targets
deleted file mode 100644 (file)
index c709187..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-<!-- Copyright (c)  Microsoft.  All Rights Reserved.  Licensed under the Apache License, Version 2.0.  See License.txt in the project root for license information. -->
-<Project>
-  <Target Name="PublishForPack" AfterTargets="PostBuildEvent" Condition="'$(NoPublishForPack)' != 'true' and '$(IsPackable)' == 'true'">
-    <Message Importance="High" Text="Executing Publish target on $(MSBuildProjectFullPath) for $(TargetFramework)" />
-    <MSBuild Targets="Publish" Projects="$(MSBuildProjectFullPath)" BuildInParallel="false" Properties="NoBuild=true;NoPublishForPack=true" />
-  </Target>
-</Project>