Build FSI and FSC using AppHost (#10736)

* move over to fsc.dll and fsi.dll
This commit is contained in:
Kevin Ransom (msft) 2020-12-21 07:19:15 -08:00 коммит произвёл nosami
Родитель d2c06ed5d7
Коммит 1cf7eeea86
9 изменённых файлов: 59 добавлений и 34 удалений

Просмотреть файл

@ -22,12 +22,12 @@
<FscToolPath>$([System.IO.Path]::GetDirectoryName('$(DOTNET_HOST_PATH)'))</FscToolPath>
<FscToolExe Condition="'$(OS)' != 'Unix'">dotnet.exe</FscToolExe>
<FscToolExe Condition="'$(OS)' == 'Unix'">dotnet</FscToolExe>
<DotnetFscCompilerPath>$(MSBuildThisFileDirectory)artifacts\bin\fsc\$(Configuration)\netcoreapp3.1\fsc.exe</DotnetFscCompilerPath>
<DotnetFscCompilerPath>$(MSBuildThisFileDirectory)artifacts\bin\fsc\$(Configuration)\netcoreapp3.1\fsc.dll</DotnetFscCompilerPath>
<FsiToolPath>$([System.IO.Path]::GetDirectoryName('$(DOTNET_HOST_PATH)'))</FsiToolPath>
<FsiToolExe Condition="'$(OS)' != 'Unix'">dotnet.exe</FsiToolExe>
<FsiToolExe Condition="'$(OS)' == 'Unix'">dotnet</FsiToolExe>
<DotnetFsiCompilerPath>$(MSBuildThisFileDirectory)artifacts\bin\fsi\$(Configuration)\netcoreapp3.1\fsi.exe</DotnetFsiCompilerPath>
<DotnetFsiCompilerPath>$(MSBuildThisFileDirectory)artifacts\bin\fsi\$(Configuration)\netcoreapp3.1\fsi.dll</DotnetFsiCompilerPath>
</PropertyGroup>
<!-- SDK targets override -->

Просмотреть файл

@ -163,7 +163,7 @@ function Update-Arguments() {
$script:bootstrap = $True
}
} else {
if (-Not (Test-Path "$ArtifactsDir\Bootstrap\fsc\fsc.exe") -or (Test-Path "$ArtifactsDir\Bootstrap\fsc\fsc.runtimeconfig.json")) {
if (-Not (Test-Path "$ArtifactsDir\Bootstrap\fsc\fsc.dll") -or (Test-Path "$ArtifactsDir\Bootstrap\fsc\fsc.runtimeconfig.json")) {
$script:bootstrap = $True
}
}

Просмотреть файл

@ -15,35 +15,52 @@ module AssemblyCheck =
let private devVersionPattern = new Regex(@"-(ci|dev)", RegexOptions.Compiled)
let verifyEmbeddedPdb (filename:string) =
use fileStream = File.OpenRead(filename)
let reader = new PEReader(fileStream)
let mutable hasEmbeddedPdb = false
let isManagedDll =
try
// Is il assembly? throws if not
let _ = AssemblyName.GetAssemblyName(filename).Version
true
with
| :? System.BadImageFormatException -> false // uninterested in embedded pdbs for native dlls
try
for entry in reader.ReadDebugDirectory() do
match entry.Type with
| DebugDirectoryEntryType.CodeView ->
let _ = reader.ReadCodeViewDebugDirectoryData(entry)
()
if isManagedDll then
use fileStream = File.OpenRead(filename)
let reader = new PEReader(fileStream)
let mutable hasEmbeddedPdb = false
| DebugDirectoryEntryType.EmbeddedPortablePdb ->
let _ = reader.ReadEmbeddedPortablePdbDebugDirectoryData(entry)
hasEmbeddedPdb <- true
()
try
for entry in reader.ReadDebugDirectory() do
match entry.Type with
| DebugDirectoryEntryType.CodeView ->
let _ = reader.ReadCodeViewDebugDirectoryData(entry)
()
| DebugDirectoryEntryType.PdbChecksum ->
let _ = reader.ReadPdbChecksumDebugDirectoryData(entry)
()
| DebugDirectoryEntryType.EmbeddedPortablePdb ->
let _ = reader.ReadEmbeddedPortablePdbDebugDirectoryData(entry)
hasEmbeddedPdb <- true
()
| _ -> ()
with | e -> printfn "Error validating assembly %s\nMessage: %s" filename (e.ToString())
hasEmbeddedPdb
| DebugDirectoryEntryType.PdbChecksum ->
let _ = reader.ReadPdbChecksumDebugDirectoryData(entry)
()
| _ -> ()
with
| e -> printfn "Error validating assembly %s\nMessage: %s" filename (e.ToString())
hasEmbeddedPdb
else
true
let verifyAssemblies (binariesPath:string) =
let excludedAssemblies =
[ ] |> Set.ofList
let maybeNativeExe =
[ "fsi.exe"
"fsc.exe" ] |> Set.ofList
let fsharpAssemblies =
[ "FSharp*.dll"
"fsc.exe"
@ -63,8 +80,12 @@ module AssemblyCheck =
let failedVersionCheck =
fsharpAssemblies
|> List.filter (fun a ->
let assemblyVersion = AssemblyName.GetAssemblyName(a).Version
assemblyVersion = versionZero || assemblyVersion = versionOne)
try
let assemblyVersion = AssemblyName.GetAssemblyName(a).Version
assemblyVersion = versionZero || assemblyVersion = versionOne
with | :? System.BadImageFormatException ->
// fsc.exe and fsi.exe are il on the desktop and native on the coreclr
Set.contains (Path.GetFileName(a)) maybeNativeExe |> not)
if failedVersionCheck.Length > 0 then
printfn "The following assemblies had a version of %A or %A" versionZero versionOne

Просмотреть файл

@ -59,11 +59,11 @@ WARNING: DO NOT MODIFY this file unless you are knowledgeable about MSBuild and
<PropertyGroup Condition="'$(DisableAutoSetFscCompilerPath)' != 'true' and '$(DOTNET_HOST_PATH)' != ''">
<FscToolPath Condition="'$(FscToolPath)' == ''">$([System.IO.Path]::GetDirectoryName($(DOTNET_HOST_PATH)))</FscToolPath>
<FscToolExe Condition="'$(FscToolExe)' == ''">$([System.IO.Path]::GetFileName($(DOTNET_HOST_PATH)))</FscToolExe>
<DotnetFscCompilerPath Condition="'$(DotnetFscCompilerPath)' == ''">"$(MSBuildThisFileDirectory)fsc.exe"</DotnetFscCompilerPath>
<DotnetFscCompilerPath Condition="'$(DotnetFscCompilerPath)' == ''">"$(MSBuildThisFileDirectory)fsc.dll"</DotnetFscCompilerPath>
<FsiToolPath Condition="'$(FsiToolPath)' == ''">$([System.IO.Path]::GetDirectoryName($(DOTNET_HOST_PATH)))</FsiToolPath>
<FsiToolExe Condition="'$(FsiToolExe)' == ''">$([System.IO.Path]::GetFileName($(DOTNET_HOST_PATH)))</FsiToolExe>
<DotnetFsiCompilerPath Condition="'$(DotnetFscCompilerPath)' == ''">"$(MSBuildThisFileDirectory)fsi.exe"</DotnetFsiCompilerPath>
<DotnetFsiCompilerPath Condition="'$(DotnetFscCompilerPath)' == ''">"$(MSBuildThisFileDirectory)fsi.dll"</DotnetFsiCompilerPath>
</PropertyGroup>
<ItemGroup Condition="'$(DisableImplicitSystemValueTupleReference)' != 'true'

Просмотреть файл

@ -46,8 +46,8 @@
this approach gives a very small deployment. Which is kind of necessary.
-->
<!-- assemblies -->
<file src="fsc\$Configuration$\netcoreapp3.1\fsc.exe" target="lib\netcoreapp3.1" />
<file src="fsi\$Configuration$\netcoreapp3.1\fsi.exe" target="lib\netcoreapp3.1" />
<file src="fsc\$Configuration$\netcoreapp3.1\fsc.dll" target="lib\netcoreapp3.1" />
<file src="fsi\$Configuration$\netcoreapp3.1\fsi.dll" target="lib\netcoreapp3.1" />
<file src="FSharp.Core\$Configuration$\netstandard2.0\FSharp.Core.dll" target="lib\netcoreapp3.1" />
<file src="FSharp.Core\$Configuration$\netstandard2.0\FSharp.Core.xml" target="lib\netcoreapp3.1" />
<file src="FSharp.Compiler.Private\$Configuration$\netstandard2.0\FSharp.Compiler.Private.dll" target="lib\netcoreapp3.1" />

Просмотреть файл

@ -12,12 +12,11 @@
<TargetFrameworks Condition="'$(OS)' == 'Unix'">netcoreapp3.0</TargetFrameworks>
<TargetFrameworks Condition="'$(ProtoTargetFramework)' == ''">net472;netcoreapp3.1</TargetFrameworks>
<TargetFrameworks Condition="'$(OS)' == 'Unix'">netcoreapp3.1</TargetFrameworks>
<TargetExt>.exe</TargetExt>
<NoWarn>$(NoWarn);45;55;62;75;1204</NoWarn>
<AllowCrossTargeting>true</AllowCrossTargeting>
<OtherFlags>$(OtherFlags) --maxerrors:20 --extraoptimizationloops:1</OtherFlags>
<NGenBinary>true</NGenBinary>
<UseAppHost>false</UseAppHost>
<UseAppHost>true</UseAppHost>
</PropertyGroup>
<PropertyGroup Condition="'$(TargetFramework)' == 'net472'">

Просмотреть файл

@ -12,13 +12,12 @@
<TargetFrameworks Condition="'$(OS)' == 'Unix'">netcoreapp3.0</TargetFrameworks>
<TargetFrameworks Condition="'$(ProtoTargetFramework)' == ''">net472;netcoreapp3.1</TargetFrameworks>
<TargetFrameworks Condition="'$(OS)' == 'Unix'">netcoreapp3.1</TargetFrameworks>
<TargetExt>.exe</TargetExt>
<NoWarn>$(NoWarn);45;55;62;75;1204</NoWarn>
<AllowCrossTargeting>true</AllowCrossTargeting>
<OtherFlags>--warnon:1182 --maxerrors:20 --extraoptimizationloops:1</OtherFlags>
<Win32Resource>fsi.res</Win32Resource>
<NGenBinary>true</NGenBinary>
<UseAppHost>false</UseAppHost>
<UseAppHost>true</UseAppHost>
</PropertyGroup>
<PropertyGroup Condition="'$(TargetFramework)' == 'net472'">

Просмотреть файл

@ -239,7 +239,7 @@ let main argv = 0"""
let args =
options
|> Array.append defaultProjectOptions.OtherOptions
|> Array.append [| "fsc.exe"; inputFilePath; "-o:" + outputFilePath; (if isExe then "--target:exe" else "--target:library"); "--nowin32manifest" |]
|> Array.append [| "fsc.dll"; inputFilePath; "-o:" + outputFilePath; (if isExe then "--target:exe" else "--target:library"); "--nowin32manifest" |]
let errors, _ = checker.Compile args |> Async.RunSynchronously
errors, outputFilePath

Просмотреть файл

@ -293,13 +293,19 @@ let config configurationName envVars =
if File.Exists(repoLocalDotnetPath) then repoLocalDotnetPath
else DOTNET_EXE
#if !NETCOREAPP
let FSI_PATH = ("fsi" ++ configurationName ++ fsiArchitecture ++ "fsi.exe")
#else
let FSI_PATH = ("fsi" ++ configurationName ++ fsiArchitecture ++ "fsi.dll")
#endif
let FSI_FOR_SCRIPTS = requireArtifact FSI_PATH
let FSI = requireArtifact FSI_PATH
#if !NETCOREAPP
let FSIANYCPU = requireArtifact ("fsiAnyCpu" ++ configurationName ++ "net472" ++ "fsiAnyCpu.exe")
#endif
let FSC = requireArtifact ("fsc" ++ configurationName ++ fscArchitecture ++ "fsc.exe")
#else
let FSC = requireArtifact ("fsc" ++ configurationName ++ fscArchitecture ++ "fsc.dll")
#endif
let FSCOREDLLPATH = requireArtifact ("FSharp.Core" ++ configurationName ++ fsharpCoreArchitecture ++ "FSharp.Core.dll")
let defaultPlatform =