Skip to content

Commit

Permalink
Merge branch 'release/dev17.5' into merges/main-to-release/dev17.5
Browse files Browse the repository at this point in the history
  • Loading branch information
vzarytovskii authored Nov 7, 2022
2 parents 5ac774e + 7326f5a commit c52add7
Show file tree
Hide file tree
Showing 67 changed files with 661 additions and 477 deletions.
8 changes: 4 additions & 4 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,11 @@ stages:
# Signed build #
#-------------------------------------------------------------------------------------------------------------------#
- ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}:
- ${{ if eq(variables['Build.SourceBranch'], 'refs/heads/release/dev17.3') }}:
- ${{ if eq(variables['Build.SourceBranch'], 'refs/heads/release/dev17.5') }}:
- template: /eng/common/templates/job/onelocbuild.yml
parameters:
MirrorRepo: fsharp
MirrorBranch: release/dev17.3
MirrorBranch: release/dev17.5
LclSource: lclFilesfromPackage
LclPackageId: 'LCL-JUNO-PROD-FSHARP'
- template: /eng/common/templates/jobs/jobs.yml
Expand Down Expand Up @@ -731,8 +731,8 @@ stages:
- ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}:
- template: eng/release/insert-into-vs.yml
parameters:
componentBranchName: refs/heads/release/dev17.3
insertTargetBranch: rel/d17.3
componentBranchName: refs/heads/release/dev17.5
insertTargetBranch: main
insertTeamEmail: [email protected]
insertTeamName: 'F#'
completeInsertion: 'auto'
12 changes: 6 additions & 6 deletions eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<!-- F# Version components -->
<FSMajorVersion>7</FSMajorVersion>
<FSMinorVersion>0</FSMinorVersion>
<FSBuildVersion>0</FSBuildVersion>
<FSBuildVersion>1</FSBuildVersion>
<FSRevisionVersion>0</FSRevisionVersion>
<!-- -->
<!-- F# Language version -->
Expand All @@ -33,7 +33,7 @@
<!-- FSharp.Compiler.Service version -->
<FCSMajorVersion>42</FCSMajorVersion>
<FCSMinorVersion>7</FCSMinorVersion>
<FCSBuildVersion>100</FCSBuildVersion>
<FCSBuildVersion>200</FCSBuildVersion>
<FCSRevisionVersion>$(FSRevisionVersion)</FCSRevisionVersion>
<FSharpCompilerServicePackageVersion>$(FCSMajorVersion).$(FCSMinorVersion).$(FCSBuildVersion)</FSharpCompilerServicePackageVersion>
<FSharpCompilerServiceVersion>$(FCSMajorVersion).$(FCSMinorVersion).$(FCSBuildVersion).$(FCSRevisionVersion)</FSharpCompilerServiceVersion>
Expand All @@ -47,16 +47,17 @@
<!-- -->
<!-- FSharp tools for Visual Studio version number -->
<FSToolsMajorVersion>12</FSToolsMajorVersion>
<FSToolsMinorVersion>0</FSToolsMinorVersion>
<FSToolsBuildVersion>5</FSToolsBuildVersion>

<FSToolsMinorVersion>5</FSToolsMinorVersion>
<FSToolsBuildVersion>0</FSToolsBuildVersion>
<FSToolsRevisionVersion>$(FSRevisionVersion)</FSToolsRevisionVersion>
<FSProductVersionPrefix>$(FSToolsMajorVersion).$(FSToolsMinorVersion).$(FSToolsBuildVersion)</FSProductVersionPrefix>
<FSProductVersionReleaseNotesVersion>$(FSToolsMajorVersion)-$(FSToolsMinorVersion)-$(FSToolsBuildVersion)</FSProductVersionReleaseNotesVersion>
<FSProductVersion>$(FSToolsMajorVersion).$(FSToolsMinorVersion).$(FSToolsBuildVersion).$(FSToolsRevisionVersion)</FSProductVersion>
</PropertyGroup>
<PropertyGroup>
<VSMajorVersion>17</VSMajorVersion>
<VSMinorVersion>3</VSMinorVersion>
<VSMinorVersion>5</VSMinorVersion>
<VSGeneralVersion>$(VSMajorVersion).0</VSGeneralVersion>
<VSAssemblyVersionPrefix>$(VSMajorVersion).$(VSMinorVersion).0</VSAssemblyVersionPrefix>
<VSAssemblyVersion>$(VSAssemblyVersionPrefix).0</VSAssemblyVersion>
Expand Down Expand Up @@ -107,7 +108,6 @@
<MicrosoftCodeAnalysisEditorFeaturesWpfVersion>$(RoslynVersion)</MicrosoftCodeAnalysisEditorFeaturesWpfVersion>
<MicrosoftCodeAnalysisExternalAccessFSharpVersion>$(RoslynVersion)</MicrosoftCodeAnalysisExternalAccessFSharpVersion>
<MicrosoftCodeAnalysisVersion>$(RoslynVersion)</MicrosoftCodeAnalysisVersion>
<MicrosoftCodeAnalysisWorkspacesCommonVersion>$(RoslynVersion)</MicrosoftCodeAnalysisWorkspacesCommonVersion>
<MicrosoftCodeAnalysisCSharpVersion>$(RoslynVersion)</MicrosoftCodeAnalysisCSharpVersion>
<MicrosoftVisualStudioLanguageServicesVersion>$(RoslynVersion)</MicrosoftVisualStudioLanguageServicesVersion>
<MicrosoftCodeAnalysisTestResourcesProprietaryVersion>2.0.28</MicrosoftCodeAnalysisTestResourcesProprietaryVersion>
Expand Down
2 changes: 1 addition & 1 deletion eng/release/insert-into-vs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ stages:
jobs:
- job: Insert_VS
pool:
name: NetCore1ESPool-Internal
name: NetCore1ESPool-Svc-Internal
demands: ImageOverride -equals windows.vs2019.amd64
variables:
- group: DotNet-VSTS-Infra-Access
Expand Down
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@
"Microsoft.DotNet.Arcade.Sdk": "8.0.0-beta.22554.2",
"Microsoft.DotNet.Helix.Sdk": "8.0.0-beta.22554.2"
}
}
}
9 changes: 6 additions & 3 deletions src/Compiler/AbstractIL/ilwrite.fs
Original file line number Diff line number Diff line change
Expand Up @@ -1192,7 +1192,7 @@ let canGenPropertyDef cenv (prop: ILPropertyDef) =
// If we have GetMethod or SetMethod set (i.e. not None), try and see if we have MethodDefs for them.
// NOTE: They can be not-None and missing MethodDefs if we skip generating them for reference assembly in the earlier pass.
// Only generate property if we have at least getter or setter, otherwise, we skip.
[| prop.GetMethod; prop.SetMethod |]
[| prop.GetMethod; prop.SetMethod |]
|> Array.choose id
|> Array.map (TryGetMethodRefAsMethodDefIdx cenv)
|> Array.exists (function | Ok _ -> true | _ -> false)
Expand Down Expand Up @@ -1304,11 +1304,14 @@ and GenTypeDefPass2 pidx enc cenv (tdef: ILTypeDef) =
// Now generate or assign index numbers for tables referenced by the maps.
// Don't yet generate contents of these tables - leave that to pass3, as
// code may need to embed these entries.
tdef.Implements |> List.iter (GenImplementsPass2 cenv env tidx)
props |> List.iter (GenPropertyDefPass2 cenv tidx)
tdef.Implements |> List.iter (GenImplementsPass2 cenv env tidx)
events |> List.iter (GenEventDefPass2 cenv tidx)
tdef.Fields.AsList() |> List.iter (GenFieldDefPass2 tdef cenv tidx)
tdef.Methods |> Seq.iter (GenMethodDefPass2 tdef cenv tidx)
// Generation of property definitions for **ref assemblies** is checking existence of generated method definitions.
// Therefore, due to mutable state within "cenv", order of operations matters.
// Who could have thought that using shared mutable state can bring unexpected bugs...?
props |> List.iter (GenPropertyDefPass2 cenv tidx)
tdef.NestedTypes.AsList() |> GenTypeDefsPass2 tidx (enc@[tdef.Name]) cenv
with exn ->
failwith ("Error in pass2 for type "+tdef.Name+", error: " + exn.Message)
Expand Down
61 changes: 52 additions & 9 deletions src/Compiler/Driver/FxResolver.fs
Original file line number Diff line number Diff line change
Expand Up @@ -382,16 +382,16 @@ type internal FxResolver

let tryGetNetCoreRefsPackDirectoryRoot () = tryNetCoreRefsPackDirectoryRoot.Force()

let getTfmNumber (v: string) =
let arr = v.Split([| '.' |], 3)
arr[0] + "." + arr[1]

// Tries to figure out the tfm for the compiler instance.
// On coreclr it uses the deps.json file
//
// On-demand because (a) some FxResolver are ephemeral (b) we want to avoid recomputation
let tryGetRunningTfm =
let tryGetRunningTfm () =
let runningTfmOpt =
let getTfmNumber (v: string) =
let arr = v.Split([| '.' |], 3)
arr[0] + "." + arr[1]

// Compute TFM from System.Runtime.InteropServices.RuntimeInformation.FrameworkDescription
// System.Runtime.InteropServices.RuntimeInformation.FrameworkDescription;;
// val it: string = ".NET 6.0.7"
Expand Down Expand Up @@ -548,6 +548,24 @@ type internal FxResolver
assemblyReferences |> List.iter traverseDependencies
assemblies

let tryGetTfmFromSdkDir (sdkDir: string) =
let dotnetConfigFile = Path.Combine(sdkDir, "dotnet.runtimeconfig.json")

try
use stream = FileSystem.OpenFileForReadShim(dotnetConfigFile)
let dotnetConfig = stream.ReadAllText()
let pattern = "\"tfm\": \""

let startPos =
dotnetConfig.IndexOf(pattern, StringComparison.OrdinalIgnoreCase)
+ pattern.Length

let endPos = dotnetConfig.IndexOf("\"", startPos)
let tfm = dotnetConfig[startPos .. endPos - 1]
tfm
with _ ->
tryGetRunningTfm ()

// This list is the default set of references for "non-project" files.
//
// These DLLs are
Expand Down Expand Up @@ -799,12 +817,37 @@ type internal FxResolver
RequireFxResolverLock(fxtok, "assuming all member require lock")
tryGetSdkDir () |> replayWarnings)

/// Gets the selected target framework moniker, e.g netcore3.0, net472, and the running rid of the current machine
/// Gets
/// 1. The Target Framework Moniker (TFM) used for scripting (e.g netcore3.0, net472)
/// 2. The running RID of the current machine (e.g. win-x64)
///
/// When analyzing scripts for editing, this is **not** necessarily the running TFM. Rather, it is the TFM to use for analysing
/// a script.
///
/// Summary:
/// - When running scripts (isInteractive = true) this is identical to the running TFM.
///
/// - When analyzing .NET Core scripts (isInteractive = false, tryGetSdkDir is Some),
/// the scripting TFM is determined from dotnet.runtimeconfig.json in the SDK directory
///
/// - Otherwise, the running TFM is used. That is, if editing with .NET Framework/Core-based tooling a script is assumed
/// to be .NET Framework/Core respectively.
///
/// The RID returned is always the RID of the running machine.
member _.GetTfmAndRid() =
fxlock.AcquireLock(fun fxtok ->
RequireFxResolverLock(fxtok, "assuming all member require lock")

let runningTfm = tryGetRunningTfm
// Interactive processes read their own configuration to find the running tfm
let targetTfm =
if isInteractive then
tryGetRunningTfm ()
else
let sdkDir = tryGetSdkDir () |> replayWarnings

match sdkDir with
| Some dir -> tryGetTfmFromSdkDir dir
| None -> tryGetRunningTfm ()

// Coreclr has mechanism for getting rid
// System.Runtime.InteropServices.RuntimeInformation.RuntimeIdentifier
Expand Down Expand Up @@ -855,7 +898,7 @@ type internal FxResolver
| Architecture.Arm64 -> baseRid + "-arm64"
| _ -> baseRid + "-arm"

runningTfm, runningRid)
targetTfm, runningRid)

static member ClearStaticCaches() =
desiredDotNetSdkVersionForDirectoryCache.Clear()
Expand All @@ -878,7 +921,7 @@ type internal FxResolver
let defaultReferences =
if assumeDotNetFramework then
getDotNetFrameworkDefaultReferences useFsiAuxLib, assumeDotNetFramework
else if useSdkRefs then
elif useSdkRefs then
// Go fetch references
let sdkDir = tryGetSdkRefsPackDirectory () |> replayWarnings

Expand Down
Loading

0 comments on commit c52add7

Please sign in to comment.