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

Fix nuget sanitycheck #236

Merged
merged 5 commits into from
Oct 20, 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
25 changes: 25 additions & 0 deletions scripts/fsxHelper.fs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,35 @@ open System.IO
open Fsdk
open Fsdk.Process

type SolutionFile =
| Default
| Linux
| Mac

module FsxHelper =

let GetSolution (solType: SolutionFile) =
let solFileName =
match solType with
| Default ->
#if !LEGACY_FRAMEWORK
"gwallet.core.sln"
#else
"gwallet.core-legacy.sln"
#endif
| Linux -> "gwallet.linux-legacy.sln"
| Mac -> "gwallet.mac-legacy.sln"

let slnFile =
Path.Combine("src", solFileName)
|> FileInfo
if not slnFile.Exists then
raise <| FileNotFoundException("Solution file not found", slnFile.FullName)
slnFile

let ScriptsDir = __SOURCE_DIRECTORY__ |> DirectoryInfo
let RootDir = Path.Combine(ScriptsDir.FullName, "..") |> DirectoryInfo
let SourceDir = Path.Combine(RootDir.FullName, "src") |> DirectoryInfo
let NugetDir = Path.Combine (RootDir.FullName, ".nuget") |> DirectoryInfo
let NugetExe = Path.Combine (NugetDir.FullName, "nuget.exe") |> FileInfo
let NugetSolutionPackagesDir = Path.Combine(RootDir.FullName, "packages") |> DirectoryInfo
Expand Down
52 changes: 15 additions & 37 deletions scripts/make.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,6 @@ open System.IO
open System.Linq
open System.Diagnostics

open System.Text
open System.Text.RegularExpressions
#r "System.Core.dll"
open System.Xml
#r "System.Xml.Linq.dll"
open System.Xml.Linq
open System.Xml.XPath

#if !LEGACY_FRAMEWORK
#r "nuget: Fsdk, Version=0.6.0--date20230818-1152.git-83d671b"
#else
Expand All @@ -34,25 +26,6 @@ let UNIX_NAME = "geewallet"
let CONSOLE_FRONTEND = "GWallet.Frontend.Console"
let GTK_FRONTEND = "GWallet.Frontend.XF.Gtk"

type SolutionFile =
| Default
| Linux
| Mac

let GetSolution (solType: SolutionFile) =
let solFileName =
match solType with
| Default ->
#if !LEGACY_FRAMEWORK
"gwallet.core.sln"
#else
"gwallet.core-legacy.sln"
#endif
| Linux -> "gwallet.linux-legacy.sln"
| Mac -> "gwallet.mac-legacy.sln"

Path.Combine("src", solFileName)

type ProjectFile =
| XFFrontend
| GtkFrontend
Expand All @@ -63,7 +36,12 @@ let GetProject (projFile: ProjectFile) =
| GtkFrontend -> Path.Combine("GWallet.Frontend.XF.Gtk", "GWallet.Frontend.XF.Gtk.fsproj")
| XFFrontend -> Path.Combine("GWallet.Frontend.XF", "GWallet.Frontend.XF.fsproj")

Path.Combine("src", projFileName)
let prjFile =
Path.Combine("src", projFileName)
|> FileInfo
if not prjFile.Exists then
raise <| FileNotFoundException("Project file not found", prjFile.FullName)
prjFile

let BACKEND = "GWallet.Backend"

Expand Down Expand Up @@ -154,11 +132,11 @@ FRONTEND_PATH="$DIR_OF_THIS_SCRIPT/../lib/$UNIX_NAME/$GWALLET_PROJECT.exe"
exec mono "$FRONTEND_PATH" "$@"
"""

let NugetRestore projectOrSolutionRelativePath =
let NugetRestore (projectOrSolution: FileInfo) =
let nugetArgs =
sprintf
"restore %s -DisableParallelProcessing -SolutionDirectory ."
projectOrSolutionRelativePath
projectOrSolution.FullName
let proc =
Network.RunNugetCommand
FsxHelper.NugetExe
Expand Down Expand Up @@ -194,13 +172,13 @@ let PrintNugetVersion () =

let BuildSolutionOrProject
(buildToolAndBuildArg: string*string)
(fileName: string)
(file: FileInfo)
(binaryConfig: BinaryConfig)
(maybeConstant: Option<string>)
(extraOptions: string)
=
#if LEGACY_FRAMEWORK
NugetRestore fileName
NugetRestore file
#endif

let buildTool,buildArg = buildToolAndBuildArg
Expand Down Expand Up @@ -255,7 +233,7 @@ let BuildSolutionOrProject
configOption
let buildArgs = sprintf "%s %s %s %s"
buildArg
fileName
file.FullName
configOptions
extraOptions
let buildProcess = Process.Execute ({ Command = buildTool; Arguments = buildArgs }, Echo.All)
Expand All @@ -273,7 +251,7 @@ let JustBuild binaryConfig maybeConstant: Frontend*FileInfo =
let maybeBuildTool = Map.tryFind "BuildTool" buildConfigContents
let maybeLegacyBuildTool = Map.tryFind "LegacyBuildTool" buildConfigContents

let solutionFileName = GetSolution SolutionFile.Default
let solutionFile = FsxHelper.GetSolution SolutionFile.Default
let getBuildToolAndArgs(buildTool: string) =
match buildTool with
| "dotnet" ->
Expand Down Expand Up @@ -307,7 +285,7 @@ let JustBuild binaryConfig maybeConstant: Frontend*FileInfo =
| None, Some buildTool ->
BuildSolutionOrProject
(getBuildToolAndArgs buildTool)
solutionFileName
solutionFile
binaryConfig
maybeConstant
String.Empty
Expand All @@ -328,7 +306,7 @@ let JustBuild binaryConfig maybeConstant: Frontend*FileInfo =
| Misc.Platform.Mac ->
//this is because building in release requires code signing keys
if binaryConfig = BinaryConfig.Debug then
let solution = GetSolution SolutionFile.Mac
let solution = FsxHelper.GetSolution SolutionFile.Mac
// somehow, msbuild doesn't restore the frontend dependencies (e.g. Xamarin.Forms) when targetting
// the {LINUX|MAC}_SOLUTION_FILE below, so we need this workaround. TODO: just finish migrating to MAUI(dotnet restore)
NugetRestore solution
Expand All @@ -337,7 +315,7 @@ let JustBuild binaryConfig maybeConstant: Frontend*FileInfo =
Frontend.Console
| Misc.Platform.Linux ->
if FsxHelper.AreGtkLibsPresent Echo.All then
let solution = GetSolution SolutionFile.Linux
let solution = FsxHelper.GetSolution SolutionFile.Linux
// somehow, msbuild doesn't restore the frontend dependencies (e.g. Xamarin.Forms) when targetting
// the {LINUX|MAC}_SOLUTION_FILE below, so we need this workaround. TODO: just finish migrating to MAUI(dotnet restore)
NugetRestore solution
Expand Down
2 changes: 1 addition & 1 deletion scripts/make.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ if [ ! -f "$BUILD_CONFIG" ]; then
echo "ERROR: configure hasn't been run yet, run ./configure.sh first" >&2 && exit 1
fi
source "$BUILD_CONFIG"
FsxRunnerBin=$FsxRunnerBin FsxRunnerArg=$FsxRunnerArg BuildTool=$BuildTool $FsxRunnerBin $FsxRunnerArg ./scripts/make.fsx "$@"
FsxRunnerBin=$FsxRunnerBin FsxRunnerArg=$FsxRunnerArg BuildTool=$BuildTool LegacyBuildTool=$LegacyBuildTool $FsxRunnerBin $FsxRunnerArg ./scripts/make.fsx "$@"
34 changes: 14 additions & 20 deletions scripts/sanitycheck.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -421,26 +421,20 @@ let SanityCheckNugetPackages () =

//let solutions = Directory.GetCurrentDirectory() |> DirectoryInfo |> findSolutions
//NOTE: we hardcode the solutions rather than the line above, because e.g. Linux OS can't build/restore iOS proj
let solutions =
FsxHelper.RootDir.EnumerateFiles().Where (
fun file ->

match Misc.GuessPlatform() with

// xbuild cannot build .NETStandard projects so we cannot build the non-Core parts:
| Misc.Platform.Linux when "msbuild" = Environment.GetEnvironmentVariable "BuildTool" ->
file.Name = "gwallet.linux.sln"

| Misc.Platform.Mac ->
file.Name = "gwallet.mac.sln"

| _ (* stockmono linux and windows *) ->

// TODO: have a windows solution file
file.Name = "gwallet.core.sln"
)
for sol in solutions do
sanityCheckNugetPackagesFromSolution sol
let sol =
match Misc.GuessPlatform() with
#if LEGACY_FRAMEWORK
| Misc.Platform.Linux when "msbuild" = Environment.GetEnvironmentVariable "LegacyBuildTool" ->
FsxHelper.GetSolution SolutionFile.Linux
#endif
| Misc.Platform.Mac when "msbuild" = Environment.GetEnvironmentVariable "LegacyBuildTool" ->
FsxHelper.GetSolution SolutionFile.Mac
| _ ->
// TODO: have a windows solution file
FsxHelper.GetSolution SolutionFile.Default

sanityCheckNugetPackagesFromSolution sol


FindOffendingPrintfUsage()
SanityCheckNugetPackages()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -276,19 +276,19 @@
<HintPath>..\..\packages\HtmlAgilityPack.1.11.24\lib\netstandard2.0\HtmlAgilityPack.dll</HintPath>
</Reference>
<Reference Include="JsonRpcSharp.Client">
<HintPath>..\..\packages\JsonRpcSharp.0.94.0--date20201018-1119.git-05d4006\lib\netstandard2.0\JsonRpcSharp.Client.dll</HintPath>
<HintPath>..\..\packages\JsonRpcSharp.0.98.0--date20230731-1252.git-6788e32\lib\netstandard2.0\JsonRpcSharp.Client.dll</HintPath>
</Reference>
<Reference Include="JsonRpcSharp.IpcClient">
<HintPath>..\..\packages\JsonRpcSharp.0.94.0--date20201018-1119.git-05d4006\lib\netstandard2.0\JsonRpcSharp.IpcClient.dll</HintPath>
<HintPath>..\..\packages\JsonRpcSharp.0.98.0--date20230731-1252.git-6788e32\lib\netstandard2.0\JsonRpcSharp.IpcClient.dll</HintPath>
</Reference>
<Reference Include="JsonRpcSharp.HttpClient">
<HintPath>..\..\packages\JsonRpcSharp.0.94.0--date20201018-1119.git-05d4006\lib\netstandard2.0\JsonRpcSharp.HttpClient.dll</HintPath>
<HintPath>..\..\packages\JsonRpcSharp.0.98.0--date20230731-1252.git-6788e32\lib\netstandard2.0\JsonRpcSharp.HttpClient.dll</HintPath>
</Reference>
<Reference Include="JsonRpcSharp.TcpClient">
<HintPath>..\..\packages\JsonRpcSharp.0.94.0--date20201018-1119.git-05d4006\lib\netstandard2.0\JsonRpcSharp.TcpClient.dll</HintPath>
<HintPath>..\..\packages\JsonRpcSharp.0.98.0--date20230731-1252.git-6788e32\lib\netstandard2.0\JsonRpcSharp.TcpClient.dll</HintPath>
</Reference>
<Reference Include="JsonRpcSharp.WebSocketClient">
<HintPath>..\..\packages\JsonRpcSharp.0.94.0--date20201018-1119.git-05d4006\lib\netstandard2.0\JsonRpcSharp.WebSocketClient.dll</HintPath>
<HintPath>..\..\packages\JsonRpcSharp.0.98.0--date20230731-1252.git-6788e32\lib\netstandard2.0\JsonRpcSharp.WebSocketClient.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Extensions.Logging.Abstractions">
<HintPath>..\..\packages\Microsoft.Extensions.Logging.Abstractions.1.0.2\lib\netstandard1.1\Microsoft.Extensions.Logging.Abstractions.dll</HintPath>
Expand Down Expand Up @@ -333,7 +333,7 @@
<HintPath>..\..\packages\Nethereum.0.95.0--date20210125-0551.git-05a29e9\lib\netstandard2.0\Nethereum.Web3.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json">
<HintPath>..\..\packages\Newtonsoft.Json.11.0.2\lib\netstandard2.0\Newtonsoft.Json.dll</HintPath>
<HintPath>..\..\packages\Newtonsoft.Json.13.0.2\lib\netstandard2.0\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="SharpRaven">
<HintPath>..\..\packages\SharpRaven.2.4.0\lib\netstandard2.0\SharpRaven.dll</HintPath>
Expand Down
4 changes: 2 additions & 2 deletions src/GWallet.Frontend.XF.Android/packages.config
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<package id="FSharp.Core" version="4.7.0" targetFramework="monoandroid90" />
<package id="FSharp.Data" version="3.0.0" targetFramework="monoandroid90" />
<package id="HtmlAgilityPack" version="1.11.24" targetFramework="monoandroid90" />
<package id="JsonRpcSharp" version="0.94.0--date20201018-1119.git-05d4006" targetFramework="monoandroid90" />
<package id="JsonRpcSharp" version="0.98.0--date20230731-1252.git-6788e32" targetFramework="monoandroid90" />
<package id="Microsoft.CSharp" version="4.3.0" targetFramework="monoandroid90" />
<package id="Microsoft.Extensions.Logging.Abstractions" version="1.0.2" targetFramework="monoandroid90" />
<package id="Microsoft.NETCore.Platforms" version="1.1.0" targetFramework="monoandroid90" />
Expand All @@ -16,7 +16,7 @@
<package id="NBitcoin.Altcoins" version="3.0.8" targetFramework="monoandroid90" />
<package id="Nethereum" version="0.95.0--date20210125-0551.git-05a29e9" targetFramework="monoandroid90" />
<package id="NETStandard.Library" version="2.0.3" targetFramework="monoandroid90" />
<package id="Newtonsoft.Json" version="11.0.2" targetFramework="monoandroid90" />
<package id="Newtonsoft.Json" version="13.0.2" targetFramework="monoandroid90" />
<package id="Portable.BouncyCastle" version="1.8.5.2" targetFramework="monoandroid90" />
<package id="SharpRaven" version="2.4.0" targetFramework="monoandroid90" />
<package id="System.AppContext" version="4.3.0" targetFramework="monoandroid90" />
Expand Down
12 changes: 6 additions & 6 deletions src/GWallet.Frontend.XF.Gtk/GWallet.Frontend.XF.Gtk.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
<HintPath>..\..\packages\Portable.BouncyCastle.1.8.5.2\lib\net40\BouncyCastle.Crypto.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json">
<HintPath>..\..\packages\Newtonsoft.Json.11.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
<HintPath>..\..\packages\Newtonsoft.Json.13.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System.Runtime.InteropServices.RuntimeInformation">
<HintPath>..\..\packages\System.Runtime.InteropServices.RuntimeInformation.4.3.0\lib\net45\System.Runtime.InteropServices.RuntimeInformation.dll</HintPath>
Expand Down Expand Up @@ -146,19 +146,19 @@
<HintPath>..\..\packages\System.Net.WebSockets.Client.4.3.2\lib\net46\System.Net.WebSockets.Client.dll</HintPath>
</Reference>
<Reference Include="JsonRpcSharp.Client">
<HintPath>..\..\packages\JsonRpcSharp.0.94.0--date20201018-1119.git-05d4006\lib\netstandard2.0\JsonRpcSharp.Client.dll</HintPath>
<HintPath>..\..\packages\JsonRpcSharp.0.98.0--date20230731-1252.git-6788e32\lib\netstandard2.0\JsonRpcSharp.Client.dll</HintPath>
</Reference>
<Reference Include="JsonRpcSharp.IpcClient">
<HintPath>..\..\packages\JsonRpcSharp.0.94.0--date20201018-1119.git-05d4006\lib\netstandard2.0\JsonRpcSharp.IpcClient.dll</HintPath>
<HintPath>..\..\packages\JsonRpcSharp.0.98.0--date20230731-1252.git-6788e32\lib\netstandard2.0\JsonRpcSharp.IpcClient.dll</HintPath>
</Reference>
<Reference Include="JsonRpcSharp.HttpClient">
<HintPath>..\..\packages\JsonRpcSharp.0.94.0--date20201018-1119.git-05d4006\lib\netstandard2.0\JsonRpcSharp.HttpClient.dll</HintPath>
<HintPath>..\..\packages\JsonRpcSharp.0.98.0--date20230731-1252.git-6788e32\lib\netstandard2.0\JsonRpcSharp.HttpClient.dll</HintPath>
</Reference>
<Reference Include="JsonRpcSharp.TcpClient">
<HintPath>..\..\packages\JsonRpcSharp.0.94.0--date20201018-1119.git-05d4006\lib\netstandard2.0\JsonRpcSharp.TcpClient.dll</HintPath>
<HintPath>..\..\packages\JsonRpcSharp.0.98.0--date20230731-1252.git-6788e32\lib\netstandard2.0\JsonRpcSharp.TcpClient.dll</HintPath>
</Reference>
<Reference Include="JsonRpcSharp.WebSocketClient">
<HintPath>..\..\packages\JsonRpcSharp.0.94.0--date20201018-1119.git-05d4006\lib\netstandard2.0\JsonRpcSharp.WebSocketClient.dll</HintPath>
<HintPath>..\..\packages\JsonRpcSharp.0.98.0--date20230731-1252.git-6788e32\lib\netstandard2.0\JsonRpcSharp.WebSocketClient.dll</HintPath>
</Reference>
<Reference Include="Nethereum.ABI">
<HintPath>..\..\packages\Nethereum.0.95.0--date20210125-0551.git-05a29e9\lib\netstandard2.0\Nethereum.ABI.dll</HintPath>
Expand Down
4 changes: 2 additions & 2 deletions src/GWallet.Frontend.XF.Gtk/packages.config
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
<package id="FSharp.Core" version="4.7.0" targetFramework="net461" />
<package id="FSharp.Data" version="3.0.0" targetFramework="net461" />
<package id="HtmlAgilityPack" version="1.11.24" targetFramework="net471" />
<package id="JsonRpcSharp" version="0.94.0--date20201018-1119.git-05d4006" targetFramework="net471" />
<package id="JsonRpcSharp" version="0.98.0--date20230731-1252.git-6788e32" targetFramework="net471" />
<package id="Microsoft.CSharp" version="4.3.0" targetFramework="net471" />
<package id="Microsoft.Extensions.Logging.Abstractions" version="1.0.2" targetFramework="net461" />
<package id="NBitcoin" version="6.0.17" targetFramework="net471" />
<package id="NBitcoin.Altcoins" version="3.0.8" targetFramework="net471" />
<package id="Nethereum" version="0.95.0--date20210125-0551.git-05a29e9" targetFramework="net471" />
<package id="Newtonsoft.Json" version="11.0.2" targetFramework="net461" />
<package id="Newtonsoft.Json" version="13.0.2" targetFramework="net461" />
<package id="OpenTK" version="3.0.1" targetFramework="net461" />
<package id="Portable.BouncyCastle" version="1.8.5.2" targetFramework="net461" />
<package id="SharpRaven" version="2.4.0" targetFramework="net461" />
Expand Down
12 changes: 6 additions & 6 deletions src/GWallet.Frontend.XF.Mac/GWallet.Frontend.XF.Mac.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
<HintPath>..\..\packages\Zlib.Portable.1.11.0\lib\portable-net4+sl5+wp8+win8+wpa81+MonoTouch+MonoAndroid\Zlib.Portable.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json">
<HintPath>..\..\packages\Newtonsoft.Json.11.0.2\lib\netstandard2.0\Newtonsoft.Json.dll</HintPath>
<HintPath>..\..\packages\Newtonsoft.Json.13.0.2\lib\netstandard2.0\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="BouncyCastle.Crypto">
<HintPath>..\..\packages\Portable.BouncyCastle.1.8.5.2\lib\netstandard2.0\BouncyCastle.Crypto.dll</HintPath>
Expand Down Expand Up @@ -121,19 +121,19 @@
<HintPath>..\..\packages\Microsoft.Extensions.Logging.Abstractions.1.0.2\lib\netstandard1.1\Microsoft.Extensions.Logging.Abstractions.dll</HintPath>
</Reference>
<Reference Include="JsonRpcSharp.Client">
<HintPath>..\..\packages\JsonRpcSharp.0.94.0--date20201018-1119.git-05d4006\lib\netstandard2.0\JsonRpcSharp.Client.dll</HintPath>
<HintPath>..\..\packages\JsonRpcSharp.0.98.0--date20230731-1252.git-6788e32\lib\netstandard2.0\JsonRpcSharp.Client.dll</HintPath>
</Reference>
<Reference Include="JsonRpcSharp.IpcClient">
<HintPath>..\..\packages\JsonRpcSharp.0.94.0--date20201018-1119.git-05d4006\lib\netstandard2.0\JsonRpcSharp.IpcClient.dll</HintPath>
<HintPath>..\..\packages\JsonRpcSharp.0.98.0--date20230731-1252.git-6788e32\lib\netstandard2.0\JsonRpcSharp.IpcClient.dll</HintPath>
</Reference>
<Reference Include="JsonRpcSharp.HttpClient">
<HintPath>..\..\packages\JsonRpcSharp.0.94.0--date20201018-1119.git-05d4006\lib\netstandard2.0\JsonRpcSharp.HttpClient.dll</HintPath>
<HintPath>..\..\packages\JsonRpcSharp.0.98.0--date20230731-1252.git-6788e32\lib\netstandard2.0\JsonRpcSharp.HttpClient.dll</HintPath>
</Reference>
<Reference Include="JsonRpcSharp.TcpClient">
<HintPath>..\..\packages\JsonRpcSharp.0.94.0--date20201018-1119.git-05d4006\lib\netstandard2.0\JsonRpcSharp.TcpClient.dll</HintPath>
<HintPath>..\..\packages\JsonRpcSharp.0.98.0--date20230731-1252.git-6788e32\lib\netstandard2.0\JsonRpcSharp.TcpClient.dll</HintPath>
</Reference>
<Reference Include="JsonRpcSharp.WebSocketClient">
<HintPath>..\..\packages\JsonRpcSharp.0.94.0--date20201018-1119.git-05d4006\lib\netstandard2.0\JsonRpcSharp.WebSocketClient.dll</HintPath>
<HintPath>..\..\packages\JsonRpcSharp.0.98.0--date20230731-1252.git-6788e32\lib\netstandard2.0\JsonRpcSharp.WebSocketClient.dll</HintPath>
</Reference>
<Reference Include="Nethereum.ABI">
<HintPath>..\..\packages\Nethereum.0.95.0--date20210125-0551.git-05a29e9\lib\netstandard2.0\Nethereum.ABI.dll</HintPath>
Expand Down
Loading
Loading