-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Frontend.Maui: build Maui on linux using GTK
We use our own fork of maui for building maui-gtk since we fixed some things. Maui: added as submodule. Gtk workload: as automatic workload manifest detection doesn't work for some reason, download and uzip mainfest file so .NET knows about gtk workload. Because of new versions of manifest, we got the following error. So by skipping manifest update we make sure that we don't get unwanted updates. ``` Workload installation failed: Failed to install manifest gtksharp.net.sdk.gtk version 3.24.24-rev.87-develop: gtksharp.net.sdk.gtk.manifest-6.0.300::3.24.24-rev.87-develop is not found in NuGet feeds https://pkgs.dev.azure.com/dnceng/public/_packaging/darc-pub-dotnet-runtime-531f715f/nuget/v3/index.json;https://pkgs.dev.azure.com/dnceng/public/_packaging/darc-pub-dotnet-emsdk-3f6c45a2/nuget/v3/index.json;https://pkgs.dev.azure.com/dnceng/public/_packaging/darc-pub-dotnet-emsdk-3f6c45a2-1/nuget/v3/index.json;https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json;https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public/nuget/v3/index.json;https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet6/nuget/v3/index.json;https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet7/nuget/v3/index.json;https://pkgs.dev.azure.com/xamarin/public/_packaging/SkiaSharp/nuget/v3/index.json;https://nuget.pkg.github.com/GtkSharp/index.json".. ``` Co-authored-by: webwarrior <[email protected]>
- Loading branch information
1 parent
a522d17
commit 9491d51
Showing
12 changed files
with
109 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -230,10 +230,37 @@ jobs: | |
linux-github--dotnet-and-mono: | ||
runs-on: ubuntu-22.04 | ||
env: | ||
GtkSharpVersion: 3.24.24.77-develop | ||
DotnetVersion: 6.0.300 | ||
steps: | ||
- uses: actions/checkout@v1 | ||
with: | ||
submodules: false | ||
submodules: true | ||
# We also tested using 6.0.111 for both projects | ||
# but MAUI failed to build on this version with this error: | ||
# Could not load file or assembly 'Microsoft.CodeAnalysis, Version=4.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' | ||
# so instead we use 6.0.300 | ||
- name: Setup .NET SDK ${{ env.DotnetVersion }} | ||
uses: actions/[email protected] | ||
with: | ||
dotnet-version: ${{ env.DotnetVersion }} | ||
- name: Install gtk workload | ||
run: | | ||
dotnet nuget add source --username ${{ github.repository_owner }} --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/GtkSharp/index.json" | ||
# For some reason automatic workload manifest detection doesn't work (see https://github.com/GtkSharp/GtkSharp/issues/355#issuecomment-1446262239), so download and uzip mainfest file manually | ||
wget --user ${{ github.repository_owner }} --password ${{ secrets.GITHUB_TOKEN }} https://nuget.pkg.github.com/GtkSharp/download/gtksharp.net.sdk.gtk.manifest-${{ env.DotnetVersion }}/$GtkSharpVersion/gtksharp.net.sdk.gtk.manifest-${{ env.DotnetVersion }}.nupkg | ||
DOTNET_DIR=/home/runner/.dotnet | ||
WORKLOAD_MANIFEST_DIR=$DOTNET_DIR/sdk-manifests/${{ env.DotnetVersion }}/gtksharp.net.sdk.gtk | ||
unzip -j gtksharp.net.sdk.gtk.manifest-${{ env.DotnetVersion }}.nupkg "data/*" -d $WORKLOAD_MANIFEST_DIR/ | ||
rm gtksharp.net.sdk.gtk.manifest-${{ env.DotnetVersion }}.nupkg | ||
chmod 764 $WORKLOAD_MANIFEST_DIR/* | ||
dotnet workload search | ||
dotnet workload install gtk --skip-manifest-update | ||
- name: Add Maui Nuget source | ||
run: | | ||
cd dependencies/maui | ||
dotnet nuget add source --username ${{ github.repository_owner }} --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/GtkSharp/index.json" | ||
- name: install missing dependencies | ||
run: sudo apt install --yes fsharp nunit-console | ||
- name: check mono version | ||
|
@@ -242,6 +269,9 @@ jobs: | |
run: ./configure.sh | ||
- name: build in DEBUG mode | ||
run: make | ||
- name: build Maui frontend | ||
run: | | ||
dotnet build src/GWallet.Frontend.Maui/GWallet.Frontend.Maui.fsproj --framework=net6.0-gtk | ||
- name: sanity check | ||
run: make sanitycheck | ||
- name: unit tests | ||
|
@@ -258,7 +288,8 @@ jobs: | |
dotnet tool install fsxc --version ${{ env.FSXC_VERSION }} | ||
find . -type f -name "*.fsx" | xargs -t -I {} dotnet fsxc {} | ||
# ignore scripts/fsx submodule as compiling scripts there will result in error | ||
find . -type f -name "*.fsx" ! -path "./scripts/fsx/*" | xargs -t -I {} dotnet fsxc {} | ||
linux-github--dotnet-and-newmono: | ||
runs-on: ubuntu-22.04 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
[submodule "scripts/fsx"] | ||
path = scripts/fsx | ||
url = https://github.com/nblockchain/fsx.git | ||
[submodule "dependencies/maui"] | ||
path = dependencies/maui | ||
url = https://github.com/nblockchain/CrossMaui.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,27 @@ | ||
namespace GWallet.Frontend.Maui | ||
|
||
open Microsoft.Maui.Hosting | ||
#if GTK | ||
open Gdk | ||
open Microsoft.Extensions.Configuration | ||
open Microsoft.Extensions.DependencyInjection | ||
open Microsoft.Extensions.DependencyInjection.Extensions | ||
#endif | ||
open Microsoft.Maui.Controls.Compatibility.Hosting | ||
open Microsoft.Maui.Controls.Hosting | ||
open Microsoft.Maui.Hosting | ||
|
||
type MauiProgram = | ||
static member CreateMauiApp() = | ||
MauiApp | ||
.CreateBuilder() | ||
.UseMauiApp<App>() | ||
#if GTK | ||
.UseMauiCompatibility() | ||
#endif | ||
.ConfigureFonts(fun fonts -> | ||
fonts | ||
.AddFont("OpenSans-Regular.ttf", "OpenSansRegular") | ||
.AddFont("OpenSans-Semibold.ttf", "OpenSansSemibold") | ||
|> ignore | ||
) | ||
.Build() | ||
.Build() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
namespace GWallet.Frontend.Maui | ||
|
||
open System | ||
open Gtk | ||
open Microsoft.Maui | ||
open Microsoft.Maui.Graphics | ||
open Microsoft.Maui.Hosting | ||
|
||
type GtkApp() = | ||
inherit MauiGtkApplication() | ||
|
||
override _.CreateMauiApp() = MauiProgram.CreateMauiApp() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
namespace GWallet.Frontend.Maui | ||
|
||
open System | ||
open System.Threading.Tasks | ||
open GLib | ||
open Microsoft.Extensions.Hosting | ||
open Microsoft.Maui | ||
open Microsoft.Maui.Hosting | ||
|
||
module Program = | ||
[<EntryPoint>] | ||
let main _args = | ||
let app = GtkApp() | ||
app.Run() | ||
0 |