Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable builds with .NET 6.0/7.0/8.0 #3542

Merged
merged 1 commit into from
Oct 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion build/Build.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<RollForward>Major</RollForward>
</PropertyGroup>
<ItemGroup>
<Compile Include="Utils.fs" />
Expand Down Expand Up @@ -38,12 +39,12 @@
<Compile Include="Main.fs" />
</ItemGroup>
<ItemGroup>
<PackageReference Update="FSharp.Core" Version="7.0.400" />
<PackageReference Include="BlackFox.CommandLine" Version="1.0.0" />
<PackageReference Include="EluciusFTW.SpectreCoff" Version="0.47.28" />
<PackageReference Include="Fake.IO.FileSystem" Version="6.0.0" />
<PackageReference Include="SimpleExec" Version="11.0.0" />
<PackageReference Include="Spectre.Console" Version="0.47.0" />
<PackageReference Update="FSharp.Core" Version="7.0.400" />
<PackageReference Include="Thoth.Json.Net" Version="11.0.0" />
<PackageReference Include="Octokit" Version="8.0.0" />
<PackageReference Include="Semver" Version="2.3.0" />
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",
"rollForward": "latestMinor"
"rollForward": "latestMajor"
}
}
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
"rollup": "rollup",
"terser": "terser",
"tslint": "tslint",
"build": "dotnet fsi build.fsx",
"publish": "dotnet fsi build.fsx publish",
"test": "dotnet fsi build.fsx test",
"build": "dotnet run --project build/Build.fsproj",
"publish": "dotnet run --project build/Build.fsproj publish",
"test": "dotnet run --project build/Build.fsproj test",
"build-compiler-js": "dotnet fable src/fable-compiler-js/src/fable-compiler-js.fsproj -o build/fable-compiler-js/out",
"postbuild-compiler-js": "rollup build/fable-compiler-js/out/app.js --file src/fable-compiler-js/dist/app.js --format umd --name Fable",
"minify-compiler-js": "terser src/fable-compiler-js/dist/app.js -o src/fable-compiler-js/dist/app.min.js --mangle --compress",
Expand Down
6 changes: 3 additions & 3 deletions src/Fable.Cli/Fable.Cli.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@
<Reference Include="../../lib/fcs/FSharp.Core.dll" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Buildalyzer" Version="4.1.6" />
<PackageReference Include="FSharp.SystemTextJson" Version="0.17.4" />
<PackageReference Include="source-map-sharp" Version="1.0.8" />
<PackageReference Include="Buildalyzer" Version="5.0.1" />
<PackageReference Include="FSharp.SystemTextJson" Version="1.2.42" />
<PackageReference Include="source-map-sharp" Version="1.0.9" />
</ItemGroup>
</Project>
1 change: 1 addition & 0 deletions src/Fable.PublishUtils/Fable.PublishUtils.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<RollForward>Major</RollForward>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<Version>2.4.0</Version>
</PropertyGroup>
Expand Down
1 change: 0 additions & 1 deletion src/Fable.Transforms/Fable.Transforms.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@
<ProjectReference Include="Rust/AST/Rust.AST.fsproj" />
</ItemGroup>
<ItemGroup>
<!-- <PackageReference Include="FSharp.Compiler.Service" Version="40.0" /> -->
<Reference Include="../../lib/fcs/FSharp.Core.dll" />
<Reference Include="../../lib/fcs/FSharp.Compiler.Service.dll" />
</ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/Fable.Transforms/Fable2Babel.fs
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ module Reflection =
| Fable.Any -> Expression.booleanLiteral(true)
| Fable.Unit -> com.TransformAsExpr(ctx, expr) |> Util.makeNullCheck range true
| Fable.Boolean -> jsTypeof "boolean" expr
| Fable.Char | Fable.String _ -> jsTypeof "string" expr
| Fable.Char | Fable.String -> jsTypeof "string" expr
| Fable.Number(Decimal,_) -> jsInstanceof (libValue com ctx "Decimal" "default") expr
| Fable.Number(JS.Replacements.BigIntegers _, _) -> jsTypeof "bigint" expr
| Fable.Number _ -> jsTypeof "number" expr
Expand Down
2 changes: 1 addition & 1 deletion src/Fable.Transforms/FableTransforms.fs
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ let noSideEffectBeforeIdent identName expr =
| Get(_, ExprGet _, _, _) ->
sideEffect <- true
true
| Get(e, (TupleIndex _|UnionField _|UnionTag|ListHead|ListTail|OptionValue _), _, _) ->
| Get(e, (TupleIndex _|UnionField _|UnionTag|ListHead|ListTail|OptionValue), _, _) ->
findIdentOrSideEffect e
| Import _ | Lambda _ | Delegate _ -> false
| Extended((Throw _|Debugger),_) -> true
Expand Down
6 changes: 3 additions & 3 deletions src/Fable.Transforms/Php/Fable2Php.fs
Original file line number Diff line number Diff line change
Expand Up @@ -1175,7 +1175,7 @@ and convertMatching (com: IPhpCompiler) input guard thenExpr elseExpr expr retur
com.AddLocalVar(fixName t, false)
PhpAssign(PhpVar(fixName t, None), PhpConst(PhpConstNumber(float i)))
PhpBreak None
| Return _ ->
| Return ->
yield! convertExprToStatement com target returnStrategy
| _ ->
yield! convertExprToStatement com target returnStrategy
Expand Down Expand Up @@ -1214,7 +1214,7 @@ and convertExprToStatement (com: IPhpCompiler) expr returnStrategy =
yield! convertExprToStatement com expr returnStrategy
| None -> ()
match returnStrategy with
| Return _ -> ()
| Return -> ()
| _ -> PhpBreak None;
]

Expand Down Expand Up @@ -1306,7 +1306,7 @@ and convertExprToStatement (com: IPhpCompiler) expr returnStrategy =
| Fable.Extended(Fable.Throw(expr, _ ),_) ->
match expr with
| None -> failwith "TODO: rethrow"
| Some (Fable.Call (Fable.IdentExpr expr, args, _, _)) when expr.Name = "Error" ->
| Some (Fable.Call (Fable.IdentExpr expr, args, _, _)) when expr.Name = "Error" ->
[ PhpThrow (PhpNew (ExType { Name="Exception"; Namespace=Some ""; Class=None }, List.map (convertExpr com) args.Args))]
| Some expr -> [ PhpThrow(convertExpr com expr)]
| Fable.Extended(Fable.Curry(expr, arrity),_) ->
Expand Down
9 changes: 4 additions & 5 deletions src/Fable.Transforms/Python/Fable2Python.fs
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,9 @@ type BoundVars =
enclosingScope.UnionWith(this.EnclosingScope)
enclosingScope.UnionWith(this.LocalScope)

{ this with
LocalScope = HashSet()
EnclosingScope = enclosingScope
Inceptions = this.Inceptions + 1 }
{ LocalScope = HashSet()
EnclosingScope = enclosingScope
Inceptions = this.Inceptions + 1 }

member this.Bind(name: string) =
this.LocalScope.Add name |> ignore
Expand Down Expand Up @@ -419,7 +418,7 @@ module Reflection =
Expression.compare (expr, [ Is ], [ Util.undefined None ], ?loc = range), stmts
| Fable.Boolean -> pyTypeof "<class 'bool'>" expr
| Fable.Char
| Fable.String _ -> pyTypeof "<class 'str'>" expr
| Fable.String -> pyTypeof "<class 'str'>" expr
| Fable.Number (kind, b) ->
match kind, typ with
| _, Fable.Type.Number (UInt8, _) -> pyTypeof "<fable_modules.fable_library.types.uint8'>>" expr
Expand Down
1 change: 1 addition & 0 deletions src/Fable.Transforms/Rust/AST/Tests/Rust.AST.Tests.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<RollForward>Major</RollForward>
<IsPackable>false</IsPackable>
<GenerateProgramFile>false</GenerateProgramFile>
</PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/Fable.Transforms/Rust/Fable2Rust.fs
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,7 @@ module TypeInfo =
| Fable.Number(BigInt, _) -> false
| Fable.Unit
| Fable.Boolean
| Fable.Char _
| Fable.Char
| Fable.Number _ // all numbers except BigInt
-> true
| _ -> false
Expand Down
2 changes: 1 addition & 1 deletion src/Fable.Transforms/State.fs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ type Assemblies(getPlugin, fsharpAssemblies: FSharpAssembly list) =
({ MemberDeclarationPlugins = Map.empty }, plugins)
||> Seq.fold (fun acc kv ->
if kv.Value.IsSubclassOf(typeof<MemberDeclarationPluginAttribute>) then
{ acc with MemberDeclarationPlugins = Map.add kv.Key kv.Value acc.MemberDeclarationPlugins }
{ MemberDeclarationPlugins = Map.add kv.Key kv.Value acc.MemberDeclarationPlugins }
else acc)

let tryFindEntityByPath (entityFullName: string) (asm: FSharpAssembly) =
Expand Down
2 changes: 1 addition & 1 deletion src/fable-compiler-js/src/fable-compiler-js.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<!-- <RollForward>Major</RollForward> -->
<RollForward>Major</RollForward>
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/fable-library-py/fable_library/double.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def parse(value: Any) -> float:
try:
return float(value)
except Exception:
raise ValueError("Input string was not in a correct format.")
raise ValueError(f"The input string {value} was not in a correct format.")


def try_parse(string: str, def_value: FSharpRef[float]) -> bool:
Expand Down
4 changes: 2 additions & 2 deletions src/fable-library-py/fable_library/int32.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def parse(
try:
v = int(string, base=radix)
except Exception:
raise ValueError("Input string was not in a correct format.")
raise ValueError(f"The input string {string} was not in a correct format.")

(umin, umax) = get_range(True, bitsize)
if not unsigned and radix != 10 and v >= umin and v <= umax:
Expand All @@ -42,7 +42,7 @@ def parse(
if v >= min and v <= max:
return v

raise ValueError("Input string was not in a correct format.")
raise ValueError(f"The input string {string} was not in a correct format.")


def try_parse(
Expand Down
4 changes: 2 additions & 2 deletions src/fable-library-py/fable_library/long.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ def parse(
try:
v = int(string, base=radix)
except Exception:
raise ValueError("Input string was not in a correct format.")
raise ValueError(f"The input string {string} was not in a correct format.")

(umin, umax) = get_range(True)
if not unsigned and radix != 10 and v >= umin and v <= umax:
Expand All @@ -134,7 +134,7 @@ def parse(
if v >= min and v <= max:
return v

raise ValueError("Input string was not in a correct format.")
raise ValueError(f"The input string {string} was not in a correct format.")


def try_parse(
Expand Down
2 changes: 1 addition & 1 deletion src/fable-library-rust/src/BigInt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ pub mod BigInt_ {
pub fn parse(s: string) -> bigint {
match BigInt::from_str_radix(s.trim(), 10) {
Ok(d) => d.into(),
Err(e) => panic!("Input string was not in a correct format."),
Err(e) => panic!("The input string {} was not in a correct format.", s),
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/fable-library-rust/src/DateOnly.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ pub mod DateOnly_ {
pub fn parse(s: string) -> DateOnly {
match Self::try_parse_str(s.trim()) {
Ok(nd) => DateOnly(nd),
Err(e) => panic!("Input string was not in a correct format."),
Err(e) => panic!("The input string {} was not in a correct format.", s),
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/fable-library-rust/src/DateTime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,7 @@ pub mod DateTime_ {
pub fn parse(s: string) -> DateTime {
match Self::try_parse_str(s.trim()) {
Ok(dt) => dt,
Err(e) => panic!("Input string was not in a correct format."),
Err(e) => panic!("The input string {} was not in a correct format.", s),
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/fable-library-rust/src/DateTimeOffset.rs
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ pub mod DateTimeOffset_ {
pub fn parse(s: string) -> DateTimeOffset {
match Self::try_parse_str(s.trim()) {
Ok(dt) => DateTimeOffset(dt.into()),
Err(e) => panic!("Input string was not in a correct format."),
Err(e) => panic!("The input string {} was not in a correct format.", s),
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/fable-library-rust/src/Decimal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ pub mod Decimal_ {
pub fn parse(s: string) -> decimal {
match Decimal::from_str(s.trim()) {
Ok(d) => d,
Err(e) => panic!("Input string was not in a correct format."),
Err(e) => panic!("The input string {} was not in a correct format.", s),
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/fable-library-rust/src/TimeOnly.rs
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ pub mod TimeOnly_ {
pub fn parse(s: string) -> TimeOnly {
match Self::try_parse_str(s.trim()) {
Ok(nt) => TimeOnly(nt),
Err(e) => panic!("Input string was not in a correct format."),
Err(e) => panic!("The input string {} was not in a correct format.", s),
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/fable-library/Decimal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ export function parse(str: string): Decimal {
if (tryParse(str, defValue)) {
return defValue.contents;
} else {
throw new Error("Input string was not in a correct format.");
throw new Error(`The input string ${str} was not in a correct format.`);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/fable-library/Double.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export function parse(str: string): number {
if (tryParse(str, defValue)) {
return defValue.contents;
} else {
throw new Error("Input string was not in a correct format.");
throw new Error(`The input string ${str} was not in a correct format.`);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/fable-library/Int32.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ export function parse(str: string, style: number, unsigned: boolean, bitsize: nu
}
}
}
throw new Error("Input string was not in a correct format.");
throw new Error(`The input string ${str} was not in a correct format.`);
}

export function tryParse(str: string, style: number, unsigned: boolean, bitsize: number, defValue: FSharpRef<number>): boolean {
Expand Down
2 changes: 1 addition & 1 deletion src/fable-library/Long.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export function parse(str: string, style: number, unsigned: boolean, _bitsize: n
return fromString(str);
}
}
throw new Error("Input string was not in a correct format.");
throw new Error(`The input string ${str} was not in a correct format.`);
}

export function tryParse(str: string, style: number, unsigned: boolean, bitsize: number, defValue: FSharpRef<bigint>) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<!-- <RollForward>Major</RollForward> -->
<TargetFramework>net6.0</TargetFramework>
<RollForward>Major</RollForward>
<DefineConstants>$(DefineConstants);DOTNET_FILE_SYSTEM</DefineConstants>
<OtherFlags>$(OtherFlags) --crossoptimize-</OtherFlags>
</PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/fable-standalone/test/bench/bench.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<!-- <RollForward>Major</RollForward> -->
<RollForward>Major</RollForward>
<DefineConstants>$(DefineConstants);DOTNET_FILE_SYSTEM</DefineConstants>
</PropertyGroup>

Expand Down
2 changes: 1 addition & 1 deletion src/fcs-fable/test/fcs-fable-test.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<ItemGroup>
<!-- <PackageReference Include="FSharp.Core" Version="7.0.0" /> -->
<!-- <Reference Include="../../../artifacts/bin/FSharp.Compiler.Service/Release/netstandard2.0/FSharp.Core.dll" /> -->
<PackageReference Include="Fable.Core" Version="4.0.0-*" />
<PackageReference Include="Fable.Core" Version="4.1.0" />
</ItemGroup>

</Project>
3 changes: 1 addition & 2 deletions tests/Dart/src/Fable.Tests.Dart.fsproj
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<DisableImplicitFSharpCoreReference>true</DisableImplicitFSharpCoreReference>
<RollForward>Major</RollForward>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="FSharp.Core" Version="7.0.0" />
<ProjectReference Include="../../../src/Fable.Core/Fable.Core.fsproj" />
</ItemGroup>
<ItemGroup>
Expand Down
6 changes: 5 additions & 1 deletion tests/Dart/src/StringTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -1078,4 +1078,8 @@ let tests() =
// let s4: FormattableString = $"I have `backticks`"
// s4.Format |> equal "I have `backticks`"
// let s5: FormattableString = $"I have {{escaped braces}} and %%percentage%%"
// s5.Format |> equal "I have {escaped braces} and %percentage%"
// #if NET8_0_OR_GREATER
// s5.Format |> equal "I have {{escaped braces}} and %percentage%"
// #elif FABLE_COMPILER
// s5.Format |> equal "I have {escaped braces} and %percentage%"
// #endif
1 change: 1 addition & 0 deletions tests/Integration/Compiler/TestProject/TestProject.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<RollForward>Major</RollForward>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<RollForward>Major</RollForward>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
</PropertyGroup>

Expand All @@ -11,8 +12,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Fable.Core" Version="4.0.0" />
<PackageReference Update="FSharp.Core" Version="7.0.400" />
<PackageReference Include="Fable.Core" Version="4.1.0" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<RollForward>Major</RollForward>
</PropertyGroup>

<ItemGroup>
Expand Down
Loading
Loading