Skip to content

Fix overbuilding fsharp & define solution to build in script for VMR #18491

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
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
5 changes: 5 additions & 0 deletions azure-pipelines-PR.yml
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,11 @@ stages:
enablePublishBuildAssets: true
enablePublishUsingPipelines: $(_PublishUsingPipelines)
enableSourceBuild: true
sourceBuildParameters:
platforms:
- name: 'Managed'
container: 'mcr.microsoft.com/dotnet-buildtools/prereqs:centos-stream9'
buildArguments: '--source-build'
enableTelemetry: true
helixRepo: dotnet/fsharp
jobs:
Expand Down
5 changes: 5 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,11 @@ extends:
enablePublishBuildAssets: true
enablePublishUsingPipelines: $(_PublishUsingPipelines)
enableSourceBuild: true
sourceBuildParameters:
platforms:
- name: 'Managed'
container: 'mcr.microsoft.com/dotnet-buildtools/prereqs:centos-stream9'
buildArguments: '--source-build'
enableTelemetry: true
helixRepo: dotnet/fsharp
jobs:
Expand Down
21 changes: 8 additions & 13 deletions eng/Build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ param (
[switch]$testBenchmarks,
[string]$officialSkipTests = "false",
[switch]$noVisualStudio,
[switch]$sourceBuild,
[switch][Alias('pb')]$productBuild,
[switch]$skipBuild,
[switch]$compressAllMetadata,
[switch]$buildnorealsig = $true,
Expand Down Expand Up @@ -133,7 +133,7 @@ function Print-Usage() {
Write-Host " -prepareMachine Prepare machine for CI run, clean up processes after build"
Write-Host " -dontUseGlobalNuGetCache Do not use the global NuGet cache"
Write-Host " -noVisualStudio Only build fsc and fsi as .NET Core applications. No Visual Studio required. '-configuration', '-verbosity', '-norestore', '-rebuild' are supported."
Write-Host " -sourceBuild Simulate building for source-build."
Write-Host " -productBuild Build the repository in product-build mode."
Write-Host " -skipbuild Skip building product"
Write-Host " -compressAllMetadata Build product with compressed metadata"
Write-Host " -buildnorealsig Build product with realsig- (default use realsig+, where necessary)"
Expand Down Expand Up @@ -218,10 +218,6 @@ function Process-Arguments() {
$script:pack = $True;
}

if ($sourceBuild) {
$script:testpack = $False;
}

if ($noBinaryLog) {
$script:binaryLog = $False;
}
Expand Down Expand Up @@ -278,7 +274,7 @@ function Update-Arguments() {
}


function BuildSolution([string] $solutionName, $nopack) {
function BuildSolution([string] $solutionName, $packSolution) {
Write-Host "${solutionName}:"

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

$sourceBuildArgs = if ($sourceBuild) { "/p:DotNetBuildSourceOnly=true /p:DotNetBuildRepo=true" } else { "" }

$BUILDING_USING_DOTNET_ORIG = $env:BUILDING_USING_DOTNET

$env:BUILDING_USING_DOTNET="false"

$pack = if ($nopack -eq $False) {""} else {$pack}
$pack = if ($packSolution -eq $False) {""} else {$pack}

MSBuild $toolsetBuildProj `
$bl `
Expand All @@ -307,6 +301,7 @@ function BuildSolution([string] $solutionName, $nopack) {
/p:RepoRoot=$RepoRoot `
/p:Restore=$restore `
/p:Build=$build `
/p:DotNetBuildRepo=$productBuild `
/p:Rebuild=$rebuild `
/p:Pack=$pack `
/p:Sign=$sign `
Expand All @@ -319,7 +314,6 @@ function BuildSolution([string] $solutionName, $nopack) {
/p:CompressAllMetadata=$CompressAllMetadata `
/p:BuildNoRealsig=$buildnorealsig `
/v:$verbosity `
$sourceBuildArgs `
$suppressExtensionDeployment `
@properties

Expand Down Expand Up @@ -567,7 +561,7 @@ try {
}

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

if ($pack) {
# When building in product build mode, only build the compiler solution.
if ($pack -or $productBuild) {
$properties_storage = $properties
BuildSolution "Microsoft.FSharp.Compiler.sln" $True
$properties = $properties_storage
Expand Down
13 changes: 0 additions & 13 deletions eng/DotNetBuild.props
Original file line number Diff line number Diff line change
@@ -1,23 +1,11 @@
<!-- When altering this file, include @dotnet/product-construction as a reviewer. -->

<Project>

<PropertyGroup>
<GitHubRepositoryName>fsharp</GitHubRepositoryName>
<SourceBuildManagedOnly>true</SourceBuildManagedOnly>
</PropertyGroup>

<!--
The build script passes in the full path of the sln to build. This must be overridden in order to build
the cloned source in the inner build.
-->
<Target Name="ConfigureInnerBuildArg"
BeforeTargets="GetSourceBuildCommandConfiguration">
<PropertyGroup>
<InnerBuildArgs>$(InnerBuildArgs) /p:Projects="$(InnerSourceBuildRepoRoot)\Microsoft.FSharp.Compiler.sln"</InnerBuildArgs>
</PropertyGroup>
</Target>

<!--
The build script bootstraps some tooling for the build. Since the inner build is triggerred via msbuild,
trigger the bootstrapping for the inner build.
Expand All @@ -26,7 +14,6 @@
DependsOnTargets="PrepareInnerSourceBuildRepoRoot"
BeforeTargets="RunInnerSourceBuildCommand"
Condition="'$(DotNetBuildSourceOnly)' == 'true'">

<PropertyGroup>
<SourceBuildBootstrapTfmArg Condition="$(SourceBuildBootstrapTfm) != ''">--tfm $(SourceBuildBootstrapTfm)</SourceBuildBootstrapTfmArg>
<DotNetBuildUseMonoRuntime Condition="'$(DotNetBuildUseMonoRuntime)' == ''">false</DotNetBuildUseMonoRuntime>
Expand Down
23 changes: 14 additions & 9 deletions eng/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ usage()
echo " --skipAnalyzers Do not run analyzers during build operations"
echo " --skipBuild Do not run the build"
echo " --prepareMachine Prepare machine for CI run, clean up processes after build"
echo " --sourceBuild Simulate building for source-build"
echo " --sourceBuild Build the repository in source-only mode."
echo " --productBuild Build the repository in product-build mode."
echo " --buildnorealsig Build product with realsig- (default use realsig+ where necessary)"
echo " --tfm Override the default target framework"
echo ""
Expand Down Expand Up @@ -73,6 +74,7 @@ skip_analyzers=false
skip_build=false
prepare_machine=false
source_build=false
product_build=false
buildnorealsig=true
properties=""

Expand Down Expand Up @@ -161,8 +163,12 @@ while [[ $# > 0 ]]; do
--docker)
docker=true
;;
--sourcebuild)
--sourcebuild|--source-build|-sb)
source_build=true
product_build=true
;;
--productbuild|--product-build|-pb)
product_build=true
;;
--buildnorealsig)
buildnorealsig=true
Expand Down Expand Up @@ -238,6 +244,9 @@ function BuildSolution {
fi

local projects="$repo_root/FSharp.sln"
if [[ "$product_build" = true ]]; then
projects="$repo_root/Microsoft.FSharp.Compiler.sln"
fi

echo "$projects:"

Expand All @@ -247,11 +256,6 @@ function BuildSolution {
if [[ "$UNAME" == "Darwin" ]]; then
enable_analyzers=false
fi

local source_build_args=""
if [[ "$source_build" == true ]]; then
source_build_args="/p:DotNetBuildRepo=true /p:DotNetBuildSourceOnly=true"
fi

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

BuildMessage="Error building tools"
local args=" publish $repo_root/proto.proj $blrestore $bltools /p:Configuration=Proto $source_build_args $properties"
local args=" publish $repo_root/proto.proj $blrestore $bltools /p:Configuration=Proto /p:DotNetBuildRepo=$product_build /p:DotNetBuildSourceOnly=$source_build $properties"
echo $args
"$DOTNET_INSTALL_DIR/dotnet" $args #$args || exit $?
fi
Expand All @@ -309,7 +313,8 @@ function BuildSolution {
/p:QuietRestore=$quiet_restore \
/p:QuietRestoreBinaryLog="$binary_log" \
/p:BuildNoRealsig=$buildnorealsig \
$source_build_args \
/p:DotNetBuildRepo=$product_build \
/p:DotNetBuildSourceOnly=$source_build \
$properties
fi
}
Expand Down
2 changes: 2 additions & 0 deletions eng/common/core-templates/job/source-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ parameters:
# Specifies the build script to invoke to perform the build in the repo. The default
# './build.sh' should work for typical Arcade repositories, but this is customizable for
# difficult situations.
# buildArguments: ''
# Specifies additional build arguments to pass to the build script.
# jobProperties: {}
# A list of job properties to inject at the top level, for potential extensibility beyond
# container and pool.
Expand Down
1 change: 1 addition & 0 deletions eng/common/core-templates/steps/source-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ steps:
${{ coalesce(parameters.platform.buildScript, './build.sh') }} --ci \
--configuration $buildConfig \
--restore --build --pack $publishArgs -bl \
${{ parameters.platform.buildArguments }} \
$officialBuildArgs \
$internalRuntimeDownloadArgs \
$internalRestoreArgs \
Expand Down