Skip to content

Commit

Permalink
scripts/sanitycheck: solotion files must exist
Browse files Browse the repository at this point in the history
The solution files had to be relocated and an exception
created if the solution file didn't exist.
  • Loading branch information
Mersho committed Oct 17, 2023
1 parent 265b103 commit 03e8743
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 15 deletions.
1 change: 1 addition & 0 deletions scripts/fsxHelper.fs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ module FsxHelper =

let ScriptsDir = __SOURCE_DIRECTORY__ |> DirectoryInfo
let RootDir = Path.Combine(ScriptsDir.FullName, "..") |> DirectoryInfo
let SourceDir = Path.Combine(ScriptsDir.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
41 changes: 26 additions & 15 deletions scripts/sanitycheck.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -421,26 +421,37 @@ 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 ->
let solutionFileNames = [
Path.Combine(FsxHelper.SourceDir.FullName, "gwallet.linux-legacy.sln")
Path.Combine(FsxHelper.SourceDir.FullName, "gwallet.mac-legacy.sln")
Path.Combine(FsxHelper.SourceDir.FullName, "gwallet.core-legacy.sln")
]

match Misc.GuessPlatform() with
let solutionFiles = solutionFileNames |> List.map FileInfo

// 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"
let checkFilesExist (fileNames: List<FileInfo>) =
fileNames
|> List.map (fun fileName -> fileName.Exists)
|> List.fold (&&) true

| Misc.Platform.Mac ->
file.Name = "gwallet.mac.sln"
let allFilesExist = checkFilesExist solutionFiles

| _ (* stockmono linux and windows *) ->
if not allFilesExist then
failwith "Solution files were not found to do sanity check."

// TODO: have a windows solution file
file.Name = "gwallet.core.sln"
)
for sol in solutions do
sanityCheckNugetPackagesFromSolution sol
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" ->
sanityCheckNugetPackagesFromSolution solutionFiles.[0]

| Misc.Platform.Mac ->
sanityCheckNugetPackagesFromSolution solutionFiles.[1]

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

// TODO: have a windows solution file
sanityCheckNugetPackagesFromSolution solutionFiles.[2]


FindOffendingPrintfUsage()
SanityCheckNugetPackages()
Expand Down

0 comments on commit 03e8743

Please sign in to comment.