Skip to content

Commit

Permalink
update to paket.core prerelease and do some refactorings for ionide.
Browse files Browse the repository at this point in the history
  • Loading branch information
matthid committed Jun 21, 2019
1 parent 197a3e5 commit cc7eb82
Show file tree
Hide file tree
Showing 36 changed files with 2,793 additions and 2,668 deletions.
2 changes: 1 addition & 1 deletion RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## 5.15.1-alpha tbd

* tbd
* ENHANCEMENT: Some internal improvements for Ionide - https://github.com/fsharp/FAKE/pull/2341

## 5.15.0 - 2019-06-17

Expand Down
17 changes: 8 additions & 9 deletions paket.dependencies
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
version 5.206.0
content: none
// just in case we need some special nuget feature again...
//source https://ci.appveyor.com/nuget/paket
//source C:\Users\matth\.nuget\localsource
source https://api.nuget.org/v3/index.json

nuget FSharp.Core ~> 4.1 redirects: force
nuget Knockout
nuget NuGet.CommandLine
nuget Paket.Core //prerelease
nuget Paket.Core 5.210.2-alpha.appveyor //prerelease
nuget RavenDB.Server
nuget serilog.sinks.nlog 1.5.4
nuget Argu >= 3.3.0
Expand Down Expand Up @@ -105,16 +104,15 @@ group Build
// [ FAKE GROUP ]
group NetcoreBuild
source https://api.nuget.org/v3/index.json
//source C:\Users\matth\.nuget\localsource
// FAKE_MYGET_FEED (don't edit this line)
//source https://www.myget.org/F/fake-vsts/api/v3/index.json
storage: none
//source https://ci.appveyor.com/nuget/fake

// 2018-07-08: Until we use a runner > 5.1, see https://github.com/fsharp/FAKE/pull/2011
nuget FSharp.Core < 4.5
nuget Suave
nuget System.AppContext prerelease
nuget Paket.Core // prerelease
nuget Paket.Core 5.210.2-alpha.appveyor // prerelease
nuget Fake.Api.GitHub prerelease // FAKE_VERSION (don't edit this line)
nuget Fake.Core.Target prerelease // FAKE_VERSION (don't edit this line)
nuget Fake.Core.SemVer prerelease // FAKE_VERSION (don't edit this line)
Expand Down Expand Up @@ -144,11 +142,12 @@ group NetcoreBuild
// New group because of FSharp.Core 4.5 upgrade, see https://github.com/fsharp/FAKE/pull/2011
group netcorerunner
source https://api.nuget.org/v3/index.json
//source C:\Users\matth\.nuget\localsource
storage: none
framework: net46, net462, netstandard1.6, netstandard2.0, netcoreapp2.0, netcoreapp2.1
nuget FSharp.Core

nuget Paket.Core
nuget Paket.Core 5.210.2-alpha.appveyor
nuget Mono.Cecil
nuget Microsoft.NETCore.App framework: netstandard1.6, netstandard2.0, netcoreapp1.1
nuget NETStandard.Library ~> 2.0
Expand All @@ -165,8 +164,8 @@ group netcorerunner
nuget Newtonsoft.Json

group netcore
//source https://ci.appveyor.com/nuget/paket
source https://api.nuget.org/v3/index.json
//source C:\Users\matth\.nuget\localsource
storage: none
framework: net46, net462, netstandard1.6, netstandard2.0, netcoreapp2.0, netcoreapp2.1

Expand All @@ -182,7 +181,7 @@ group netcore
nuget FParsec
nuget Octokit
nuget Newtonsoft.Json
nuget Paket.Core // prerelease
nuget Paket.Core 5.210.2-alpha.appveyor // prerelease
nuget NuGet.Protocol ~> 4.0 strategy: min // To support net462...
nuget Mono.Cecil prerelease
nuget FSharp.Control.Reactive
Expand Down
5,071 changes: 2,583 additions & 2,488 deletions paket.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/app/Fake.Runtime/CoreCache.fs
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ module internal Cache =
}
RuntimeOptions =
{ context.Config.RuntimeOptions with
RuntimeDependencies = references @ context.Config.RuntimeOptions.RuntimeDependencies
_RuntimeDependencies = references @ context.Config.RuntimeOptions._RuntimeDependencies
}
}
}, None
Expand Down
6 changes: 3 additions & 3 deletions src/app/Fake.Runtime/FakeHeader.fs
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ type InlinePaketDependenciesSection =
{ Header : HeaderType
Section : string }

let writeFixedPaketDependencies scriptCacheDir (f : InlinePaketDependenciesSection) =
let writeFixedPaketDependencies (scriptCacheDir:Lazy<string>) (f : InlinePaketDependenciesSection) =
match f.Header with
| HeaderType.PaketInline ->
let dependenciesFile = Path.Combine(scriptCacheDir, dependenciesFileName)
let dependenciesFile = Path.Combine(scriptCacheDir.Value, dependenciesFileName)
let fixedSection =
f.Section.Split([| "\r\n"; "\r"; "\n" |], System.StringSplitOptions.None)
|> Seq.map (fun line ->
Expand Down Expand Up @@ -142,4 +142,4 @@ let tryReadPaketDependenciesFromScript (tokenized:Fake.Runtime.FSharpParser.Toke

let fullpath = Path.GetFullPath dependencies.DependenciesFile
PaketDependencies (PaketDependenciesRef, dependencies, (lazy DependenciesFile.ReadFromFile fullpath), Some group)
|> Some
|> Some
92 changes: 60 additions & 32 deletions src/app/Fake.Runtime/FakeRuntime.fs
Original file line number Diff line number Diff line change
Expand Up @@ -265,10 +265,14 @@ let paketCachingProvider (config:FakeConfig) cacheDir (paketApi:Paket.Dependenci
if needLocalLock then File.Copy(lockFilePath.FullName, localLock, true)

// Restore
if config.RestoreOnlyGroup then
paketApi.Restore(false,group,[],false,false,false,None,None)
if config.RestoreOnlyGroup then
if config.UseSimpleRestore
then RestoreProcess.Restore(paketApi.DependenciesFile,RestoreProcess.RestoreProjectOptions.NoProjects,false,Option.map Paket.Domain.GroupName group,true,false,None,None,true)
else paketApi.Restore(false,group,[],false,false,false,None,None)
else
paketApi.Restore()
if config.UseSimpleRestore
then paketApi.SimplePackagesRestore()
else paketApi.Restore()

// https://github.com/fsharp/FAKE/issues/1908
writeIntellisenseFile cacheDir // write intellisense.fsx immediately
Expand Down Expand Up @@ -378,8 +382,8 @@ let paketCachingProvider (config:FakeConfig) cacheDir (paketApi:Paket.Dependenci
FsiOptions = newAdditionalArgs}
RuntimeOptions =
{ context.Config.RuntimeOptions with
RuntimeDependencies = runtimeAssemblies @ context.Config.RuntimeOptions.RuntimeDependencies
NativeLibraries = nativeLibraries @ context.Config.RuntimeOptions.NativeLibraries }
_RuntimeDependencies = runtimeAssemblies @ context.Config.RuntimeOptions.RuntimeDependencies
_NativeLibraries = nativeLibraries @ context.Config.RuntimeOptions.NativeLibraries }

}
},
Expand Down Expand Up @@ -442,15 +446,23 @@ type PrepareInfo =
member x.CacheDir = x._CacheDir
member x.DependencyType = x._DependencyType

type TryPrepareInfo =
| Prepared of PrepareInfo
| NoHeader of cacheDir:Lazy<string> * saveCache:(unit->unit)

let prepareFakeScript (config:FakeConfig) =
/// Doesn't create the .fake folder for this file if we don't detect a fake script
let tryPrepareFakeScript (config:FakeConfig) : TryPrepareInfo =
let script = config.ScriptFilePath
let scriptDir = Path.GetDirectoryName (script)
let cacheDir = Path.Combine(scriptDir, ".fake", Path.GetFileName(script))
Directory.CreateDirectory (cacheDir) |> ignore
let cacheDirUnsafe = Path.Combine(scriptDir, ".fake", Path.GetFileName(script))
let cacheDir =
lazy
Directory.CreateDirectory (cacheDirUnsafe) |> ignore<DirectoryInfo>
cacheDirUnsafe

let scriptSectionHashFile = Path.Combine(cacheDir, "fake-section.cached")
let scriptSectionCacheFile = Path.Combine(cacheDir, "fake-section.txt")
let mutable actions = []
let scriptSectionHashFile = Path.Combine(cacheDirUnsafe, "fake-section.cached")
let scriptSectionCacheFile = Path.Combine(cacheDirUnsafe, "fake-section.txt")
let inline getSectionUncached () =
use __ = Fake.Profile.startCategory Fake.Profile.Category.Analyzing
let newSection = FakeHeader.tryReadPaketDependenciesFromScript config.ScriptTokens.Value cacheDir script
Expand All @@ -459,16 +471,20 @@ let prepareFakeScript (config:FakeConfig) =
| None ->
tryFindGroupFromDepsFile scriptDir
let writeToCache (section : FakeHeader.FakeSection option) =
match section with
| Some (FakeHeader.PaketDependencies(headerType, p, _, group)) ->
let s =
match headerType with
| FakeHeader.PaketInline -> "paket-inline"
| FakeHeader.PaketDependenciesRef -> "paket-ref"
sprintf "paket: %s, %s, %s" (Path.fixPathForCache config.ScriptFilePath p.DependenciesFile) (match group with | Some g -> g | _ -> "<null>") s
| None -> "none"
|> fun t -> File.WriteAllText(scriptSectionCacheFile, t)
File.Copy (script, scriptSectionHashFile, true)
let content =
match section with
| Some (FakeHeader.PaketDependencies(headerType, p, _, group)) ->
let s =
match headerType with
| FakeHeader.PaketInline -> "paket-inline"
| FakeHeader.PaketDependenciesRef -> "paket-ref"
sprintf "paket: %s, %s, %s" (Path.fixPathForCache config.ScriptFilePath p.DependenciesFile) (match group with | Some g -> g | _ -> "<null>") s
| None -> "none"
actions <- (fun () ->
ignore cacheDir.Value // init cache
File.WriteAllText(scriptSectionCacheFile, content)
File.Copy (script, scriptSectionHashFile, true)) :: actions


let readFromCache () =
let t = File.ReadAllText(scriptSectionCacheFile).Trim()
Expand Down Expand Up @@ -500,29 +516,40 @@ let prepareFakeScript (config:FakeConfig) =

match section with
| Some section ->
{ _CacheDir = cacheDir
actions |> List.rev |> List.iter (fun f -> f())
{ _CacheDir = cacheDir.Value
_Config = config
_Section = section
_DependencyType =
match section with
| FakeHeader.PaketDependencies(FakeHeader.PaketInline, _, _, _) -> PreparedDependencyType.PaketInline
| FakeHeader.PaketDependencies(FakeHeader.PaketDependenciesRef, _, _, _) -> PreparedDependencyType.PaketDependenciesRef }
|> Prepared
| None ->
NoHeader(cacheDir, (fun () -> actions |> List.rev |> List.iter (fun f -> f())))


let prepareFakeScript (config:FakeConfig) : PrepareInfo =
match tryPrepareFakeScript config with
| Prepared s -> s
| NoHeader(cacheDir, saveCache) ->
saveCache()

let defaultPaketCode = """
source https://api.nuget.org/v3/index.json
storage: none
framework: netstandard2.0
nuget FSharp.Core
"""
source https://api.nuget.org/v3/index.json
storage: none
framework: netstandard2.0
nuget FSharp.Core
"""
if Environment.environVar "FAKE_ALLOW_NO_DEPENDENCIES" <> "true" then
Trace.traceFAKE """Consider adding your dependencies via `#r` dependencies, for example add '#r "paket: nuget FSharp.Core //"'.
Trace.traceFAKE """Consider adding your dependencies via `#r` dependencies, for example add '#r "paket: nuget FSharp.Core //"'.
See https://fake.build/fake-fake5-modules.html for details.
If you know what you are doing you can silence this warning by setting the environment variable 'FAKE_ALLOW_NO_DEPENDENCIES' to 'true'"""
let section =
{ FakeHeader.Header = FakeHeader.PaketInline
FakeHeader.Section = defaultPaketCode }
|> FakeHeader.writeFixedPaketDependencies cacheDir
{ _CacheDir = cacheDir
{ FakeHeader.Header = FakeHeader.PaketInline
FakeHeader.Section = defaultPaketCode }
|> FakeHeader.writeFixedPaketDependencies cacheDir
{ _CacheDir = cacheDir.Value
_Config = config
_Section = section
_DependencyType = PreparedDependencyType.DefaultDependencies }
Expand Down Expand Up @@ -553,7 +580,8 @@ let createConfig (logLevel:Trace.VerboseLevel) (fsiOptions:string list) scriptPa
Runners.FakeConfig.CompileOptions =
{ FsiOptions = newFsiOptions }
Runners.FakeConfig.RuntimeOptions =
{ RuntimeDependencies = []; NativeLibraries = [] }
{ _RuntimeDependencies = []; _NativeLibraries = [] }
Runners.FakeConfig.UseSimpleRestore = false
Runners.FakeConfig.UseCache = useCache
Runners.FakeConfig.RestoreOnlyGroup = restoreOnlyGroup
Runners.FakeConfig.Out = out
Expand Down
5 changes: 4 additions & 1 deletion src/app/Fake.Runtime/Runners.fs
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,17 @@ type CompileOptions =
member x.AsArgs = x.FsiOptions.AsArgs

type RuntimeOptions =
internal { RuntimeDependencies : AssemblyInfo list; NativeLibraries : NativeLibrary list }
internal { _RuntimeDependencies : AssemblyInfo list; _NativeLibraries : NativeLibrary list }
member x.RuntimeDependencies : AssemblyInfo list = x._RuntimeDependencies
member x.NativeLibraries : NativeLibrary list = x._NativeLibraries
type FakeConfig =
{ VerboseLevel : Trace.VerboseLevel
ScriptFilePath : string
ScriptTokens : Lazy<Fake.Runtime.FSharpParser.TokenizedScript>
RuntimeOptions : RuntimeOptions
CompileOptions : CompileOptions
UseCache : bool
UseSimpleRestore : bool
RestoreOnlyGroup : bool
Out: TextWriter
Err: TextWriter
Expand Down
12 changes: 6 additions & 6 deletions src/legacy/FAKE/FAKE.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@
</When>
</Choose>
<Choose>
<When Condition="($(TargetFrameworkIdentifier) == '.NETCoreApp' And ($(TargetFrameworkVersion) == 'v1.0' Or $(TargetFrameworkVersion) == 'v1.1' Or $(TargetFrameworkVersion) == 'v2.0' Or $(TargetFrameworkVersion) == 'v2.1' Or $(TargetFrameworkVersion) == 'v2.2' Or $(TargetFrameworkVersion) == 'v3.0')) Or ($(TargetFrameworkIdentifier) == '.NETStandard' And ($(TargetFrameworkVersion) == 'v1.3' Or $(TargetFrameworkVersion) == 'v1.4' Or $(TargetFrameworkVersion) == 'v1.5' Or $(TargetFrameworkVersion) == 'v1.6' Or $(TargetFrameworkVersion) == 'v2.0' Or $(TargetFrameworkVersion) == 'v2.1'))">
<When Condition="($(TargetFrameworkIdentifier) == '.NETCoreApp' And ($(TargetFrameworkVersion) == 'v1.0' Or $(TargetFrameworkVersion) == 'v1.1')) Or ($(TargetFrameworkIdentifier) == '.NETStandard' And ($(TargetFrameworkVersion) == 'v1.3' Or $(TargetFrameworkVersion) == 'v1.4' Or $(TargetFrameworkVersion) == 'v1.5' Or $(TargetFrameworkVersion) == 'v1.6' Or $(TargetFrameworkVersion) == 'v2.0' Or $(TargetFrameworkVersion) == 'v2.1'))">
<ItemGroup>
<Reference Include="Microsoft.Win32.Primitives">
<HintPath>..\..\..\packages\Microsoft.Win32.Primitives\ref\netstandard1.3\Microsoft.Win32.Primitives.dll</HintPath>
Expand Down Expand Up @@ -546,7 +546,7 @@
</Reference>
</ItemGroup>
</When>
<When Condition="($(TargetFrameworkIdentifier) == '.NETCoreApp' And ($(TargetFrameworkVersion) == 'v1.0' Or $(TargetFrameworkVersion) == 'v1.1')) Or ($(TargetFrameworkIdentifier) == '.NETStandard' And $(TargetFrameworkVersion) == 'v1.6')">
<When Condition="($(TargetFrameworkIdentifier) == '.NETCoreApp' And ($(TargetFrameworkVersion) == 'v1.0' Or $(TargetFrameworkVersion) == 'v1.1')) Or ($(TargetFrameworkIdentifier) == '.NETStandard' And $(TargetFrameworkVersion) == 'v1.6') Or ($(TargetFrameworkIdentifier) == '.NETCore' And $(TargetFrameworkVersion) == 'v5.0')">
<ItemGroup>
<Reference Include="System.Linq.Expressions">
<HintPath>..\..\..\packages\System.Linq.Expressions\lib\netstandard1.6\System.Linq.Expressions.dll</HintPath>
Expand Down Expand Up @@ -1511,7 +1511,7 @@
</When>
</Choose>
<Choose>
<When Condition="($(TargetFrameworkIdentifier) == '.NETCoreApp' And ($(TargetFrameworkVersion) == 'v1.0' Or $(TargetFrameworkVersion) == 'v1.1')) Or ($(TargetFrameworkIdentifier) == '.NETStandard' And ($(TargetFrameworkVersion) == 'v1.3' Or $(TargetFrameworkVersion) == 'v1.4' Or $(TargetFrameworkVersion) == 'v1.5' Or $(TargetFrameworkVersion) == 'v1.6'))">
<When Condition="$(TargetFrameworkIdentifier) == '.NETStandard' And ($(TargetFrameworkVersion) == 'v1.3' Or $(TargetFrameworkVersion) == 'v1.4' Or $(TargetFrameworkVersion) == 'v1.5' Or $(TargetFrameworkVersion) == 'v1.6')">
<ItemGroup>
<Reference Include="System.Security.Principal.Windows">
<HintPath>..\..\..\packages\System.Security.Principal.Windows\lib\netstandard1.3\System.Security.Principal.Windows.dll</HintPath>
Expand All @@ -1520,7 +1520,7 @@
</Reference>
</ItemGroup>
</When>
<When Condition="($(TargetFrameworkIdentifier) == '.NETCoreApp' And ($(TargetFrameworkVersion) == 'v1.0' Or $(TargetFrameworkVersion) == 'v1.1')) Or ($(TargetFrameworkIdentifier) == '.NETStandard' And ($(TargetFrameworkVersion) == 'v1.3' Or $(TargetFrameworkVersion) == 'v1.4' Or $(TargetFrameworkVersion) == 'v1.5' Or $(TargetFrameworkVersion) == 'v1.6'))">
<When Condition="$(TargetFrameworkIdentifier) == '.NETStandard' And ($(TargetFrameworkVersion) == 'v1.3' Or $(TargetFrameworkVersion) == 'v1.4' Or $(TargetFrameworkVersion) == 'v1.5' Or $(TargetFrameworkVersion) == 'v1.6')">
<ItemGroup>
<Reference Include="System.Security.Principal.Windows">
<HintPath>..\..\..\packages\System.Security.Principal.Windows\ref\netstandard1.3\System.Security.Principal.Windows.dll</HintPath>
Expand Down Expand Up @@ -1569,7 +1569,7 @@
</When>
</Choose>
<Choose>
<When Condition="($(TargetFrameworkIdentifier) == '.NETCoreApp' And ($(TargetFrameworkVersion) == 'v1.0' Or $(TargetFrameworkVersion) == 'v1.1' Or $(TargetFrameworkVersion) == 'v2.0' Or $(TargetFrameworkVersion) == 'v2.1' Or $(TargetFrameworkVersion) == 'v2.2' Or $(TargetFrameworkVersion) == 'v3.0')) Or ($(TargetFrameworkIdentifier) == '.NETStandard' And ($(TargetFrameworkVersion) == 'v1.4' Or $(TargetFrameworkVersion) == 'v1.5' Or $(TargetFrameworkVersion) == 'v1.6' Or $(TargetFrameworkVersion) == 'v2.0' Or $(TargetFrameworkVersion) == 'v2.1'))">
<When Condition="($(TargetFrameworkIdentifier) == '.NETCoreApp' And ($(TargetFrameworkVersion) == 'v1.0' Or $(TargetFrameworkVersion) == 'v1.1')) Or ($(TargetFrameworkIdentifier) == '.NETStandard' And ($(TargetFrameworkVersion) == 'v1.4' Or $(TargetFrameworkVersion) == 'v1.5' Or $(TargetFrameworkVersion) == 'v1.6' Or $(TargetFrameworkVersion) == 'v2.0' Or $(TargetFrameworkVersion) == 'v2.1'))">
<ItemGroup>
<Reference Include="System.Text.Encoding.Extensions">
<HintPath>..\..\..\packages\System.Text.Encoding.Extensions\ref\netstandard1.3\System.Text.Encoding.Extensions.dll</HintPath>
Expand Down Expand Up @@ -1598,7 +1598,7 @@
</Reference>
</ItemGroup>
</When>
<When Condition="($(TargetFrameworkIdentifier) == 'MonoAndroid' And $(TargetFrameworkVersion) == 'v8.0') Or ($(TargetFrameworkIdentifier) == '.NETCoreApp' And ($(TargetFrameworkVersion) == 'v1.0' Or $(TargetFrameworkVersion) == 'v1.1' Or $(TargetFrameworkVersion) == 'v2.0' Or $(TargetFrameworkVersion) == 'v2.1' Or $(TargetFrameworkVersion) == 'v2.2' Or $(TargetFrameworkVersion) == 'v3.0')) Or ($(TargetFrameworkIdentifier) == '.NETStandard' And ($(TargetFrameworkVersion) == 'v1.6' Or $(TargetFrameworkVersion) == 'v2.0' Or $(TargetFrameworkVersion) == 'v2.1'))">
<When Condition="($(TargetFrameworkIdentifier) == 'MonoAndroid' And $(TargetFrameworkVersion) == 'v8.0') Or ($(TargetFrameworkIdentifier) == '.NETCoreApp' And ($(TargetFrameworkVersion) == 'v1.0' Or $(TargetFrameworkVersion) == 'v1.1' Or $(TargetFrameworkVersion) == 'v2.0' Or $(TargetFrameworkVersion) == 'v2.1' Or $(TargetFrameworkVersion) == 'v2.2' Or $(TargetFrameworkVersion) == 'v3.0')) Or ($(TargetFrameworkIdentifier) == '.NETStandard' And ($(TargetFrameworkVersion) == 'v1.6' Or $(TargetFrameworkVersion) == 'v2.0' Or $(TargetFrameworkVersion) == 'v2.1')) Or ($(TargetFrameworkIdentifier) == '.NETCore' And $(TargetFrameworkVersion) == 'v5.0')">
<ItemGroup>
<Reference Include="System.Text.RegularExpressions">
<HintPath>..\..\..\packages\System.Text.RegularExpressions\lib\netstandard1.6\System.Text.RegularExpressions.dll</HintPath>
Expand Down
Loading

0 comments on commit cc7eb82

Please sign in to comment.