Skip to content

Commit

Permalink
Scripts,CI: choose global.json in configure script
Browse files Browse the repository at this point in the history
Have 2 variants of global.json (one for MAUI/Gtk with .NET6
and one for other MAUI platfoprms with .NET8) and choose
appropriate one in configure script depending on installed
.NET Sdk version.
  • Loading branch information
webwarrior-ws committed May 23, 2024
1 parent a0ef50e commit f38b168
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 21 deletions.
13 changes: 0 additions & 13 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,6 @@ jobs:
uses: actions/setup-dotnet@v1.7.2
with:
dotnet-version: '8.0.300'
- name: Replace global.json in root dir
run: |
# Use global.json from src/GWallet.Frontend.Maui as it specifies .NET8
cp ./src/GWallet.Frontend.Maui/global.json ./
- name: install maui workload
run: dotnet workload install maui
- name: configure
Expand Down Expand Up @@ -226,10 +222,6 @@ jobs:
uses: actions/setup-dotnet@v1.7.2
with:
dotnet-version: ${{ env.DotnetVersion }}
- name: Replace global.json in src/GWallet.Frontend.Maui
run: |
# Use global.json from root as it specifies .NET6
cp ./global.json ./src/GWallet.Frontend.Maui/
- name: Install gtk workload
run: |
wget -O gtksharp.net.sdk.gtk.manifest-${{ env.DotnetVersion }}.nupkg https://globalcdn.nuget.org/packages/gtksharp.net.sdk.gtk.manifest-${{ env.DotnetVersion }}.$GtkSharpVersion.nupkg
Expand Down Expand Up @@ -667,11 +659,6 @@ jobs:
run: |
git submodule foreach git fetch --all && git submodule sync --recursive && git submodule update --init --recursive
dotnet fsi ./scripts/snap_bump.fsx
- name: Replace global.json in src/GWallet.Frontend.Maui
run: |
# Use global.json from root as it specifies .NET6
cp ./global.json ./src/GWallet.Frontend.Maui/
- name: Generate snap package
run: ./scripts/snap_build_maui.sh || (cat /home/runner/.local/state/snapcraft/log/*.log && exit 1)
Expand Down
4 changes: 2 additions & 2 deletions global.json → global-net6.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"sdk": {
"version": "6.0.113",
"version": "6.0.400",
"rollForward": "latestMinor"
}
}
}
2 changes: 1 addition & 1 deletion src/GWallet.Frontend.Maui/global.json → global-net8.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
"version": "8.0.0",
"rollForward": "latestMinor"
}
}
}
23 changes: 18 additions & 5 deletions scripts/configure.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,6 @@ let AddToDefinedConstants (constant: string) (configMap: Map<string, string>) =
configMap
|> Map.add configKey (sprintf "%s;%s" previousConstants constant)


let configFileToBeWritten =
let initialConfigFile = Map.empty.Add("Prefix", prefix.FullName)

Expand Down Expand Up @@ -236,7 +235,7 @@ let lines =

File.AppendAllLines(buildConfigFile.FullName, lines |> Array.ofSeq)

let version = Misc.GetCurrentVersion(rootDir)
//let version = Misc.GetCurrentVersion(rootDir)

let repoInfo = Git.GetRepoInfo()

Expand All @@ -246,11 +245,25 @@ let frontend =
else
"Xamarin.Forms"

if buildTool = Some "dotnet" then
let dotnetVesionString =
Process
.Execute({ Command = "dotnet"; Arguments = "--version" }, Echo.All)
.Unwrap("dotnet command failed")
let globalJsonFile =
if dotnetVesionString.StartsWith "6" then
"global-net6.json"
else
"global-net8.json"
Process
.Execute({ Command = "cp"; Arguments = sprintf "%s global.json" globalJsonFile }, Echo.All)
.Unwrap("Copy command failed")
|> ignore

Console.WriteLine()
Console.WriteLine(sprintf
"\tConfiguration summary for geewallet %s %s"
(version.ToString()) repoInfo)
//Console.WriteLine(sprintf
// "\tConfiguration summary for geewallet %s %s"
// (version.ToString()) repoInfo)
Console.WriteLine()
Console.WriteLine(sprintf
"\t* Installation prefix: %s"
Expand Down

0 comments on commit f38b168

Please sign in to comment.