Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add .net 9 to platform #931

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
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
9 changes: 5 additions & 4 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ on:
branches: [master]
schedule:
- cron: '26 22 * * 0'

env:
caliburn_sln : "src\\caliburn.micro.sln"
jobs:
analyse:
name: Analyse
Expand Down Expand Up @@ -41,7 +42,7 @@ jobs:
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
global-json-file: src/global.json

- name: Setup Java SDK
uses: actions/setup-java@v4
Expand All @@ -65,10 +66,10 @@ jobs:
run: dotnet workload list

- name: Restore nuget packages
run: msbuild src\caliburn.micro.sln -t:restore
run: msbuild ${{env.caliburn_sln}} -t:restore

- name: Build app for release
run: msbuild src\caliburn.micro.sln /t:Build
run: msbuild ${{env.caliburn_sln}} /t:Build

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
Expand Down
19 changes: 7 additions & 12 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ env:
caliburn_features: "samples\\features\\features.sln"
package_feed: "https://nuget.pkg.github.com/caliburn-micro/index.json"
nuget_folder: "\\packages"
nuget_upload: 'packages\*.nupkg'
build_configuration: "Release"

jobs:
Expand All @@ -29,7 +30,7 @@ jobs:
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
global-json-file: src/global.json
- name: Setup Java SDK
uses: actions/setup-java@v4
with:
Expand All @@ -50,22 +51,16 @@ jobs:
run: dotnet workload install maui maui-android maui-ios maui-tizen maui-maccatalyst maui-windows android --source https://api.nuget.org/v3/index.json
- name: list workloads
run: dotnet workload list

- name: Ensure GitHub NuGet Source
run: dotnet nuget add source ${{ env.package_feed }}
-n github
-u ${{ secrets.NUGET_USER }}
-p ${{ secrets.CONSUME_CALIBURN_FEED }}
--store-password-in-clear-text
if: github.event_name != 'pull_request'

- name: Restore nuget packages
run: msbuild ${{env.caliburn_sln}} -t:restore

- name: Build app for release
run: msbuild ${{env.caliburn_sln}} /t:Build /p:Configuration=${{env.build_configuration}}


- name: Run Unit Tests
run: dotnet test ${{env.caliburn_sln}} --configuration ${{env.build_configuration}} -p:CollectCoverage=true -p:CoverletOutputFormat=json --no-build --verbosity normal

- name: Restore nuget packages for tutorial
run: msbuild ${{env.caliburn_tutorial}} -t:restore

Expand All @@ -82,5 +77,5 @@ jobs:
run: msbuild ${{env.caliburn_sln}} /t:package /p:Configuration=${{env.build_configuration}}

- name: publish Nuget Packages to GitHub
run: dotnet nuget push ${{env.nuget_folder}}\**\*.nupkg --source ${{env.package_feed}} --api-key ${{secrets.PUBLISH_NUGET_PACKAGE}} --skip-duplicate
if: github.event_name != 'pull_request'
run: dotnet nuget push ${{env.nuget_upload}} --source ${{env.package_feed}} --api-key ${{secrets.PUBLISH_NUGET_PACKAGE}} --skip-duplicate
if: github.event_name != 'pull_request'
2 changes: 1 addition & 1 deletion azure-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ steps:
displayName: 'Install .NET'
inputs:
packageType: 'sdk'
version: '8.0.x'
version: '9.0.x'


- task: PowerShell@2
Expand Down
6 changes: 3 additions & 3 deletions samples/features/Features.NetFive/Features.DotNet.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net8.0-windows</TargetFramework>
<TargetFramework>net9.0-windows</TargetFramework>
<UseWPF>true</UseWPF>
<AssemblyName>Features.CrossPlatform</AssemblyName>
<RootNamespace>Features.CrossPlatform</RootNamespace>
Expand All @@ -23,10 +23,10 @@

<ItemGroup>
<Reference Include="Caliburn.Micro.Core">
<HintPath>..\..\..\bin\Caliburn.Micro.Platform\release\net8.0-windows\Caliburn.Micro.Core.dll</HintPath>
<HintPath>..\..\..\bin\Caliburn.Micro.Platform\release\net9.0-windows\Caliburn.Micro.Core.dll</HintPath>
</Reference>
<Reference Include="Caliburn.Micro.Platform">
<HintPath>..\..\..\bin\Caliburn.Micro.Platform\release\net8.0-windows\Caliburn.Micro.Platform.dll</HintPath>
<HintPath>..\..\..\bin\Caliburn.Micro.Platform\release\net9.0-windows\Caliburn.Micro.Platform.dll</HintPath>
</Reference>
</ItemGroup>

Expand Down
2 changes: 1 addition & 1 deletion samples/setup/Setup.UWP/Setup.UWP.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@
<Version>4.0.173</Version>
</PackageReference>
<PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform">
<Version>6.2.12</Version>
<Version>6.2.14</Version>
</PackageReference>
</ItemGroup>
<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion samples/setup/Setup.WPF.Core.VB/Bootstrapper.vb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Public Class Bootstrapper
End Sub

Protected Overrides Sub OnStartup(sender As Object, e As StartupEventArgs)
DisplayRootViewFor(Of ShellViewModel)()
DisplayRootViewForAsync(Of ShellViewModel)()
End Sub

Protected Overrides Function GetInstance(service As Type, key As String) As Object
Expand Down
4 changes: 2 additions & 2 deletions samples/setup/Setup.WPF.Core.VB/Setup.WPF.Core.VB.vbproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net8.0-windows</TargetFramework>
<TargetFramework>net9.0-windows</TargetFramework>
<RootNamespace>Setup.WPF.Core.VB</RootNamespace>
<UseWPF>true</UseWPF>
</PropertyGroup>
Expand All @@ -20,7 +20,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Caliburn.Micro" Version="4.0.173" />
<PackageReference Include="Caliburn.Micro" Version="4.0.212" />
</ItemGroup>

<ItemGroup>
Expand Down
5 changes: 1 addition & 4 deletions samples/setup/Setup.WPF.Core/Bootstrapper.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using Caliburn.Micro;
using Setup.WPF.Core.ViewModels;
Expand Down Expand Up @@ -30,7 +27,7 @@ protected override void Configure()

protected override void OnStartup(object sender, StartupEventArgs e)
{
DisplayRootViewFor<ShellViewModel>();
DisplayRootViewForAsync<ShellViewModel>();
}

protected override object GetInstance(Type service, string key)
Expand Down
4 changes: 2 additions & 2 deletions samples/setup/Setup.WPF.Core/Setup.WPF.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net8.0-windows</TargetFramework>
<TargetFramework>net9.0-windows</TargetFramework>
<UseWPF>true</UseWPF>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Caliburn.Micro" Version="4.0.173" />
<PackageReference Include="Caliburn.Micro" Version="4.0.212" />
</ItemGroup>

</Project>
6 changes: 3 additions & 3 deletions src/Caliburn.Micro.Core.Tests/EventAggregatorTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ public void A_valid_subscriber_is_assigned_as_a_handler_its_message_type()
{
var handlerStub = new Mock<IHandle<object>>().Object;
var aggregator = new EventAggregator();

Assert.False(aggregator.HandlerExistsFor(typeof(object)));
var messageType = typeof(object);
Assert.False(aggregator.HandlerExistsFor(messageType));

aggregator.SubscribeOnPublishedThread(handlerStub);

Assert.True(aggregator.HandlerExistsFor(typeof(object)));
Assert.True(aggregator.HandlerExistsFor(messageType));
}
}

Expand Down
7 changes: 6 additions & 1 deletion src/Caliburn.Micro.Core/EventAggregator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,17 @@ namespace Caliburn.Micro
/// <inheritdoc />
public class EventAggregator : IEventAggregator
{
private static readonly ILog Log = LogManager.GetLog(typeof(EventAggregator));

private readonly List<Handler> _handlers = new List<Handler>();

/// <inheritdoc />
public virtual bool HandlerExistsFor(Type messageType)
{
lock (_handlers)
{
Log.Info("Checking if handler exists for {0}.", messageType.FullName);
Log.Info("There are {0} handlers registered.", _handlers.Count);
return _handlers.Any(handler => handler.Handles(messageType) && !handler.IsDead);
}
}
Expand All @@ -38,9 +42,10 @@ public virtual void Subscribe(object subscriber, Func<Func<Task>, Task> marshal)
{
if (_handlers.Any(x => x.Matches(subscriber)))
{
Log.Info("Message Handler exists");
return;
}

Log.Info("Message Handler Adding it");
_handlers.Add(new Handler(subscriber, marshal));
}
}
Expand Down
18 changes: 17 additions & 1 deletion src/Caliburn.Micro.Platform/Caliburn.Micro.Platform.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="MSBuild.Sdk.Extras">

<PropertyGroup>
<TargetFrameworks>net462;uap10.0.19041;net8.0-android;net8.0-ios;net8.0-windows;</TargetFrameworks>
<TargetFrameworks>net462;uap10.0.19041;net8.0-android;net8.0-ios;net9.0-android;net9.0-ios;net8.0-windows;net9.0-windows</TargetFrameworks>
<PackageId>Caliburn.Micro</PackageId>
<Product>Caliburn.Micro</Product>
<RootNamespace>Caliburn.Micro</RootNamespace>
Expand Down Expand Up @@ -50,6 +50,10 @@
<PackageReference Include="Microsoft.Xaml.Behaviors.Wpf" Version="1.1.135" />
<Compile Include="Platforms\net46-netcore\**\*.cs" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net9.0-windows'">
<PackageReference Include="Microsoft.Xaml.Behaviors.Wpf" Version="1.1.135" />
<Compile Include="Platforms\net46-netcore\**\*.cs" />
</ItemGroup>

<ItemGroup Label="Package">
<None Include="Platforms\uap\Caliburn.Micro.Platform.rd.xml" PackagePath="lib\uap10.0.16299\Caliburn.Micro.Platform\Properties\Caliburn.Micro.Platform.rd.xml" Pack="true" />
Expand All @@ -72,6 +76,18 @@
<Compile Include="ViewModelLocator.cs" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net9.0-android'">
<Compile Remove="*.cs" />
<Compile Include="Platforms\android\**\*.cs" />
<Compile Include="ViewModelLocator.cs" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net9.0-ios'">
<Compile Remove="*.cs" />
<Compile Include="Platforms\ios\**\*.cs" />
<Compile Include="ViewModelLocator.cs" />
</ItemGroup>

<ItemGroup>
<PackageReference Update="Microsoft.SourceLink.GitHub" Version="8.0.0" />
<PackageReference Update="Nerdbank.GitVersioning" Version="3.6.146" />
Expand Down
2 changes: 1 addition & 1 deletion src/global.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"sdk": {
"version": "8.0.x",
"version": "9.0.x",
"rollForward": "latestFeature"
},
"msbuild-sdks": {
Expand Down
Loading