Skip to content

Commit

Permalink
Back to net 5 and FCS 40
Browse files Browse the repository at this point in the history
  • Loading branch information
alfonsogarciacaro committed Nov 12, 2021
1 parent 8b8de17 commit 22bfb48
Show file tree
Hide file tree
Showing 14 changed files with 32 additions and 42 deletions.
20 changes: 1 addition & 19 deletions build.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@ open System.Text.RegularExpressions

// Appveyor artifact
let FABLE_BRANCH = "master"
let APPVEYOR_REPL_ARTIFACT_URL_PARAMS = "?branch=" + FABLE_BRANCH //+ "&pr=false"
let APPVEYOR_REPL_ARTIFACT_URL =
"https://ci.appveyor.com/api/projects/fable-compiler/Fable/artifacts/src/fable-standalone/fable-standalone.zip"
+ APPVEYOR_REPL_ARTIFACT_URL_PARAMS

// ncave FCS fork
let FCS_REPO = "https://github.com/ncave/fsharp"
Expand Down Expand Up @@ -79,22 +75,9 @@ module Util =
open Util

module Unused =
// type Chokidar =
// abstract watch: path: string -> Chokidar
// abstract on: event: string * (string -> unit) -> Chokidar

// let chokidar: Chokidar = importDefault "chokidar"

// let concurrently(commands: string[]): unit = importDefault "concurrently"

let downloadAndExtractTo (url: string) (targetDir: string) =
sprintf "npx download --extract --out %s \"%s\"" targetDir url |> run

let downloadStandalone() =
let targetDir = "src/fable-standalone/dist"
cleanDirs [targetDir]
downloadAndExtractTo APPVEYOR_REPL_ARTIFACT_URL targetDir

let coverage() =
// report converter
// https://github.com/danielpalme/ReportGenerator
Expand Down Expand Up @@ -407,7 +390,7 @@ let test() =
testIntegration()

// TODO: Run testJsFast() in CI after fcs-fable is synced with latest FCS
// if envVarOrNone "APPVEYOR" |> Option.isSome then
// if envVarOrNone "CI" |> Option.isSome then
// testJsFast()

let buildLocalPackageWith pkgDir pkgCommand fsproj action =
Expand Down Expand Up @@ -554,7 +537,6 @@ match BUILD_ARGS_LOWER with
// ("src/quicktest/Quicktest.fs", "src/quicktest/bin/Quicktest.js", "src/quicktest/bin/Quicktest.js.map")
// |||> sprintf "nodemon --watch src/quicktest/bin/Quicktest.js --exec 'source-map-visualization --sm=\"%s;%s;%s\"'"
// |> List.singleton |> quicktest
// | "download-standalone"::_ -> downloadStandalone()
// | "coverage"::_ -> coverage()
| "test"::_ -> test()
| "test-mocha"::_ -> testMocha()
Expand Down
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"sdk": {
"version": "6.0.100",
"version": "5.0.300",
"rollForward": "minor"
}
}
1 change: 1 addition & 0 deletions src/Fable.AST/Fable.AST.fsproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<DisableImplicitFSharpCoreReference>true</DisableImplicitFSharpCoreReference>
<Description>Fable AST</Description>
<TargetFramework>netstandard2.0</TargetFramework>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
Expand Down
9 changes: 4 additions & 5 deletions src/Fable.Cli/Entry.fs
Original file line number Diff line number Diff line change
Expand Up @@ -178,13 +178,12 @@ type Runner =
let language = argLanguage args
let typedArrays = args.FlagOr("--typedArrays", true)
let outDir = args.Value("-o", "--outDir") |> Option.map normalizeAbsolutePath
let outDirLast = outDir |> Option.bind (fun outDir -> outDir.TrimEnd('/').Split('/') |> Array.tryLast) |> Option.defaultValue ""

do!
if outDirLast = Naming.fableHiddenDir then
Error($"{Naming.fableHiddenDir} is a reserved directory, please use another output directory")
elif outDirLast = "obj" then
Error("obj is a reserved directory, please use another output directory")
let reservedDirs = [Naming.fableHiddenDir; "obj"]
let outDirLast = outDir |> Option.bind (fun outDir -> outDir.TrimEnd('/').Split('/') |> Array.tryLast) |> Option.defaultValue ""
if List.contains outDirLast reservedDirs then
Error($"{outDirLast} is a reserved directory, please use another output directory")
// TODO: Remove this check when typed arrays are compatible with typescript
elif language = TypeScript && typedArrays then
Error("Typescript output is currently not compatible with typed arrays, pass: --typedArrays false")
Expand Down
1 change: 1 addition & 0 deletions src/Fable.Cli/Fable.Cli.fsproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<DisableImplicitFSharpCoreReference>true</DisableImplicitFSharpCoreReference>
<OutputType>Exe</OutputType>
<TargetFramework>net5.0</TargetFramework>
<Version>3.4.10</Version>
Expand Down
2 changes: 1 addition & 1 deletion src/Fable.Cli/Main.fs
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ type ProjectCracked(cliArgs: CliArgs,
|> getFullProjectOpts

// We display "parsed" because "cracked" may not be understood by users
Log.always $"Project parsed in %i{ms}ms. {result.ProjectOptions.SourceFiles.Length} files.\n"
Log.always $"Project an references ({result.ProjectOptions.SourceFiles.Length} files) parsed in %i{ms}ms.\n"
Log.verbose(lazy
let proj = IO.Path.GetRelativePath(cliArgs.RootDir, cliArgs.ProjectFile)
let opts = result.ProjectOptions.OtherOptions |> String.concat "\n "
Expand Down
4 changes: 4 additions & 0 deletions src/Fable.Core/Fable.Core.fsproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<DisableImplicitFSharpCoreReference>true</DisableImplicitFSharpCoreReference>
<Description>Fable Core Library</Description>
<TargetFramework>netstandard2.0</TargetFramework>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
Expand All @@ -15,4 +16,7 @@
<Compile Include="Fable.Core.JsInterop.fs" />
<Compile Include="Fable.Core.Extensions.fs" />
</ItemGroup>
<ItemGroup>
<PackageReference Update="FSharp.Core" Version="4.7.2" />
</ItemGroup>
</Project>
16 changes: 8 additions & 8 deletions src/Fable.Transforms/FSharp2Fable.Util.fs
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,12 @@ type FsMemberFunctionOrValue(m: FSharpMemberOrFunctionOrValue) =
DeclaringEntity = m.DeclaringEntity |> Option.map (FsEnt.Ref) }

static member DisplayName(m: FSharpMemberOrFunctionOrValue) =
// TODO: Remove when fcs-fable is updated
#if FABLE_COMPILER
// TODO: Change needed when updating to FCS 41
// #if FABLE_COMPILER
Naming.removeGetSetPrefix m.DisplayName
#else
Naming.removeGetSetPrefix m.DisplayNameCore
#endif
// #else
// Naming.removeGetSetPrefix m.DisplayNameCore
// #endif

interface Fable.MemberFunctionOrValue with
member _.Attributes =
Expand Down Expand Up @@ -453,10 +453,10 @@ module Helpers =
| FSharpInlineAnnotation.NeverInline
// TODO: Add compiler option to inline also `OptionalInline`
| FSharpInlineAnnotation.OptionalInline -> false
// TODO: Remove when fcs-fable is updated
#if FABLE_COMPILER
// TODO: Change needed when updating to FCS 41
// #if FABLE_COMPILER
| FSharpInlineAnnotation.PseudoValue
#endif
// #endif
| FSharpInlineAnnotation.AlwaysInline
| FSharpInlineAnnotation.AggressiveInline -> true

Expand Down
10 changes: 5 additions & 5 deletions src/Fable.Transforms/FSharp2Fable.fs
Original file line number Diff line number Diff line change
Expand Up @@ -676,12 +676,12 @@ let private transformExpr (com: IFableCompiler) (ctx: Context) fsExpr =
// When using Fable dynamic operator, we must untuple arguments
// Note F# compiler wraps the value in a closure if it detects it's a lambda
| FSharpExprPatterns.Let((_, FSharpExprPatterns.Call(None,m,_,_,[e1; e2])),_), args
// TODO: Remove when fcs-fable is updated
#if FABLE_COMPILER
// TODO: Change needed when updating to FCS 41
// #if FABLE_COMPILER
when m.FullName = "Fable.Core.JsInterop.( ? )" ->
#else
when m.FullName = "Fable.Core.JsInterop.(?)" ->
#endif
// #else
// when m.FullName = "Fable.Core.JsInterop.(?)" ->
// #endif
let! e1 = transformExpr com ctx e1
let! e2 = transformExpr com ctx e2
let e = Fable.Get(e1, Fable.ByKey(Fable.ExprKey e2), Fable.Any, e1.Range)
Expand Down
3 changes: 2 additions & 1 deletion src/Fable.Transforms/Fable.Transforms.fsproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<DisableImplicitFSharpCoreReference>true</DisableImplicitFSharpCoreReference>
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
Expand All @@ -26,6 +27,6 @@
<ProjectReference Include="..\Fable.AST\Fable.AST.fsproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="FSharp.Compiler.Service" Version="41.0.1" />
<PackageReference Include="FSharp.Compiler.Service" Version="40.0" />
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion src/Fable.Transforms/State.fs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ open Fable.AST
open System.Collections.Generic
open FSharp.Compiler.CodeAnalysis
open FSharp.Compiler.Symbols
// TODO: Remove when fcs-fable is updated
// TODO: Change needed when updating to FCS 40
#if FABLE_COMPILER
open FSharp.Compiler.SourceCodeServices
#endif
Expand Down
1 change: 1 addition & 0 deletions tests/Compiler/Compiler.fsproj
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<DisableImplicitFSharpCoreReference>true</DisableImplicitFSharpCoreReference>
<OutputType>Exe</OutputType>
<TargetFramework>net5</TargetFramework>
<RollForward>Major</RollForward>
Expand Down
1 change: 1 addition & 0 deletions tests/Integration/Fable.Tests.Integration.fsproj
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<DisableImplicitFSharpCoreReference>true</DisableImplicitFSharpCoreReference>
<OutputType>Exe</OutputType>
<TargetFramework>net5</TargetFramework>
<RollForward>Major</RollForward>
Expand Down
2 changes: 1 addition & 1 deletion tests/Main/Fable.Tests.fsproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net5.0</TargetFramework>
<RollForward>Major</RollForward>
<OtherFlags>$(OtherFlags) --crossoptimize- --nowarn:3370</OtherFlags>
<FableDefinesQueue>True</FableDefinesQueue>
Expand Down

0 comments on commit 22bfb48

Please sign in to comment.