Skip to content

Commit

Permalink
Merge pull request #351 from andy840119/upgrade-net-version-to-8
Browse files Browse the repository at this point in the history
Upgrade net version to 8.
  • Loading branch information
andy840119 authored Feb 19, 2024
2 parents 12f05a5 + bf927ad commit 137bbce
Show file tree
Hide file tree
Showing 16 changed files with 77 additions and 98 deletions.
80 changes: 40 additions & 40 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3

# FIXME: Tools won't run in .NET 5.0 unless you install 3.1.x LTS side by side.
# https://itnext.io/how-to-support-multiple-net-sdks-in-github-actions-workflows-b988daa884e
- name: Install .NET 3.1.x LTS
uses: actions/setup-dotnet@v1
- name: Install .NET 8.0.x
uses: actions/setup-dotnet@v3
with:
dotnet-version: "3.1.x"

- name: Install .NET 6.0.x
uses: actions/setup-dotnet@v1
with:
dotnet-version: "6.0.x"
dotnet-version: "8.0.x"

- name: Restore Tools
run: dotnet tool restore
Expand All @@ -31,7 +24,7 @@ jobs:
uses: actions/cache@v3
with:
path: ${{ github.workspace }}/inspectcode
key: inspectcode-${{ hashFiles('.config/dotnet-tools.json', '.github/workflows/ci.yml', 'osu-framework-microphone.sln*', 'osu-framework-microphone*.slnf', '.editorconfig', '.globalconfig', 'CodeAnalysis/*') }}
key: inspectcode-${{ hashFiles('.config/dotnet-tools.json', '.github/workflows/ci.yml', 'osu-framework-microphone.sln*', 'osu-framework-microphone*.slnf', '.editorconfig', '.globalconfig', 'CodeAnalysis/*', '**/*.csproj', '**/*.props') }}

- name: Dotnet code style
run: dotnet build -c Debug -warnaserror osu-framework-microphone.Desktop.slnf -p:EnforceCodeStyleInBuild=true
Expand Down Expand Up @@ -62,23 +55,24 @@ jobs:
OSU_EXECUTION_MODE: ${{matrix.threadingMode}}
OSU_TESTS_LOCAL_HTTPBIN: 1
strategy:
fail-fast: false
matrix:
os:
- { prettyname: Windows, fullname: windows-latest }
- { prettyname: macOS, fullname: macos-latest }
- { prettyname: Linux, fullname: ubuntu-latest }
threadingMode: ['SingleThread', 'MultiThreaded']
fail-fast: false
matrix:
os:
- { prettyname: Windows, fullname: windows-latest, configuration: Debug }
- { prettyname: macOS, fullname: macos-latest, configuration: Debug }
- { prettyname: Linux, fullname: ubuntu-latest, configuration: Debug }
- { prettyname: Linux, fullname: ubuntu-latest, configuration: Release }
threadingMode: ['SingleThread', 'MultiThreaded']
timeout-minutes: 60

steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Install .NET 6.0.x
uses: actions/setup-dotnet@v1
- name: Install .NET 8.0.x
uses: actions/setup-dotnet@v3
with:
dotnet-version: "6.0.x"
dotnet-version: "8.0.x"

- name: Setup Go
uses: actions/setup-go@v3
Expand All @@ -91,57 +85,63 @@ jobs:
shell: bash

- name: Compile
run: dotnet build -c Debug -warnaserror osu-framework-microphone.Desktop.slnf
run: dotnet build -c ${{matrix.os.configuration}} -warnaserror osu-framework-microphone.Desktop.slnf

- name: Test
run: dotnet test $pwd/**/*.Tests/bin/Debug/*/*.Tests.dll --settings $pwd/build/vstestconfig.runsettings --logger "trx;LogFileName=TestResults-${{matrix.os.prettyname}}-${{matrix.threadingMode}}.trx"
run: dotnet test $pwd/**/*.Tests/bin/${{matrix.os.configuration}}/*/*.Tests.dll --no-build --settings $pwd/build/vstestconfig.runsettings --logger "trx;LogFileName=TestResults-${{matrix.os.prettyname}}-${{matrix.threadingMode}}-${{matrix.os.configuration}}.trx"
shell: pwsh

# Attempt to upload results even if test fails.
# https://docs.github.com/en/actions/reference/context-and-expression-syntax-for-github-actions#always
- name: Upload Test Results
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
if: ${{ always() }}
with:
name: osu-framework-microphone-test-results-${{matrix.os.prettyname}}-${{matrix.threadingMode}}
path: ${{github.workspace}}/TestResults/TestResults-${{matrix.os.prettyname}}-${{matrix.threadingMode}}.trx
name: osu-framework-test-results-${{matrix.os.prettyname}}-${{matrix.threadingMode}}-${{matrix.os.configuration}}
path: ${{github.workspace}}/TestResults/TestResults-${{matrix.os.prettyname}}-${{matrix.threadingMode}}-${{matrix.os.configuration}}.trx

build-only-android:
name: Build only (Android)
runs-on: windows-latest
timeout-minutes: 60
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Setup JDK 11
uses: actions/setup-java@v3
with:
distribution: microsoft
java-version: 11

- name: Install .NET 6.0.x
uses: actions/setup-dotnet@v1
- name: Install .NET 8.0.x
uses: actions/setup-dotnet@v3
with:
dotnet-version: "6.0.x"
dotnet-version: "8.0.x"

- name: Restore .NET workloads
run: dotnet workload restore
run: dotnet workload install android

- name: Compile
run: dotnet build -c Debug osu-framework-microphone.Android.slnf

build-only-ios:
# ignore the ios build.
if: false
name: Build only (iOS)
runs-on: macos-latest
timeout-minutes: 60
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Install .NET 6.0.x
uses: actions/setup-dotnet@v1
- name: Install .NET 8.0.x
uses: actions/setup-dotnet@v3
with:
dotnet-version: "6.0.x"
dotnet-version: "8.0.x"

- name: Restore .NET workloads
run: dotnet workload restore
# `dotnet workload restore` is bugged in .NET 7.0.101+ when restoring iOS projects,
# see https://github.com/xamarin/xamarin-macios/issues/16400.
run: dotnet workload install ios

- name: Compile
run: dotnet build -c Debug osu-framework-microphone.iOS.slnf
13 changes: 3 additions & 10 deletions .github/workflows/deploy-pack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,17 +51,10 @@ jobs:
id: artifactsPath
run: echo "::set-output name=NUGET_ARTIFACTS::${{github.workspace}}\artifacts"

# FIXME: 3.1 LTS is required here because iOS builds refuse to build without it.
# https://itnext.io/how-to-support-multiple-net-sdks-in-github-actions-workflows-b988daa884e
- name: Install .NET 3.1.x LTS
uses: actions/setup-dotnet@v1
- name: Install .NET 8.0.x
uses: actions/setup-dotnet@v3
with:
dotnet-version: "3.1.x"

- name: Install .NET 6.0.x
uses: actions/setup-dotnet@v1
with:
dotnet-version: "6.0.x"
dotnet-version: "8.0.x"

- name: Build (Framework)
run: dotnet build -c Release osu.Framework.Microphone /p:Version=${{needs.check-if-tag.outputs.version}} /p:GenerateDocumentationFile=true///
Expand Down
10 changes: 5 additions & 5 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
<!-- Contains required properties for osu!framework projects. -->
<Project>
<PropertyGroup Label="C#">
<LangVersion>10.0</LangVersion>
<LangVersion>12.0</LangVersion>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Nullable>enable</Nullable>
</PropertyGroup>
<PropertyGroup Label="Documentation">
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<NoWarn>$(NoWarn);CS1591</NoWarn>
</PropertyGroup>
<ItemGroup Label="License">
<None Include="$(MSBuildThisFileDirectory)osu-framework-microphone.licenseheader">
<Link>osu-framework-microphone.licenseheader</Link>
Expand Down Expand Up @@ -37,8 +41,4 @@
<PackageProjectUrl>https://github.com/karaoke-dev/osu-framework-microphone</PackageProjectUrl>
<RepositoryUrl>https://github.com/karaoke-dev/osu-framework-microphone</RepositoryUrl>
</PropertyGroup>
<PropertyGroup Label="Sourcelink3">
<EnableSourceLink Condition=" '$(OS)' != 'Windows_NT' AND '$(MSBuildRuntimeType)' != 'Core' ">false</EnableSourceLink>
<EnableSourceControlManagerQueries>$(EnableSourceLink)</EnableSourceControlManagerQueries>
</PropertyGroup>
</Project>
12 changes: 11 additions & 1 deletion osu-framework-microphone.sln
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,17 @@ Global
{431614F4-D662-4CBD-B6C2-3E0D79CA968B}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
{431614F4-D662-4CBD-B6C2-3E0D79CA968B}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
{4D112E30-462B-4264-B44D-53B61ABB185E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4D112E30-462B-4264-B44D-53B61ABB185E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4D112E30-462B-4264-B44D-53B61ABB185E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4D112E30-462B-4264-B44D-53B61ABB185E}.Debug|iPhone.ActiveCfg = Debug|Any CPU
{4D112E30-462B-4264-B44D-53B61ABB185E}.Debug|iPhone.Build.0 = Debug|Any CPU
{4D112E30-462B-4264-B44D-53B61ABB185E}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{4D112E30-462B-4264-B44D-53B61ABB185E}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
{4D112E30-462B-4264-B44D-53B61ABB185E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4D112E30-462B-4264-B44D-53B61ABB185E}.Release|Any CPU.Build.0 = Release|Any CPU
{4D112E30-462B-4264-B44D-53B61ABB185E}.Release|iPhone.ActiveCfg = Release|Any CPU
{4D112E30-462B-4264-B44D-53B61ABB185E}.Release|iPhone.Build.0 = Release|Any CPU
{4D112E30-462B-4264-B44D-53B61ABB185E}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
{4D112E30-462B-4264-B44D-53B61ABB185E}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
1 change: 1 addition & 0 deletions osu-framework-microphone.sln.DotSettings
Original file line number Diff line number Diff line change
Expand Up @@ -824,6 +824,7 @@ See the LICENCE file in the repository root for full licence text.&#xD;
<s:Boolean x:Key="/Default/Environment/AutoImport2/=CSHARP/BlackLists/=System_002ENumerics_002E_002A/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/AutoImport2/=CSHARP/BlackLists/=System_002ESecurity_002ECryptography_002ERSA/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/AutoImport2/=CSHARP/BlackLists/=TagLib_002EMpeg4_002EBox/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EFeature_002EServices_002ECodeCleanup_002EFileHeader_002EFileHeaderSettingsMigrate/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EFeature_002EServices_002EDaemon_002ESettings_002EMigration_002ESwaWarningsModeSettingsMigrate/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpAttributeForSingleLineMethodUpgrade/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpKeepExistingMigration/@EntryIndexedValue">True</s:Boolean>
Expand Down
2 changes: 1 addition & 1 deletion osu.Framework.Microphone.Android.props
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<Project>
<PropertyGroup>
<LangVersion>10.0</LangVersion>
<SupportedOSPlatformVersion>21.0</SupportedOSPlatformVersion>
<RuntimeIdentifiers>android-x86;android-arm;android-arm64</RuntimeIdentifiers>
<AndroidPackageFormat>apk</AndroidPackageFormat>
<AndroidHttpClientHandlerType>Xamarin.Android.Net.AndroidMessageHandler</AndroidHttpClientHandlerType>
<!-- NullabilityInfoContextSupport is disabled by default for Android -->
<NullabilityInfoContextSupport>true</NullabilityInfoContextSupport>
<EmbedAssembliesIntoApk>true</EmbedAssembliesIntoApk>
<NoWarn>$(NoWarn);XA4218</NoWarn>
</PropertyGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup Label="Project">
<TargetFramework>net6.0-android</TargetFramework>
<TargetFramework>net8.0-android</TargetFramework>
<SupportedOSPlatformVersion>21.0</SupportedOSPlatformVersion>
<OutputType>Library</OutputType>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
Expand All @@ -18,6 +18,6 @@
<ProjectReference Include="..\osu.Framework.Microphone\osu.Framework.Microphone.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="ppy.osu.Framework.Android" Version="2023.1030.0" />
<PackageReference Include="ppy.osu.Framework.Android" Version="2024.217.0" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\osu.Framework.Microphone.Android.props" />
<PropertyGroup>
<TargetFramework>net6.0-android</TargetFramework>
<TargetFramework>net8.0-android</TargetFramework>
<OutputType>Exe</OutputType>
<AssemblyName>osu.Framework.Microphone.Tests.Android</AssemblyName>
<RootNamespace>osu.Framework.Tests.Android</RootNamespace>
Expand Down
13 changes: 0 additions & 13 deletions osu.Framework.Microphone.Tests.iOS/AppDelegate.cs

This file was deleted.

8 changes: 3 additions & 5 deletions osu.Framework.Microphone.Tests.iOS/Application.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
// Copyright (c) karaoke.dev <[email protected]>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.

using UIKit;
using osu.Framework.iOS;

namespace osu.Framework.Tests;

public static class Application
{
public static void Main(string[] args)
{
UIApplication.Main(args, null, typeof(AppDelegate));
}
// This is the main entry point of the application.
public static void Main(string[] args) => GameApplication.Main(new VisualTestGame());
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0-ios</TargetFramework>
<TargetFramework>net8.0-ios</TargetFramework>
<SupportedOSPlatformVersion>13.4</SupportedOSPlatformVersion>
<RootNamespace>osu.Framework.Tests</RootNamespace>
<AssemblyName>osu.Framework.Tests</AssemblyName>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup Label="Project">
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<OutputType>WinExe</OutputType>
</PropertyGroup>
<PropertyGroup>
Expand Down
3 changes: 1 addition & 2 deletions osu.Framework.Microphone.iOS.props
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
<Project>
<PropertyGroup>
<CodesignKey>iPhone Developer</CodesignKey>
<LangVersion>10.0</LangVersion>
<NullabilityInfoContextSupport>true</NullabilityInfoContextSupport>
<!-- MT7091 occurs when referencing a .framework bundle that consists of a static library.
It only warns about not copying the library to the app bundle to save space,
so there's nothing to be worried about. -->
<NoWarn>MT7091</NoWarn>
<NoWarn>$(NoWarn);MT7091</NoWarn>
</PropertyGroup>
<PropertyGroup Condition="'$(Platform)' == 'iPhone'">
<RuntimeIdentifier>ios-arm64</RuntimeIdentifier>
Expand Down
15 changes: 3 additions & 12 deletions osu.Framework.Microphone.iOS/Input/IOSMicrophoneHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// See the LICENCE file in the repository root for full licence text.

using AVFoundation;
using Foundation;
using osu.Framework.Input.Handlers.Microphone;
using osu.Framework.Logging;
using osu.Framework.Platform;
Expand Down Expand Up @@ -31,21 +30,13 @@ public override bool Initialize(GameHost host)

if (granted)
{
session.SetCategory(AVAudioSession.CategoryRecord, out NSError error);
var error = session.SetCategory(AVAudioSessionCategory.Record);

if (error == null)
{
session.SetActive(true, out error);

if (error != null)
{
Logger.Log(error.LocalizedDescription, LoggingTarget.Information, LogLevel.Error);
}
else
{
success = base.Initialize(host);
Logger.Log($"Microphone get permission status : {success}", LoggingTarget.Information);
}
success = base.Initialize(host);
Logger.Log($"Microphone get permission status : {success}", LoggingTarget.Information);
}
else
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup Label="Project">
<TargetFramework>net6.0-ios</TargetFramework>
<TargetFramework>net8.0-ios</TargetFramework>
<SupportedOSPlatformVersion>13.4</SupportedOSPlatformVersion>
<OutputType>Library</OutputType>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
Expand All @@ -18,6 +18,6 @@
<ProjectReference Include="..\osu.Framework.Microphone\osu.Framework.Microphone.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="ppy.osu.Framework.iOS" Version="2023.1030.0" />
<PackageReference Include="ppy.osu.Framework.iOS" Version="2024.217.0" />
</ItemGroup>
</Project>
4 changes: 2 additions & 2 deletions osu.Framework.Microphone/osu.Framework.Microphone.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup Label="Project">
<OutputType>Library</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
</PropertyGroup>
<PropertyGroup Label="Nuget">
Expand All @@ -23,6 +23,6 @@
</PropertyGroup>
<ItemGroup Label="Package References">
<PackageReference Include="NWaves" Version="0.9.6" />
<PackageReference Include="ppy.osu.Framework" Version="2023.1201.1" />
<PackageReference Include="ppy.osu.Framework" Version="2024.217.0" />
</ItemGroup>
</Project>

0 comments on commit 137bbce

Please sign in to comment.