Skip to content

Commit

Permalink
Sourcebuild perf perhaps (#16860)
Browse files Browse the repository at this point in the history
* Sourcebuild perf

* proto

* publish

* tweak

* baseline

* tweak

* fix publish framework

* temp

* temp

* temp

* publish

* props

* UseCurrentRuntimeIdentifier

* oops

* publishing.props

* BUILDING_USING_DOTNET

* fsharpqa and ngen

* Reqork -norealsig

* update yaml

* revert realsig changes
  • Loading branch information
KevinRansom authored May 8, 2024
1 parent fc42ec9 commit 8d1e873
Show file tree
Hide file tree
Showing 42 changed files with 325 additions and 367 deletions.
2 changes: 1 addition & 1 deletion Build.cmd
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
@echo off
powershell -ExecutionPolicy ByPass -NoProfile -command "& """%~dp0eng\build.ps1""" -build -restore %*"
powershell -ExecutionPolicy ByPass -NoProfile -command "Measure-Command { & """%~dp0eng\build.ps1""" -build -restore %* } | Select-Object TotalMinutes, TotalSeconds"
20 changes: 6 additions & 14 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,11 @@
<PropertyGroup Condition="'$(BUILDING_USING_DOTNET)' != 'false' and '$(DotnetProjInfo)' == 'true'">
<BUILDING_USING_DOTNET>true</BUILDING_USING_DOTNET>
</PropertyGroup>

<PropertyGroup Condition="'$(BUILDING_USING_DOTNET)' != 'true'">
<!--
When shipping Build fsharp.compiler.service dll using realsig visibility
When testing we have a test pass built using old style visibility to improve
testing coverage.
Don't use it explicitly when building with plain .NET (without Proto or Arcade).
-->
<OtherFlags Condition="'$(Configuration)' != 'Proto' and '$(TestingLegacyInternalSignature)' != 'true'">$(OtherFlags) --realsig-</OtherFlags>
<!-- TBD: Fix MEF Export visibility issues in VS -->
<OtherFlags Condition="'$(Configuration)' != 'Proto' and '$(TestingLegacyInternalSignature)' == 'true'">$(OtherFlags) --realsig+</OtherFlags>

<!-- pick realsig value -->
<PropertyGroup Condition="'$(BUILDING_USING_DOTNET)' != 'true' and '$(Configuration)' != 'Proto'">
<OtherFlags Condition="'$(BuildNoRealsig)' == 'true'">$(OtherFlags) --realsig-</OtherFlags>
<OtherFlags Condition="'$(BuildNoRealsig)' != 'true'">$(OtherFlags) --realsig+</OtherFlags>
</PropertyGroup>

<Import Project="$(RepoRoot)/Directory.Build.props.user" Condition="Exists('$(RepoRoot)/Directory.Build.props.user')" />
Expand All @@ -53,8 +45,8 @@
<IntermediateOutputPath>$(ArtifactsDir)obj/$(MSBuildProjectName)/$(Configuration)/</IntermediateOutputPath>
<!-- Note, that default framework is used here (the one we use for development in the current cycle),
since it's a non-arcade and non-sourcebuild scenario -->
<FsLexPath>$(ArtifactsDir)/bin/fslex/$(Configuration)/$(FSharpNetCoreProductDefaultTargetFramework)/fslex.dll</FsLexPath>
<FsYaccPath>$(ArtifactsDir)/bin/fsyacc/$(Configuration)/$(FSharpNetCoreProductDefaultTargetFramework)/fsyacc.dll</FsYaccPath>
<FsLexPath>$(ArtifactsDir)/bin/fslex/$(Configuration)/$(FSharpNetCoreProductDefaultTargetFramework)/$(RuntimeIdentifier)/fslex.dll</FsLexPath>
<FsYaccPath>$(ArtifactsDir)/bin/fsyacc/$(Configuration)/$(FSharpNetCoreProductDefaultTargetFramework)/$(RuntimeIdentifier)/fsyacc.dll</FsYaccPath>
<DefineConstants>NO_CHECKNULLS;BUILDING_WITH_LKG;NO_NULLCHECKING_LIB_SUPPORT;$(DefineConstants)</DefineConstants>
</PropertyGroup>
<Import Project="$(MSBuildThisFileDirectory)/eng/Versions.props" Condition="'$(DISABLE_ARCADE)' == 'true'" />
Expand Down
8 changes: 8 additions & 0 deletions Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,19 @@
<Import Project="FSharpTests.Directory.Build.targets" Condition = " '$(FSharpTestCompilerVersion)' != '' "/>
<Import Project="CoordinateXliff.targets" Condition = " '$(FSharpBuildAssemblyFile)' != '' and '$(XliffTasksAssembly)' != '' "/>

<PropertyGroup Condition="'$(BUILDING_USING_DOTNET)' == 'true'">
<!-- Note, that default framework is used here (the one we use for development in the current cycle),
since it's a non-arcade and non-sourcebuild scenario -->
<FsLexPath>$(ArtifactsDir)/bin/fslex/$(Configuration)/$(FSharpNetCoreProductDefaultTargetFramework)/$(NETCoreSdkPortableRuntimeIdentifier)/fslex.dll</FsLexPath>
<FsYaccPath>$(ArtifactsDir)/bin/fsyacc/$(Configuration)/$(FSharpNetCoreProductDefaultTargetFramework)/$(NETCoreSdkPortableRuntimeIdentifier)/fsyacc.dll</FsYaccPath>
</PropertyGroup>

<ItemGroup Condition="'$(UnitTestType)' == 'nunit'">
<PackageReference Include="NUnit" Version="$(NUnitVersion)" />
<PackageReference Include="NUnit3TestAdapter" Version="$(NUnit3TestAdapterVersion)" />
<PackageReference Include="NunitXml.TestLogger" Version="$(NunitXmlTestLoggerVersion)" />
</ItemGroup>

<ItemGroup Condition="'$(UnitTestType)' == 'xunit'">
<PackageReference Include="xunit" Version="$(XUnitVersion)" />
<PackageReference Include="xunit.runner.visualstudio" Version="$(XUnitRunnerVersion)" />
Expand Down
1 change: 0 additions & 1 deletion FSharpBuild.Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

<Import Project="Sdk.targets" Sdk="Microsoft.DotNet.Arcade.Sdk" Condition="'$(DISABLE_ARCADE)' != 'true'"/>
<Import Project="eng\targets\Imports.targets" Condition="'$(DISABLE_ARCADE)' != 'true'"/>
<Import Project="eng\targets\NGenBinaries.targets" Condition="'$(DISABLE_ARCADE)' != 'true'"/>
<Import Project="eng\targets\NuGet.targets" Condition="'$(DISABLE_ARCADE)' != 'true'"/>
<Import Project="FSharp.Profiles.props" />

Expand Down
14 changes: 7 additions & 7 deletions Microsoft.FSharp.Compiler.sln
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.1.32113.165
VisualStudioVersion = 17.10.34710.37
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.FSharp.Compiler", "src\Microsoft.FSharp.Compiler\Microsoft.FSharp.Compiler.fsproj", "{BBEDE3FA-6E2C-4C53-8B61-FBB545CD4FFC}"
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "Microsoft.FSharp.Compiler", "src\Microsoft.FSharp.Compiler\Microsoft.FSharp.Compiler.fsproj", "{196088D5-ED51-4A42-9B80-F0014D1ED28C}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{BBEDE3FA-6E2C-4C53-8B61-FBB545CD4FFC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BBEDE3FA-6E2C-4C53-8B61-FBB545CD4FFC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BBEDE3FA-6E2C-4C53-8B61-FBB545CD4FFC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BBEDE3FA-6E2C-4C53-8B61-FBB545CD4FFC}.Release|Any CPU.Build.0 = Release|Any CPU
{196088D5-ED51-4A42-9B80-F0014D1ED28C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{196088D5-ED51-4A42-9B80-F0014D1ED28C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{196088D5-ED51-4A42-9B80-F0014D1ED28C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{196088D5-ED51-4A42-9B80-F0014D1ED28C}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {6FF31C5A-ED51-45C2-A405-5534CB7D283C}
SolutionGuid = {CBCFE753-E7C1-4FFB-9F8F-26B50E5910E4}
EndGlobalSection
EndGlobal
34 changes: 0 additions & 34 deletions Proto.sln

This file was deleted.

4 changes: 2 additions & 2 deletions azure-pipelines-PR.yml
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ stages:
- checkout: self
clean: true

- script: eng\CIBuild.cmd -compressallmetadata -norealsig -testCoreclr -configuration Release
- script: eng\CIBuild.cmd -compressallmetadata -buildnorealsig -testCoreclr -configuration Release
env:
NativeToolsOnMachine: true
displayName: Build
Expand Down Expand Up @@ -385,7 +385,7 @@ stages:
- checkout: self
clean: true

- script: eng\CIBuild.cmd -compressallmetadata -norealsig -testDesktop -configuration Release
- script: eng\CIBuild.cmd -compressallmetadata -buildnorealsig -testDesktop -configuration Release
env:
NativeToolsOnMachine: true
displayName: Build
Expand Down
2 changes: 1 addition & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ while [[ -h $source ]]; do
done

scriptroot="$( cd -P "$( dirname "$source" )" && pwd )"
"$scriptroot/eng/build.sh" --build --restore $@
time "$scriptroot/eng/build.sh" --build --restore $@
8 changes: 6 additions & 2 deletions buildtools/AssemblyCheck/AssemblyCheck.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,17 @@
<OutputType>Exe</OutputType>
<TargetFramework>$(FSharpNetCoreProductTargetFramework)</TargetFramework>
<DisableImplicitFSharpCoreReference>true</DisableImplicitFSharpCoreReference>
<UseAppHost Condition="'$(DotNetBuildFromSource)' == 'true'">false</UseAppHost>
</PropertyGroup>

<PropertyGroup>
<PublishReadyToRun>true</PublishReadyToRun>
<UseCurrentRuntimeIdentifier>true</UseCurrentRuntimeIdentifier>
</PropertyGroup>

<ItemGroup>
<Compile Include="AssemblyCheck.fs" />
<Content Include="SkipVerifyEmbeddedPdb.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>

Expand Down
35 changes: 0 additions & 35 deletions buildtools/buildtools.proj

This file was deleted.

6 changes: 5 additions & 1 deletion buildtools/fslex/fslex.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,14 @@
<OutputType>Exe</OutputType>
<TargetFramework>$(FSharpNetCoreProductTargetFramework)</TargetFramework>
<DisableImplicitFSharpCoreReference>true</DisableImplicitFSharpCoreReference>
<UseAppHost Condition="'$(DotNetBuildFromSource)' == 'true'">false</UseAppHost>
<RollForward Condition="'$(BUILDING_USING_DOTNET)' == 'true'">LatestMajor</RollForward>
</PropertyGroup>

<PropertyGroup>
<PublishReadyToRun>true</PublishReadyToRun>
<UseCurrentRuntimeIdentifier>true</UseCurrentRuntimeIdentifier>
</PropertyGroup>

<ItemGroup>
<Compile Include="Lexing.fsi" />
<Compile Include="Lexing.fs" />
Expand Down
6 changes: 5 additions & 1 deletion buildtools/fsyacc/fsyacc.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,14 @@
<OutputType>Exe</OutputType>
<TargetFramework>$(FSharpNetCoreProductTargetFramework)</TargetFramework>
<DisableImplicitFSharpCoreReference>true</DisableImplicitFSharpCoreReference>
<UseAppHost Condition="'$(DotNetBuildFromSource)' == 'true'">false</UseAppHost>
<RollForward Condition="'$(BUILDING_USING_DOTNET)' == 'true'">LatestMajor</RollForward>
</PropertyGroup>

<PropertyGroup>
<PublishReadyToRun>true</PublishReadyToRun>
<UseCurrentRuntimeIdentifier>true</UseCurrentRuntimeIdentifier>
</PropertyGroup>

<ItemGroup>
<Compile Include="Lexing.fsi" />
<Compile Include="Lexing.fs" />
Expand Down
16 changes: 8 additions & 8 deletions eng/Build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ param (
# Options
[switch][Alias('proto')]$bootstrap,
[string]$bootstrapConfiguration = "Proto",
[string]$bootstrapTfm = "net472",
[string]$bootstrapTfm = "net8.0",
[string]$fsharpNetCoreProductTfm = "net8.0",
[switch][Alias('bl')]$binaryLog = $true,
[switch][Alias('nobl')]$excludeCIBinaryLog = $false,
Expand Down Expand Up @@ -69,7 +69,7 @@ param (
[switch]$sourceBuild,
[switch]$skipBuild,
[switch]$compressAllMetadata,
[switch]$norealsig,
[switch]$buildnorealsig,
[switch]$verifypackageshipstatus = $false,
[parameter(ValueFromRemainingArguments = $true)][string[]]$properties)

Expand Down Expand Up @@ -132,7 +132,7 @@ function Print-Usage() {
Write-Host " -sourceBuild Simulate building for source-build."
Write-Host " -skipbuild Skip building product"
Write-Host " -compressAllMetadata Build product with compressed metadata"
Write-Host " -norealsig Build product with realsig- (default use realsig+)"
Write-Host " -buildnorealsig Build product with realsig- (default use realsig+, where necessary)"
Write-Host " -verifypackageshipstatus Verify whether the packages we are building have already shipped to nuget"
Write-Host ""
Write-Host "Command line arguments starting with '/p:' are passed through to MSBuild."
Expand Down Expand Up @@ -212,12 +212,12 @@ function Process-Arguments() {
$script:compressAllMetadata = $True;
}

if ($norealsig) {
$script:realsig = $False;
if ($buildnorealsig) {
$script:buildnorealsig = $True
$env:FSHARP_REALSIG="false"
}
else {
$script:realsig = $True;
$script:buildnorealsig = $False
$env:FSHARP_REALSIG="true"
}
if ($verifypackageshipstatus) {
Expand Down Expand Up @@ -298,7 +298,7 @@ function BuildSolution([string] $solutionName, $nopack) {
/p:TestTargetFrameworks=$testTargetFrameworks `
/p:DotNetBuildFromSource=$sourceBuild `
/p:CompressAllMetadata=$CompressAllMetadata `
/p:TestingLegacyInternalSignature=$realsig `
/p:BuildNoRealsig=$buildnorealsig `
/v:$verbosity `
$suppressExtensionDeployment `
@properties
Expand Down Expand Up @@ -554,7 +554,7 @@ try {
}

$script:BuildMessage = "Failure building product"
if ($restore -or $build -or $rebuild -or $pack -or $sign -or $publish -and -not $skipBuild) {
if ($restore -or $build -or $rebuild -or $pack -or $sign -or $publish -and -not $skipBuild -and -not $sourceBuild) {
if ($noVisualStudio) {
BuildSolution "FSharp.sln" $False
}
Expand Down
5 changes: 5 additions & 0 deletions eng/SourceBuildPrebuiltBaseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@
<UsagePattern IdentityGlob="System.Diagnostics.EventLog/7.0.0" />
<UsagePattern IdentityGlob="System.Security.Cryptography.ProtectedData/7.0.0" />

<UsagePattern IdentityGlob="Microsoft.AspNetCore.App.Runtime.linux-x64/8.0.2" />
<UsagePattern IdentityGlob="Microsoft.NETCore.App.Crossgen2.linux-x64/8.0.2" />
<UsagePattern IdentityGlob="Microsoft.NETCore.App.Runtime.linux-x64/8.0.2" />


<!-- Tracked in https://github.com/dotnet/source-build/issues/3438 -->
<UsagePattern IdentityGlob="Microsoft.VisualStudio.Setup.Configuration.Interop/3.2.2146" />
</IgnorePatterns>
Expand Down
26 changes: 4 additions & 22 deletions eng/build-utils.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -240,33 +240,15 @@ function Make-BootstrapBuild() {
# prepare FsLex and Fsyacc and AssemblyCheck
$dotnetPath = InitializeDotNetCli
$dotnetExe = Join-Path $dotnetPath "dotnet.exe"
$buildToolsProject = "`"$RepoRoot\buildtools\buildtools.proj`""

$argNoRestore = if ($norestore) { " --no-restore" } else { "" }
$argNoIncremental = if ($rebuild) { " --no-incremental" } else { "" }

$args = "build $buildToolsProject -c $bootstrapConfiguration -v $verbosity" + $argNoRestore + $argNoIncremental
if ($binaryLog) {
$logFilePath = Join-Path $LogDir "toolsBootstrapLog.binlog"
$args += " /bl:`"$logFilePath`""
}
Exec-Console $dotnetExe $args

Copy-Item "$ArtifactsDir\bin\fslex\$bootstrapConfiguration\$fsharpNetCoreProductTfm" -Destination "$dir\fslex" -Force -Recurse
Copy-Item "$ArtifactsDir\bin\fsyacc\$bootstrapConfiguration\$fsharpNetCoreProductTfm" -Destination "$dir\fsyacc" -Force -Recurse
Copy-Item "$ArtifactsDir\bin\AssemblyCheck\$bootstrapConfiguration\$fsharpNetCoreProductTfm" -Destination "$dir\AssemblyCheck" -Force -Recurse

# prepare compiler
$protoProject = "`"$RepoRoot\proto.sln`""
$args = "build $protoProject -c $bootstrapConfiguration -v $verbosity " + $argNoRestore + $argNoIncremental
$projectpath = "$RepoRoot" + "proto.proj"
$args = "publish $projectpath -c $bootstrapConfiguration"
if ($binaryLog) {
$logFilePath = Join-Path $LogDir "protoBootstrapLog.binlog"
$logFilePath = Join-Path $LogDir "bootstrap.binlog"
$args += " /bl:`"$logFilePath`""
}
Write-Host "$dotnetExe $args"
Exec-Console $dotnetExe $args

Copy-Item "$ArtifactsDir\bin\fsc\$bootstrapConfiguration\$bootstrapTfm" -Destination "$dir\fsc" -Force -Recurse
Copy-Item "$ArtifactsDir\bin\fsi\$bootstrapConfiguration\$bootstrapTfm" -Destination "$dir\fsi" -Force -Recurse

return $dir
}
Loading

0 comments on commit 8d1e873

Please sign in to comment.