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

Target .NET 7 #8547

Merged
merged 12 commits into from
Dec 7, 2022
2 changes: 1 addition & 1 deletion .ci/azure-pipelines-abi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ parameters:
default: "ubuntu-latest"
- name: DotNetSdkVersion
type: string
default: 6.0.x
default: 7.0.x

jobs:
- job: CompatibilityCheck
Expand Down
31 changes: 1 addition & 30 deletions .ci/azure-pipelines-main.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
parameters:
LinuxImage: 'ubuntu-latest'
RestoreBuildProjects: 'Jellyfin.Server/Jellyfin.Server.csproj'
DotNetSdkVersion: 6.0.x
DotNetSdkVersion: 7.0.x

jobs:
- job: Build
Expand All @@ -20,35 +20,6 @@ jobs:
submodules: true
persistCredentials: true

- task: DownloadPipelineArtifact@2
displayName: 'Download Web Branch'
condition: in(variables['Build.Reason'], 'IndividualCI', 'BatchedCI', 'BuildCompletion')
inputs:
path: '$(Agent.TempDirectory)'
artifact: 'jellyfin-web-production'
source: 'specific'
project: 'jellyfin'
pipeline: 'Jellyfin Web'
runBranch: variables['Build.SourceBranch']

- task: DownloadPipelineArtifact@2
displayName: 'Download Web Target'
condition: eq(variables['Build.Reason'], 'PullRequest')
inputs:
path: '$(Agent.TempDirectory)'
artifact: 'jellyfin-web-production'
source: 'specific'
project: 'jellyfin'
pipeline: 'Jellyfin Web'
runBranch: variables['System.PullRequest.TargetBranch']

- task: ExtractFiles@1
displayName: 'Extract Web Client'
inputs:
archiveFilePatterns: '$(Agent.TempDirectory)/*.zip'
destinationFolder: '$(Build.SourcesDirectory)/MediaBrowser.WebDashboard'
cleanDestinationFolder: false

- task: UseDotNet@2
displayName: 'Update DotNet'
inputs:
Expand Down
4 changes: 2 additions & 2 deletions .ci/azure-pipelines-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -205,10 +205,10 @@ jobs:

steps:
- task: UseDotNet@2
displayName: 'Use .NET 6.0 sdk'
displayName: 'Use .NET 7.0 sdk'
inputs:
packageType: 'sdk'
version: '6.0.x'
version: '7.0.x'

- task: DotNetCoreCLI@2
displayName: 'Build Stable Nuget packages'
Expand Down
4 changes: 2 additions & 2 deletions .ci/azure-pipelines-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ parameters:
default: "tests/**/*Tests.csproj"
- name: DotNetSdkVersion
type: string
default: 6.0.x
default: 7.0.x

jobs:
- job: Test
Expand Down Expand Up @@ -94,5 +94,5 @@ jobs:
displayName: 'Publish OpenAPI Artifact'
condition: and(succeeded(), eq(variables['Agent.OS'], 'Linux'))
inputs:
targetPath: "tests/Jellyfin.Server.Integration.Tests/bin/Release/net6.0/openapi.json"
targetPath: "tests/Jellyfin.Server.Integration.Tests/bin/Release/net7.0/openapi.json"
artifactName: 'OpenAPI Spec'
4 changes: 2 additions & 2 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # tag=v3
- name: Setup .NET Core
- name: Setup .NET
uses: actions/setup-dotnet@607fce577a46308457984d59e4954e075820f10a # tag=v3
with:
dotnet-version: '6.0.x'
dotnet-version: '7.0.x'

- name: Initialize CodeQL
uses: github/codeql-action/init@b2a92eb56d8cb930006a1c6ed86b0782dd8a4297 # v2
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/openapi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ jobs:
with:
ref: ${{ github.event.pull_request.head.sha }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
- name: Setup .NET Core
- name: Setup .NET
uses: actions/setup-dotnet@607fce577a46308457984d59e4954e075820f10a # tag=v3
with:
dotnet-version: '6.0.x'
dotnet-version: '7.0.x'
- name: Generate openapi.json
run: dotnet test tests/Jellyfin.Server.Integration.Tests/Jellyfin.Server.Integration.Tests.csproj -c Release --filter "Jellyfin.Server.Integration.Tests.OpenApiSpecTests"
- name: Upload openapi.json
Expand All @@ -30,7 +30,7 @@ jobs:
name: openapi-head
retention-days: 14
if-no-files-found: error
path: tests/Jellyfin.Server.Integration.Tests/bin/Release/net6.0/openapi.json
path: tests/Jellyfin.Server.Integration.Tests/bin/Release/net7.0/openapi.json

openapi-base:
name: OpenAPI - BASE
Expand All @@ -42,10 +42,10 @@ jobs:
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # tag=v3
with:
ref: ${{ github.base_ref }}
- name: Setup .NET Core
- name: Setup .NET
uses: actions/setup-dotnet@607fce577a46308457984d59e4954e075820f10a # tag=v3
with:
dotnet-version: '6.0.x'
dotnet-version: '7.0.x'
- name: Generate openapi.json
run: dotnet test tests/Jellyfin.Server.Integration.Tests/Jellyfin.Server.Integration.Tests.csproj -c Release --filter "Jellyfin.Server.Integration.Tests.OpenApiSpecTests"
- name: Upload openapi.json
Expand All @@ -54,7 +54,7 @@ jobs:
name: openapi-base
retention-days: 14
if-no-files-found: error
path: tests/Jellyfin.Server.Integration.Tests/bin/Release/net6.0/openapi.json
path: tests/Jellyfin.Server.Integration.Tests/bin/Release/net7.0/openapi.json

openapi-diff:
permissions:
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,6 @@ BenchmarkDotNet.Artifacts
# Ignore web artifacts from native builds
web/
web-src.*
MediaBrowser.WebDashboard/jellyfin-web
apiclient/generated

# Omnisharp crash logs
Expand Down
10 changes: 5 additions & 5 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
"version": "0.2.0",
"configurations": [
{
"name": ".NET Core Launch (console)",
"name": ".NET Launch (console)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceFolder}/Jellyfin.Server/bin/Debug/net6.0/jellyfin.dll",
"program": "${workspaceFolder}/Jellyfin.Server/bin/Debug/net7.0/jellyfin.dll",
"args": [],
"cwd": "${workspaceFolder}/Jellyfin.Server",
"console": "internalConsole",
Expand All @@ -18,19 +18,19 @@
}
},
{
"name": ".NET Core Launch (nowebclient)",
"name": ".NET Launch (nowebclient)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceFolder}/Jellyfin.Server/bin/Debug/net6.0/jellyfin.dll",
"program": "${workspaceFolder}/Jellyfin.Server/bin/Debug/net7.0/jellyfin.dll",
"args": ["--nowebclient"],
"cwd": "${workspaceFolder}/Jellyfin.Server",
"console": "internalConsole",
"stopAtEntry": false,
"internalConsoleOptions": "openOnSessionStart"
},
{
"name": ".NET Core Attach",
"name": ".NET Attach",
"type": "coreclr",
"request": "attach",
"processId": "${command:pickProcess}"
Expand Down
2 changes: 1 addition & 1 deletion DvdLib/DvdLib.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</ItemGroup>

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net7.0</TargetFramework>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<AnalysisMode>AllDisabledByDefault</AnalysisMode>
Expand Down
28 changes: 11 additions & 17 deletions Emby.Dlna/DlnaManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,11 @@ private bool IsMatch(IHeaderDictionary headers, HttpHeaderInfo header)

if (headers.TryGetValue(header.Name, out StringValues value))
{
if (StringValues.IsNullOrEmpty(value))
{
return false;
}

switch (header.Match)
{
case HeaderMatchType.Equals:
Expand All @@ -208,7 +213,8 @@ private bool IsMatch(IHeaderDictionary headers, HttpHeaderInfo header)
// _logger.LogDebug("IsMatch-Substring value: {0} testValue: {1} isMatch: {2}", value, header.Value, isMatch);
return isMatch;
case HeaderMatchType.Regex:
return Regex.IsMatch(value, header.Value, RegexOptions.IgnoreCase);
// Can't be null, we checked above the switch statement
return Regex.IsMatch(value!, header.Value, RegexOptions.IgnoreCase);
default:
throw new ArgumentException("Unrecognized HeaderMatchType");
}
Expand Down Expand Up @@ -265,10 +271,7 @@ private IEnumerable<DeviceProfile> GetProfiles(string path, DeviceProfileType ty
/// <inheritdoc />
public DeviceProfile? GetProfile(string id)
{
if (string.IsNullOrEmpty(id))
{
throw new ArgumentNullException(nameof(id));
}
ArgumentException.ThrowIfNullOrEmpty(id);

var info = GetProfileInfosInternal().FirstOrDefault(i => string.Equals(i.Info.Id, id, StringComparison.OrdinalIgnoreCase));

Expand Down Expand Up @@ -371,10 +374,7 @@ public void CreateProfile(DeviceProfile profile)
{
profile = ReserializeProfile(profile);

if (string.IsNullOrEmpty(profile.Name))
{
throw new ArgumentException("Profile is missing Name");
}
ArgumentException.ThrowIfNullOrEmpty(profile.Name);

var newFilename = _fileSystem.GetValidFilename(profile.Name) + ".xml";
var path = Path.Combine(UserProfilesPath, newFilename);
Expand All @@ -387,15 +387,9 @@ public void UpdateProfile(string profileId, DeviceProfile profile)
{
profile = ReserializeProfile(profile);

if (string.IsNullOrEmpty(profile.Id))
{
throw new ArgumentException("Profile is missing Id");
}
ArgumentException.ThrowIfNullOrEmpty(profile.Id);

if (string.IsNullOrEmpty(profile.Name))
{
throw new ArgumentException("Profile is missing Name");
}
ArgumentException.ThrowIfNullOrEmpty(profile.Name);

var current = GetProfileInfosInternal().First(i => string.Equals(i.Info.Id, profileId, StringComparison.OrdinalIgnoreCase));
if (current.Info.Type == DeviceProfileType.System)
Expand Down
4 changes: 2 additions & 2 deletions Emby.Dlna/Emby.Dlna.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
</ItemGroup>

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net7.0</TargetFramework>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
</PropertyGroup>
Expand Down Expand Up @@ -80,7 +80,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Http" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Http" Version="7.0.0" />
</ItemGroup>

</Project>
1 change: 1 addition & 0 deletions Emby.Dlna/IDlnaEventManager.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#nullable disable
#pragma warning disable CS1591

namespace Emby.Dlna
Expand Down
5 changes: 1 addition & 4 deletions Emby.Dlna/PlayTo/Device.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1017,10 +1017,7 @@ private async Task<TransportCommands> GetRenderingProtocolAsync(CancellationToke
}

var avService = GetServiceRenderingControl();
if (avService is null)
{
throw new ArgumentException("Device AvService is null");
}
ArgumentNullException.ThrowIfNull(avService);

string url = NormalizeUrl(Properties.BaseUrl, avService.ScpdUrl);

Expand Down
10 changes: 2 additions & 8 deletions Emby.Dlna/PlayTo/PlayToController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -936,10 +936,7 @@ public async Task<MediaSourceInfo> GetMediaSource(CancellationToken cancellation

private static Guid GetItemId(string url)
{
if (string.IsNullOrEmpty(url))
{
throw new ArgumentNullException(nameof(url));
}
ArgumentException.ThrowIfNullOrEmpty(url);

var parts = url.Split('/');

Expand All @@ -962,10 +959,7 @@ private static Guid GetItemId(string url)

public static StreamParams ParseFromUrl(string url, ILibraryManager libraryManager, IMediaSourceManager mediaSourceManager)
{
if (string.IsNullOrEmpty(url))
{
throw new ArgumentNullException(nameof(url));
}
ArgumentException.ThrowIfNullOrEmpty(url);

var request = new StreamParams
{
Expand Down
11 changes: 2 additions & 9 deletions Emby.Dlna/Server/DescriptionXmlBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,8 @@ public class DescriptionXmlBuilder

public DescriptionXmlBuilder(DeviceProfile profile, string serverUdn, string serverAddress, string serverName, string serverId)
{
if (string.IsNullOrEmpty(serverUdn))
{
throw new ArgumentNullException(nameof(serverUdn));
}

if (string.IsNullOrEmpty(serverAddress))
{
throw new ArgumentNullException(nameof(serverAddress));
}
ArgumentException.ThrowIfNullOrEmpty(serverUdn);
ArgumentException.ThrowIfNullOrEmpty(serverAddress);

_profile = profile;
_serverUdn = serverUdn;
Expand Down
1 change: 1 addition & 0 deletions Emby.Dlna/Service/BaseService.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#nullable disable
#pragma warning disable CS1591

using System.Net.Http;
Expand Down
2 changes: 1 addition & 1 deletion Emby.Drawing/Emby.Drawing.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
</PropertyGroup>

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net7.0</TargetFramework>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
</PropertyGroup>
Expand Down
17 changes: 3 additions & 14 deletions Emby.Drawing/ImageProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -503,20 +503,9 @@ private Task<(string Path, DateTime DateModified)> GetSupportedImage(string orig
/// </exception>
public string GetCachePath(string path, string uniqueName, string fileExtension)
{
if (string.IsNullOrEmpty(path))
{
throw new ArgumentNullException(nameof(path));
}

if (string.IsNullOrEmpty(uniqueName))
{
throw new ArgumentNullException(nameof(uniqueName));
}

if (string.IsNullOrEmpty(fileExtension))
{
throw new ArgumentNullException(nameof(fileExtension));
}
ArgumentException.ThrowIfNullOrEmpty(path);
ArgumentException.ThrowIfNullOrEmpty(uniqueName);
ArgumentException.ThrowIfNullOrEmpty(fileExtension);

var filename = uniqueName.GetMD5() + fileExtension;

Expand Down
2 changes: 1 addition & 1 deletion Emby.Naming/Emby.Naming.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
</PropertyGroup>

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net7.0</TargetFramework>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
Expand Down
2 changes: 1 addition & 1 deletion Emby.Notifications/Emby.Notifications.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
</PropertyGroup>

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net7.0</TargetFramework>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
</PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion Emby.Photos/Emby.Photos.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
</ItemGroup>

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net7.0</TargetFramework>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
</PropertyGroup>
Expand Down