Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions eng/Version.Details.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@
</Dependency>
</ProductDependencies>
<ToolsetDependencies>
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="1.0.0-beta.19103.1">
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="1.0.0-beta.19112.3">
<Uri>https://github.com/dotnet/arcade</Uri>
<Sha>58be4cadf2cabd4b3b3186576557835a1987a711</Sha>
<Sha>9a5da1c8a3232c6304955c7a6ffe6109a1b13d9f</Sha>
</Dependency>
</ToolsetDependencies>
</Dependencies>
3 changes: 0 additions & 3 deletions eng/common/PublishBuildAssets.cmd

This file was deleted.

3 changes: 3 additions & 0 deletions eng/common/PublishToPackageFeed.proj
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@
<PushArtifactsInManifestToFeed
ExpectedFeedUrl="$(TargetStaticFeed)"
AccountKey="$(AccountKeyToStaticFeed)"
BARBuildId="$(BARBuildId)"
MaestroApiEndpoint="$(MaestroApiEndpoint)"
BuildAssetRegistryToken="$(BuildAssetRegistryToken)"
Overwrite="$(OverrideAssetsWithSameName)"
PassIfExistingItemIdentical="$(PassIfExistingItemIdentical)"
MaxClients="$(MaxParallelUploads)"
Expand Down
19 changes: 5 additions & 14 deletions eng/common/build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Param(
[switch] $sign,
[switch] $pack,
[switch] $publish,
[string][Alias('bl')]$binaryLog,
[switch][Alias('bl')]$binaryLog,
[switch] $ci,
[switch] $prepareMachine,
[switch] $help,
Expand All @@ -30,7 +30,7 @@ function Print-Usage() {
Write-Host "Common settings:"
Write-Host " -configuration <value> Build configuration: 'Debug' or 'Release' (short: -c)"
Write-Host " -verbosity <value> Msbuild verbosity: q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic] (short: -v)"
Write-Host " -binaryLog <value> Output binary log; specify name of Binary Log in the form <value>.binlog (short: -bl)"
Write-Host " -binaryLog Output binary log (short: -bl)"
Write-Host " -help Print help and exit"
Write-Host ""

Expand Down Expand Up @@ -74,14 +74,7 @@ function Build {
$toolsetBuildProj = InitializeToolset
InitializeCustomToolset

$bl = ""
# if flag is present
if ($null -ne $binaryLog)
{
# if value is set, then use it; otherwise default to Build.binlog
$binaryLogName = if ("" -eq $binaryLog) { "Build" } else { $binaryLog }
$bl = "/bl:" + (Join-Path $LogDir ($binaryLogName + ".binlog"))
}
$bl = if ($binaryLog) { "/bl:" + (Join-Path $LogDir "Build.binlog") } else { "" }

if ($projects) {
# Re-assign properties to a new variable because PowerShell doesn't let us append properties directly for unclear reasons.
Expand All @@ -107,19 +100,17 @@ function Build {
/p:Sign=$sign `
/p:Publish=$publish `
/p:ContinuousIntegrationBuild=$ci `
/p:AllowUnsafeBlocks=true `
@properties
}

try {
if ($help -or (($null -ne $properties) -and ($properties.Contains("/help") -or $properties.Contains("/?")))) {
if ($help -or (($properties -ne $null) -and ($properties.Contains("/help") -or $properties.Contains("/?")))) {
Print-Usage
exit 0
}

if ($ci) {
# if binarylog value is given, do not overwrite it
$binaryLog = if ($null -eq $binaryLog) { "" } else { $binaryLog }
$binaryLog = $true
$nodeReuse = $false
}

Expand Down
4 changes: 4 additions & 0 deletions eng/common/internal/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<!-- Licensed to the .NET Foundation under one or more agreements. The .NET Foundation licenses this file to you under the MIT license. See the LICENSE file in the project root for more information. -->
<Project>
<Import Project="Sdk.props" Sdk="Microsoft.DotNet.Arcade.Sdk" />
</Project>
23 changes: 23 additions & 0 deletions eng/common/internal/Tools.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- 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 Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net472</TargetFramework>
<ImportDirectoryBuildTargets>false</ImportDirectoryBuildTargets>
</PropertyGroup>
<ItemGroup>
<!-- Clear references, the SDK may add some depending on UsuingToolXxx settings, but we only want to restore the following -->
<PackageReference Remove="@(PackageReference)"/>
<PackageReference Include="Microsoft.DotNet.IBCMerge" Version="$(MicrosoftDotNetIBCMergeVersion)" Condition="'$(UsingToolIbcOptimization)' == 'true'" />
<PackageReference Include="Drop.App" Version="$(DropAppVersion)" ExcludeAssets="all" Condition="'$(UsingToolVisualStudioIbcTraining)' == 'true'"/>
</ItemGroup>
<PropertyGroup>
<RestoreSources>
https://devdiv.pkgs.visualstudio.com/_packaging/8f470c7e-ac49-4afe-a6ee-cf784e438b93/nuget/v3/index.json;
https://devdiv.pkgs.visualstudio.com/_packaging/VS/nuget/v3/index.json;
</RestoreSources>
</PropertyGroup>

<!-- Repository extensibility point -->
<Import Project="$(RepositoryEngineeringDir)InternalTools.props" Condition="Exists('$(RepositoryEngineeringDir)InternalTools.props')" />
</Project>
73 changes: 39 additions & 34 deletions eng/common/sdk-task.ps1
Original file line number Diff line number Diff line change
@@ -1,48 +1,47 @@
[CmdletBinding(PositionalBinding=$false)]
Param(
[string] $projects = "",
[string][Alias('v')]$verbosity = "minimal",
[string] $configuration = "Debug",
[string] $task,
[string] $verbosity = "minimal",
[string] $msbuildEngine = $null,
[bool] $warnAsError = $true,
[switch][Alias('bl')]$binaryLog,
[switch][Alias('r')]$restore,
[switch] $ci,
[switch] $restore,
[switch] $prepareMachine,
[switch] $help,
[Parameter(ValueFromRemainingArguments=$true)][String[]]$properties
)

$ci = $true
$binaryLog = $true
$warnAsError = $true

. $PSScriptRoot\tools.ps1

function Print-Usage() {
Write-Host "Common settings:"
Write-Host " -v[erbosity] <value> Msbuild verbosity: q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic]"
Write-Host " -[bl|binaryLog] Output binary log (short: -bl)"
Write-Host " -help Print help and exit"
Write-Host ""
Write-Host "Common settings:"
Write-Host " -task <value> Name of Arcade task (name of a project in SdkTasks directory of the Arcade SDK package)"
Write-Host " -restore Restore dependencies"
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 ""

Write-Host "Advanced settings:"
Write-Host " -restore Restore dependencies (short: -r)"
Write-Host " -projects <value> Semi-colon delimited list of sln/proj's from the Arcade sdk 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 " -msbuildEngine <value> Msbuild engine to use to run build ('dotnet', 'vs', or unspecified)."
Write-Host ""
Write-Host "Command line arguments not listed above are passed thru to msbuild."
Write-Host "The above arguments can be shortened as much as to be unambiguous (e.g. -co for configuration, -t for test, etc.)."
Write-Host "Advanced settings:"
Write-Host " -prepareMachine Prepare machine for CI run"
Write-Host " -msbuildEngine <value> Msbuild engine to use to run build ('dotnet', 'vs', or unspecified)."
Write-Host ""
Write-Host "Command line arguments not listed above are passed thru to msbuild."
}

function Build {
$toolsetBuildProj = InitializeToolset
function Build([string]$target) {
$logSuffix = if ($target -eq "Execute") { "" } else { ".$target" }
$log = Join-Path $LogDir "$task$logSuffix.binlog"
$outputPath = Join-Path $ToolsetDir "$task\\"

$toolsetBuildProj = Join-Path (Split-Path $toolsetBuildProj -Parent) "SdkTasks\SdkTask.proj"
$bl = if ($binaryLog) { "/bl:" + (Join-Path $LogDir "SdkTask.binlog") } else { "" }
MSBuild $toolsetBuildProj `
$bl `
/p:Projects=$projects `
/p:Restore=$restore `
MSBuild $taskProject `
/bl:$log `
/t:$target `
/p:Configuration=$configuration `
/p:RepoRoot=$RepoRoot `
/p:ContinuousIntegrationBuild=$ci `
/p:BaseIntermediateOutputPath=$outputPath `
@properties
}

Expand All @@ -52,17 +51,23 @@ try {
exit 0
}

if ($projects -eq "") {
Write-Error "Missing required parameter '-projects <value>'"
if ($task -eq "") {
Write-Host "Missing required parameter '-task <value>'" -ForegroundColor Red
Print-Usage
ExitWithExitCode 1
}

if ($ci) {
$binaryLog = $true
$taskProject = GetSdkTaskProject $task
if (!(Test-Path $taskProject)) {
Write-Host "Unknown task: $task" -ForegroundColor Red
ExitWithExitCode 1
}

if ($restore) {
Build "Restore"
}

Build
Build "Execute"
}
catch {
Write-Host $_
Expand Down
42 changes: 15 additions & 27 deletions eng/common/templates/job/job.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,18 +41,11 @@ parameters:
enablePublishTestResults: false

# Optional: enable sending telemetry
# if 'true', these "variables" must be specified in the variables object or as part of the queue matrix
# _HelixBuildConfig - differentiate between Debug, Release, other
# _HelixType - Example: build/product/
# _HelixSource - Example: official/dotnet/arcade/$(Build.SourceBranch)
enableTelemetry: false

# Optional: If specified, then automatically derive "_HelixSource" variable for telemetry
# Optional: define the helix repo for telemeetry (example: 'dotnet/arcade')
helixRepo: ''

# Optional: Define the type for helix telemetry (must end in '/')
helixType: build/product/

# Required: name of the job
name: ''

Expand Down Expand Up @@ -115,29 +108,20 @@ jobs:
- name: ${{ pair.key }}
value: ${{ pair.value }}

# Add additional variables
- ${{ if and(ne(parameters.helixRepo, ''), eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notIn(variables['Build.Reason'], 'PullRequest')) }}:
- name: _HelixSource
value: official/${{ parameters.helixRepo }}/$(Build.SourceBranch)
- ${{ if and(ne(parameters.helixRepo, ''), or(ne(parameters.runAsPublic, 'false'), eq(variables['System.TeamProject'], 'public'), in(variables['Build.Reason'], 'PullRequest'))) }}:
- name: _HelixSource
value: pr/${{ parameters.helixRepo }}/$(Build.SourceBranch)
- name: _HelixType
value: ${{ parameters.helixType }}
- name: _HelixBuildConfig
value: $(_BuildConfig)

${{ if ne(parameters.workspace, '') }}:
workspace: ${{ parameters.workspace }}

steps:
- ${{ if eq(parameters.enableTelemetry, 'true') }}:
- template: /eng/common/templates/steps/telemetry-start.yml
parameters:
buildConfig: $(_HelixBuildConfig)
helixSource: $(_HelixSource)
helixType: $(_HelixType)
# Telemetry tasks are built from https://github.com/dotnet/arcade-extensions
- task: sendStartTelemetry@0
displayName: 'Send Helix Start Telemetry'
inputs:
helixRepo: ${{ parameters.helixRepo }}
buildConfig: $(_BuildConfig)
runAsPublic: ${{ parameters.runAsPublic }}
continueOnError: ${{ parameters.continueOnError }}
condition: always()

- ${{ if eq(parameters.enableMicrobuild, 'true') }}:
- ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}:
Expand Down Expand Up @@ -165,11 +149,15 @@ jobs:
TeamName: $(_TeamName)

- ${{ if eq(parameters.enableTelemetry, 'true') }}:
- template: /eng/common/templates/steps/telemetry-end.yml
# Telemetry tasks are built from https://github.com/dotnet/arcade-extensions
- task: sendEndTelemetry@0
displayName: 'Send Helix End Telemetry'
continueOnError: ${{ parameters.continueOnError }}
condition: always()

- ${{ if eq(parameters.enablePublishBuildArtifacts, 'true') }}:
- task: PublishBuildArtifacts@1
displayName: Publish Logs to VSTS
displayName: Publish Logs
inputs:
PathtoPublish: '$(Build.SourcesDirectory)/artifacts/log/$(_BuildConfig)'
PublishLocation: Container
Expand Down
13 changes: 8 additions & 5 deletions eng/common/templates/job/publish-build-assets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,15 @@ jobs:
downloadPath: '$(Build.StagingDirectory)/Download'
condition: ${{ parameters.condition }}
continueOnError: ${{ parameters.continueOnError }}
- script: eng\common\publishbuildassets.cmd
/p:ManifestsPath='$(Build.StagingDirectory)/Download/AssetManifests'
/p:BuildAssetRegistryToken=$(MaestroAccessToken)
/p:MaestroApiEndpoint=https://maestro-prod.westus2.cloudapp.azure.com
/p:Configuration=$(_BuildConfig)
- task: PowerShell@2
displayName: Publish Build Assets
inputs:
filePath: eng\common\sdk-task.ps1
arguments: -task PublishBuildAssets -restore -msbuildEngine dotnet
/p:ManifestsPath='$(Build.StagingDirectory)/Download/AssetManifests'
/p:BuildAssetRegistryToken=$(MaestroAccessToken)
/p:MaestroApiEndpoint=https://maestro-prod.westus2.cloudapp.azure.com
/p:Configuration=$(_BuildConfig)
condition: ${{ parameters.condition }}
continueOnError: ${{ parameters.continueOnError }}
- ${{ if eq(parameters.enablePublishBuildArtifacts, 'true') }}:
Expand Down
10 changes: 2 additions & 8 deletions eng/common/templates/jobs/jobs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,15 @@ parameters:
enablePublishTestResults: false

# Optional: enable sending telemetry
# if 'true', these "variables" must be specified in the variables object or as part of the queue matrix
# _HelixBuildConfig - differentiate between Debug, Release, other
# _HelixType - Example: build/product/
# _HelixSource - Example: official/dotnet/arcade/$(Build.SourceBranch)
# if enabled then the 'helixRepo' parameter should also be specified
enableTelemetry: false

# Required: A collection of jobs to run - https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema?view=vsts&tabs=schema#job
jobs: []

# Optional: If specified, then automatically derive "_HelixSource" variable for telemetry
# Optional: define the helix repo for telemetry (example: 'dotnet/arcade')
helixRepo: ''

# Optional: Define the type for helix telemetry (must end in '/')
helixType: build/product/

# Optional: Override automatically derived dependsOn value for "publish build assets" job
publishBuildAssetsDependsOn: ''

Expand Down
13 changes: 8 additions & 5 deletions eng/common/templates/phases/publish-build-assets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,15 @@ phases:
SecretsFilter: 'MaestroAccessToken'
condition: ${{ parameters.condition }}
continueOnError: ${{ parameters.continueOnError }}
- script: eng\common\publishbuildassets.cmd
/p:ManifestsPath='$(Build.StagingDirectory)/Download/AssetManifests'
/p:BuildAssetRegistryToken=$(MaestroAccessToken)
/p:MaestroApiEndpoint=https://maestro-prod.westus2.cloudapp.azure.com
/p:Configuration=$(_BuildConfig)
- task: PowerShell@2
displayName: Publish Build Assets
inputs:
filePath: eng\common\sdk-task.ps1
arguments: -task PublishBuildAssets -restore -msbuildEngine dotnet
/p:ManifestsPath='$(Build.StagingDirectory)/Download/AssetManifests'
/p:BuildAssetRegistryToken=$(MaestroAccessToken)
/p:MaestroApiEndpoint=https://maestro-prod.westus2.cloudapp.azure.com
/p:Configuration=$(_BuildConfig)
condition: ${{ parameters.condition }}
continueOnError: ${{ parameters.continueOnError }}
- task: PublishBuildArtifacts@1
Expand Down
1 change: 1 addition & 0 deletions eng/common/templates/steps/telemetry-start.yml
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ steps:
MaxRetries: ${{ parameters.maxRetries }}
RetryDelay: ${{ parameters.retryDelay }}
condition: and(always(), eq(variables['Agent.Os'], 'Windows_NT'))
displayName: Send Windows Job Start Telemetry
- powershell: |
# Basic retry loop to harden against server flakiness
$retryCount = 0
Expand Down
Loading