Skip to content

Commit

Permalink
Merge pull request #1829 from tmat/Arcade
Browse files Browse the repository at this point in the history
Migrate to Arcade
  • Loading branch information
mavasani committed Sep 24, 2018
2 parents b63e7bd + fb5890b commit 851ba52
Show file tree
Hide file tree
Showing 32 changed files with 118 additions and 185 deletions.
19 changes: 11 additions & 8 deletions .vsts-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ steps:

- script: eng\common\CIBuild.cmd
-configuration $(BuildConfiguration)
/p:OfficialBuildId=$(BUILD.BUILDNUMBER)
/p:DotNetSignType=$(SignType)
/p:DotNetSymbolServerTokenMsdl=$(microsoft-symbol-server-pat)
/p:DotNetSymbolServerTokenSymWeb=$(symweb-symbol-server-pat)
displayName: Build
Expand All @@ -25,29 +27,30 @@ steps:
displayName: Publish Test Results
inputs:
testRunner: XUnit
testResultsFiles: 'artifacts/$(BuildConfiguration)/TestResults/*.xml'
testResultsFiles: 'artifacts/TestResults/$(BuildConfiguration)/*.xml'
mergeTestResults: true
testRunTitle: 'Unit Tests'
condition: succeededOrFailed()

- task: NuGetPublisher@0
displayName: Publish NuGet Packages to MyGet
inputs:
searchPattern: 'artifacts\$(BuildConfiguration)\packages\*.nupkg'
searchPattern: 'artifacts\packages\$(BuildConfiguration)\Shipping\*.nupkg'
connectedServiceName: 'RoslynAnalyzers NuGet feed'
nuGetVersion: 4.0.0.2283
condition: succeeded()

- task: CopyPublishBuildArtifacts@1
displayName: Publish Artifacts
inputs:
CopyRoot: '$(Build.SourcesDirectory)'
Contents: |
artifacts\$(BuildConfiguration)\bin
artifacts\$(BuildConfiguration)\log
artifacts\$(BuildConfiguration)\TestResults
artifacts\$(BuildConfiguration)\packages
artifacts\$(BuildConfiguration)\SymStore
artifacts\$(BuildConfiguration)\VSSetup
artifacts\bin\$(BuildConfiguration)
artifacts\log\$(BuildConfiguration)
artifacts\TestResults\$(BuildConfiguration)
artifacts\SymStore\$(BuildConfiguration)
artifacts\packages\$(BuildConfiguration)
artifacts\VSSetup\$(BuildConfiguration)
ArtifactName: '$(Build.BuildNumber)'
ArtifactType: FilePath
TargetPath: '$(DropRoot)\$(TeamName)\$(Build.DefinitionName)'
Expand Down
2 changes: 1 addition & 1 deletion Build.cmd
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
@echo off
powershell -ExecutionPolicy ByPass -command "& """%~dp0eng\common\Build.ps1""" -restore -build %*"
powershell -ExecutionPolicy ByPass -NoProfile -command "& """%~dp0eng\common\Build.ps1""" -restore -build %*"
exit /b %ErrorLevel%
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
<VSSDKTargetPlatformRegRootSuffix>RoslynDev</VSSDKTargetPlatformRegRootSuffix>
</PropertyGroup>

<Import Project="Sdk.props" Sdk="RoslynTools.RepoToolset" />
<Import Project="Sdk.props" Sdk="Microsoft.DotNet.Arcade.Sdk" />
</Project>
2 changes: 1 addition & 1 deletion Directory.Build.targets
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!-- 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>
<Import Project="Sdk.targets" Sdk="RoslynTools.RepoToolset" />
<Import Project="Sdk.targets" Sdk="Microsoft.DotNet.Arcade.Sdk" />
</Project>
2 changes: 1 addition & 1 deletion Restore.cmd
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
@echo off
powershell -ExecutionPolicy ByPass -command "& """%~dp0eng\common\Build.ps1""" -restore %*"
powershell -ExecutionPolicy ByPass -NoProfile -command "& """%~dp0eng\common\Build.ps1""" -restore %*"
exit /b %ErrorLevel%
2 changes: 1 addition & 1 deletion Test.cmd
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
@echo off
powershell -ExecutionPolicy ByPass -command "& """%~dp0eng\common\Build.ps1""" -test %*"
powershell -ExecutionPolicy ByPass -NoProfile -command "& """%~dp0eng\common\Build.ps1""" -test %*"
exit /b %ErrorLevel%
17 changes: 9 additions & 8 deletions eng/GenerateAnalyzerNuspec.csx
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
string nuspecFile = Args[0];
string assetsDir = Args[1];
string projectDir = Args[2];
string tfm = Args[3];
var metadataList = Args[4].Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
var fileList = Args[5].Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
var assemblyList = Args[6].Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
var dependencyList = Args[7].Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
var rulesetsDir = Args[8];
var legacyRulesets = Args[9].Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
string configuration = Args[3];
string tfm = Args[4];
var metadataList = Args[5].Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
var fileList = Args[6].Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
var assemblyList = Args[7].Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
var dependencyList = Args[8].Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
var rulesetsDir = Args[9];
var legacyRulesets = Args[10].Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries);

var result = new StringBuilder();

Expand Down Expand Up @@ -107,7 +108,7 @@ if (fileList.Length > 0 || assemblyList.Length > 0)
targets = allTargets;
}

string path = Path.Combine(Path.GetFileNameWithoutExtension(assembly), tfm, assembly);
string path = Path.Combine(Path.GetFileNameWithoutExtension(assembly), configuration, tfm, assembly);

foreach (string target in targets)
{
Expand Down
12 changes: 6 additions & 6 deletions eng/GenerateAnalyzerNuspec.targets
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
<PropertyGroup>
<NuspecFile>$(IntermediateOutputPath)$(NuspecPackageId).nuspec</NuspecFile>
<NuspecBasePath>$(ArtifactsBinDir)</NuspecBasePath>
<AnalyzerRulesetsDir>$(ArtifactsBinDir)Rulesets\$(NuspecPackageId)</AnalyzerRulesetsDir>
<ProduceReferenceAssembly>false</ProduceReferenceAssembly>
</PropertyGroup>

Expand All @@ -23,6 +22,10 @@
DependsOnTargets="InitializeSourceControlInformation"
Condition="'@(AnalyzerNupkgAssembly)' != '' or '@(AnalyzerRulesetAssembly)' != ''">

<PropertyGroup>
<_GeneratedRulesetsDir>$(IntermediateOutputPath)Rulesets</_GeneratedRulesetsDir>
</PropertyGroup>

<MSBuild Projects="$(RepoRoot)src\GenerateAnalyzerRulesets\GenerateAnalyzerRulesets.csproj" Targets="Build">
<Output TaskParameter="TargetOutputs" PropertyName="_GenerateAnalyzerRulesetsPath"/>
</MSBuild>
Expand All @@ -31,16 +34,13 @@
<AnalyzerRulesetAssembly Condition="'@(AnalyzerNupkgAssembly)' != '' and '@(AnalyzerRulesetAssembly)' == ''" Include="@(AnalyzerNupkgAssembly)"/>
</ItemGroup>

<Exec Command='"$(RepoRoot).dotnet\dotnet.exe" "$(_GenerateAnalyzerRulesetsPath)" "$(AnalyzerRulesetsDir)" "$(NuspecPackageId)" "$(TargetFramework)" "@(AnalyzerRulesetAssembly)"' />
<Exec Command='"$(DotNetRoot)dotnet.exe" "$(_GenerateAnalyzerRulesetsPath)" "$(_GeneratedRulesetsDir)" "$(ArtifactsBinDir)\" "$(Configuration)" "$(TargetFramework)" "@(AnalyzerRulesetAssembly)"' />
</Target>

<Target Name="GenerateAnalyzerNuspecFile"
BeforeTargets="GenerateNuspec"
DependsOnTargets="InitializeSourceControlInformation;GenerateAnalyzerRulesets"
Condition="'@(AnalyzerNupkgFile)' != '' or '@(AnalyzerNupkgAssembly)' != '' or '@(AnalyzerNupkgDependency)' != ''">
<PropertyGroup>
<PackageId>$(NuspecPackageId)</PackageId>
</PropertyGroup>
<ItemGroup>
<_NuspecMetadata Include="version=$(PackageVersion)" />
<_NuspecMetadata Include="id=$(NuspecPackageId)" />
Expand All @@ -67,6 +67,6 @@
<_CscToolPath Condition="!HasTrailingSlash('$(_CscToolPath)')">$(_CscToolPath)\</_CscToolPath>
</PropertyGroup>

<Exec Command='"$(_CscToolPath)csi.exe" "$(RepoRoot)eng\GenerateAnalyzerNuspec.csx" "$(NuspecFile)" "$(AssetsDir)\" "$(MSBuildProjectDirectory)" "$(TargetFramework)" "@(_NuspecMetadata)" "@(AnalyzerNupkgFile)" "@(AnalyzerNupkgAssembly)" "@(AnalyzerNupkgDependency)" "$(AnalyzerRulesetsDir)" "@(AnalyzerLegacyRuleset)"' />
<Exec Command='"$(_CscToolPath)csi.exe" "$(RepoRoot)eng\GenerateAnalyzerNuspec.csx" "$(NuspecFile)" "$(AssetsDir)\" "$(MSBuildProjectDirectory)" "$(Configuration)" "$(TargetFramework)" "@(_NuspecMetadata)" "@(AnalyzerNupkgFile)" "@(AnalyzerNupkgAssembly)" "@(AnalyzerNupkgDependency)" "$(_GeneratedRulesetsDir)" "@(AnalyzerLegacyRuleset)"' />
</Target>
</Project>
77 changes: 0 additions & 77 deletions eng/SignToolData.json

This file was deleted.

10 changes: 10 additions & 0 deletions eng/Signing.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<Project>
<PropertyGroup>
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
</PropertyGroup>

<!-- Avoid signing PowerShell scripts included in analyzer packages (https://github.com/dotnet/arcade/issues/825) -->
<ItemGroup>
<FileExtensionSignInfo Remove=".ps1"/>
</ItemGroup>
</Project>
8 changes: 5 additions & 3 deletions eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>

<VersionPrefix>2.6.2</VersionPrefix>
<PreReleaseVersionLabel>beta3</PreReleaseVersionLabel>
<PreReleaseVersionLabel>beta4</PreReleaseVersionLabel>

<!-- Opt-in RepoToolset tools -->
<!-- Opt-in repo features -->
<UsingToolVSSDK>true</UsingToolVSSDK>
<UsingToolNuGetRepack>true</UsingToolNuGetRepack>
<UsingToolSymbolUploader>true</UsingToolSymbolUploader>
<UsingToolNetFrameworkReferenceAssemblies>true</UsingToolNetFrameworkReferenceAssemblies>

<!-- Toolset -->
<MicrosoftVSSDKVersion>15.0.26201-alpha</MicrosoftVSSDKVersion>
Expand All @@ -26,10 +27,11 @@
<!-- Roslyn Testing -->
<MicrosoftCodeAnalysisTestingVersion>1.0.0-beta1-63230-04</MicrosoftCodeAnalysisTestingVersion>

<!-- CoreFX -->
<!-- Libs -->
<SystemCollectionsImmutableVersion>1.3.1</SystemCollectionsImmutableVersion>
<SystemReflectionMetadataVersion>1.4.2</SystemReflectionMetadataVersion>
<MicrosoftVisualBasicVersion>10.1.0</MicrosoftVisualBasicVersion>
<MicrosoftBuildLocatorVersion>1.0.18</MicrosoftBuildLocatorVersion>
</PropertyGroup>

<PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion eng/common/CIBuild.cmd
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
@echo off
powershell -ExecutionPolicy ByPass -command "& """%~dp0Build.ps1""" -restore -build -test -sign -pack -publish -ci %*"
powershell -ExecutionPolicy ByPass -NoProfile -command "& """%~dp0Build.ps1""" -restore -build -test -sign -pack -publish -ci %*"
exit /b %ErrorLevel%
24 changes: 13 additions & 11 deletions eng/common/build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,14 @@ function InitializeDotNetCli {

# Use dotnet installation specified in DOTNET_INSTALL_DIR if it contains the required SDK version,
# otherwise install the dotnet CLI and SDK to repo local .dotnet directory to avoid potential permission issues.
if (($env:DOTNET_INSTALL_DIR -ne $null) -and (Test-Path(Join-Path $env:DOTNET_INSTALL_DIR "sdk\$($GlobalJson.sdk.version)"))) {
if (($env:DOTNET_INSTALL_DIR -ne $null) -and (Test-Path(Join-Path $env:DOTNET_INSTALL_DIR "sdk\$($GlobalJson.tools.dotnet)"))) {
$dotnetRoot = $env:DOTNET_INSTALL_DIR
} else {
$dotnetRoot = Join-Path $RepoRoot ".dotnet"
$env:DOTNET_INSTALL_DIR = $dotnetRoot

if ($restore) {
InstallDotNetSdk $dotnetRoot $GlobalJson.sdk.version
InstallDotNetSdk $dotnetRoot $GlobalJson.tools.dotnet
}
}

Expand Down Expand Up @@ -130,7 +130,7 @@ function InitializeVisualStudioBuild {
}

function LocateVisualStudio {
$vswhereVersion = $GlobalJson.vswhere.version
$vswhereVersion = $GlobalJson.tools.vswhere
$toolsRoot = Join-Path $RepoRoot ".tools"
$vsWhereDir = Join-Path $toolsRoot "vswhere\$vswhereVersion"
$vsWhereExe = Join-Path $vsWhereDir "vswhere.exe"
Expand All @@ -152,15 +152,17 @@ function LocateVisualStudio {
}

function GetBuildCommand() {
if ((Get-Member -InputObject $GlobalJson -Name "sdk") -ne $null) {
$tools = $GlobalJson.tools

if ((Get-Member -InputObject $tools -Name "dotnet") -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) {
if ((Get-Member -InputObject $tools -Name "vswhere") -ne $null) {
$vsInstallDir = InitializeVisualStudioBuild

# Presence of vswhere.version indicates the repo needs to build using VS msbuild:
Expand All @@ -169,7 +171,7 @@ function GetBuildCommand() {
}

if ($buildDriver -eq $null) {
Write-Host "/global.json must either specify 'sdk.version' or 'vswhere.version'." -ForegroundColor Red
Write-Host "/global.json must either specify 'tools.dotnet' or 'tools.vswhere'." -ForegroundColor Red
exit 1
}

Expand All @@ -181,7 +183,7 @@ function GetBuildCommand() {
}

function InitializeToolset([string] $buildDriver, [string]$buildArgs) {
$toolsetVersion = $GlobalJson.'msbuild-sdks'.'RoslynTools.RepoToolset'
$toolsetVersion = $GlobalJson.'msbuild-sdks'.'Microsoft.DotNet.Arcade.Sdk'
$toolsetLocationFile = Join-Path $ToolsetDir "$toolsetVersion.txt"

if (Test-Path $toolsetLocationFile) {
Expand All @@ -199,7 +201,7 @@ function InitializeToolset([string] $buildDriver, [string]$buildArgs) {

$proj = Join-Path $ToolsetDir "restore.proj"

'<Project Sdk="RoslynTools.RepoToolset"/>' | Set-Content $proj
'<Project Sdk="Microsoft.DotNet.Arcade.Sdk"/>' | Set-Content $proj
& $buildDriver $buildArgs $proj /t:__WriteToolsetLocation /m /nologo /clp:None /warnaserror /bl:$ToolsetRestoreLog /v:$verbosity /p:__ToolsetLocationOutputFile=$toolsetLocationFile

if ($lastExitCode -ne 0) {
Expand Down Expand Up @@ -247,7 +249,7 @@ function Build([string] $buildDriver, [string]$buildArgs) {
/p:PerformanceTest=$performanceTest `
/p:Sign=$sign `
/p:Publish=$publish `
/p:CIBuild=$ci `
/p:ContinuousIntegrationBuild=$ci `
$properties

if ($lastExitCode -ne 0) {
Expand All @@ -268,10 +270,10 @@ try {
$EngRoot = Join-Path $PSScriptRoot ".."
$ArtifactsDir = Join-Path $RepoRoot "artifacts"
$ToolsetDir = Join-Path $ArtifactsDir "toolset"
$LogDir = Join-Path (Join-Path $ArtifactsDir $configuration) "log"
$LogDir = Join-Path (Join-Path $ArtifactsDir "log") $configuration
$BuildLog = Join-Path $LogDir "Build.binlog"
$ToolsetRestoreLog = Join-Path $LogDir "ToolsetRestore.binlog"
$TempDir = Join-Path (Join-Path $ArtifactsDir $configuration) "tmp"
$TempDir = Join-Path (Join-Path $ArtifactsDir "tmp") $configuration
$GlobalJson = Get-Content -Raw -Path (Join-Path $RepoRoot "global.json") | ConvertFrom-Json

if ($projects -eq "") {
Expand Down
Loading

0 comments on commit 851ba52

Please sign in to comment.