Skip to content

Commit

Permalink
Merge pull request #9790 from dotnet/merges/master-to-feature/tasks
Browse files Browse the repository at this point in the history
Merge master to feature/tasks
  • Loading branch information
KevinRansom authored Jul 25, 2020
2 parents 86a60c0 + 87114ec commit 4758a6b
Show file tree
Hide file tree
Showing 15 changed files with 161 additions and 969 deletions.
1 change: 0 additions & 1 deletion FSharp.Profiles.props
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
<DefineConstants>$(DefineConstants);FX_NO_WINFORMS</DefineConstants>
<DefineConstants>$(DefineConstants);FX_NO_INDENTED_TEXT_WRITER</DefineConstants>
<DefineConstants>$(DefineConstants);FX_RESHAPED_REFEMIT</DefineConstants>
<DefineConstants>$(DefineConstants);FX_RESHAPED_MSBUILD</DefineConstants>
<OtherFlags>$(OtherFlags) --simpleresolution</OtherFlags>
</PropertyGroup>

Expand Down
2 changes: 1 addition & 1 deletion eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@
<MicrosoftCodeAnalysisTestResourcesProprietaryVersion>2.0.17</MicrosoftCodeAnalysisTestResourcesProprietaryVersion>
<MicrosoftVisualStudioLanguageServicesVersion>$(RoslynVersion)</MicrosoftVisualStudioLanguageServicesVersion>
<!-- Microsoft Build packages -->
<MicrosoftBuildOverallPackagesVersion>16.4</MicrosoftBuildOverallPackagesVersion>
<MicrosoftBuildOverallPackagesVersion>16.6</MicrosoftBuildOverallPackagesVersion>
<MicrosoftBuildVersion>$(MicrosoftBuildOverallPackagesVersion)</MicrosoftBuildVersion>
<MicrosoftBuildFrameworkVersion>$(MicrosoftBuildOverallPackagesVersion)</MicrosoftBuildFrameworkVersion>
<MicrosoftBuildTasksCoreVersion>$(MicrosoftBuildOverallPackagesVersion)</MicrosoftBuildTasksCoreVersion>
Expand Down
3 changes: 0 additions & 3 deletions fcs/FSharp.Compiler.Service/FSharp.Compiler.Service.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -283,9 +283,6 @@
<Compile Include="$(FSharpSourcesRoot)/absil/ilreflect.fs">
<Link>AbsIL/ilreflect.fs</Link>
</Compile>
<Compile Include="$(FSharpSourcesRoot)\utils\reshapedmsbuild.fs">
<Link>ReferenceResolution/reshapedmsbuild.fs</Link>
</Compile>
<Compile Include="$(FSharpSourcesRoot)/fsharp/ReferenceResolver.fs">
<Link>ReferenceResolution/ReferenceResolver.fs</Link>
</Compile>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ folder "InstallDir:Common7\IDE\CommonExtensions\Microsoft\FSharp"
file source="$(BinariesFolder)\FSharp.Core\$(Configuration)\net45\FSharp.Core.sigdata"
file source="$(BinariesFolder)\FSharp.Build\$(Configuration)\$(TargetFramework)\FSharp.Build.dll" vs.file.ngen=yes vs.file.ngenArchitecture=All vs.file.ngenPriority=2
file source="$(BinariesFolder)\Microsoft.DotNet.DependencyManager\$(Configuration)\net472\Microsoft.DotNet.DependencyManager.dll" vs.file.ngen=yes vs.file.ngenArchitecture=All vs.file.ngenPriority=2
file source="$(BinariesFolder)\FSharp.Build\$(Configuration)\$(TargetFramework)\Microsoft.Build.dll"
file source="$(BinariesFolder)\FSharp.Build\$(Configuration)\$(TargetFramework)\Microsoft.Build.Framework.dll"
file source="$(BinariesFolder)\FSharp.Build\$(Configuration)\$(TargetFramework)\Microsoft.Build.Tasks.Core.dll"
file source="$(BinariesFolder)\FSharp.Build\$(Configuration)\$(TargetFramework)\Microsoft.Build.Utilities.Core.dll"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
</PropertyGroup>
<ItemGroup>
<BuiltProjectOutputGroupKeyOutput Include="$(BuildOutputGroupLocation)\Microsoft.Build.Framework.dll" />
<BuiltProjectOutputGroupKeyOutput Include="$(BuildOutputGroupLocation)\Microsoft.Build.dll" />
<BuiltProjectOutputGroupKeyOutput Include="$(BuildOutputGroupLocation)\Microsoft.Build.Utilities.Core.dll" />
<BuiltProjectOutputGroupKeyOutput Include="$(BuildOutputGroupLocation)\Microsoft.Build.Tasks.Core.dll" />
<BuiltProjectOutputGroupKeyOutput Include="$(BuildOutputGroupLocation)\System.Buffers.dll" />
Expand Down Expand Up @@ -273,9 +272,6 @@
<Compile Include="..\ReferenceResolver.fs">
<Link>ReferenceResolution\ReferenceResolver.fs</Link>
</Compile>
<Compile Include="..\..\utils\reshapedmsbuild.fs">
<Link>ReferenceResolution/reshapedmsbuild.fs</Link>
</Compile>
<!-- A legacy resolver used to help with scripting diagnostics in the Visual Studio tools -->
<Compile Include="..\LegacyMSBuildReferenceResolver.fsi">
<Link>ReferenceResolution/LegacyMSBuildReferenceResolver.fsi</Link>
Expand Down Expand Up @@ -740,10 +736,6 @@

<ItemGroup Condition="'$(TargetFramework)' == 'net472'">
<Reference Include="ISymWrapper, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<PackageReference Include="Microsoft.Build" Version="$(MicrosoftBuildVersion)" />
<PackageReference Include="Microsoft.Build.Framework" Version="$(MicrosoftBuildVersion)" />
<PackageReference Include="Microsoft.Build.Tasks.Core" Version="$(MicrosoftBuildVersion)" />
<PackageReference Include="Microsoft.Build.Utilities.Core" Version="$(MicrosoftBuildVersion)" />
<PackageReference Include="System.IO.Compression" Version="$(SystemIoCompressionVersion)" />
</ItemGroup>

Expand Down Expand Up @@ -772,6 +764,9 @@
<PackageReference Include="System.Threading.ThreadPool" Version="$(SystemThreadingThreadPoolVersion)" />
<PackageReference Include="System.Buffers" Version="$(SystemBuffersVersion)" />
<PackageReference Include="System.Memory" Version="$(SystemMemoryVersion)" />
<PackageReference Include="Microsoft.Build.Framework" Version="$(MicrosoftBuildVersion)" />
<PackageReference Include="Microsoft.Build.Tasks.Core" Version="$(MicrosoftBuildVersion)" />
<PackageReference Include="Microsoft.Build.Utilities.Core" Version="$(MicrosoftBuildVersion)" />
</ItemGroup>

</Project>
35 changes: 30 additions & 5 deletions src/fsharp/FSharp.Core/string.fs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ namespace Microsoft.FSharp.Core
open Microsoft.FSharp.Core.Operators
open Microsoft.FSharp.Core.Operators.Checked
open Microsoft.FSharp.Collections
open Microsoft.FSharp.Primitives.Basics

[<CompilationRepresentation(CompilationRepresentationFlags.ModuleSuffix)>]
[<RequireQualifiedAccess>]
Expand All @@ -22,7 +23,25 @@ namespace Microsoft.FSharp.Core

[<CompiledName("Concat")>]
let concat sep (strings : seq<string>) =
String.Join(sep, strings)

let concatArray sep (strings: string []) =
match length sep with
| 0 -> String.Concat strings
// following line should be used when this overload becomes part of .NET Standard (it's only in .NET Core)
//| 1 -> String.Join(sep.[0], strings, 0, strings.Length)
| _ -> String.Join(sep, strings, 0, strings.Length)

match strings with
| :? array<string> as arr ->
concatArray sep arr

| :? list<string> as lst ->
lst
|> List.toArray
|> concatArray sep

| _ ->
String.Join(sep, strings)

[<CompiledName("Iterate")>]
let iter (action : (char -> unit)) (str:string) =
Expand Down Expand Up @@ -52,13 +71,19 @@ namespace Microsoft.FSharp.Core

[<CompiledName("MapIndexed")>]
let mapi (mapping: int -> char -> char) (str:string) =
if String.IsNullOrEmpty str then
let len = length str
if len = 0 then
String.Empty
else
let res = StringBuilder str.Length
let result = str.ToCharArray()
let f = OptimizedClosures.FSharpFunc<_,_,_>.Adapt(mapping)
str |> iteri (fun i c -> res.Append(f.Invoke(i, c)) |> ignore)
res.ToString()

let mutable i = 0
while i < len do
result.[i] <- f.Invoke(i, result.[i])
i <- i + 1

new String(result)

[<CompiledName("Filter")>]
let filter (predicate: char -> bool) (str:string) =
Expand Down
22 changes: 0 additions & 22 deletions src/fsharp/LegacyMSBuildReferenceResolver.fs
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,6 @@ module LegacyMSBuildReferenceResolver
open System
open System.IO
open System.Reflection

#if FX_RESHAPED_MSBUILD
open FSharp.Compiler.MsBuildAdapters
open FSharp.Compiler.ToolLocationHelper
#endif

open FSharp.Compiler.AbstractIL.Internal.Library
open FSharp.Compiler.ReferenceResolver
open Microsoft.Build.Tasks
Expand Down Expand Up @@ -137,7 +131,6 @@ module LegacyMSBuildReferenceResolver
else Net45 // version is 4.5 assumed since this code is running.
with _ -> Net45

#if !FX_RESHAPED_MSBUILD
// 1. First look to see if we can find the highest installed set of dotnet reference assemblies, if yes then select that framework
// 2. Otherwise ask msbuild for the highestinstalled framework
let checkFrameworkForReferenceAssemblies (dotNetVersion:string) =
Expand All @@ -153,9 +146,6 @@ module LegacyMSBuildReferenceResolver
match SupportedDesktopFrameworkVersions |> Seq.tryFind(fun v -> checkFrameworkForReferenceAssemblies v) with
| Some v -> v
| None -> getHighestInstalledDotNETFramework()
#else
getHighestInstalledDotNETFramework()
#endif

/// Derive the target framework directories.
let DeriveTargetFrameworkDirectories (targetFrameworkVersion:string, logMessage) =
Expand Down Expand Up @@ -270,17 +260,10 @@ module LegacyMSBuildReferenceResolver
let engine =
{ new IBuildEngine with
member __.BuildProjectFile(projectFileName, targetNames, globalProperties, targetOutputs) = true
#if FX_RESHAPED_MSBUILD
member __.LogCustomEvent(e) = protect (fun () -> logMessage ((e.GetPropertyValue("Message")) :?> string))
member __.LogErrorEvent(e) = protect (fun () -> logDiagnostic true ((e.GetPropertyValue("Code")) :?> string) ((e.GetPropertyValue("Message")) :?> string))
member __.LogMessageEvent(e) = protect (fun () -> logMessage ((e.GetPropertyValue("Message")) :?> string))
member __.LogWarningEvent(e) = protect (fun () -> logDiagnostic false ((e.GetPropertyValue("Code")) :?> string) ((e.GetPropertyValue("Message")) :?> string))
#else
member __.LogCustomEvent(e) = protect (fun () -> logMessage e.Message)
member __.LogErrorEvent(e) = protect (fun () -> logDiagnostic true e.Code e.Message)
member __.LogMessageEvent(e) = protect (fun () -> logMessage e.Message)
member __.LogWarningEvent(e) = protect (fun () -> logDiagnostic false e.Code e.Message)
#endif
member __.ColumnNumberOfTaskNode with get() = 1
member __.LineNumberOfTaskNode with get() = 1
member __.ContinueOnError with get() = true
Expand Down Expand Up @@ -329,15 +312,10 @@ module LegacyMSBuildReferenceResolver
|]

let assemblies =
#if FX_RESHAPED_MSBUILD
ignore references
[||]
#else
[| for (referenceName,baggage) in references ->
let item = new Microsoft.Build.Utilities.TaskItem(referenceName) :> ITaskItem
item.SetMetadata("Baggage", baggage)
item |]
#endif
let rar =
ResolveAssemblyReference(BuildEngine=engine, TargetFrameworkDirectories=targetFrameworkDirectories,
FindRelatedFiles=false, FindDependencies=false, FindSatellites=false,
Expand Down
6 changes: 0 additions & 6 deletions src/fsharp/SimulatedMSBuildReferenceResolver.fs
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,13 @@ let private SimulatedMSBuildResolver =
| None -> "v4.5"

member __.DotNetFrameworkReferenceAssembliesRootDirectory =
#if !FX_RESHAPED_MSBUILD
if System.Environment.OSVersion.Platform = System.PlatformID.Win32NT then
let PF =
match Environment.GetEnvironmentVariable("ProgramFiles(x86)") with
| null -> Environment.GetEnvironmentVariable("ProgramFiles") // if PFx86 is null, then we are 32-bit and just get PF
| s -> s
PF + @"\Reference Assemblies\Microsoft\Framework\.NETFramework"
else
#endif
""

member __.Resolve(resolutionEnvironment, references, targetFrameworkVersion, targetFrameworkDirectories, targetProcessorArchitecture,
Expand Down Expand Up @@ -105,7 +103,6 @@ let private SimulatedMSBuildResolver =
success r
with e -> logWarningOrError false "SR001" (e.ToString())

#if !FX_RESHAPED_MSBUILD
// For this one we need to get the version search exactly right, without doing a load
try
if not found && r.StartsWithOrdinal("FSharp.Core, Version=") && Environment.OSVersion.Platform = PlatformID.Win32NT then
Expand All @@ -120,7 +117,6 @@ let private SimulatedMSBuildResolver =
if FileSystem.SafeExists trialPath then
success trialPath
with e -> logWarningOrError false "SR001" (e.ToString())
#endif

let isFileName =
r.EndsWith("dll", StringComparison.OrdinalIgnoreCase) ||
Expand All @@ -136,7 +132,6 @@ let private SimulatedMSBuildResolver =
success trialPath
with e -> logWarningOrError false "SR001" (e.ToString())

#if !FX_RESHAPED_MSBUILD
try
// Search the GAC on Windows
if not found && not isFileName && Environment.OSVersion.Platform = PlatformID.Win32NT then
Expand Down Expand Up @@ -178,7 +173,6 @@ let private SimulatedMSBuildResolver =
if FileSystem.SafeExists trialPath then
success trialPath
with e -> logWarningOrError false "SR001" (e.ToString())
#endif

results.ToArray() }

Expand Down
5 changes: 5 additions & 0 deletions src/fsharp/TcGlobals.fs
Original file line number Diff line number Diff line change
Expand Up @@ -1614,6 +1614,11 @@ type public TcGlobals(compilingFslib: bool, ilg:ILGlobals, fslibCcu: CcuThunk, d
Some (g.array_set_info, [ety], argExprs)
| "get_Item", [sty; _; _], _, [_; _] when isStringTy g sty ->
Some (g.getstring_info, [], argExprs)
| "op_UnaryPlus", [aty], _, [_] ->
// Call Operators.id
let info = makeOtherIntrinsicValRef (fslib_MFOperators_nleref, "id", None, None, [vara], ([[varaTy]], varaTy))
let tyargs = [aty]
Some (info, tyargs, argExprs)
| _ ->
None

Expand Down
Loading

0 comments on commit 4758a6b

Please sign in to comment.