diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index f738ad7c8..bcd22cd2d 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -41,7 +41,7 @@ jobs: find . -type f -name "*.fsx" | xargs -t -I {} dotnet fsxc {} - macOS--mono: + macOS--mono-only: runs-on: macOS-latest steps: - uses: actions/checkout@v1 @@ -64,7 +64,30 @@ jobs: - name: integration tests run: make update-servers - windows--dotnet6: + macOS--dotnet6-only: + runs-on: macOS-latest + steps: + - uses: actions/checkout@v1 + with: + submodules: false + - name: HACK to emulate mono uninstall + run: sudo rm -f `which mono` && sudo rm -f `which msbuild` + - name: configure + run: ./configure.sh + - name: build in DEBUG mode + run: make + - name: sanity check + run: make sanitycheck + - name: unit tests + run: make check + - name: build in STRICT mode + run: git clean -fdx && ./configure.sh && make strict + - name: build in RELEASE mode + run: git clean -fdx && ./configure.sh && make release + - name: integration tests + run: make update-servers + + windows--dotnet6-and-legacyFramework: runs-on: windows-latest steps: - uses: actions/checkout@v1 @@ -98,7 +121,7 @@ jobs: find . -type f -name "*.fsx" | xargs -t -I {} dotnet fsxc {} - windows--legacyFramework: + windows--legacyFramework-only: runs-on: windows-2019 steps: - uses: actions/checkout@v1 @@ -121,7 +144,43 @@ jobs: - name: integration tests run: .\make update-servers - linux22-github: + windows--dotnet6-only: + runs-on: windows-latest + steps: + - uses: actions/checkout@v1 + with: + submodules: false + - name: Setup .NET SDK 6.0.x + uses: actions/setup-dotnet@v1.7.2 + with: + dotnet-version: '6.0.113' + - name: HACK to emulate legacy .NETFramework uninstall + run: del $(& "${Env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" -find MSBuild\\**\\Bin\\MSBuild.exe) + - name: configure + run: .\configure.bat + - name: build in DEBUG mode + run: .\make.bat + - name: sanity check + run: .\make.bat sanitycheck + - name: unit tests + run: .\make.bat check + - name: re-build in STRICT mode + run: git clean -fdx && .\configure.bat && .\make.bat strict + - name: re-build in RELEASE mode + run: git clean -fdx && .\configure.bat && .\make.bat release + - name: integration tests + run: .\make update-servers + - name: compile .fsx scripts + shell: bash + run: | + dotnet new tool-manifest + + # we need to install specific version because of this bug: https://github.com/dotnet/sdk/issues/24037 + dotnet tool install fsxc --version 0.5.9.1 + + find . -type f -name "*.fsx" | xargs -t -I {} dotnet fsxc {} + + linux22-github--dotnet-and-mono: runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v1 @@ -146,7 +205,7 @@ jobs: - name: integration tests run: make update-servers - linux22-github--newmono: + linux22-github--dotnet-and-newmono: runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v1 @@ -176,7 +235,7 @@ jobs: - name: integration tests run: make update-servers - linux22-vanilla--stockmono: + linux22-vanilla--stockmono-only: runs-on: ubuntu-22.04 container: image: "ubuntu:22.04" @@ -212,7 +271,7 @@ jobs: - name: integration tests run: make update-servers - linux22-vanilla--stockdotnet6: + linux22-vanilla--stockdotnet6-only: runs-on: ubuntu-22.04 container: image: "ubuntu:22.04" @@ -340,7 +399,7 @@ jobs: find . -type f -name "*.fsx" | xargs -t -I {} dotnet fsxc {} - linux22-vanilla--newmono: + linux22-vanilla--newmono-only: runs-on: ubuntu-22.04 container: image: "ubuntu:22.04" @@ -382,7 +441,7 @@ jobs: run: make update-servers - linux20-github: + linux20-github--dotnet-and-mono: runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v1 @@ -407,7 +466,7 @@ jobs: - name: integration tests run: make update-servers - linux20-github--newmono: + linux20-github--dotnet-and-newmono: runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v1 @@ -435,7 +494,7 @@ jobs: - name: integration tests run: make update-servers - linux20-vanilla--stockmono: + linux20-vanilla--stockmono-only: runs-on: ubuntu-20.04 container: image: "ubuntu:20.04" @@ -471,7 +530,7 @@ jobs: - name: integration tests run: make update-servers - linux20-vanilla--newmono: + linux20-vanilla--newmono-only: runs-on: ubuntu-20.04 container: image: "ubuntu:20.04" @@ -517,21 +576,23 @@ jobs: container: image: "ubuntu:22.04" needs: - - linux22-github - - linux22-github--newmono - - linux22-vanilla--stockmono - - linux22-vanilla--newmono - - linux22-vanilla--stockdotnet6 + - linux22-github--dotnet-and-mono + - linux22-github--dotnet-and-newmono + - linux22-vanilla--stockmono-only + - linux22-vanilla--newmono-only + - linux22-vanilla--stockdotnet6-only - linux22-vanilla--stockdotnet6-and-stockmono - linux22-vanilla--stockdotnet6-and-newmono - - linux20-github - - linux20-github--newmono - - linux20-vanilla--stockmono - - linux20-vanilla--newmono - - windows--dotnet6 - - windows--legacyFramework + - linux20-github--dotnet-and-mono + - linux20-github--dotnet-and-newmono + - linux20-vanilla--stockmono-only + - linux20-vanilla--newmono-only + - windows--dotnet6-and-legacyFramework + - windows--legacyFramework-only + - windows--dotnet6-only - macOS--dotnet6-and-mono - - macOS--mono + - macOS--mono-only + - macOS--dotnet6-only steps: - uses: actions/checkout@v1 diff --git a/scripts/bump.fsx b/scripts/bump.fsx index 29e16f0be..e0069434c 100755 --- a/scripts/bump.fsx +++ b/scripts/bump.fsx @@ -4,7 +4,7 @@ open System open System.IO #if !LEGACY_FRAMEWORK -#r "nuget: Fsdk" +#r "nuget: Fsdk, Version=0.6.0--date20230812-0646.git-2268d50" #else #r "System.Configuration" open System.Configuration diff --git a/scripts/configure.fsx b/scripts/configure.fsx index 905f107b3..5cec296c5 100755 --- a/scripts/configure.fsx +++ b/scripts/configure.fsx @@ -4,7 +4,7 @@ open System open System.IO #if !LEGACY_FRAMEWORK -#r "nuget: Fsdk" +#r "nuget: Fsdk, Version=0.6.0--date20230812-0646.git-2268d50" #else #r "System.Configuration" open System.Configuration @@ -27,7 +27,17 @@ let initialConfigFile, buildTool, areGtkLibsAbsentOrDoesNotApply = match Process.ConfigCommandCheck ["dotnet"] false true with | Some _ -> "dotnet" | None -> - Process.VsWhere "MSBuild\\**\\Bin\\MSBuild.exe" + Console.Write "checking for msbuild... " + match Process.VsWhere "MSBuild\\**\\Bin\\MSBuild.exe" with + | None -> + Console.WriteLine "not found" + Console.Out.Flush() + Console.Error.WriteLine "Error, please install 'dotnet' aka .NET (6.0 or newer), and/or .NETFramework 4.x ('msbuild')" + Environment.Exit 1 + failwith "Unreachable" + | Some msbuildPath -> + Console.WriteLine "found" + msbuildPath Map.empty, buildTool, true | platform (* Unix *) -> diff --git a/scripts/find.fsx b/scripts/find.fsx index 3f910da05..f39abb2a6 100755 --- a/scripts/find.fsx +++ b/scripts/find.fsx @@ -5,7 +5,7 @@ open System.IO open System.Linq #if !LEGACY_FRAMEWORK -#r "nuget: Fsdk" +#r "nuget: Fsdk, Version=0.6.0--date20230812-0646.git-2268d50" #else #r "System.Configuration" #load "fsx/Fsdk/Misc.fs" diff --git a/scripts/fsx b/scripts/fsx index 8dd6e58f2..2268d5059 160000 --- a/scripts/fsx +++ b/scripts/fsx @@ -1 +1 @@ -Subproject commit 8dd6e58f2ca33b46bf64d2ab968d8c38e093c677 +Subproject commit 2268d505970604f38738bda758ffac44a2a77e54 diff --git a/scripts/make.fsx b/scripts/make.fsx index 7bcabeae7..c55468a39 100644 --- a/scripts/make.fsx +++ b/scripts/make.fsx @@ -14,7 +14,7 @@ open System.Xml.Linq open System.Xml.XPath #if !LEGACY_FRAMEWORK -#r "nuget: Fsdk" +#r "nuget: Fsdk, Version=0.6.0--date20230812-0646.git-2268d50" #else #r "System.Configuration" open System.Configuration @@ -160,18 +160,17 @@ let BuildSolution let buildTool,buildArg = buildToolAndBuildArg let configOption = -#if !LEGACY_FRAMEWORK - sprintf "--configuration %s" (binaryConfig.ToString()) -#else - sprintf "/p:Configuration=%s" (binaryConfig.ToString()) -#endif + if buildTool.StartsWith "dotnet" then + sprintf "--configuration %s" (binaryConfig.ToString()) + else + sprintf "/p:Configuration=%s" (binaryConfig.ToString()) let defineConstantsFromBuildConfig = match buildConfigContents |> Map.tryFind "DefineConstants" with | Some constants -> constants.Split([|";"|], StringSplitOptions.RemoveEmptyEntries) |> Seq.ofArray | None -> Seq.empty let defineConstantsSoFar = - if buildTool <> "dotnet" then + if not (buildTool.StartsWith "dotnet") then Seq.append ["LEGACY_FRAMEWORK"] defineConstantsFromBuildConfig else defineConstantsFromBuildConfig diff --git a/scripts/sanitycheck.fsx b/scripts/sanitycheck.fsx index 13fc30bfc..dc990fff8 100755 --- a/scripts/sanitycheck.fsx +++ b/scripts/sanitycheck.fsx @@ -14,7 +14,7 @@ open System.Xml.Linq open System.Xml.XPath #if !LEGACY_FRAMEWORK -#r "nuget: Fsdk" +#r "nuget: Fsdk, Version=0.6.0--date20230812-0646.git-2268d50" #else #r "System.Configuration" open System.Configuration diff --git a/scripts/snap_release.fsx b/scripts/snap_release.fsx index e73d82e4b..027d1af0e 100755 --- a/scripts/snap_release.fsx +++ b/scripts/snap_release.fsx @@ -15,7 +15,7 @@ open System.Xml.Linq open System.Xml.XPath #if !LEGACY_FRAMEWORK -#r "nuget: Fsdk" +#r "nuget: Fsdk, Version=0.6.0--date20230812-0646.git-2268d50" #else #r "System.Configuration" open System.Configuration diff --git a/src/GWallet.Backend/Ether/EtherServer.fs b/src/GWallet.Backend/Ether/EtherServer.fs index 6e103906a..e755a1bb3 100644 --- a/src/GWallet.Backend/Ether/EtherServer.fs +++ b/src/GWallet.Backend/Ether/EtherServer.fs @@ -203,7 +203,7 @@ module Server = let maybeRpcResponseEx = FSharpUtil.FindException ex match maybeRpcResponseEx with | Some rpcResponseEx -> - if rpcResponseEx.RpcError <> null then + if not (isNull rpcResponseEx.RpcError) then match rpcResponseEx.RpcError.Code with | a when a = int RpcErrorCode.JackOfAllTradesErrorCode -> if not (err32kPossibleMessages.Any (fun msg -> rpcResponseEx.RpcError.Message.Contains msg)) then @@ -494,7 +494,7 @@ module Server = let! latestBlock = web3.Eth.Blocks.GetBlockNumber.SendRequestAsync (null, cancelToken) |> Async.AwaitTask - if (latestBlock = null) then + if isNull latestBlock then failwith "latestBlock somehow is null" let blockToCheck = BigInteger.Subtract(latestBlock.Value, @@ -578,7 +578,7 @@ module Server = let private GetConfirmedTokenBalanceInternal (web3: Web3) (publicAddress: string) (currency: Currency) : Async = - if (web3 = null) then + if isNull web3 then invalidArg "web3" "web3 argument should not be null" async { @@ -587,7 +587,7 @@ module Server = let contractAddress = TokenManager.GetTokenContractAddress currency let contractHandler = web3.Eth.GetContractHandler contractAddress - if (contractHandler = null) then + if isNull contractHandler then failwith "contractHandler somehow is null" let! cancelToken = Async.CancellationToken diff --git a/src/GWallet.Backend/Ether/TokenManager.fs b/src/GWallet.Backend/Ether/TokenManager.fs index 3de531e92..ed00b7f22 100644 --- a/src/GWallet.Backend/Ether/TokenManager.fs +++ b/src/GWallet.Backend/Ether/TokenManager.fs @@ -35,7 +35,7 @@ module TokenManager = origin, HexBigInteger(gasLimit), tokenValue) - if (transactionInput = null) then + if isNull transactionInput then failwith "Assertion failed: transaction input should not be null" if transactionInput.To <> GetTokenContractAddress currency then failwith "Assertion failed: transactionInput's TO property should be equal to the contract address" diff --git a/src/GWallet.Backend/Marshalling.fs b/src/GWallet.Backend/Marshalling.fs index 2feae327d..17836fc7a 100644 --- a/src/GWallet.Backend/Marshalling.fs +++ b/src/GWallet.Backend/Marshalling.fs @@ -28,7 +28,7 @@ type MarshalledException = } static member private ExtractBasicDetailsFromException (ex: Exception) = let stackTrace = - if ex.StackTrace = null then + if isNull ex.StackTrace then String.Empty else ex.StackTrace @@ -170,7 +170,7 @@ module Marshalling = false let DeserializeCustom<'T>(json: string, settings: JsonSerializerSettings): 'T = - if (json = null) then + if isNull json then raise (ArgumentNullException("json")) if (String.IsNullOrWhiteSpace(json)) then raise (ArgumentException("empty or whitespace json", "json")) diff --git a/src/GWallet.Frontend.Console/Program.fs b/src/GWallet.Frontend.Console/Program.fs index 1828964cb..41600e606 100644 --- a/src/GWallet.Frontend.Console/Program.fs +++ b/src/GWallet.Frontend.Console/Program.fs @@ -352,7 +352,7 @@ let rec PerformOperation (numActiveAccounts: uint32) (numHotAccounts: uint32) = | Operations.CreateAccounts -> let bootstrapTask = Caching.Instance.BootstrapServerStatsFromTrustedSource() |> Async.StartAsTask let passphrase,dob,email = UserInteraction.AskBrainSeed true - if null <> bootstrapTask.Exception then + if not (isNull bootstrapTask.Exception) then raise bootstrapTask.Exception let masterPrivateKeyTask = Account.GenerateMasterPrivateKey passphrase dob email