Skip to content

Commit

Permalink
Merge pull request #119 from janusw/net8
Browse files Browse the repository at this point in the history
Update to .NET 8
  • Loading branch information
roubachof authored Sep 27, 2024
2 parents 6b62930 + 260dd71 commit bcc07df
Show file tree
Hide file tree
Showing 9 changed files with 73 additions and 32 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: ci/github-actions

on:
push:
branches: [ "**" ]
pull_request:
branches: [ "**" ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

jobs:

winBuild:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Set up JDK 11
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '11'
- name: Restore dependencies
run: dotnet restore MauiSample/MauiSample.sln
- name: Build Maui Lib
run: dotnet build Maui.Tabs/Maui.Tabs.csproj --no-restore -c Release
- name: Upload package
uses: actions/upload-artifact@v4
with:
name: nupkg
path: ./Maui.Tabs/bin/Release/*.nupkg
- name: Build Test
run: dotnet build MauiSample/MauiSample.csproj --no-restore -c Debug
17 changes: 9 additions & 8 deletions Maui.Tabs/Maui.Tabs.csproj
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net6.0;net6.0-android;net6.0-ios;net6.0-maccatalyst</TargetFrameworks>
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net6.0-windows10.0.19041.0</TargetFrameworks>
<TargetFrameworks>net8.0;net8.0-android;net8.0-ios;net8.0-maccatalyst</TargetFrameworks>
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net8.0-windows10.0.19041.0</TargetFrameworks>
<!-- Uncomment to also build the tizen app. You will need to install tizen by following this: https://github.com/Samsung/Tizen.NET -->
<!-- <TargetFrameworks>$(TargetFrameworks);net6.0-tizen</TargetFrameworks> -->
<!-- <TargetFrameworks>$(TargetFrameworks);net8.0-tizen</TargetFrameworks> -->
<RootNamespace>Sharpnado.Tabs</RootNamespace>
<UseMaui>true</UseMaui>
<SingleProject>true</SingleProject>
Expand Down Expand Up @@ -92,11 +92,11 @@
</PropertyGroup>

<ItemGroup>
<None Include="..\Docs\logo_maui.png" Pack="true" PackagePath="\images\" />
<None Include="ReadMe.md" Pack="true" PackagePath="\docs\" />
<None Include="..\Docs\logo_maui.png" Pack="true" PackagePath="\images" />
<None Include="ReadMe.md" Pack="true" PackagePath="\docs" />
</ItemGroup>

<ItemGroup Condition="$(TargetFramework.StartsWith('Xamarin.iOS')) != true AND $(TargetFramework.StartsWith('net6.0-ios')) != true AND $(TargetFramework.StartsWith('net6.0-maccatalyst')) != true ">
<ItemGroup Condition="$(TargetFramework.StartsWith('Xamarin.iOS')) != true AND $(TargetFramework.StartsWith('net8.0-ios')) != true AND $(TargetFramework.StartsWith('net8.0-maccatalyst')) != true ">
<Compile Remove="**\**\*.ios.cs" />
<None Include="**\**\*.ios.cs" Exclude="$(DefaultItemExcludes);$(DefaultExcludesInProjectFolder)" />
<Compile Remove="**\ios\**\*.cs" />
Expand All @@ -108,13 +108,13 @@
<Compile Remove="**\macos\**\*.cs" />
<None Include="**\macos\**\*.cs" Exclude="$(DefaultItemExcludes);$(DefaultExcludesInProjectFolder)" />
</ItemGroup>
<ItemGroup Condition="$(TargetFramework.StartsWith('Xamarin.Mac')) != true AND $(TargetFramework.StartsWith('Xamarin.iOS')) != true AND $(TargetFramework.StartsWith('net6.0-ios')) != true AND $(TargetFramework.StartsWith('net6.0-maccatalyst')) != true">
<ItemGroup Condition="$(TargetFramework.StartsWith('Xamarin.Mac')) != true AND $(TargetFramework.StartsWith('Xamarin.iOS')) != true AND $(TargetFramework.StartsWith('net8.0-ios')) != true AND $(TargetFramework.StartsWith('net8.0-maccatalyst')) != true">
<Compile Remove="**\*.macios.cs" />
<None Include="**\*.macios.cs" Exclude="$(DefaultItemExcludes);$(DefaultExcludesInProjectFolder)" />
<Compile Remove="**\macios\**\*.cs" />
<None Include="**\macios\**\*.cs" Exclude="$(DefaultItemExcludes);$(DefaultExcludesInProjectFolder)" />
</ItemGroup>
<ItemGroup Condition="$(TargetFramework.StartsWith('MonoAndroid')) != true AND $(TargetFramework.StartsWith('net6.0-android')) != true ">
<ItemGroup Condition="$(TargetFramework.StartsWith('MonoAndroid')) != true AND $(TargetFramework.StartsWith('net8.0-android')) != true ">
<Compile Remove="**\**\*.android.cs" />
<None Include="**\**\*.android.cs" Exclude="$(DefaultItemExcludes);$(DefaultExcludesInProjectFolder)" />
<Compile Remove="**\android\**\*.cs" />
Expand All @@ -128,6 +128,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Maui.Controls" Version="$(MauiVersion)" />
<PackageReference Include="Sharpnado.TaskMonitor" Version="1.0.2" />
<PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.164">
<PrivateAssets>all</PrivateAssets>
Expand Down
4 changes: 2 additions & 2 deletions MauiSample/Infrastructure/PlatformService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public static ScreenSize ScreenSize
{
get
{
if (Device.RuntimePlatform == Device.iOS)
if (DeviceInfo.Platform == DevicePlatform.iOS)
{
if (MainSize.Width <= 320)
{
Expand Down Expand Up @@ -100,7 +100,7 @@ public static void ForceGarbageCollector()
// I tested it, and in fact, in the most cases, you DO need all
// those calls for the GC to REALLY reclaim resources (especially
// with Android RecyclerView).
Device.BeginInvokeOnMainThread(async () =>
MainThread.BeginInvokeOnMainThread(async () =>
{
GC.Collect();
GC.WaitForPendingFinalizers();
Expand Down
2 changes: 1 addition & 1 deletion MauiSample/Localization/TranslateExtension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public class TranslateExtension : IMarkupExtension

public TranslateExtension()
{
if (Device.RuntimePlatform == Device.iOS || Device.RuntimePlatform == Device.Android)
if (DeviceInfo.Platform == DevicePlatform.iOS || DeviceInfo.Platform == DevicePlatform.Android)
{
_cultureInfo = CultureInfo.CurrentUICulture;
}
Expand Down
30 changes: 13 additions & 17 deletions MauiSample/MauiSample.csproj
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net6.0-android;net6.0-ios;net6.0-maccatalyst</TargetFrameworks>
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net6.0-windows10.0.19041.0</TargetFrameworks>
<TargetFrameworks>net8.0-android;net8.0-ios;net8.0-maccatalyst</TargetFrameworks>
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net8.0-windows10.0.19041.0</TargetFrameworks>
<!-- Uncomment to also build the tizen app. You will need to install tizen by following this: https://github.com/Samsung/Tizen.NET -->
<!-- <TargetFrameworks>$(TargetFrameworks);net6.0-tizen</TargetFrameworks> -->
<!-- <TargetFrameworks>$(TargetFrameworks);net8.0-tizen</TargetFrameworks> -->
<OutputType>Exe</OutputType>
<RootNamespace>MauiSample</RootNamespace>
<UseMaui>true</UseMaui>
Expand All @@ -31,40 +31,40 @@
<ProvisioningType>automatic</ProvisioningType>
</PropertyGroup>

<PropertyGroup Condition="'$(TargetFramework)'=='net6.0-ios'">
<PropertyGroup Condition="'$(TargetFramework)'=='net8.0-ios'">
<CodesignKey>Apple Development: Created via API (K8Q3S2AN24)</CodesignKey>
<CodesignProvision>VS: WildCard Development</CodesignProvision>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net6.0-android|AnyCPU'">
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net8.0-android|AnyCPU'">
<MtouchLink>None</MtouchLink>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|net6.0-android|AnyCPU'">
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|net8.0-android|AnyCPU'">
<MtouchLink>None</MtouchLink>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net6.0-ios|AnyCPU'">
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net8.0-ios|AnyCPU'">
<MtouchLink>None</MtouchLink>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|net6.0-ios|AnyCPU'">
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|net8.0-ios|AnyCPU'">
<MtouchLink>None</MtouchLink>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net6.0-maccatalyst|AnyCPU'">
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net8.0-maccatalyst|AnyCPU'">
<MtouchLink>None</MtouchLink>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|net6.0-maccatalyst|AnyCPU'">
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|net8.0-maccatalyst|AnyCPU'">
<MtouchLink>None</MtouchLink>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net6.0-windows10.0.19041.0|AnyCPU'">
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net8.0-windows10.0.19041.0|AnyCPU'">
<MtouchLink>None</MtouchLink>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|net6.0-windows10.0.19041.0|AnyCPU'">
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|net8.0-windows10.0.19041.0|AnyCPU'">
<MtouchLink>None</MtouchLink>
</PropertyGroup>

Expand Down Expand Up @@ -117,11 +117,7 @@
</ItemGroup>

<ItemGroup>
<MauiImage Include="Resources\AppIcon\logo.png" />
<MauiImage Include="Resources\Splash\logo.png" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Maui.Controls" Version="$(MauiVersion)" />
<PackageReference Include="Sharpnado.Maui.TaskLoaderView" Version="2.5.1" />
<PackageReference Include="SimpleInjector" Version="5.4.0" />
</ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion MauiSample/Presentation/Views/TabA.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

<Style x:Key="MaterialTabStyle" TargetType="tabs:MaterialUnderlinedTabItem">
<Setter Property="SelectedTabColor" Value="{StaticResource Primary}" />
<Setter Property="SelectedTabTextColor" Value="{StaticResource Secondary}" />
<!--<Setter Property="SelectedTabTextColor" Value="{StaticResource Secondary}" />-->
<Setter Property="IconSize" Value="24" />
<Setter Property="FontFamily" Value="OpenSansRegular" />
<Setter Property="LabelSize" Value="14" />
Expand Down
3 changes: 1 addition & 2 deletions Tabs/Tabs/DelayedView.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using Sharpnado.Tasks;
using Xamarin.Forms;

namespace Sharpnado.Tabs;

Expand All @@ -14,7 +13,7 @@ public override void LoadView()
async () =>
{
View? view = null;

Check warning on line 15 in Tabs/Tabs/DelayedView.cs

View workflow job for this annotation

GitHub Actions / winBuild

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.

Check warning on line 15 in Tabs/Tabs/DelayedView.cs

View workflow job for this annotation

GitHub Actions / winBuild

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.

Check warning on line 15 in Tabs/Tabs/DelayedView.cs

View workflow job for this annotation

GitHub Actions / winBuild

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.
if (Device.RuntimePlatform == Device.Android)
if (DeviceInfo.Platform == DevicePlatform.Android)
{
await Task.Run(
() =>
Expand Down
2 changes: 1 addition & 1 deletion Tabs/Tabs/TabHostView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -709,7 +709,7 @@ private void AddTapCommand(TabItem tabItem)
return;
}

if (Device.RuntimePlatform == Device.UWP)
if (DeviceInfo.Platform == DevicePlatform.WinUI)
{
tabItem.GestureRecognizers.Add(
new TapGestureRecognizer { Command = TabItemTappedCommand, CommandParameter = tabItem });
Expand Down
7 changes: 7 additions & 0 deletions global.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"sdk": {
"version": "8.0.100",
"rollForward": "latestFeature"
}
}

0 comments on commit bcc07df

Please sign in to comment.