Skip to content
Permalink
Browse files

Support building the workspaces layer in source-build. Also added a v…

…erification step to CI to ensure we don't break the build.
  • Loading branch information...
333fred committed Aug 30, 2019
1 parent e512863 commit 4f6fe5d384310014ba319b16f06722be4671f2df
@@ -210,6 +210,23 @@ jobs:
continueOnError: true
condition: not(succeeded())

- job: SourceBuild_Test
pool:
name: NetCorePublic-Pool
queue: BuildPool.Ubuntu.1604.amd64.Open
timeoutInMinutes: 90
steps:
- script: ./eng/cibuild.sh --configuration Debug --prepareMachine --docker --sourceBuild
displayName: Build
- task: PublishBuildArtifacts@1
displayName: Publish Logs
inputs:
PathtoPublish: '$(Build.SourcesDirectory)/artifacts/log/Debug'
ArtifactName: 'SourceBuild_Test'
publishLocation: Container
continueOnError: true
condition: not(succeeded())

- job: macOS_Test
pool:
vmImage: 'macOS-10.13'
@@ -42,6 +42,7 @@ param (
[switch]$prepareMachine,
[switch]$useGlobalNuGetCache = $true,
[switch]$warnAsError = $false,
[switch]$sourceBuild = $false,

# official build settings
[string]$officialBuildId = "",
@@ -102,6 +103,7 @@ function Print-Usage() {
Write-Host " -prepareMachine Prepare machine for CI run, clean up processes after build"
Write-Host " -useGlobalNuGetCache Use global NuGet cache."
Write-Host " -warnAsError Treat all warnings as errors"
Write-Host " -sourceBuild Simulate building source-build"
Write-Host ""
Write-Host "Official build settings:"
Write-Host " -officialBuildId An official build id, e.g. 20190102.3"
@@ -233,6 +235,9 @@ function BuildSolution() {
# Workaround for some machines in the AzDO pool not allowing long paths (%5c is msbuild escaped backslash)
$ibcDir = Join-Path $RepoRoot ".o%5c"

# Set DotNetBuildFromSource to 'true' if we're simulating building for source-build.
$buildFromSource = if ($sourceBuild) { "/p:DotNetBuildFromSource=true" } else { "" }

try {
MSBuild $toolsetBuildProj `
$bl `
@@ -258,6 +263,7 @@ function BuildSolution() {
/p:IbcOptimizationDataDir=$ibcDir `
$suppressExtensionDeployment `
$msbuildWarnAsError `
$buildFromSource `
@properties
}
finally {
@@ -34,6 +34,7 @@ usage()
echo " --skipAnalyzers Do not run analyzers during build operations"
echo " --prepareMachine Prepare machine for CI run, clean up processes after build"
echo " --warnAsError Treat all warnings as errors"
echo " --sourceBuild Simulate building for source-build"
echo ""
echo "Command line arguments starting with '/p:' are passed through to MSBuild."
}
@@ -68,6 +69,7 @@ prepare_machine=false
warn_as_error=false
properties=""
disable_parallel_restore=false
source_build=false

docker=false
args=""
@@ -141,6 +143,9 @@ while [[ $# > 0 ]]; do
shift
continue
;;
--sourcebuild)
source_build=true
;;
/p:*)
properties="$properties $1"
;;
@@ -274,6 +279,7 @@ function BuildSolution {
/p:TreatWarningsAsErrors=true \
/p:RestoreDisableParallel=$disable_parallel_restore \
/p:TestRuntimeAdditionalArguments=$test_runtime_args \
/p:DotNetBuildFromSource=$source_build \
$test_runtime \
$mono_tool \
$properties
@@ -194,4 +194,8 @@
</PropertyGroup>
</When>
</Choose>

<PropertyGroup Condition="'$(DotNetBuildFromSource)' == 'true'">
<DefineConstants>DotNetBuildFromSource</DefineConstants>
</PropertyGroup>
</Project>
@@ -24,10 +24,11 @@
<ProjectReference Include="..\..\..\Compilers\Core\Portable\Microsoft.CodeAnalysis.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="SQLitePCLRaw.bundle_green" Version="$(SQLitePCLRawbundle_greenVersion)" PrivateAssets="all" />
<PackageReference Include="SQLitePCLRaw.bundle_green" Version="$(SQLitePCLRawbundle_greenVersion)" PrivateAssets="all" Condition="'$(DotNetBuildFromSource)' != 'true'" />
<PackageReference Include="System.Composition" Version="$(SystemCompositionVersion)" />
</ItemGroup>
<ItemGroup Label="Linked Files">
<Compile Remove="Storage\Sqlite\**\*.cs" Condition="'$(DotNetBuildFromSource)' == 'true'" />
<Compile Include="..\..\..\CodeStyle\Core\CodeFixes\FixAllContextHelper.cs" Link="CodeFixes\FixAllOccurrences\FixAllContextHelper.cs" />
<Compile Include="..\..\..\Compilers\Shared\DesktopAnalyzerAssemblyLoader.cs">
<Link>Execution\Desktop\DesktopAnalyzerAssemblyLoader.cs</Link>
@@ -5,7 +5,10 @@
using Microsoft.CodeAnalysis.Host.Mef;
using Microsoft.CodeAnalysis.Options;
using Microsoft.CodeAnalysis.SolutionSize;
// When building for source-build, there is no sqlite dependency
#if !DotNetBuildFromSource
using Microsoft.CodeAnalysis.SQLite;
#endif

namespace Microsoft.CodeAnalysis.Storage
{
@@ -22,6 +25,7 @@ public PersistenceStorageServiceFactory(ISolutionSizeTracker solutionSizeTracker

public IWorkspaceService CreateService(HostWorkspaceServices workspaceServices)
{
#if !DotNetBuildFromSource
var optionService = workspaceServices.GetRequiredService<IOptionService>();
var database = optionService.GetOption(StorageOptions.Database);
switch (database)
@@ -35,6 +39,7 @@ public IWorkspaceService CreateService(HostWorkspaceServices workspaceServices)

break;
}
#endif

return NoOpPersistentStorageService.Instance;
}

0 comments on commit 4f6fe5d

Please sign in to comment.
You can’t perform that action at this time.