Skip to content

Commit

Permalink
feat: Upgrade to .NET 6 RC1
Browse files Browse the repository at this point in the history
  • Loading branch information
jeromelaban committed Sep 11, 2021
1 parent 4e56ebe commit d110581
Show file tree
Hide file tree
Showing 22 changed files with 81 additions and 103 deletions.
11 changes: 8 additions & 3 deletions build/ci/templates/dotnet6-install-mac.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
parameters:
DotNetVersion: '6.0.100-preview.6.21355.2'
MauiCheck_Version: '0.6.1'
MauiCheck_Manifest: 'https://raw.githubusercontent.com/Redth/dotnet-maui-check/556b43a8b9df5ea1e65eb6b9b3ea8854a91fceed/manifests/maui-preview.manifest.json'
DotNetVersion: '6.0.100-rc.1.21452.64'
MauiCheck_Version: '0.8.5'
MauiCheck_Manifest: 'https://raw.githubusercontent.com/Redth/dotnet-maui-check/d469cb3804d68ad52a1bfec041b95a8800acf4ab/manifests/maui-preview.manifest.json'
Dotnet_Root: '/usr/local/share/dotnet/'
Dotnet_Tools: '~/.dotnet/tools'

Expand All @@ -26,6 +26,11 @@ steps:
echo "##vso[task.setvariable variable=PATH]$PATH"
displayName: install .NET ${{ parameters.DotNetVersion }}
- pwsh: |
echo "##vso[task.setvariable variable=JAVA_HOME]$(JAVA_HOME_11_X64)"
echo "##vso[task.setvariable variable=JavaSdkDirectory]$(JAVA_HOME_11_X64)"
displayName: Select JDK 11
- bash: |
dotnet tool update --global redth.net.maui.check --version ${{ parameters.MauiCheck_Version }} --add-source https://api.nuget.org/v3/index.json
maui-check --ci --non-interactive --fix --skip androidsdk --skip xcode --skip vswin --skip vsmac --manifest ${{ parameters.MauiCheck_Manifest }}
Expand Down
17 changes: 11 additions & 6 deletions build/ci/templates/dotnet6-install-windows.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
parameters:
DotNetVersion: '6.0.100-preview.6.21355.2'
MauiCheck_Version: '0.6.1'
MauiCheck_Manifest: 'https://raw.githubusercontent.com/Redth/dotnet-maui-check/556b43a8b9df5ea1e65eb6b9b3ea8854a91fceed/manifests/maui-preview.manifest.json'
DotNetVersion: '6.0.100-rc.1.21452.64'
MauiCheck_Version: '0.8.5'
MauiCheck_Manifest: 'https://raw.githubusercontent.com/Redth/dotnet-maui-check/d469cb3804d68ad52a1bfec041b95a8800acf4ab/manifests/maui-preview.manifest.json'

steps:

Expand All @@ -11,12 +11,17 @@ steps:
Invoke-WebRequest -Uri "https://dot.net/v1/dotnet-install.ps1" -OutFile dotnet-install.ps1
& .\dotnet-install.ps1 -Version ${{ parameters.DotNetVersion }} -InstallDir "$env:ProgramFiles\dotnet\" -Verbose
& dotnet --list-sdks
displayName: install .NET $(DotNetVersion)
displayName: Install .NET ${{ parameters.DotNetVersion }}
errorActionPreference: stop
- pwsh: |
echo "##vso[task.setvariable variable=JAVA_HOME]$(JAVA_HOME_11_X64)"
echo "##vso[task.setvariable variable=JavaSdkDirectory]$(JAVA_HOME_11_X64)"
displayName: Select JDK 11
- powershell: |
& dotnet tool update --global redth.net.maui.check --version ${{ parameters.MauiCheck_Version }} --add-source https://api.nuget.org/v3/index.json
& maui-check --ci --non-interactive --fix --skip androidsdk --skip xcode --skip vswin --skip vsmac --manifest ${{ parameters.MauiCheck_Manifest }}
displayName: Install .NET 6 Workloads
& maui-check -v --ci --non-interactive --fix --skip xcode --skip vswin --skip vsmac --manifest ${{ parameters.MauiCheck_Manifest }}
displayName: Install .NET Workloads
errorActionPreference: continue
ignoreLASTEXITCODE: true
62 changes: 1 addition & 61 deletions src/AddIns/Uno.UI.Lottie/LottieVisualSourceBase.Android.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#if !NET6_0 // Revalidate when https://github.com/unoplatform/uno/issues/5873 gets updated
using System;
using System;
using System.Threading;
using Android.Animation;
using Android.Widget;
Expand Down Expand Up @@ -261,62 +260,3 @@ private Size CompositionSize
}
}
}
#else
using System;
using System.Threading;
using Windows.Foundation;
using Windows.UI.Xaml.Controls;
using System.Threading.Tasks;
using Uno.Disposables;

namespace Microsoft.Toolkit.Uwp.UI.Lottie
{
partial class LottieVisualSourceBase
{
public bool UseHardwareAcceleration { get; set; } = true;

async Task InnerUpdate(CancellationToken ct)
{

}

public void Play(double fromProgress, double toProgress, bool looped)
{
throw new NotImplementedException();
}

public void Stop()
{
throw new NotImplementedException();
}

public void Pause()
{
throw new NotImplementedException();
}

public void Resume()
{
throw new NotImplementedException();
}

public void SetProgress(double progress)
{
throw new NotImplementedException();
}

public void Load()
{
throw new NotImplementedException();
}

public void Unload()
{
throw new NotImplementedException();
}

private Size CompositionSize => default;
}
}
#endif

3 changes: 2 additions & 1 deletion src/AddIns/Uno.UI.Lottie/Uno.UI.Lottie.net6.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
<Deterministic>true</Deterministic>
<Nullable>enable</Nullable>
<AssemblyName>Uno.UI.Lottie</AssemblyName>
<RootNamespace>Uno.UI.Lottie</RootNamespace>
</PropertyGroup>

<PropertyGroup Condition="'$(UnoTargetFrameworkOverride)'!=''">
Expand Down Expand Up @@ -43,7 +44,7 @@
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net6.0-android'">
<!--<PackageReference Include="Com.Airbnb.Android.Lottie" Version="3.0.4" PrivateAssets="none" />-->
<PackageReference Include="Com.Airbnb.Android.Lottie" Version="3.0.4" PrivateAssets="none" />
<PackageReference Include="Newtonsoft.Json" Version="9.0.1" />
</ItemGroup>

Expand Down
7 changes: 7 additions & 0 deletions src/AddIns/Uno.UI.MSAL/Uno.UI.MSAL.net6.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<Deterministic>true</Deterministic>
<AssemblyName>Uno.UI.MSAL</AssemblyName>
<RootNamespace>Uno.UI.MSAL</RootNamespace>

<!--
Required for Catalyst nuget restore to revalidate
once transitive dependencies have been updated.
-->
<NoWarn>$(NoWarn);NU1703</NoWarn>
</PropertyGroup>

<PropertyGroup>
Expand Down
7 changes: 4 additions & 3 deletions src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -114,13 +114,14 @@
<JavaSdkDirectory Condition="'$(JavaSdkDirectory)'=='' and '$(JAVA_HOME_8_X64)'!=''">$(JAVA_HOME_8_X64)</JavaSdkDirectory>
</PropertyGroup>

<ItemGroup>
<ItemGroup Condition="'$(TargetFramework)'=='net461' or '$(TargetFramework)'=='net472' or '$(TargetFramework)'==''">
<!--
Include the reference assemblies to ensure that hard links don't use system files (workaround for same disk restriction)
Make sure to include on the versions that are needed to avoid growing the nuget cache unnecessarily.
-->
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies.net472" Version="1.0.0" PrivateAssets="All" />
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies.net461" Version="1.0.0" PrivateAssets="All" />
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies.net48" Version="1.0.2" PrivateAssets="All" />
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies.net472" Version="1.0.2" PrivateAssets="All" />
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies.net461" Version="1.0.2" PrivateAssets="All" />
</ItemGroup>

<PropertyGroup>
Expand Down
5 changes: 3 additions & 2 deletions src/Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
<!-- Keep aligned with MSBuild extras' default ExtrasUwpMetaPackageVersion -->
<PackageReference Update="Uno.SourceGenerationTasks" Version="3.2.0-dev.2" />
<PackageReference Update="Uno.SourceGeneration" Version="3.2.0-dev.2" />
<PackageReference Update="Uno.Core" Version="2.4.0" />
<PackageReference Update="Uno.Core.Build" Version="2.4.0" />
<PackageReference Update="Uno.Core" Version="3.0.0-dev.2" />
<PackageReference Update="Uno.Core.Build" Version="3.0.0-dev.2" />
<PackageReference Update="Uno.Diagnostics.Eventing" Version="1.0.4" />
<PackageReference Update="Uno.Wasm.Bootstrap" Version="2.1.0" />
<PackageReference Update="Uno.Wasm.Bootstrap.DevServer" Version="2.1.0" />
Expand Down Expand Up @@ -54,6 +54,7 @@
<PackageReference Update="Microsoft.Extensions.Logging.Filter" Version="1.1.2" />
<PackageReference Update="Uno.Extensions.Logging.WebAssembly.Console" Version="1.1.0" />
<PackageReference Update="Uno.Extensions.Logging.WebAssembly.OSLog" Version="1.0.0-dev.3" />
<PackageReference Update="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.2" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'MonoAndroid11.0'">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ namespace SamplesApp.Droid
{
[Activity(
MainLauncher = true,
Exported = true,
ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.ScreenSize | ConfigChanges.UiMode,
WindowSoftInputMode = SoftInput.AdjustPan | SoftInput.StateHidden
)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,18 @@

<!-- Debugger workaround https://github.com/dotnet/maui-samples/blob/8aa6b8780b12e97b157514c3bdc54bb4a13001cd/HelloMacCatalyst/HelloMacCatalyst.csproj#L7 -->
<!-- <MtouchExtraArgs Condition="'$(TargetFramework)' == 'net6.0-maccatalyst'">$(MtouchExtraArgs) -setenv:MONO_THREADS_SUSPEND=preemptive</MtouchExtraArgs> -->


<!--
Required for Catalyst nuget restore to revalidate
once transitive dependencies have been updated.
-->
<NoWarn>$(NoWarn);NU1703</NoWarn>

<!--
aab is the default packaging format in net6 API 31.
We need an APK for deployment on simulators.
-->
<AndroidPackageFormat>apk</AndroidPackageFormat>
</PropertyGroup>

<PropertyGroup Condition="'$(UnoTargetFrameworkOverride)'!=''">
Expand Down
3 changes: 3 additions & 0 deletions src/Uno.CrossTargetting.props
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@

<PropertyGroup Condition="'$(TargetFramework)'=='net6.0-maccatalyst'">
<DefineConstants>$(DefineConstants);IOS1_0;XAMARIN;XAMARIN_IOS;XAMARIN_IOS_UNIFIED;UNO_HAS_UIELEMENT_IMPLICIT_PINNING</DefineConstants>

<!-- Remove Warnings about -->
<NoWarn>$(NoWarn);NU1703</NoWarn>
</PropertyGroup>

<PropertyGroup Condition="$(IsXamarinMac)">
Expand Down
1 change: 0 additions & 1 deletion src/Uno.Foundation/Uno.Foundation.net6.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
<ItemGroup>
<PackageReference Include="Uno.SourceGenerationTasks" />
<PackageReference Include="Uno.Core" />
<PackageReference Include="Uno.MonoAnalyzers" />
<PackageReference Include="Uno.Diagnostics.Eventing" />
</ItemGroup>

Expand Down
6 changes: 6 additions & 0 deletions src/Uno.UI.RuntimeTests/Uno.UI.RuntimeTests.net6.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@

<AssemblyName>Uno.UI.RuntimeTests</AssemblyName>
<RootNamespace>Uno.UI.RuntimeTests</RootNamespace>

<!--
Required for Catalyst nuget restore to revalidate
once transitive dependencies have been updated.
-->
<NoWarn>$(NoWarn);NU1703</NoWarn>
</PropertyGroup>

<PropertyGroup Condition="'$(UnoTargetFrameworkOverride)'!=''">
Expand Down
2 changes: 1 addition & 1 deletion src/Uno.UI/BaseActivity.Android.cs
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ public override void AddContentView(View view, ViewGroup.LayoutParams @params)

#region Activity LifeCycle cf. https://developer.android.com/reference/android/app/Activity.html

partial void InnerCreate(Android.OS.Bundle bundle) => SetAsCurrent();
partial void InnerCreate(Android.OS.Bundle savedInstanceState) => SetAsCurrent();

partial void InnerCreateWithPersistedState(Bundle savedInstanceState, PersistableBundle persistentState) => SetAsCurrent();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ Adapted to csharp by Jean-Marie Alfonsi
------------------------------------------------------------------------------
*/

#pragma warning disable CS0618 // RenderScript is obsolete

using Android.Content;
using Android.Graphics;
using Android.Renderscripts;
Expand All @@ -41,9 +43,9 @@ internal class AndroidStockBlur : IBlurImpl
private const bool DEBUG = false;
#endif

private RenderScript _mRenderScript;
private RenderScript _mRenderScript;

private ScriptIntrinsicBlur _mBlurScript;
private ScriptIntrinsicBlur _mBlurScript;

private Allocation _mBlurInput;

Expand Down
4 changes: 4 additions & 0 deletions src/Uno.UI/UI/Xaml/UIElement.Android.cs
Original file line number Diff line number Diff line change
Expand Up @@ -370,15 +370,19 @@ public Java.Lang.Object GetDependencyPropertyValue(string dependencyPropertyName
}
else if (type == typeof(sbyte))
{
#pragma warning disable CS0618 // Byte.Byte(sbyte) is obsolete in API 31
return new Java.Lang.Byte((sbyte)dpValue);
#pragma warning restore CS0618 // Byte.Byte(sbyte) is obsolete in API 31
}
else if (type == typeof(char))
{
return new Java.Lang.Character((char)dpValue);
}
else if (type == typeof(short))
{
#pragma warning disable CS0618 // Short.Short(short) is obsolete in API 31
return new Java.Lang.Short((short)dpValue);
#pragma warning restore CS0618 // Short.Short(short) is obsolete in API 31
}
else if (type == typeof(int))
{
Expand Down
2 changes: 1 addition & 1 deletion src/Uno.UI/UI/Xaml/UIElement.Pointers.iOS.cs
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ partial void OnManipulationModeChanged(ManipulationModes oldMode, ManipulationMo
// As we have to walk the tree and this method may be invoked too early, we don't try to track the state between the old and the new mode
=> PrepareParentTouchesManagers(newMode, CanDrag);

partial void OnCanDragChanged(bool _, bool newValue)
partial void OnCanDragChanged(bool oldValue, bool newValue)
=> PrepareParentTouchesManagers(ManipulationMode, newValue);

private void OnLoadedForPointers()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@

namespace Windows.ApplicationModel.Calls
{
#pragma warning disable CS0618, CS0672 // PhoneStateListener is obsolete
internal class CallStateListener : PhoneStateListener
{
public override void OnCallStateChanged([GeneratedEnum] CallState state, string phoneNumber)
{
PhoneCallManager.RaiseCallStateChanged();
}
}
#pragma warning restore CS0618, CS0672 // PhoneStateListener is obsolete
}
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,22 @@ static PhoneCallManager()
}
_telephonyManager = (TelephonyManager)ContextHelper.Current
.GetSystemService(Context.TelephonyService);
#pragma warning disable CS0618 // TelephonyManager is obsolete in API 31
_telephonyManager.Listen(new CallStateListener(), PhoneStateListenerFlags.CallState);
#pragma warning restore CS0618 // TelephonyManager is obsolete in API 31
}

public static event EventHandler<object> CallStateChanged;

public static bool IsCallActive =>
#pragma warning disable CS0618 // TelephonyManager is obsolete in API 31
_telephonyManager.CallState == CallState.Offhook;
#pragma warning restore CS0618 // TelephonyManager is obsolete in API 31

public static bool IsCallIncoming =>
#pragma warning disable CS0618 // TelephonyManager is obsolete in API 31
_telephonyManager.CallState == CallState.Ringing;
#pragma warning restore CS0618 // TelephonyManager is obsolete in API 31

public static void ShowPhoneCallSettingsUI()
{
Expand Down
2 changes: 2 additions & 0 deletions src/Uno.UWP/Graphics/Display/DisplayInformation.Android.cs
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,9 @@ private void RefreshDisplayMetricsCache()
using var windowManager = CreateWindowManager();
if (windowManager.DefaultDisplay is { } defaultDisplay)
{
#pragma warning disable CS0618 // GetRealMetrics is obsolete in API 31
defaultDisplay.GetRealMetrics(displayMetrics);
#pragma warning restore CS0618 // GetRealMetrics is obsolete in API 31

_cachedDisplayMetrics = new DisplayMetricsCache(displayMetrics);
_cachedRotation = windowManager.DefaultDisplay.Rotation;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,9 @@ private NetworkConnectivityLevel GetNetworkConnectivityLevelImpl()

if (Build.VERSION.SdkInt >= BuildVersionCodes.Lollipop)
{
#pragma warning disable CS0618 // ConnectivityManager.GetAllNetworks() is obsolete in API 31
var networks = manager.GetAllNetworks();
#pragma warning restore CS0618 // ConnectivityManager.GetAllNetworks() is obsolete in API 31

// some devices running 21 and 22 only use the older api.
if (networks.Length == 0 && (int)Build.VERSION.SdkInt < 23)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ public static VibrationDevice GetDefault()
{
throw new InvalidOperationException($"{Permission} needs to be declared in AndroidManifest.xml");
}
#pragma warning disable CS0618 // VibratorServic is obsolete in API 31
var vibrator = Application.Context.GetSystemService(Context.VibratorService) as Vibrator;
#pragma warning restore CS0618 // VibratorServic is obsolete in API 31
if (vibrator != null && vibrator.HasVibrator)
{
_instance = new VibrationDevice(vibrator);
Expand Down
Loading

0 comments on commit d110581

Please sign in to comment.