Skip to content

Commit c1564ed

Browse files
authored
Merge PR dotnet#28 from webwarrior-ws/fix-linux-maui-94-mali
Build nuget packages in CI and push to nuget.
2 parents 7f3b34f + eae8bf7 commit c1564ed

25 files changed

+109
-18
lines changed

.github/workflows/build-gtk.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Build Controls.Sample.Gtk
2+
on: [push, pull_request]
3+
4+
jobs:
5+
build_and_test:
6+
name: Build & Test
7+
runs-on: ubuntu-22.04
8+
env:
9+
GtkSharpVersion: 3.24.24.117-develop
10+
GtkSharpManifestVersion: 8.0.200
11+
DotnetVersion: 8.0.200
12+
PROJECTS_TO_PACK: |
13+
src/BlazorWebView/src/Maui/Microsoft.AspNetCore.Components.WebView.Maui.csproj
14+
src/Essentials/src/Essentials.csproj
15+
src/Controls/src/Core/Controls.Core.csproj
16+
src/Controls/src/Xaml/Controls.Xaml.csproj
17+
src/Core/src/Core.csproj
18+
src/Compatibility/Core/src/Compatibility.csproj
19+
src/Controls/Foldable/src/Controls.Foldable.csproj
20+
src/Graphics/src/Graphics/Graphics.csproj
21+
steps:
22+
- name: Checkout MAUI repo
23+
uses: actions/checkout@v2
24+
- name: Setup .NET SDK ${{ env.DotnetVersion }}
25+
uses: actions/[email protected]
26+
with:
27+
dotnet-version: ${{ env.DotnetVersion }}
28+
- name: Install gtk workload
29+
run: ./install_gtk_workload.sh
30+
- name: Generate pre-release version suffix
31+
run: dotnet fsi nugetPreRelease.fsx "" > PreReleaseVersionSuffix.txt
32+
- name: Build MAUI
33+
run: |
34+
mv Directory.Build.Override.props.in Directory.Build.Override.props
35+
dotnet build Microsoft.Maui.BuildTasks.slnf
36+
echo "$PROJECTS_TO_PACK" | while read -r project; do
37+
[ -z "$project" ] && continue # Skip if empty
38+
dotnet build -c Release "$project"
39+
done
40+
- name: Pack MAUI
41+
run: ./pack_mali.sh
42+
- name: Upload binaries to nuget (if tag or main branch, and nugetKey is present)
43+
env:
44+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
45+
NUGET_KEY: ${{ secrets.NUGET_KEY }}
46+
if: ${{ env.NUGET_KEY != '' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/')) }}
47+
run: dotnet nuget push **/*.nupkg --api-key ${{ secrets.NUGET_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate

Directory.Build.Override.props.in

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,15 @@
66
-->
77
<_IncludeWindows></_IncludeWindows>
88
<_IncludeTizen></_IncludeTizen>
9+
<_IncludeGtk>true</_IncludeGtk>
910
<_IncludeAndroid></_IncludeAndroid>
1011
<_IncludeIos></_IncludeIos>
1112
<_IncludeMacCatalyst></_IncludeMacCatalyst>
1213
<_IncludeMacOS></_IncludeMacOS>
1314
</PropertyGroup>
1415

1516
<PropertyGroup>
16-
<_SpecificPlatformRequested Condition="'$(_IncludeAndroid)' == 'true' OR '$(_IncludeWindows)' == 'true' OR '$(_IncludeTizen)' == 'true' OR '$(_IncludeIos)' == 'true' OR '$(_IncludeMacCatalyst)' == 'true' OR '$(_IncludeMacOS)' == 'true'">true</_SpecificPlatformRequested>
17+
<_SpecificPlatformRequested Condition="'$(_IncludeAndroid)' == 'true' OR '$(_IncludeWindows)' == 'true' OR '$(_IncludeTizen)' == 'true' OR '$(_IncludeGtk)' == true OR '$(_IncludeIos)' == 'true' OR '$(_IncludeMacCatalyst)' == 'true' OR '$(_IncludeMacOS)' == 'true'">true</_SpecificPlatformRequested>
1718
<IncludeAndroidTargetFrameworks Condition="'$(_SpecificPlatformRequested)' == 'true' AND '$(_IncludeAndroid)' != 'true'">false</IncludeAndroidTargetFrameworks>
1819
<IncludeWindowsTargetFrameworks Condition="'$(_SpecificPlatformRequested)' == 'true' AND '$(_IncludeWindows)' != 'true'">false</IncludeWindowsTargetFrameworks>
1920
<IncludeTizenTargetFrameworks Condition="'$(_SpecificPlatformRequested)' == 'true' AND '$(_IncludeTizen)' != 'true'">false</IncludeTizenTargetFrameworks>

Directory.Build.props

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,8 @@
129129
<_MauiBuildTasksLocation Condition="'$(_MauiBuildTasksLocation)' == ''">$(MSBuildThisFileDirectory).buildtasks\</_MauiBuildTasksLocation>
130130
<_MauiAOTProfileLocation>$(MauiSrcDirectory)Controls\src\Build.Tasks\nuget\buildTransitive\netstandard2.0\</_MauiAOTProfileLocation>
131131
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
132+
<NoWarn>$(NoWarn);NU1605</NoWarn>
133+
<WarningsNotAsErrors>NU1605</WarningsNotAsErrors>
132134
<DebugType>portable</DebugType>
133135
<PublishRepositoryUrl>true</PublishRepositoryUrl>
134136
<EmbedUntrackedSources>true</EmbedUntrackedSources>

eng/Versions.props

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
<SystemNumericsVectorsVersion>4.5.0</SystemNumericsVectorsVersion>
4545
<SystemMemoryPackageVersion>4.5.5</SystemMemoryPackageVersion>
4646
<SystemBuffersPackageVersion>4.5.1</SystemBuffersPackageVersion>
47-
<SystemTextJsonPackageVersion>7.0.2</SystemTextJsonPackageVersion>
47+
<SystemTextJsonPackageVersion>8.0.5</SystemTextJsonPackageVersion>
4848
<SystemTextEncodingsWebPackageVersion>7.0.0</SystemTextEncodingsWebPackageVersion>
4949
<MicrosoftBclAsyncInterfacesPackageVersion>7.0.0</MicrosoftBclAsyncInterfacesPackageVersion>
5050
<SystemIOUnmanagedMemoryStreamPackageVersion>4.3.0</SystemIOUnmanagedMemoryStreamPackageVersion>
@@ -64,7 +64,7 @@
6464
- Feed URI in the nuget.config
6565
- Native assets build and sha
6666
-->
67-
<_SkiaSharpVersion>2.88.2</_SkiaSharpVersion>
67+
<_SkiaSharpVersion>2.88.6</_SkiaSharpVersion>
6868
<_HarfBuzzSharpVersion>2.8.2.2</_HarfBuzzSharpVersion>
6969
<_SkiaSharpNativeAssetsVersion>0.0.0-commit.193b587552cb0ed39372a049d7e6c692db98c267.483</_SkiaSharpNativeAssetsVersion>
7070
<MicrosoftTemplateEngineTasksVersion>7.0.100-preview.5.22226.1</MicrosoftTemplateEngineTasksVersion>

eng/Versions.targets

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,13 @@
6464

6565
<VersionMetadata Include="sha.$(GitCommit)"/>
6666

67-
<VersionMetadata Condition="$(CI)"
67+
<VersionMetadata Condition="$(CI) and '$(BUILD_BUILDID)' != ''"
6868
Include="azdo.$(BUILD_BUILDID)"/>
6969
</ItemGroup>
70-
70+
7171
<PropertyGroup>
7272
<VersionMetadataLabel>@(VersionMetadata -> '%(Identity)', '-')</VersionMetadataLabel>
73-
<VersionMetadataPlusLabel Condition="'$(VersionMetadataLabel)' != ''">+$(VersionMetadataLabel)</VersionMetadataPlusLabel>
73+
<VersionMetadataPlusLabel Condition="'$(VersionMetadataLabel)' != ''">0+$(VersionMetadataLabel)</VersionMetadataPlusLabel>
7474
<Version>$(GitBaseVersionMajor).$(GitBaseVersionMinor).$(GitBaseVersionPatch)</Version>
7575
<PackageReferenceVersion>$(GitSemVerMajor).$(GitSemVerMinor).$(GitSemVerPatch)$(GitSemVerDashLabel)</PackageReferenceVersion>
7676
<PackageReferenceVersion Condition="$(CI) and '$(GitSemVerDashLabel)' != ''">$(GitSemVerMajor).$(GitSemVerMinor).$(GitBaseVersionPatch)$(GitSemVerDashLabel).$(BUILDVERSION)</PackageReferenceVersion>
@@ -79,6 +79,11 @@
7979
<VSComponentVersion Condition="$(CI) and '$(GitSemVerDashLabel)' != ''">$(GitSemVerMajor).$(GitSemVerMinor).$(GitBaseVersionPatch).$(BUILDVERSION)</VSComponentVersion>
8080
<VSComponentVersion Condition="$(CI) and '$(GitSemVerDashLabel)' == ''">$(GitSemVerMajor).$(GitSemVerMinor).$(GitSemVerPatch).0</VSComponentVersion>
8181
<PackageVersion>$(PackageReferenceVersion)$(VersionMetadataPlusLabel)</PackageVersion>
82+
<!-- Generate stable release package for tags -->
83+
<PackageVersion Condition=" '$(GitTag)' != '' ">$(GitSemVerMajor).$(GitSemVerMinor).$(GitSemVerPatch)</PackageVersion>
84+
<!-- Pre-release version for other cases -->
85+
<PreReleaseVersionSuffix>$([System.IO.File]::ReadAllText($(MSBuildThisFileDirectory)../PreReleaseVersionSuffix.txt))</PreReleaseVersionSuffix>
86+
<PackageVersion Condition="$(CI) and '$(GitTag)' == '' ">$(GitSemVerMajor).$(GitSemVerMinor).$(GitSemVerPatch)$(PreReleaseVersionSuffix)</PackageVersion>
8287
</PropertyGroup>
8388

8489
<PropertyGroup>

install_gtk_workload.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/usr/bin/env bash
2+
3+
set -euxo pipefail
4+
5+
# 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
6+
dotnet nuget add source --name nuget.org "https://api.nuget.org/v3/index.json"
7+
wget https://www.nuget.org/api/v2/package/gtksharp.net.sdk.gtk.manifest-$GtkSharpManifestVersion/$GtkSharpVersion -O gtksharp.net.sdk.gtk.manifest-$GtkSharpManifestVersion.nupkg
8+
DOTNET_DIR=/home/runner/.dotnet
9+
WORKLOAD_MANIFEST_DIR=$DOTNET_DIR/sdk-manifests/$DotnetVersion/gtksharp.net.sdk.gtk
10+
mkdir -p $WORKLOAD_MANIFEST_DIR
11+
unzip -j gtksharp.net.sdk.gtk.manifest-$GtkSharpManifestVersion.nupkg "data/*" -d $WORKLOAD_MANIFEST_DIR/
12+
rm gtksharp.net.sdk.gtk.manifest-$GtkSharpManifestVersion.nupkg
13+
chmod 764 $WORKLOAD_MANIFEST_DIR/*
14+
dotnet workload search
15+
dotnet workload install gtk --skip-manifest-update

nugetPreRelease.fsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#r "nuget: Fsdk, Version=0.6.0--date20231213-0703.git-d7a5962"
2+
3+
let args = fsi.CommandLineArgs
4+
5+
Fsdk.Network.GetNugetPrereleaseVersionFromBaseVersion args.[1]
6+
|> System.Console.WriteLine

pack_mali.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/env bash
2+
3+
# Use PROJECTS_TO_PACK env. var for newline-separated list of projects.
4+
5+
set -euxo pipefail
6+
7+
8+
echo "$PROJECTS_TO_PACK" | while read -r project; do
9+
[ -z "$project" ] && continue # Skip if empty
10+
dotnet pack "$project" --no-build --no-restore
11+
done

src/BlazorWebView/src/Maui/Microsoft.AspNetCore.Components.WebView.Maui.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
<PropertyGroup>
44
<TargetFrameworks>$(_MauiDotNetTfm);$(MauiPlatforms)</TargetFrameworks>
5+
<PackageId>Mali.AspNetCore.Components.WebView</PackageId>
56
<Nullable>enable</Nullable>
67
<Description>Build .NET MAUI applications with Blazor web UI in the BlazorWebView control.</Description>
78
<DefineConstants>$(DefineConstants);WEBVIEW2_MAUI</DefineConstants>

0 commit comments

Comments
 (0)