未验证 提交 e05bdc2d 编写于 作者: T Theodore Tsirpanis 提交者: GitHub

Add trimming XML files to FSharp.Core. (#13853)

* Add ILLink xml files to FSharp.Core.

* Trim away the compressed blobs if they exist.

* Added a very basic test project to test trimming

* Added a very basic test project to test trimming(2)

* Added a very basic test project to test trimming(3)

* Added a very basic test project to test trimming(4)

* Added a very basic test project to test trimming(5)

* Added a very basic test project to test trimming(6)

* Added a very basic test project to test trimming(7)

* Added a very basic test project to test trimming(8)

* Added a very basic test project to test trimming(9)

* Added a very basic test project to test trimming(10)

* Added a very basic test project to test trimming(11)

* Added a very basic test project to test trimming(12)

* Fix trimming tests
Co-authored-by: NDon Syme <dsyme@users.noreply.github.com>
Co-authored-by: NVlad Zarytovskii <vzaritovsky@hotmail.com>
Co-authored-by: NKevin Ransom (msft) <codecutter@hotmail.com>
上级 68e16008
...@@ -605,6 +605,50 @@ stages: ...@@ -605,6 +605,50 @@ stages:
DOTNET_ROLL_FORWARD_TO_PRERELEASE: 1 DOTNET_ROLL_FORWARD_TO_PRERELEASE: 1
displayName: Regular rebuild of FSharp.Compiler.Service.sln displayName: Regular rebuild of FSharp.Compiler.Service.sln
# Test trimming on Windows
- job: Build_And_Test_Trimming_Windows
pool:
name: NetCore-Public
demands: ImageOverride -equals $(WindowsMachineQueueName)
strategy:
maxParallel: 2
matrix:
compressed_metadata:
_kind: "-compressAllMetadata"
classic_metadata:
_kind: ""
variables:
- name: _BuildConfig
value: Release
steps:
- checkout: self
clean: true
- task: UseDotNet@2
displayName: install SDK
inputs:
packageType: sdk
useGlobalJson: true
includePreviewVersions: true
workingDirectory: $(Build.SourcesDirectory)
installationPath: $(Agent.ToolsDirectory)/dotnet
- script: dotnet --list-sdks
displayName: Report dotnet SDK versions
- script: .\Build.cmd $(_kind) -pack -c $(_BuildConfig)
displayName: Initial build and prepare packages.
- script: dotnet publish -c $(_BuildConfig) -bl:\"./bin/$(_BuildConfig)/net7.0/win-x64/publish/Trimming.binlog\"
displayName: Build and publish a trim test package.
workingDirectory: $(Build.SourcesDirectory)/tests/projects/SelfContained_Trimming_Test
- script: .\check.cmd
displayName: Check the state of the trimmed app.
workingDirectory: $(Build.SourcesDirectory)/tests/projects/SelfContained_Trimming_Test
- task: PublishPipelineArtifact@1
displayName: Publish Trim Tests Logs
inputs:
targetPath: '$(Build.SourcesDirectory)/tests/projects/SelfContained_Trimming_Test/bin/$(_BuildConfig)/net7.0/win-x64/publish'
artifactName: 'Trim Test Logs Attempt $(System.JobAttempt) Logs $(_kind)'
continueOnError: true
condition: always()
# Arcade-powered source build # Arcade-powered source build
# turned off until https://github.com/dotnet/source-build/issues/1795 is fixed # turned off until https://github.com/dotnet/source-build/issues/1795 is fixed
# - template: /eng/common/templates/jobs/jobs.yml # - template: /eng/common/templates/jobs/jobs.yml
......
...@@ -52,6 +52,8 @@ ...@@ -52,6 +52,8 @@
<GeneratedModuleName>Microsoft.FSharp.Core.SR</GeneratedModuleName> <GeneratedModuleName>Microsoft.FSharp.Core.SR</GeneratedModuleName>
<Link>FSCore.resx</Link> <Link>FSCore.resx</Link>
</EmbeddedResource> </EmbeddedResource>
<EmbeddedResource Include="ILLink.LinkAttributes.xml" LogicalName="ILLink.LinkAttributes.xml" />
<EmbeddedResource Include="ILLink.Substitutions.xml" LogicalName="ILLink.Substitutions.xml" />
<CompileBefore Include="prim-types-prelude.fsi"> <CompileBefore Include="prim-types-prelude.fsi">
<Link>Primitives/prim-types-prelude.fsi</Link> <Link>Primitives/prim-types-prelude.fsi</Link>
</CompileBefore> </CompileBefore>
......
<linker>
<!--
Attributes listed below here should be behind the 'System.AggressiveAttributeTrimming' feature switch, which
is only enabled by default on app models that need as much size savings as possible.
-->
<assembly fullname="FSharp.Core" feature="System.AggressiveAttributeTrimming" featurevalue="true">
<!-- Microsoft.FSharp.Core -->
<type fullname="Microsoft.FSharp.Core.AbstractClassAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="Microsoft.FSharp.Core.AutoOpenAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="Microsoft.FSharp.Core.AutoSerializableAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="Microsoft.FSharp.Core.ClassAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="Microsoft.FSharp.Core.CLIEventAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="Microsoft.FSharp.Core.CLIMutableAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="Microsoft.FSharp.Core.ComparisonConditionalOnAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="Microsoft.FSharp.Core.CompilationArgumentCountsAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="Microsoft.FSharp.Core.CompilationSourceNameAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="Microsoft.FSharp.Core.CompiledNameAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="Microsoft.FSharp.Core.CompilerMessageAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="Microsoft.FSharp.Core.CustomComparisonAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="Microsoft.FSharp.Core.CustomEqualityAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="Microsoft.FSharp.Core.CustomOperationAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="Microsoft.FSharp.Core.DefaultAugmentationAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="Microsoft.FSharp.Core.DefaultValueAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="Microsoft.FSharp.Core.EntryPointAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="Microsoft.FSharp.Core.EqualityConditionalOnAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="Microsoft.FSharp.Core.ExperimentalAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="Microsoft.FSharp.Core.FSharpInterfaceDataVersionAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="Microsoft.FSharp.Core.GeneralizableValueAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="Microsoft.FSharp.Core.InlineIfLambdaAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="Microsoft.FSharp.Core.FSharpInterfaceDataVersionLiteralAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="Microsoft.FSharp.Core.MeasureAnnotatedAbbreviationAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="Microsoft.FSharp.Core.MeasureAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="Microsoft.FSharp.Core.NoComparisonAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="Microsoft.FSharp.Core.NoDynamicInvocationAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="Microsoft.FSharp.Core.NoEqualityAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="Microsoft.FSharp.Core.OptionalArgumentAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="Microsoft.FSharp.Core.ProjectionParameterAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="Microsoft.FSharp.Core.ReferenceEqualityAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="Microsoft.FSharp.Core.ReflectedDefinitionAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="Microsoft.FSharp.Core.RequireQualifiedAccessAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="Microsoft.FSharp.Core.RequiresExplicitTypeArgumentsAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="Microsoft.FSharp.Core.SealedAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="Microsoft.FSharp.Core.StructAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="Microsoft.FSharp.Core.StructuralComparisonAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="Microsoft.FSharp.Core.StructuralEqualityAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="Microsoft.FSharp.Core.UnverifiableAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="Microsoft.FSharp.Core.ValueAsStaticPropertyAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="Microsoft.FSharp.Core.VolatileFieldAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<!-- The following attributes are accessed by FSharp.Core at runtime.
Removing them would cause behavior changes but the feature switch allows them. -->
<type fullname="Microsoft.FSharp.Core.AllowNullLiteralAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="Microsoft.FSharp.Core.CompilationMappingAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="Microsoft.FSharp.Core.CompilationRepresentationAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="Microsoft.FSharp.Core.StructuredFormatDisplayAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<!-- Microsoft.FSharp.Core.CompilerServices -->
<type fullname="Microsoft.FSharp.Core.CompilerServices.NoEagerConstraintApplicationAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="Microsoft.FSharp.Core.CompilerServices.TypeProviderAssemblyAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="Microsoft.FSharp.Core.CompilerServices.TypeProviderAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="Microsoft.FSharp.Core.CompilerServices.TypeProviderDefinitionLocationAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="Microsoft.FSharp.Core.CompilerServices.TypeProviderEditorHideMethodsAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="Microsoft.FSharp.Core.CompilerServices.TypeProviderXmlDocAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
</assembly>
</linker>
\ No newline at end of file
<linker>
<assembly fullname="FSharp.Core">
<resource name="FSharpOptimizationCompressedData.FSharp.Core" action="remove" />
<resource name="FSharpOptimizationInfo.FSharp.Core" action="remove" />
<resource name="FSharpSignatureCompressedData.FSharp.Core" action="remove" />
<resource name="FSharpSignatureInfo.FSharp.Core" action="remove" />
</assembly>
</linker>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<solution>
<add key="disableSourceControlIntegration" value="true" />
</solution>
<packageSources>
<clear />
<add key="localPackages" value="../../../artifacts/packages/Release/Release"/>
</packageSources>
<disabledPackageSources>
<clear />
</disabledPackageSources>
<fallbackPackageFolders>
<clear />
</fallbackPackageFolders>
</configuration>
此差异已折叠。
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<LangVersion>preview</LangVersion>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<DotNetBuildOffline>true</DotNetBuildOffline>
</PropertyGroup>
<PropertyGroup>
<DisableImplicitFSharpCoreReference>true</DisableImplicitFSharpCoreReference>
<PublishTrimmed>true</PublishTrimmed>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
</PropertyGroup>
<PropertyGroup>
<DotnetFscCompilerPath>$(MSBuildThisFileDirectory)../../../artifacts/bin/fsc/Release/net7.0/fsc.dll</DotnetFscCompilerPath>
<Fsc_DotNET_DotnetFscCompilerPath>$(MSBuildThisFileDirectory)../../../artifacts/bin/fsc/Release/net7.0/fsc.dll</Fsc_DotNET_DotnetFscCompilerPath>
<FSharpPreferNetFrameworkTools>False</FSharpPreferNetFrameworkTools>
<FSharpPrefer64BitTools>True</FSharpPrefer64BitTools>
</PropertyGroup>
<ItemGroup>
<Compile Include="Program.fs" />
</ItemGroup>
<Import Project="$(MSBuildThisFileDirectory)../../../eng/Versions.props" />
<PropertyGroup>
<RestoreSources>
$(MSBuildThisFileDirectory)/../../../artifacts/packages/Release/Release
</RestoreSources>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="FSharp.Core" Version="$(FSCoreProductVersion).*"/>
</ItemGroup>
</Project>
@echo off
powershell -ExecutionPolicy ByPass -NoProfile -command "& """%~dp0check.ps1""""
$output = .\bin\Release\net7.0\win-x64\publish\SelfContained_Trimming_Test.exe
# Checking that it is actually running.
if (-not ($LASTEXITCODE -eq 0))
{
Write-Error "Test failed with exit code ${LASTEXITCODE}" -ErrorAction Stop
}
# Checking that the output is as expected.
$expected = "All tests passed"
if (-not ($output -eq $expected))
{
Write-Error "Test failed with unexpected output:`nExpected:`n`t${expected}`nActual`n`t${output}" -ErrorAction Stop
}
# Checking that FSharp.Core binary is of expected size (needs adjustments if test is updated).
$expected_len = 2181119 # In bytes
$file = Get-Item .\bin\Release\net7.0\win-x64\publish\FSharp.Core.dll
$file_len = $file.Length
if ($file_len -le $expected_len)
{
Write-Error "Test failed with unexpected FSharp.Core length:`nExpected:`n`t${expected_len} Bytes`nActual:`n`t${file_len} Bytes" -ErrorAction Stop
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册