Skip to content

Commit

Permalink
chore: net8 samples (#2830)
Browse files Browse the repository at this point in the history
Co-authored-by: Stefan Jandl <reg@bitfox.at>
  • Loading branch information
vaind and bitsandfoxes authored Nov 15, 2023
1 parent 7f4b8fa commit ea5dddc
Show file tree
Hide file tree
Showing 30 changed files with 126 additions and 108 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,10 @@ jobs:
if: runner.os == 'macOS'
uses: ./.github/actions/buildcocoasdk

# Only switch to newer xcode after building the Cocoa SDK so that it can keep IPHONEOS_DEPLOYMENT_TARGET=11.0
- run: sudo xcode-select -s /Applications/Xcode_15.0.1.app
if: startsWith(matrix.os, 'macos')

- name: Restore .NET Dependencies
run: dotnet restore Sentry-CI-Build-${{ runner.os }}.slnf --nologo

Expand Down
6 changes: 2 additions & 4 deletions .github/workflows/device-tests-android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,9 @@ jobs:
name: device-test-android
path: bin

- name: Setup Environment
uses: ./.github/actions/environment

- name: Install XHarness
run: dotnet tool install Microsoft.DotNet.XHarness.CLI --global --version "1.*-*"
run: dotnet tool install Microsoft.DotNet.XHarness.CLI --global --version "1.*-*" --add-source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json
working-directory: ${{ runner.temp }} # Run outside of the project dir so global.json doesn't have an effect.

- name: Setup Gradle
uses: gradle/gradle-build-action@842c587ad8aa4c68eeba24c396e15af4c2e9f30a # pin@v2
Expand Down
6 changes: 2 additions & 4 deletions .github/workflows/device-tests-ios.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,9 @@ jobs:
name: device-test-ios
path: bin/Sentry.Maui.Device.TestApp.app

- name: Setup Environment
uses: ./.github/actions/environment

- name: Install XHarness
run: dotnet tool install Microsoft.DotNet.XHarness.CLI --global --version "1.*-*"
run: dotnet tool install Microsoft.DotNet.XHarness.CLI --global --version "1.*-*" --add-source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json
working-directory: ${{ runner.temp }} # Run outside of the project dir so global.json doesn't have an effect.

- name: Run Tests
id: first-run
Expand Down
3 changes: 2 additions & 1 deletion integration-test/cli.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ $ErrorActionPreference = 'Stop'
. $PSScriptRoot/common.ps1

Describe 'Console apps (<framework>) - normal build' -ForEach @(
@{ framework = "net7.0" }
@{ framework = "net7.0" },
@{ framework = "net8.0" }
) {
BeforeAll {
DotnetNew 'console' 'console-app' $framework
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0-android</TargetFramework>
<TargetFramework>net8.0-android</TargetFramework>
<SupportedOSPlatformVersion>21</SupportedOSPlatformVersion>
<OutputType>Exe</OutputType>
<Nullable>enable</Nullable>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,7 @@
<OutputType>Exe</OutputType>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<TargetFrameworks>net7.0;net8.0</TargetFrameworks>
</PropertyGroup>

<PropertyGroup Condition="!$([MSBuild]::IsOSPlatform('OSX')) or '$(TargetFramework)' == 'net8.0'">
<!-- AOT not supported for osx-arm64 on .NET 7 -->
<TargetFramework>net8.0</TargetFramework>
<PublishAot>true</PublishAot>
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion samples/Sentry.Samples.Ios/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>MinimumOSVersion</key>
<string>10.0</string>
<string>11.0</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>LSRequiresIPhoneOS</key>
Expand Down
4 changes: 2 additions & 2 deletions samples/Sentry.Samples.Ios/Sentry.Samples.Ios.csproj
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net7.0-ios</TargetFramework>
<TargetFramework>net8.0-ios</TargetFramework>
<OutputType>Exe</OutputType>
<Nullable>enable</Nullable>
<ImplicitUsings>true</ImplicitUsings>
<SupportedOSPlatformVersion>10.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion>11.0</SupportedOSPlatformVersion>
<SelfContained>true</SelfContained>
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0-maccatalyst</TargetFramework>
<TargetFramework>net8.0-maccatalyst</TargetFramework>
<OutputType>Exe</OutputType>
<Nullable>enable</Nullable>
<ImplicitUsings>true</ImplicitUsings>
Expand Down
9 changes: 5 additions & 4 deletions samples/Sentry.Samples.Maui/Sentry.Samples.Maui.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
On Mac, we'll also build for iOS and MacCatalyst.
On Windows, we'll also build for Windows 10.
-->
<TargetFrameworks>net7.0-android</TargetFrameworks>
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net7.0-windows10.0.19041.0</TargetFrameworks>
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('OSX'))">$(TargetFrameworks);net7.0-ios;net7.0-maccatalyst</TargetFrameworks>
<TargetFrameworks>net8.0-android</TargetFrameworks>
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net8.0-windows10.0.19041.0</TargetFrameworks>
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('OSX'))">$(TargetFrameworks);net8.0-ios;net8.0-maccatalyst</TargetFrameworks>
<OutputType>Exe</OutputType>
<RootNamespace>Sentry.Samples.Maui</RootNamespace>
<UseMaui>true</UseMaui>
Expand All @@ -28,7 +28,7 @@
<ApplicationDisplayVersion>1.0</ApplicationDisplayVersion>
<ApplicationVersion>1</ApplicationVersion>

<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">10.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">11.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">13.1</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">21.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</SupportedOSPlatformVersion>
Expand Down Expand Up @@ -90,6 +90,7 @@

<ItemGroup>
<ProjectReference Include="..\..\src\Sentry.Maui\Sentry.Maui.csproj" />
<PackageReference Condition="$(TargetFramework.StartsWith('net8'))" Include="Microsoft.Maui.Controls" Version="$(MauiVersion)" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ public class FakeAuthHandler : AuthenticationHandler<AuthenticationSchemeOptions
public FakeAuthHandler(
IOptionsMonitor<AuthenticationSchemeOptions> options,
ILoggerFactory logger,
UrlEncoder encoder,
ISystemClock clock) : base(options, logger, encoder, clock)
UrlEncoder encoder) : base(options, logger, encoder)
{
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
Expand Down
19 changes: 0 additions & 19 deletions scripts/run-android-tests.cmd

This file was deleted.

29 changes: 29 additions & 0 deletions scripts/run-android-tests.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
Set-StrictMode -Version latest
$ErrorActionPreference = "Stop"

Push-Location $PSScriptRoot/..
try
{
if (!(Get-Command xharness -ErrorAction SilentlyContinue))
{
dotnet tool install Microsoft.DotNet.XHarness.CLI --global --version "1.*-*"
}

$tfm = 'net7.0-android'
dotnet build -f $tfm test/Sentry.Maui.Device.TestApp
if ($LASTEXITCODE -ne 0)
{
throw "Failed to build Sentry.Maui.Device.TestApp"
}

$arch = $(uname -m) -eq 'arm64' ? 'arm64' : 'x64'
Remove-Item -Recurse -Force test_output -ErrorAction SilentlyContinue
xharness android test `
--app=test/Sentry.Maui.Device.TestApp/bin/Debug/$tfm/android-$arch/io.sentry.dotnet.maui.device.testapp-Signed.apk `
--package-name=io.sentry.dotnet.maui.device.testapp `
--output-directory=test_output
}
finally
{
Pop-Location
}
21 changes: 0 additions & 21 deletions scripts/run-android-tests.sh

This file was deleted.

29 changes: 29 additions & 0 deletions scripts/run-ios-tests.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
Set-StrictMode -Version latest
$ErrorActionPreference = "Stop"

Push-Location $PSScriptRoot/..
try
{
if (!(Get-Command xharness -ErrorAction SilentlyContinue))
{
dotnet tool install Microsoft.DotNet.XHarness.CLI --global --version "1.*-*"
}

$tfm = 'net7.0-ios'
dotnet build -f $tfm test/Sentry.Maui.Device.TestApp
if ($LASTEXITCODE -ne 0)
{
throw "Failed to build Sentry.Maui.Device.TestApp"
}

$arch = $(uname -m) -eq 'arm64' ? 'arm64' : 'x64'
Remove-Item -Recurse -Force test_output -ErrorAction SilentlyContinue
xharness apple test `
--app=test/Sentry.Maui.Device.TestApp/bin/Debug/$tfm/iossimulator-$arch/Sentry.Maui.Device.TestApp.app `
--target=ios-simulator-64 `
--output-directory=test_output
}
finally
{
Pop-Location
}
22 changes: 0 additions & 22 deletions scripts/run-ios-tests.sh

This file was deleted.

2 changes: 1 addition & 1 deletion src/Sentry.Bindings.Cocoa/Sentry.Bindings.Cocoa.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
</ItemGroup>

<!-- Build the Sentry Cocoa SDK -->
<Target Name="_BuildSentryCocoaSDK" BeforeTargets="DispatchToInnerBuilds;BeforeBuild" Condition="$([MSBuild]::IsOSPlatform('OSX'))"
<Target Name="_BuildSentryCocoaSDK" BeforeTargets="DispatchToInnerBuilds;BeforeBuild" Condition="'$(CI)' != 'true' and $([MSBuild]::IsOSPlatform('OSX'))"
Inputs="..\..\.git\modules\modules\sentry-cocoa\HEAD" Outputs="..\..\modules\sentry-cocoa\Carthage\.built-from-sha">
<MSBuild Projects="$(MSBuildProjectFile)" Targets="_InnerBuildSentryCocoaSDK" Properties="TargetFramework=once" />
</Target>
Expand Down
6 changes: 3 additions & 3 deletions src/Sentry/Sentry.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@

<PropertyGroup Condition="'$(SolutionName)' != 'Sentry.Unity'">
<TargetFrameworks>net8.0;net6.0;netstandard2.1;netstandard2.0;net462</TargetFrameworks>
<TargetFrameworks Condition="'$(NO_ANDROID)' == ''">$(TargetFrameworks);net7.0-android</TargetFrameworks>
<TargetFrameworks Condition="'$(NO_IOS)' == '' And $([MSBuild]::IsOSPlatform('OSX'))">$(TargetFrameworks);net7.0-ios</TargetFrameworks>
<TargetFrameworks Condition="'$(NO_MACCATALYST)' == '' And $([MSBuild]::IsOSPlatform('OSX'))">$(TargetFrameworks);net7.0-maccatalyst</TargetFrameworks>
<TargetFrameworks Condition="'$(NO_ANDROID)' == ''">$(TargetFrameworks);net7.0-android;net8.0-android</TargetFrameworks>
<TargetFrameworks Condition="'$(NO_IOS)' == '' And $([MSBuild]::IsOSPlatform('OSX'))">$(TargetFrameworks);net7.0-ios;net8.0-ios</TargetFrameworks>
<TargetFrameworks Condition="'$(NO_MACCATALYST)' == '' And $([MSBuild]::IsOSPlatform('OSX'))">$(TargetFrameworks);net7.0-maccatalyst;net8.0-maccatalyst</TargetFrameworks>
</PropertyGroup>

<PropertyGroup Condition="'$(SolutionName)' == 'Sentry.Unity'">
Expand Down
2 changes: 1 addition & 1 deletion test/AndroidTestApp/AndroidTestApp.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0-android</TargetFramework>
<TargetFramework>net8.0-android</TargetFramework>
<SupportedOSPlatformVersion>21</SupportedOSPlatformVersion>
<OutputType>Exe</OutputType>
<Nullable>enable</Nullable>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<TargetFrameworks Condition="'$(NO_WINDOWS)' == '' And $([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net7.0-windows10.0.19041.0</TargetFrameworks>
<TargetFrameworks Condition="'$(NO_IOS)' == '' And $([MSBuild]::IsOSPlatform('OSX'))">$(TargetFrameworks);net7.0-ios</TargetFrameworks>
<TargetFrameworks Condition="'$(NO_MACCATALYST)' == '' And $([MSBuild]::IsOSPlatform('OSX'))">$(TargetFrameworks);net7.0-maccatalyst</TargetFrameworks>

<SingleProject>true</SingleProject>
<RootNamespace>Microsoft.Maui.TestUtils.DeviceTests.Runners</RootNamespace>
<AssemblyName>Microsoft.Maui.TestUtils.DeviceTests.Runners</AssemblyName>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

<!-- Build the Android test app in various configurations during the build of this test project. -->
<Target Name="BuildTestAPKs" BeforeTargets="DispatchToInnerBuilds;BeforeBuild" Condition="'$(TargetPlatformIdentifier)' != 'android'">
<MSBuild Projects="$(MSBuildProjectFile)" Targets="_InnerBuildTestAPKs" Properties="TargetFramework=net7.0-android" />
<MSBuild Projects="$(MSBuildProjectFile)" Targets="_InnerBuildTestAPKs" Properties="TargetFramework=net8.0-android" />
</Target>
<Target Name="_InnerBuildTestAPKs">
<MSBuild Projects="..\AndroidTestApp\AndroidTestApp.csproj" Targets="Restore" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
<TargetFrameworks />
<TargetFrameworks Condition="'$(NO_ANDROID)' == ''">$(TargetFrameworks);net7.0-android</TargetFrameworks>
<TargetFrameworks Condition="'$(NO_IOS)' == '' And $([MSBuild]::IsOSPlatform('OSX'))">$(TargetFrameworks);net7.0-ios</TargetFrameworks>
<TargetFrameworks Condition="'$(NO_MACCATALYST)' == '' And $([MSBuild]::IsOSPlatform('OSX'))">$(TargetFrameworks);net7.0-maccatalyst</TargetFrameworks>
<!-- Currently broken on .NET 7, see
- https://github.com/dotnet/maui/issues/18573
- https://developercommunity.visualstudio.com/t/MAUI0000:-SystemMissingMethodException:/10505327?sort=newest&ftype=problem
<TargetFrameworks Condition="'$(NO_MACCATALYST)' == '' And $([MSBuild]::IsOSPlatform('OSX'))">$(TargetFrameworks);net7.0-maccatalyst</TargetFrameworks> -->

<OutputType>Exe</OutputType>
<SingleProject>true</SingleProject>
Expand Down Expand Up @@ -71,6 +74,7 @@
<ProjectReference Include="..\Sentry.Tests\Sentry.Tests.csproj" />
<ProjectReference Include="..\Sentry.Extensions.Logging.Tests\Sentry.Extensions.Logging.Tests.csproj" />
<ProjectReference Include="..\Sentry.Maui.Tests\Sentry.Maui.Tests.csproj" />
<PackageReference Condition="$(TargetFramework.StartsWith('net8'))" Include="Microsoft.Maui.Controls" Version="$(MauiVersion)" />
</ItemGroup>

<!-- https://github.com/dotnet/maui/blob/main/.nuspec/Microsoft.Maui.TestUtils.DeviceTests.Runners.targets -->
Expand Down
19 changes: 19 additions & 0 deletions test/Sentry.Maui.Tests/ApiApprovalTests.Run.DotNet8_0.verified.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
namespace Microsoft.Maui.Hosting
{
public static class SentryMauiAppBuilderExtensions
{
public static Microsoft.Maui.Hosting.MauiAppBuilder UseSentry(this Microsoft.Maui.Hosting.MauiAppBuilder builder) { }
public static Microsoft.Maui.Hosting.MauiAppBuilder UseSentry(this Microsoft.Maui.Hosting.MauiAppBuilder builder, System.Action<Sentry.Maui.SentryMauiOptions>? configureOptions) { }
public static Microsoft.Maui.Hosting.MauiAppBuilder UseSentry(this Microsoft.Maui.Hosting.MauiAppBuilder builder, string dsn) { }
}
}
namespace Sentry.Maui
{
public class SentryMauiOptions : Sentry.Extensions.Logging.SentryLoggingOptions
{
public SentryMauiOptions() { }
public bool IncludeBackgroundingStateInBreadcrumbs { get; set; }
public bool IncludeTextInBreadcrumbs { get; set; }
public bool IncludeTitleInBreadcrumbs { get; set; }
}
}
Loading

0 comments on commit ea5dddc

Please sign in to comment.