Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/Directory.build.props
Original file line number Diff line number Diff line change
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);IDE0060;IDE1006;IDE0130;VSSpell001</NoWarn>
<NoWarn>$(NoWarn);IDE0060;IDE1006;IDE0130;VSSpell001;CA1510</NoWarn>
<!-- Publish the repository URL in the built .nupkg (in the NuSpec <Repository> element) -->
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<!-- Embed source files that are not tracked by the source control manager in the PDB -->
Expand All @@ -35,6 +35,8 @@
<WindowsTargetFrameworks>net462;net472;net8.0-windows10.0.17763.0;net9.0-windows10.0.17763.0;net8.0-windows10.0.19041.0;net9.0-windows10.0.19041.0</WindowsTargetFrameworks>
<MobileTargetFrameworks>net8.0-android;net8.0-ios;net8.0-tvos;net8.0-macos;net8.0-maccatalyst;net9.0-android;net9.0-ios;net9.0-tvos;net9.0-macos;net9.0-maccatalyst</MobileTargetFrameworks>
<BaseTargetFrameworks>netstandard2.0;net8.0;net9.0</BaseTargetFrameworks>
<!-- Ensure all test runs use our runsettings to control cross-assembly parallelism -->
<RunSettingsFilePath>$(MSBuildThisFileDirectory)tests.runsettings</RunSettingsFilePath>
</PropertyGroup>
<PropertyGroup Condition="'$(IsTestProject)' != 'true' and ($(TargetFramework.StartsWith('net8.0')) or $(TargetFramework.StartsWith('net9.0')))">
<IsAotCompatible>true</IsAotCompatible>
Expand Down
2 changes: 2 additions & 0 deletions src/ReactiveUI.AOTTests/ComprehensiveAOTTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,8 @@ public void ObservableAsPropertyHelper_StringBased_WorksInAOT()
[Fact]
public void DependencyInjection_BasicUsage_WorksInAOT()
{
Splat.Builder.AppBuilder.ResetBuilderStateForTests();

// Basic DI operations that work in AOT
var resolver = Locator.CurrentMutable;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
// Copyright (c) 2025 .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.

using System.Reactive.Concurrency;

namespace ReactiveUI.Builder;

/// <summary>
/// AndroidX-specific extensions for the ReactiveUI builder.
/// </summary>
public static class AndroidXReactiveUIBuilderExtensions
{
/// <summary>
/// Gets the android x main thread scheduler.
/// </summary>
/// <value>
/// The android x main thread scheduler.
/// </value>
public static IScheduler AndroidXMainThreadScheduler { get; } = HandlerScheduler.MainThreadScheduler;

/// <summary>
/// Configures ReactiveUI for AndroidX platform with appropriate schedulers.
/// </summary>
/// <param name="builder">The builder instance.</param>
/// <returns>The builder instance for chaining.</returns>
public static ReactiveUIBuilder WithAndroidX(this ReactiveUIBuilder builder)
{
if (builder is null)
{
throw new ArgumentNullException(nameof(builder));
}

return builder
.WithMainThreadScheduler(HandlerScheduler.MainThreadScheduler)
.WithPlatformModule<AndroidX.Registrations>();
}

/// <summary>
/// Withes the android x scheduler.
/// </summary>
/// <param name="builder">The builder.</param>
/// <returns>The builder instance for chaining.</returns>
public static ReactiveUIBuilder WithAndroidXScheduler(this ReactiveUIBuilder builder)
{
if (builder is null)
{
throw new ArgumentNullException(nameof(builder));
}

return builder.WithMainThreadScheduler(AndroidXMainThreadScheduler);
}
}
57 changes: 0 additions & 57 deletions src/ReactiveUI.AndroidX/ReactiveUIBuilderAndroidXExtensions.cs

This file was deleted.

52 changes: 52 additions & 0 deletions src/ReactiveUI.Blazor/Builder/BlazorReactiveUIBuilderExtensions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
// Copyright (c) 2025 .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.Builder;

/// <summary>
/// Blazor-specific extensions for the ReactiveUI builder.
/// </summary>
public static class BlazorReactiveUIBuilderExtensions
{
/// <summary>
/// Gets the blazor main thread scheduler.
/// </summary>
/// <value>
/// The blazor main thread scheduler.
/// </value>
public static IScheduler BlazorMainThreadScheduler { get; } = CurrentThreadScheduler.Instance;

/// <summary>
/// Configures ReactiveUI for Blazor platform with appropriate schedulers.
/// </summary>
/// <param name="builder">The builder instance.</param>
/// <returns>The builder instance for chaining.</returns>
public static ReactiveUIBuilder WithBlazor(this ReactiveUIBuilder builder)
{
if (builder is null)
{
throw new ArgumentNullException(nameof(builder));
}

return builder
.WithBlazorScheduler()
.WithPlatformModule<Blazor.Registrations>();
}

/// <summary>
/// Withes the blazor scheduler.
/// </summary>
/// <param name="builder">The builder.</param>
/// <returns>The builder instance for chaining.</returns>
public static ReactiveUIBuilder WithBlazorScheduler(this ReactiveUIBuilder builder)
{
if (builder is null)
{
throw new ArgumentNullException(nameof(builder));
}

return builder.WithMainThreadScheduler(BlazorMainThreadScheduler);
}
}
57 changes: 0 additions & 57 deletions src/ReactiveUI.Blazor/ReactiveUIBuilderBlazorExtensions.cs

This file was deleted.

17 changes: 1 addition & 16 deletions src/ReactiveUI.Builder.Maui.Tests/ReactiveUIBuilderMauiTests.cs
Original file line number Diff line number Diff line change
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 ReactiveUI.Maui;
using Splat.Builder;

namespace ReactiveUI.Builder.Maui.Tests;
Expand All @@ -16,21 +15,7 @@ public void WithMaui_Should_Register_Services()
AppBuilder.ResetBuilderStateForTests();
using var locator = new ModernDependencyResolver();

locator.CreateBuilder()
.WithMaui()
.Build();

var typeConverters = locator.GetServices<IBindingTypeConverter>();
Assert.NotNull(typeConverters);
}

[Fact]
public void WithCoreServices_AndMaui_Should_Register_All_Services()
{
AppBuilder.ResetBuilderStateForTests();
using var locator = new ModernDependencyResolver();

locator.CreateBuilder()
locator.CreateReactiveUIBuilder()
.WithMaui()
.Build();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public void WithBlazor_Should_Register_Services()
{
AppBuilder.ResetBuilderStateForTests();
using var locator = new ModernDependencyResolver();
var builder = locator.CreateBuilder();
var builder = locator.CreateReactiveUIBuilder();

builder.WithBlazor().Build();

Expand All @@ -31,9 +31,9 @@ public void WithCoreServices_AndBlazor_Should_Register_All_Services()
{
AppBuilder.ResetBuilderStateForTests();
using var locator = new ModernDependencyResolver();
var builder = locator.CreateBuilder();
var builder = locator.CreateReactiveUIBuilder();

builder.WithCoreServices().WithBlazor().Build();
builder.WithBlazor().Build();

var observableProperty = locator.GetService<ICreatesObservableForProperty>();
Assert.NotNull(observableProperty);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ public void WithDrawing_Should_Register_Services()
{
AppBuilder.ResetBuilderStateForTests();
using var locator = new ModernDependencyResolver();
var builder = locator.CreateBuilder();
var builder = locator.CreateReactiveUIBuilder();

builder.WithDrawing().Build();

// Drawing registers bitmap loader in non-NETSTANDARD contexts; we can still assert no exception and core services with chaining
locator.CreateBuilder().WithCoreServices().WithDrawing().Build();
locator.CreateReactiveUIBuilder().WithDrawing().Build();
var bindingConverters = locator.GetServices<IBindingTypeConverter>();
Assert.NotNull(bindingConverters);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public void WithWinForms_Should_Register_WinForms_Services()
{
AppBuilder.ResetBuilderStateForTests();
using var locator = new ModernDependencyResolver();
var builder = locator.CreateBuilder();
var builder = locator.CreateReactiveUIBuilder();

builder.WithWinForms().Build();

Expand All @@ -31,9 +31,9 @@ public void WithCoreServices_AndWinForms_Should_Register_All_Services()
{
AppBuilder.ResetBuilderStateForTests();
using var locator = new ModernDependencyResolver();
var builder = locator.CreateBuilder();
var builder = locator.CreateReactiveUIBuilder();

builder.WithCoreServices().WithWinForms().Build();
builder.WithWinForms().Build();

var observableProperty = locator.GetService<ICreatesObservableForProperty>();
Assert.NotNull(observableProperty);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public void WithWpf_Should_Register_Wpf_Services()
{
AppBuilder.ResetBuilderStateForTests();
using var locator = new ModernDependencyResolver();
var builder = locator.CreateBuilder();
var builder = locator.CreateReactiveUIBuilder();

builder.WithWpf().Build();

Expand All @@ -31,9 +31,9 @@ public void WithCoreServices_AndWpf_Should_Register_All_Services()
{
AppBuilder.ResetBuilderStateForTests();
using var locator = new ModernDependencyResolver();
var builder = locator.CreateBuilder();
var builder = locator.CreateReactiveUIBuilder();

builder.WithCoreServices().WithWpf().Build();
builder.WithWpf().Build();

var observableProperty = locator.GetService<ICreatesObservableForProperty>();
Assert.NotNull(observableProperty);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public void Build_SetsFlag_AndBlocks_InitializeReactiveUI()
AppBuilder.ResetBuilderStateForTests();
using var locator = new ModernDependencyResolver();

var builder = locator.CreateBuilder();
var builder = locator.CreateReactiveUIBuilder();
builder.WithCoreServices().Build();

locator.InitializeReactiveUI();
Expand Down
Loading
Loading