Skip to content

Commit 394083c

Browse files
authored
Fix overbuilding fsharp & define solution to build in script for VMR (#18491)
* Fix overbuilding fsharp & define solution to build in script FSharp was building two solutions in the VMR on Windows which resulted in the inner-build building the same thing but in parallel. The builds each take 7-8 minutes. Fix that by introducing a productBuild switch (which is already exposed in the Arcade scripts) and condition which solution to build on it or the existing source-build switch. Remove the /p:Projects property from DotNetBuild.props. * proto fix * Fix repo source-build * Fixes * fix * Add YML test fix * try * fix200 * Fix201 * Update azure-pipelines-PR.yml * Fixesss
1 parent 61d7213 commit 394083c

File tree

7 files changed

+35
-35
lines changed

7 files changed

+35
-35
lines changed

azure-pipelines-PR.yml

+5
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,11 @@ stages:
208208
enablePublishBuildAssets: true
209209
enablePublishUsingPipelines: $(_PublishUsingPipelines)
210210
enableSourceBuild: true
211+
sourceBuildParameters:
212+
platforms:
213+
- name: 'Managed'
214+
container: 'mcr.microsoft.com/dotnet-buildtools/prereqs:centos-stream9'
215+
buildArguments: '--source-build'
211216
enableTelemetry: true
212217
helixRepo: dotnet/fsharp
213218
jobs:

azure-pipelines.yml

+5
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,11 @@ extends:
103103
enablePublishBuildAssets: true
104104
enablePublishUsingPipelines: $(_PublishUsingPipelines)
105105
enableSourceBuild: true
106+
sourceBuildParameters:
107+
platforms:
108+
- name: 'Managed'
109+
container: 'mcr.microsoft.com/dotnet-buildtools/prereqs:centos-stream9'
110+
buildArguments: '--source-build'
106111
enableTelemetry: true
107112
helixRepo: dotnet/fsharp
108113
jobs:

eng/Build.ps1

+8-13
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ param (
6868
[switch]$testBenchmarks,
6969
[string]$officialSkipTests = "false",
7070
[switch]$noVisualStudio,
71-
[switch]$sourceBuild,
71+
[switch][Alias('pb')]$productBuild,
7272
[switch]$skipBuild,
7373
[switch]$compressAllMetadata,
7474
[switch]$buildnorealsig = $true,
@@ -133,7 +133,7 @@ function Print-Usage() {
133133
Write-Host " -prepareMachine Prepare machine for CI run, clean up processes after build"
134134
Write-Host " -dontUseGlobalNuGetCache Do not use the global NuGet cache"
135135
Write-Host " -noVisualStudio Only build fsc and fsi as .NET Core applications. No Visual Studio required. '-configuration', '-verbosity', '-norestore', '-rebuild' are supported."
136-
Write-Host " -sourceBuild Simulate building for source-build."
136+
Write-Host " -productBuild Build the repository in product-build mode."
137137
Write-Host " -skipbuild Skip building product"
138138
Write-Host " -compressAllMetadata Build product with compressed metadata"
139139
Write-Host " -buildnorealsig Build product with realsig- (default use realsig+, where necessary)"
@@ -218,10 +218,6 @@ function Process-Arguments() {
218218
$script:pack = $True;
219219
}
220220

221-
if ($sourceBuild) {
222-
$script:testpack = $False;
223-
}
224-
225221
if ($noBinaryLog) {
226222
$script:binaryLog = $False;
227223
}
@@ -278,7 +274,7 @@ function Update-Arguments() {
278274
}
279275

280276

281-
function BuildSolution([string] $solutionName, $nopack) {
277+
function BuildSolution([string] $solutionName, $packSolution) {
282278
Write-Host "${solutionName}:"
283279

284280
$bl = if ($binaryLog) { "/bl:" + (Join-Path $LogDir "Build.$solutionName.binlog") } else { "" }
@@ -292,13 +288,11 @@ function BuildSolution([string] $solutionName, $nopack) {
292288
# Do not set the property to true explicitly, since that would override value projects might set.
293289
$suppressExtensionDeployment = if (!$deployExtensions) { "/p:DeployExtension=false" } else { "" }
294290

295-
$sourceBuildArgs = if ($sourceBuild) { "/p:DotNetBuildSourceOnly=true /p:DotNetBuildRepo=true" } else { "" }
296-
297291
$BUILDING_USING_DOTNET_ORIG = $env:BUILDING_USING_DOTNET
298292

299293
$env:BUILDING_USING_DOTNET="false"
300294

301-
$pack = if ($nopack -eq $False) {""} else {$pack}
295+
$pack = if ($packSolution -eq $False) {""} else {$pack}
302296

303297
MSBuild $toolsetBuildProj `
304298
$bl `
@@ -307,6 +301,7 @@ function BuildSolution([string] $solutionName, $nopack) {
307301
/p:RepoRoot=$RepoRoot `
308302
/p:Restore=$restore `
309303
/p:Build=$build `
304+
/p:DotNetBuildRepo=$productBuild `
310305
/p:Rebuild=$rebuild `
311306
/p:Pack=$pack `
312307
/p:Sign=$sign `
@@ -319,7 +314,6 @@ function BuildSolution([string] $solutionName, $nopack) {
319314
/p:CompressAllMetadata=$CompressAllMetadata `
320315
/p:BuildNoRealsig=$buildnorealsig `
321316
/v:$verbosity `
322-
$sourceBuildArgs `
323317
$suppressExtensionDeployment `
324318
@properties
325319

@@ -567,7 +561,7 @@ try {
567561
}
568562

569563
$script:BuildMessage = "Failure building product"
570-
if ($restore -or $build -or $rebuild -or $pack -or $sign -or $publish -and -not $skipBuild -and -not $sourceBuild) {
564+
if ($restore -or $build -or $rebuild -or $pack -or $sign -or $publish -and -not $skipBuild -and -not $productBuild) {
571565
$originalSignValue = $sign
572566
if ($msbuildEngine -eq "dotnet") {
573567
# Building FSharp.sln and VisualFSharp.sln with .NET Core MSBuild
@@ -587,7 +581,8 @@ try {
587581
BuildSolution "FSharp.Benchmarks.sln" $False
588582
}
589583

590-
if ($pack) {
584+
# When building in product build mode, only build the compiler solution.
585+
if ($pack -or $productBuild) {
591586
$properties_storage = $properties
592587
BuildSolution "Microsoft.FSharp.Compiler.sln" $True
593588
$properties = $properties_storage

eng/DotNetBuild.props

-13
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,11 @@
11
<!-- When altering this file, include @dotnet/product-construction as a reviewer. -->
2-
32
<Project>
43

54
<PropertyGroup>
65
<GitHubRepositoryName>fsharp</GitHubRepositoryName>
76
<SourceBuildManagedOnly>true</SourceBuildManagedOnly>
87
</PropertyGroup>
98

10-
<!--
11-
The build script passes in the full path of the sln to build. This must be overridden in order to build
12-
the cloned source in the inner build.
13-
-->
14-
<Target Name="ConfigureInnerBuildArg"
15-
BeforeTargets="GetSourceBuildCommandConfiguration">
16-
<PropertyGroup>
17-
<InnerBuildArgs>$(InnerBuildArgs) /p:Projects="$(InnerSourceBuildRepoRoot)\Microsoft.FSharp.Compiler.sln"</InnerBuildArgs>
18-
</PropertyGroup>
19-
</Target>
20-
219
<!--
2210
The build script bootstraps some tooling for the build. Since the inner build is triggerred via msbuild,
2311
trigger the bootstrapping for the inner build.
@@ -26,7 +14,6 @@
2614
DependsOnTargets="PrepareInnerSourceBuildRepoRoot"
2715
BeforeTargets="RunInnerSourceBuildCommand"
2816
Condition="'$(DotNetBuildSourceOnly)' == 'true'">
29-
3017
<PropertyGroup>
3118
<SourceBuildBootstrapTfmArg Condition="$(SourceBuildBootstrapTfm) != ''">--tfm $(SourceBuildBootstrapTfm)</SourceBuildBootstrapTfmArg>
3219
<DotNetBuildUseMonoRuntime Condition="'$(DotNetBuildUseMonoRuntime)' == ''">false</DotNetBuildUseMonoRuntime>

eng/build.sh

+14-9
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ usage()
3535
echo " --skipAnalyzers Do not run analyzers during build operations"
3636
echo " --skipBuild Do not run the build"
3737
echo " --prepareMachine Prepare machine for CI run, clean up processes after build"
38-
echo " --sourceBuild Simulate building for source-build"
38+
echo " --sourceBuild Build the repository in source-only mode."
39+
echo " --productBuild Build the repository in product-build mode."
3940
echo " --buildnorealsig Build product with realsig- (default use realsig+ where necessary)"
4041
echo " --tfm Override the default target framework"
4142
echo ""
@@ -73,6 +74,7 @@ skip_analyzers=false
7374
skip_build=false
7475
prepare_machine=false
7576
source_build=false
77+
product_build=false
7678
buildnorealsig=true
7779
properties=""
7880

@@ -161,8 +163,12 @@ while [[ $# > 0 ]]; do
161163
--docker)
162164
docker=true
163165
;;
164-
--sourcebuild)
166+
--sourcebuild|--source-build|-sb)
165167
source_build=true
168+
product_build=true
169+
;;
170+
--productbuild|--product-build|-pb)
171+
product_build=true
166172
;;
167173
--buildnorealsig)
168174
buildnorealsig=true
@@ -238,6 +244,9 @@ function BuildSolution {
238244
fi
239245

240246
local projects="$repo_root/FSharp.sln"
247+
if [[ "$product_build" = true ]]; then
248+
projects="$repo_root/Microsoft.FSharp.Compiler.sln"
249+
fi
241250

242251
echo "$projects:"
243252

@@ -247,11 +256,6 @@ function BuildSolution {
247256
if [[ "$UNAME" == "Darwin" ]]; then
248257
enable_analyzers=false
249258
fi
250-
251-
local source_build_args=""
252-
if [[ "$source_build" == true ]]; then
253-
source_build_args="/p:DotNetBuildRepo=true /p:DotNetBuildSourceOnly=true"
254-
fi
255259

256260
# NuGet often exceeds the limit of open files on Mac and Linux
257261
# https://github.com/NuGet/Home/issues/2163
@@ -285,7 +289,7 @@ function BuildSolution {
285289
fi
286290

287291
BuildMessage="Error building tools"
288-
local args=" publish $repo_root/proto.proj $blrestore $bltools /p:Configuration=Proto $source_build_args $properties"
292+
local args=" publish $repo_root/proto.proj $blrestore $bltools /p:Configuration=Proto /p:DotNetBuildRepo=$product_build /p:DotNetBuildSourceOnly=$source_build $properties"
289293
echo $args
290294
"$DOTNET_INSTALL_DIR/dotnet" $args #$args || exit $?
291295
fi
@@ -309,7 +313,8 @@ function BuildSolution {
309313
/p:QuietRestore=$quiet_restore \
310314
/p:QuietRestoreBinaryLog="$binary_log" \
311315
/p:BuildNoRealsig=$buildnorealsig \
312-
$source_build_args \
316+
/p:DotNetBuildRepo=$product_build \
317+
/p:DotNetBuildSourceOnly=$source_build \
313318
$properties
314319
fi
315320
}

eng/common/core-templates/job/source-build.yml

+2
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ parameters:
2626
# Specifies the build script to invoke to perform the build in the repo. The default
2727
# './build.sh' should work for typical Arcade repositories, but this is customizable for
2828
# difficult situations.
29+
# buildArguments: ''
30+
# Specifies additional build arguments to pass to the build script.
2931
# jobProperties: {}
3032
# A list of job properties to inject at the top level, for potential extensibility beyond
3133
# container and pool.

eng/common/core-templates/steps/source-build.yml

+1
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ steps:
7979
${{ coalesce(parameters.platform.buildScript, './build.sh') }} --ci \
8080
--configuration $buildConfig \
8181
--restore --build --pack $publishArgs -bl \
82+
${{ parameters.platform.buildArguments }} \
8283
$officialBuildArgs \
8384
$internalRuntimeDownloadArgs \
8485
$internalRestoreArgs \

0 commit comments

Comments
 (0)