Skip to content

Commit

Permalink
RT 1.0.0-beta2-63011-08
Browse files Browse the repository at this point in the history
  • Loading branch information
tmat authored Sep 14, 2018
1 parent bcf2215 commit b63e7bd
Show file tree
Hide file tree
Showing 18 changed files with 169 additions and 118 deletions.
22 changes: 5 additions & 17 deletions .vsts-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@ steps:
signType: real
esrpSigning: true

- script: eng\common\CIBuild.cmd -configuration $(BuildConfiguration)
- script: eng\common\CIBuild.cmd
-configuration $(BuildConfiguration)
/p:DotNetSymbolServerTokenMsdl=$(microsoft-symbol-server-pat)
/p:DotNetSymbolServerTokenSymWeb=$(symweb-symbol-server-pat)
displayName: Build

- task: PublishTestResults@1
Expand All @@ -34,22 +37,6 @@ steps:
connectedServiceName: 'RoslynAnalyzers NuGet feed'
nuGetVersion: 4.0.0.2283

- task: PublishSymbols@1
displayName: Prepare Symbols
inputs:
SymbolsPath: '$(DropRoot)\$(TeamName)\$(Build.DefinitionName)\$(Build.BuildNumber)\Symbols'
SearchPattern: '**/*.dll;**/*.exe;**/*.pdb'
SymbolsFolder: '$(Build.SourcesDirectory)\artifacts\$(BuildConfiguration)\SymStore'
SkipIndexing: true

- task: ms-vscs-artifact.build-tasks.artifactSymbolTask-1.artifactSymbolTask@0
displayName: Publish Symbols
inputs:
symbolServiceURI: 'https://microsoft.artifacts.visualstudio.com/DefaultCollection'
requestName: '$(system.teamProject)/$(Build.DefinitionName)/$(Build.BuildNumber)/$(Build.BuildId)'
sourcePath: '$(DropRoot)\$(TeamName)\$(Build.DefinitionName)\$(Build.BuildNumber)\Symbols'
usePat: false

- task: CopyPublishBuildArtifacts@1
displayName: Publish Artifacts
inputs:
Expand All @@ -59,6 +46,7 @@ steps:
artifacts\$(BuildConfiguration)\log
artifacts\$(BuildConfiguration)\TestResults
artifacts\$(BuildConfiguration)\packages
artifacts\$(BuildConfiguration)\SymStore
artifacts\$(BuildConfiguration)\VSSetup
ArtifactName: '$(Build.BuildNumber)'
ArtifactType: FilePath
Expand Down
3 changes: 3 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
<!-- 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>
<PropertyGroup>
<ImportNetSdkFromRepoToolset>false</ImportNetSdkFromRepoToolset>
<AssetsDir>$(MSBuildThisFileDirectory)assets\</AssetsDir>
<VSSDKTargetPlatformRegRootSuffix>RoslynDev</VSSDKTargetPlatformRegRootSuffix>
</PropertyGroup>

<Import Project="Sdk.props" Sdk="RoslynTools.RepoToolset" />
</Project>
4 changes: 4 additions & 0 deletions Directory.Build.targets
Original file line number Diff line number Diff line change
@@ -0,0 +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" />
</Project>
11 changes: 11 additions & 0 deletions RoslynAnalyzers.sln
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tools", "Tools", "{C0B86774
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Metrics", "src\Tools\Metrics.csproj", "{EEF553EA-1D3D-44A1-A334-1F9220698FB8}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GenerateAnalyzerRulesets", "src\GenerateAnalyzerRulesets\GenerateAnalyzerRulesets.csproj", "{CC0DB31C-87B7-4ABF-A95A-B12526F3056D}"
EndProject
Global
GlobalSection(SharedMSBuildProjectFiles) = preSolution
src\Utilities\Analyzer.Utilities.projitems*{ec946164-1e17-410b-b7d9-7de7e6268d63}*SharedItemsImports = 13
Expand Down Expand Up @@ -557,6 +559,14 @@ Global
{EEF553EA-1D3D-44A1-A334-1F9220698FB8}.Release|Any CPU.Build.0 = Release|Any CPU
{EEF553EA-1D3D-44A1-A334-1F9220698FB8}.Release|x86.ActiveCfg = Release|Any CPU
{EEF553EA-1D3D-44A1-A334-1F9220698FB8}.Release|x86.Build.0 = Release|Any CPU
{CC0DB31C-87B7-4ABF-A95A-B12526F3056D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CC0DB31C-87B7-4ABF-A95A-B12526F3056D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CC0DB31C-87B7-4ABF-A95A-B12526F3056D}.Debug|x86.ActiveCfg = Debug|Any CPU
{CC0DB31C-87B7-4ABF-A95A-B12526F3056D}.Debug|x86.Build.0 = Debug|Any CPU
{CC0DB31C-87B7-4ABF-A95A-B12526F3056D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CC0DB31C-87B7-4ABF-A95A-B12526F3056D}.Release|Any CPU.Build.0 = Release|Any CPU
{CC0DB31C-87B7-4ABF-A95A-B12526F3056D}.Release|x86.ActiveCfg = Release|Any CPU
{CC0DB31C-87B7-4ABF-A95A-B12526F3056D}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down Expand Up @@ -614,6 +624,7 @@ Global
{361CC818-460A-4250-AE67-7A8EFEA1938E} = {BBE0A1C9-3995-4BD1-995E-38DE862BE208}
{EFC1EAEF-88A9-41DA-8EC9-0EB6C8A05027} = {BBE0A1C9-3995-4BD1-995E-38DE862BE208}
{EEF553EA-1D3D-44A1-A334-1F9220698FB8} = {C0B86774-8307-444F-9EE4-98D62C3424F9}
{CC0DB31C-87B7-4ABF-A95A-B12526F3056D} = {C0B86774-8307-444F-9EE4-98D62C3424F9}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {FC44ACA9-AEA3-4EE6-881C-2E08ED281B5F}
Expand Down
35 changes: 28 additions & 7 deletions eng/GenerateAnalyzerNuspec.targets
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,37 @@
<PropertyGroup>
<NuspecFile>$(IntermediateOutputPath)$(NuspecPackageId).nuspec</NuspecFile>
<NuspecBasePath>$(ArtifactsBinDir)</NuspecBasePath>
<AnalyzerRulesetsDir>"$(ArtifactsBinDir)Rulesets\$(NuspecPackageId)"</AnalyzerRulesetsDir>
<AnalyzerRulesetsDir>$(ArtifactsBinDir)Rulesets\$(NuspecPackageId)</AnalyzerRulesetsDir>
<ProduceReferenceAssembly>false</ProduceReferenceAssembly>
</PropertyGroup>

<!--
Projects in this directory do not produce useful binaries, they are only used to generate packages.
Build target only needs to build their project dependencies (via ResolveProjectReferences).
-->
<Target Name="Build" DependsOnTargets="ResolveProjectReferences">
<MakeDir Directories="$(IntermediateOutputPath)" ContinueOnError="True"/>
</Target>

<Target Name="GenerateAnalyzerRulesets"
BeforeTargets="GenerateAnalyzerNuspecFile"
DependsOnTargets="InitializeSourceControlInformation"
Condition="'@(AnalyzerNupkgAssembly)' != '' or '@(AnalyzerRulesetAssembly)' != ''">

<MSBuild Projects="$(RepoRoot)src\GenerateAnalyzerRulesets\GenerateAnalyzerRulesets.csproj" Targets="Build">
<Output TaskParameter="TargetOutputs" PropertyName="_GenerateAnalyzerRulesetsPath"/>
</MSBuild>

<ItemGroup>
<AnalyzerRulesetAssembly Condition="'@(AnalyzerNupkgAssembly)' != '' And '@(AnalyzerRulesetAssembly)' == ''" Include="@(AnalyzerNupkgAssembly)"/>
<AnalyzerRulesetAssembly Condition="'@(AnalyzerNupkgAssembly)' != '' and '@(AnalyzerRulesetAssembly)' == ''" Include="@(AnalyzerNupkgAssembly)"/>
</ItemGroup>
<Exec Command='"$(RepoRoot).dotnet\dotnet.exe" "$(ArtifactsBinDir)GenerateAnalyzerRulesets\netcoreapp2.0\GenerateAnalyzerRulesets.dll" "$(AnalyzerRulesetsDir)" "$(NuspecPackageId)" "$(TargetFramework)" "@(AnalyzerRulesetAssembly)"' />

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

<Target Name="GenerateAnalyzerNuspecFile"
BeforeTargets="$(PackDependsOn)"
BeforeTargets="GenerateNuspec"
DependsOnTargets="InitializeSourceControlInformation;GenerateAnalyzerRulesets"
Condition="'@(AnalyzerNupkgFile)' != '' or '@(AnalyzerNupkgAssembly)' != '' or'@(AnalyzerNupkgDependency)' != ''">
Condition="'@(AnalyzerNupkgFile)' != '' or '@(AnalyzerNupkgAssembly)' != '' or '@(AnalyzerNupkgDependency)' != ''">
<PropertyGroup>
<PackageId>$(NuspecPackageId)</PackageId>
</PropertyGroup>
Expand All @@ -46,6 +60,13 @@
<_NuspecMetadata Include="repositoryCommit=$(SourceRevisionId)" />
<_NuspecMetadata Include="repositoryUrl=$(PrivateRepositoryUrl)" />
</ItemGroup>
<Exec Command='"$(CscToolPath)\csi.exe" "$(RepoRoot)eng\GenerateAnalyzerNuspec.csx" "$(NuspecFile)" "$(AssetsDir)\" "$(MSBuildProjectDirectory)" "$(TargetFramework)" "@(_NuspecMetadata)" "@(AnalyzerNupkgFile)" "@(AnalyzerNupkgAssembly)" "@(AnalyzerNupkgDependency)" "$(AnalyzerRulesetsDir)" "@(AnalyzerLegacyRuleset)"' />

<PropertyGroup>
<_CscToolPath>$(CscToolPath)</_CscToolPath>
<_CscToolPath Condition="'$(_CscToolPath)' == ''">$(MSBuildBinPath)\Roslyn</_CscToolPath>
<_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)"' />
</Target>
</Project>
3 changes: 1 addition & 2 deletions eng/Versions.props
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
<Project>
<PropertyGroup>
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
</PropertyGroup>

<PropertyGroup>
<VersionPrefix>2.6.2</VersionPrefix>
<PreReleaseVersionLabel>beta3</PreReleaseVersionLabel>

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

<!-- Toolset -->
<MicrosoftVSSDKVersion>15.0.26201-alpha</MicrosoftVSSDKVersion>
Expand Down
3 changes: 1 addition & 2 deletions eng/common/CIBuild.cmd
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
@echo off
powershell -ExecutionPolicy ByPass -command "& """%~dp0Build.ps1""" -restore -build -projects """%~dp0..\GenerateAnalyzerRulesets\GenerateAnalyzerRulesets.csproj""" %*"
powershell -ExecutionPolicy ByPass -command "& """%~dp0Build.ps1""" -restore -build -test -sign -pack -ci %*"
powershell -ExecutionPolicy ByPass -command "& """%~dp0Build.ps1""" -restore -build -test -sign -pack -publish -ci %*"
exit /b %ErrorLevel%
96 changes: 62 additions & 34 deletions eng/common/build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@ Param(
[switch] $deploy,
[switch] $test,
[switch] $integrationTest,
[switch] $performanceTest,
[switch] $sign,
[switch] $pack,
[switch] $publish,
[switch] $ci,
[switch] $prepareMachine,
[switch] $help,
Expand All @@ -36,9 +38,11 @@ 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:"
Expand Down Expand Up @@ -147,7 +151,36 @@ 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"

Expand All @@ -167,10 +200,10 @@ 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
}
Expand All @@ -195,8 +228,28 @@ function InitializeCustomToolset {
}
}

function Build {
& $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:IntegrationTest=$integrationTest /p:Sign=$sign /p:Pack=$pack /p:CIBuild=$ci $properties
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: $BuildLog" -ForegroundColor DarkGray
exit $lastExitCode
Expand Down Expand Up @@ -240,36 +293,11 @@ try {
$env:TEMP = $TempDir
$env:TMP = $TempDir
}

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"
}

InitializeToolset
$driver, $args = GetBuildCommand
InitializeToolset $driver $args
InitializeCustomToolset

Build
Build $driver $args
}
catch {
Write-Host $_
Expand Down
51 changes: 41 additions & 10 deletions eng/common/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,21 @@ while [[ -h "$source" ]]; do
done
scriptroot="$( cd -P "$( dirname "$source" )" && pwd )"

build=false
ci=false
configuration='Debug'
help=false
pack=false
prepare_machine=false
rebuild=false
restore=false
build=false
rebuild=false
test=false
pack=false
integration_test=false
performance_test=false
sign=false
public=false
ci=false

projects=''
test=false
configuration='Debug'
prepare_machine=false
verbosity='minimal'
properties=''

Expand Down Expand Up @@ -105,6 +109,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
Expand Down Expand Up @@ -249,9 +265,24 @@ function InitializeCustomToolset {
}

function Build {
"$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: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=$?

Expand Down
Loading

0 comments on commit b63e7bd

Please sign in to comment.