Skip to content

Commit

Permalink
Feature : Add Net 8.0 (#3671)
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisPulman committed Nov 18, 2023
1 parent c643a4a commit dd1e6b3
Show file tree
Hide file tree
Showing 370 changed files with 20,941 additions and 19,737 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci-build.yml
Expand Up @@ -20,6 +20,6 @@ jobs:
with:
configuration: Release
productNamespacePrefix: "ReactiveUI"
useVisualStudioPreview: true
useVisualStudioPreview: false
useMauiCheckDotNetTool: false
solutionFile: "reactiveui.sln"
21 changes: 11 additions & 10 deletions src/Directory.build.props
Expand Up @@ -17,7 +17,7 @@
<PackageReleaseNotes>https://github.com/reactiveui/ReactiveUI/releases</PackageReleaseNotes>
<RepositoryUrl>https://github.com/reactiveui/reactiveui</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<NoWarn>$(NoWarn);VSSpell001</NoWarn>
<NoWarn>$(NoWarn);SA1010;RCS1198;RCS1158;RCS1163;RCS1256;IDE0060;IDE1006;VSSpell001</NoWarn>

<!-- Publish the repository URL in the built .nupkg (in the NuSpec <Repository> element) -->
<PublishRepositoryUrl>true</PublishRepositoryUrl>
Expand All @@ -32,11 +32,12 @@
<WarningsAsErrors>nullable</WarningsAsErrors>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<IncludePackageReferencesDuringMarkupCompilation>true</IncludePackageReferencesDuringMarkupCompilation>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<XunitVersion>2.6.1</XunitVersion>
</PropertyGroup>
<PropertyGroup Condition="$(IsTestProject) != 'true'">
<!--<PropertyGroup Condition="$(IsTestProject) != 'true'">
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>
</PropertyGroup>-->

<!-- MonoAndroid doesn't seem to want to allow debugging for maintainers -->
<PropertyGroup Condition=" $(TargetFramework.StartsWith('MonoAndroid')) ">
Expand All @@ -48,20 +49,20 @@
</PropertyGroup>

<ItemGroup Condition="$(IsTestProject)">
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.7.2" />
<PackageReference Include="xunit" Version="2.6.1" />
<PackageReference Include="xunit.runner.console" Version="2.6.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="xunit" Version="$(XunitVersion)" />
<PackageReference Include="xunit.runner.console" Version="$(XunitVersion)" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.3" />
<PackageReference Include="Xunit.StaFact" Version="1.1.11" />
<PackageReference Include="FluentAssertions" Version="6.12.0" />
<PackageReference Include="Microsoft.Reactive.Testing" Version="6.0.0" />
<PackageReference Include="PublicApiGenerator" Version="11.0.0" />
<PackageReference Include="coverlet.msbuild" Version="6.0.0" PrivateAssets="All" />
<PackageReference Include="Verify.Xunit" Version="22.1.4" />
<PackageReference Include="Verify.Xunit" Version="22.5.0" />
</ItemGroup>

<ItemGroup Condition="'$(IsTestProject)' != 'true'">
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PrivateAssets="All" />
</ItemGroup>

<PropertyGroup>
Expand All @@ -77,7 +78,7 @@
<ItemGroup>
<PackageReference Include="Nerdbank.GitVersioning" Version="3.6.133" PrivateAssets="all" />
<PackageReference Include="stylecop.analyzers" Version="1.2.0-beta.507" PrivateAssets="all" />
<PackageReference Include="Roslynator.Analyzers" Version="4.6.1" PrivateAssets="All" />
<PackageReference Include="Roslynator.Analyzers" Version="4.6.2" PrivateAssets="All" />
</ItemGroup>
<ItemGroup>
<AdditionalFiles Include="$(MSBuildThisFileDirectory)stylecop.json" Link="stylecop.json" />
Expand Down
15 changes: 15 additions & 0 deletions src/Directory.build.targets
Expand Up @@ -28,6 +28,12 @@
<PropertyGroup Condition="$(TargetFramework.StartsWith('net7.0-maccatalyst'))">
<DefineConstants>$(DefineConstants);MONO;UIKIT;COCOA;IOS</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="$(TargetFramework.StartsWith('net8.0-ios'))">
<DefineConstants>$(DefineConstants);MONO;UIKIT;COCOA;IOS</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="$(TargetFramework.StartsWith('net8.0-maccatalyst'))">
<DefineConstants>$(DefineConstants);MONO;UIKIT;COCOA;IOS</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="$(TargetFramework.StartsWith('Xamarin.Mac'))">
<DefineConstants>$(DefineConstants);MONO;COCOA;MAC</DefineConstants>
</PropertyGroup>
Expand All @@ -37,6 +43,9 @@
<PropertyGroup Condition="$(TargetFramework.StartsWith('net7.0-macos'))">
<DefineConstants>$(DefineConstants);MONO;COCOA;MAC</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="$(TargetFramework.StartsWith('net8.0-macos'))">
<DefineConstants>$(DefineConstants);MONO;COCOA;MAC</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="$(TargetFramework.StartsWith('Xamarin.TVOS'))">
<DefineConstants>$(DefineConstants);MONO;UIKIT;COCOA;TVOS</DefineConstants>
</PropertyGroup>
Expand All @@ -46,6 +55,9 @@
<PropertyGroup Condition="$(TargetFramework.StartsWith('net7.0-tvos'))">
<DefineConstants>$(DefineConstants);MONO;UIKIT;COCOA;TVOS</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="$(TargetFramework.StartsWith('net8.0-tvos'))">
<DefineConstants>$(DefineConstants);MONO;UIKIT;COCOA;TVOS</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="$(TargetFramework.StartsWith('Xamarin.WatchOS'))">
<DefineConstants>$(DefineConstants);MONO;UIKIT;COCOA;WATCHOS</DefineConstants>
</PropertyGroup>
Expand All @@ -59,6 +71,9 @@
<PropertyGroup Condition="$(TargetFramework.StartsWith('net7.0-android'))">
<DefineConstants>$(DefineConstants);MONO;ANDROID</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="$(TargetFramework.StartsWith('net8.0-android'))">
<DefineConstants>$(DefineConstants);MONO;ANDROID</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="$(TargetFramework.StartsWith('tizen'))">
<DefineConstants>$(DefineConstants);TIZEN</DefineConstants>
</PropertyGroup>
Expand Down
6 changes: 1 addition & 5 deletions src/ReactiveUI.AndroidSupport/ControlFetcherMixin.cs
Expand Up @@ -3,10 +3,6 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.

using Android.Views;

using static ReactiveUI.ControlFetcherMixin;

using Fragment = Android.Support.V4.App.Fragment;

namespace ReactiveUI.AndroidSupport;
Expand Down Expand Up @@ -51,4 +47,4 @@ public static void WireUpControls(this Fragment fragment, View inflatedView, Res
}
}
}
}
}
12 changes: 12 additions & 0 deletions src/ReactiveUI.AndroidSupport/GlobalUsings.cs
Expand Up @@ -3,9 +3,20 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.

global using global::Android.App;
global using global::Android.Content;
global using global::Android.Runtime;
global using global::Android.Support.V4.App;
global using global::Android.Support.V4.View;
global using global::Android.Support.V7.App;
global using global::Android.Support.V7.Widget;
global using global::Android.Views;
global using global::DynamicData;
global using global::DynamicData.Binding;
global using global::Splat;
global using global::System;
global using global::System.Collections.Generic;
global using global::System.Collections.Specialized;
global using global::System.ComponentModel;
global using global::System.Diagnostics.CodeAnalysis;
global using global::System.Linq;
Expand All @@ -14,3 +25,4 @@
global using global::System.Reactive.Subjects;
global using global::System.Reactive.Threading.Tasks;
global using global::System.Threading.Tasks;
global using static ReactiveUI.ControlFetcherMixin;
7 changes: 1 addition & 6 deletions src/ReactiveUI.AndroidSupport/ReactiveAppCompatActivity.cs
Expand Up @@ -3,11 +3,6 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.

using Android.App;
using Android.Content;
using Android.Runtime;
using Android.Support.V7.App;

namespace ReactiveUI.AndroidSupport;

/// <summary>
Expand Down Expand Up @@ -65,7 +60,7 @@ protected ReactiveAppCompatActivity()
/// </summary>
/// <param name="handle">The handle.</param>
/// <param name="ownership">The ownership.</param>
protected ReactiveAppCompatActivity(IntPtr handle, JniHandleOwnership ownership)
protected ReactiveAppCompatActivity(in IntPtr handle, JniHandleOwnership ownership)
: base(handle, ownership)
{
}
Expand Down
6 changes: 1 addition & 5 deletions src/ReactiveUI.AndroidSupport/ReactiveFragmentActivity.cs
Expand Up @@ -3,10 +3,6 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.

using Android.App;
using Android.Content;
using Android.Support.V4.App;

namespace ReactiveUI.AndroidSupport;

/// <summary>
Expand Down Expand Up @@ -164,4 +160,4 @@ protected override void Dispose(bool disposing)

base.Dispose(disposing);
}
}
}
34 changes: 0 additions & 34 deletions src/ReactiveUI.AndroidSupport/ReactivePagerAdapter.cs
Expand Up @@ -3,14 +3,6 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.

using System.Collections.Specialized;

using Android.Support.V4.View;
using Android.Views;

using DynamicData;
using DynamicData.Binding;

using Object = Java.Lang.Object;

namespace ReactiveUI.AndroidSupport;
Expand Down Expand Up @@ -109,29 +101,3 @@ protected override void Dispose(bool disposing)
base.Dispose(disposing);
}
}

/// <summary>
/// ReactivePagerAdapter is a PagerAdapter that will interface with a
/// Observable change set, in a similar fashion to ReactiveTableViewSource.
/// </summary>
/// <typeparam name="TViewModel">The view model type.</typeparam>
/// <typeparam name="TCollection">The type of collection.</typeparam>
[SuppressMessage("StyleCop.CSharp.MaintainabilityRules", "SA1402:FileMayOnlyContainASingleType", Justification = "Classes with the same class names within.")]
public class ReactivePagerAdapter<TViewModel, TCollection> : ReactivePagerAdapter<TViewModel>
where TViewModel : class
where TCollection : INotifyCollectionChanged, IEnumerable<TViewModel>
{
/// <summary>
/// Initializes a new instance of the <see cref="ReactivePagerAdapter{TViewModel, TCollection}"/> class.
/// </summary>
/// <param name="collection">The collection to page.</param>
/// <param name="viewCreator">The function which will create the view.</param>
/// <param name="viewInitializer">A action which will initialize the view.</param>
public ReactivePagerAdapter(
TCollection collection,
Func<TViewModel, ViewGroup, View> viewCreator,
Action<TViewModel, View>? viewInitializer = null)
: base(collection.ToObservableChangeSet<TCollection, TViewModel>(), viewCreator, viewInitializer)
{
}
}
@@ -0,0 +1,27 @@
// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.

namespace ReactiveUI.AndroidSupport;

/// <summary>
/// ReactivePagerAdapter is a PagerAdapter that will interface with a
/// Observable change set, in a similar fashion to ReactiveTableViewSource.
/// </summary>
/// <typeparam name="TViewModel">The view model type.</typeparam>
/// <typeparam name="TCollection">The type of collection.</typeparam>
/// <remarks>
/// Initializes a new instance of the <see cref="ReactivePagerAdapter{TViewModel, TCollection}"/> class.
/// </remarks>
/// <param name="collection">The collection to page.</param>
/// <param name="viewCreator">The function which will create the view.</param>
/// <param name="viewInitializer">A action which will initialize the view.</param>
public class ReactivePagerAdapter<TViewModel, TCollection>(
TCollection collection,
Func<TViewModel, ViewGroup, View> viewCreator,
Action<TViewModel, View>? viewInitializer = null) : ReactivePagerAdapter<TViewModel>(collection.ToObservableChangeSet<TCollection, TViewModel>(), viewCreator, viewInitializer)
where TViewModel : class
where TCollection : INotifyCollectionChanged, IEnumerable<TViewModel>
{
}
7 changes: 3 additions & 4 deletions src/ReactiveUI.AndroidSupport/ReactivePreferenceFragment.cs
Expand Up @@ -3,7 +3,6 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.

using Android.Runtime;
using Android.Support.V7.Preferences;

namespace ReactiveUI.AndroidSupport;
Expand Down Expand Up @@ -31,7 +30,7 @@ protected ReactivePreferenceFragment()
/// </summary>
/// <param name="handle">The handle.</param>
/// <param name="ownership">The ownership.</param>
protected ReactivePreferenceFragment(IntPtr handle, JniHandleOwnership ownership)
protected ReactivePreferenceFragment(in IntPtr handle, JniHandleOwnership ownership)
: base(handle, ownership)
{
}
Expand Down Expand Up @@ -72,7 +71,7 @@ protected ReactivePreferenceFragment()
/// </summary>
/// <param name="handle">The handle.</param>
/// <param name="ownership">The ownership.</param>
protected ReactivePreferenceFragment(IntPtr handle, JniHandleOwnership ownership)
protected ReactivePreferenceFragment(in IntPtr handle, JniHandleOwnership ownership)
: base(handle, ownership)
{
}
Expand Down Expand Up @@ -136,4 +135,4 @@ protected override void Dispose(bool disposing)

base.Dispose(disposing);
}
}
}
32 changes: 1 addition & 31 deletions src/ReactiveUI.AndroidSupport/ReactiveRecyclerViewAdapter.cs
Expand Up @@ -3,14 +3,6 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.

using System.Collections.Specialized;

using Android.Support.V7.Widget;
using Android.Views;

using DynamicData;
using DynamicData.Binding;

namespace ReactiveUI.AndroidSupport;

/// <summary>
Expand All @@ -22,7 +14,7 @@ namespace ReactiveUI.AndroidSupport;
public abstract class ReactiveRecyclerViewAdapter<TViewModel> : RecyclerView.Adapter
where TViewModel : class, IReactiveObject
{
private readonly ISourceList<TViewModel> _list;
private readonly SourceList<TViewModel> _list;

private readonly IDisposable _inner;

Expand Down Expand Up @@ -112,25 +104,3 @@ private void UpdateBindings(Change<TViewModel> change)
}
}
}

/// <summary>
/// An adapter for the Android <see cref="RecyclerView"/>.
/// Override the <see cref="RecyclerView.Adapter.CreateViewHolder(ViewGroup, int)"/> method
/// to create the your <see cref="ReactiveRecyclerViewViewHolder{TViewModel}"/> based ViewHolder.
/// </summary>
/// <typeparam name="TViewModel">The type of ViewModel that this adapter holds.</typeparam>
/// <typeparam name="TCollection">The type of collection.</typeparam>
[SuppressMessage("StyleCop.CSharp.MaintainabilityRules", "SA1402:FileMayOnlyContainASingleType", Justification = "Classes with the same class names within.")]
public abstract class ReactiveRecyclerViewAdapter<TViewModel, TCollection> : ReactiveRecyclerViewAdapter<TViewModel>
where TViewModel : class, IReactiveObject
where TCollection : ICollection<TViewModel>, INotifyCollectionChanged
{
/// <summary>
/// Initializes a new instance of the <see cref="ReactiveRecyclerViewAdapter{TViewModel, TCollection}"/> class.
/// </summary>
/// <param name="backingList">The backing list.</param>
protected ReactiveRecyclerViewAdapter(TCollection backingList)
: base(backingList.ToObservableChangeSet<TCollection, TViewModel>())
{
}
}
@@ -0,0 +1,27 @@
// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.

namespace ReactiveUI.AndroidSupport;

/// <summary>
/// An adapter for the Android <see cref="RecyclerView"/>.
/// Override the <see cref="RecyclerView.Adapter.CreateViewHolder(ViewGroup, int)"/> method
/// to create the your <see cref="ReactiveRecyclerViewViewHolder{TViewModel}"/> based ViewHolder.
/// </summary>
/// <typeparam name="TViewModel">The type of ViewModel that this adapter holds.</typeparam>
/// <typeparam name="TCollection">The type of collection.</typeparam>
public abstract class ReactiveRecyclerViewAdapter<TViewModel, TCollection> : ReactiveRecyclerViewAdapter<TViewModel>
where TViewModel : class, IReactiveObject
where TCollection : ICollection<TViewModel>, INotifyCollectionChanged
{
/// <summary>
/// Initializes a new instance of the <see cref="ReactiveRecyclerViewAdapter{TViewModel, TCollection}"/> class.
/// </summary>
/// <param name="backingList">The backing list.</param>
protected ReactiveRecyclerViewAdapter(TCollection backingList)
: base(backingList.ToObservableChangeSet<TCollection, TViewModel>())
{
}
}

0 comments on commit dd1e6b3

Please sign in to comment.