Skip to content

Commit

Permalink
Merge pull request #3734 from microsoft/feature/net8
Browse files Browse the repository at this point in the history
feature/net8
  • Loading branch information
baywet authored Nov 16, 2023
2 parents 16685b0 + 8ce3b73 commit dea00b4
Show file tree
Hide file tree
Showing 76 changed files with 264 additions and 259 deletions.
8 changes: 4 additions & 4 deletions .azure-pipelines/ci-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,9 @@ stages:
version: 6.x

- task: UseDotNet@2
displayName: "Use .NET 7"
displayName: "Use .NET 8"
inputs:
version: 7.x
version: 8.x

- task: PoliCheck@2
displayName: 'Run PoliCheck "/src"'
Expand Down Expand Up @@ -328,9 +328,9 @@ stages:
inputs:
version: 6.x
- task: UseDotNet@2
displayName: "Use .NET 7"
displayName: "Use .NET 8"
inputs:
version: 7.x
version: 8.x

- task: DownloadPipelineArtifact@2
inputs:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ jobs:
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 7.0.x
dotnet-version: 8.x

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 7.0.x
dotnet-version: 8.x
- name: Restore dependencies
run: dotnet restore kiota.sln
- name: Check formatting
Expand Down Expand Up @@ -64,7 +64,7 @@ jobs:
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 7.0.x
dotnet-version: 8.x
- name: Restore dependencies
run: dotnet restore kiota.sln
- name: Publish ${{ matrix.os }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/idempotency-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 7.0.x
dotnet-version: 8.x
- name: Restore dependencies
run: dotnet restore kiota.sln
- name: Build
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 7.0.x
dotnet-version: 8.x
- name: Restore dependencies
run: dotnet restore kiota.sln
- name: Build
Expand Down Expand Up @@ -94,7 +94,7 @@ jobs:
if: matrix.language == 'csharp'
uses: actions/setup-dotnet@v3
with:
dotnet-version: 7.0.x
dotnet-version: 8.x
- name: Setup Go
if: matrix.language == 'go'
uses: actions/setup-go@v4
Expand Down
10 changes: 4 additions & 6 deletions .github/workflows/sonarcloud.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,12 @@ jobs:
with:
distribution: "adopt"
java-version: 17
- name: Setup .NET 5 # At the moment the scanner requires dotnet 5 https://www.nuget.org/packages/dotnet-sonarscanner
uses: actions/setup-dotnet@v3
with:
dotnet-version: 5.0.x
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 7.0.x
with: # At the moment the scanner requires dotnet 5 https://www.nuget.org/packages/dotnet-sonarscanner
dotnet-version: |
5.x
8.x
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
Expand Down
34 changes: 17 additions & 17 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceFolder}/src/kiota/bin/Debug/net7.0/kiota.dll",
"program": "${workspaceFolder}/src/kiota/bin/Debug/net8.0/kiota.dll",
"args": [
"generate",
"--openapi",
Expand All @@ -27,7 +27,7 @@
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceFolder}/src/kiota/bin/Debug/net7.0/kiota.dll",
"program": "${workspaceFolder}/src/kiota/bin/Debug/net8.0/kiota.dll",
"args": [
"generate",
"--openapi",
Expand All @@ -48,7 +48,7 @@
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceFolder}/src/kiota/bin/Debug/net7.0/kiota.dll",
"program": "${workspaceFolder}/src/kiota/bin/Debug/net8.0/kiota.dll",
"args": [
"generate",
"--openapi",
Expand All @@ -69,7 +69,7 @@
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceFolder}/src/kiota/bin/Debug/net7.0/kiota.dll",
"program": "${workspaceFolder}/src/kiota/bin/Debug/net8.0/kiota.dll",
"args": [
"generate",
"--openapi",
Expand All @@ -90,7 +90,7 @@
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceFolder}/src/kiota/bin/Debug/net7.0/kiota.dll",
"program": "${workspaceFolder}/src/kiota/bin/Debug/net8.0/kiota.dll",
"args": [
"generate",
"--openapi",
Expand All @@ -111,7 +111,7 @@
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceFolder}/src/kiota/bin/Debug/net7.0/kiota.dll",
"program": "${workspaceFolder}/src/kiota/bin/Debug/net8.0/kiota.dll",
"args": [
"generate",
"--openapi",
Expand All @@ -132,7 +132,7 @@
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceFolder}/src/kiota/bin/Debug/net7.0/kiota.dll",
"program": "${workspaceFolder}/src/kiota/bin/Debug/net8.0/kiota.dll",
"args": [
"generate",
"--openapi",
Expand All @@ -154,7 +154,7 @@
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceFolder}/src/kiota/bin/Debug/net7.0/kiota.dll",
"program": "${workspaceFolder}/src/kiota/bin/Debug/net8.0/kiota.dll",
"args": [
"generate",
"--openapi",
Expand All @@ -175,7 +175,7 @@
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceFolder}/src/kiota/bin/Debug/net7.0/kiota.dll",
"program": "${workspaceFolder}/src/kiota/bin/Debug/net8.0/kiota.dll",
"args": [
"generate",
"--openapi",
Expand All @@ -195,7 +195,7 @@
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceFolder}/src/kiota/bin/Debug/net7.0/kiota.dll",
"program": "${workspaceFolder}/src/kiota/bin/Debug/net8.0/kiota.dll",
"args": ["search", "microsoft"],
"cwd": "${workspaceFolder}/src/kiota",
"console": "internalConsole",
Expand All @@ -206,7 +206,7 @@
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceFolder}/src/kiota/bin/Debug/net7.0/kiota.dll",
"program": "${workspaceFolder}/src/kiota/bin/Debug/net8.0/kiota.dll",
"args": ["search", "test"],
"cwd": "${workspaceFolder}/src/kiota",
"console": "internalConsole",
Expand All @@ -217,7 +217,7 @@
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceFolder}/src/kiota/bin/Debug/net7.0/kiota.dll",
"program": "${workspaceFolder}/src/kiota/bin/Debug/net8.0/kiota.dll",
"args": [
"show",
"-d",
Expand All @@ -232,12 +232,12 @@
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceFolder}/src/kiota/bin/Debug/net7.0/kiota.dll",
"program": "${workspaceFolder}/src/kiota/bin/Debug/net8.0/kiota.dll",
"args": [
"download",
"msgraph::microsoft-graph",
"-o",
"${workspaceFolder}/src/kiota/bin/Debug/net7.0/graphv1.yml"
"${workspaceFolder}/src/kiota/bin/Debug/net8.0/graphv1.yml"
],
"cwd": "${workspaceFolder}/src/kiota",
"console": "internalConsole",
Expand All @@ -248,7 +248,7 @@
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceFolder}/src/kiota/bin/Debug/net7.0/kiota.dll",
"program": "${workspaceFolder}/src/kiota/bin/Debug/net8.0/kiota.dll",
"args": ["info", "-l", "CSharp"],
"cwd": "${workspaceFolder}/src/kiota",
"console": "internalConsole",
Expand All @@ -259,7 +259,7 @@
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceFolder}/src/kiota/bin/Debug/net7.0/kiota.dll",
"program": "${workspaceFolder}/src/kiota/bin/Debug/net8.0/kiota.dll",
"args": ["update", "-o", "${workspaceFolder}/samples"],
"cwd": "${workspaceFolder}/src/kiota",
"console": "internalConsole",
Expand All @@ -270,7 +270,7 @@
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceFolder}/src/kiota/bin/Debug/net7.0/kiota.dll",
"program": "${workspaceFolder}/src/kiota/bin/Debug/net8.0/kiota.dll",
"args": ["login", "github", "device"],
"cwd": "${workspaceFolder}/src/kiota",
"console": "internalConsole",
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Changed

- Moved from net7 to net8.
- Fixes bug where import statements for additionalDataHolder and enumSet are missing when BackingStore is enabled in java. [#3643](https://github.com/microsoft/kiota/pull/3643)
- Fixes bug where getBackingStore method body was malformed for java. [#3643](https://github.com/microsoft/kiota/pull/3643)
- Fixes bug where serialize method will not write additional data when backingStore is enabled for java. [#3643](https://github.com/microsoft/kiota/pull/3643)
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Thanks for your interest in contributing to Kiota! We welcome contributions from

To get started, you'll need to have the following tools installed:

- [.NET SDK 7.0](https://get.dot.net/7)
- [.NET SDK 8.0](https://get.dot.net/8)

## Recommended tools

Expand Down
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:7.0 AS build-env
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:8.0 AS build-env
ARG version_suffix
WORKDIR /app

Expand All @@ -10,10 +10,10 @@ RUN if [ -z "$version_suffix" ]; then \
dotnet publish ./src/kiota/kiota.csproj -c Release -p:TreatWarningsAsErrors=false --version-suffix $version_suffix; \
fi

FROM mcr.microsoft.com/dotnet/runtime:7.0 AS runtime
FROM mcr.microsoft.com/dotnet/runtime:8.0 AS runtime
WORKDIR /app

COPY --from=build-env /app/kiota/src/kiota/bin/Release/net7.0 ./
COPY --from=build-env /app/kiota/src/kiota/bin/Release/net8.0 ./

VOLUME /app/output
VOLUME /app/openapi.yml
Expand Down
2 changes: 1 addition & 1 deletion it/compare-generation.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ if ($IsWindows) {
switch ($dev) {
$true {
Write-Warning "Using kiota in dev mode"
$kiotaExec = Join-Path -Path $rootPath -ChildPath "src" -AdditionalChildPath "kiota", "bin", "Debug", "net7.0", $executableName
$kiotaExec = Join-Path -Path $rootPath -ChildPath "src" -AdditionalChildPath "kiota", "bin", "Debug", "net8.0", $executableName
break
}
default {
Expand Down
2 changes: 1 addition & 1 deletion it/csharp/basic/basic.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>

Expand Down
2 changes: 1 addition & 1 deletion it/csharp/dotnet.csproj
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>
<RootNamespace>App</RootNamespace>
Expand Down
2 changes: 1 addition & 1 deletion it/generate-code.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ if ($IsWindows) {
switch ($dev) {
$true {
Write-Warning "Using kiota in dev mode"
$kiotaExec = Join-Path -Path $rootPath -ChildPath "src" -AdditionalChildPath "kiota", "bin", "Debug", "net7.0", $executableName
$kiotaExec = Join-Path -Path $rootPath -ChildPath "src" -AdditionalChildPath "kiota", "bin", "Debug", "net8.0", $executableName
break
}
default {
Expand Down
11 changes: 5 additions & 6 deletions src/Kiota.Builder/CodeDOM/CodeBlock.cs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ returnedValue is CodeProperty cProp &&
.Any())
{
// allows for methods overload
var methodOverloadNameSuffix = currentMethodParameterNames.Any() ? currentMethodParameterNames.OrderBy(static x => x).Aggregate(static (x, y) => x + y) : "1";
var methodOverloadNameSuffix = currentMethodParameterNames.Count != 0 ? currentMethodParameterNames.OrderBy(static x => x).Aggregate(static (x, y) => x + y) : "1";
if (InnerChildElements.GetOrAdd($"{element.Name}-{methodOverloadNameSuffix}", element) is T result2)
return result2;
}
Expand All @@ -121,7 +121,7 @@ public IEnumerable<T> FindChildrenByName<T>(string childName) where T : ICodeEle
{
ArgumentException.ThrowIfNullOrEmpty(childName);

if (InnerChildElements.Any())
if (!InnerChildElements.IsEmpty)
{
var result = new List<T>();
var immediateResult = this.FindChildByName<T>(childName, false);
Expand All @@ -137,18 +137,17 @@ public IEnumerable<T> FindChildrenByName<T>(string childName) where T : ICodeEle

public IEnumerable<T?> FindChildrenByName<T>(IEnumerable<string> childrenName, bool findInChildElements = true) where T : ICodeElement
{
if (childrenName == null)
throw new ArgumentNullException(nameof(childrenName));
ArgumentNullException.ThrowIfNull(childrenName);

return childrenName.Where(static x => !string.IsNullOrEmpty(x))
.Select(x => this.FindChildByName<T>(x, findInChildElements));
.Select(x => FindChildByName<T>(x, findInChildElements));
}

public T? FindChildByName<T>(string childName, bool findInChildElements = true) where T : ICodeElement
{
ArgumentException.ThrowIfNullOrEmpty(childName);

if (!InnerChildElements.Any())
if (InnerChildElements.IsEmpty)
return default;

if (InnerChildElements.TryGetValue(childName, out var result) && result is T castResult)
Expand Down
10 changes: 5 additions & 5 deletions src/Kiota.Builder/CodeDOM/CodeClass.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public void AddIndexer(params CodeIndexer[] indexers)
{
if (indexers == null || Array.Exists(indexers, static x => x == null))
throw new ArgumentNullException(nameof(indexers));
if (!indexers.Any())
if (indexers.Length == 0)
throw new ArgumentOutOfRangeException(nameof(indexers));

foreach (var value in indexers)
Expand All @@ -74,7 +74,7 @@ public override IEnumerable<CodeProperty> AddProperty(params CodeProperty[] prop
{
if (properties == null || properties.Any(static x => x == null))
throw new ArgumentNullException(nameof(properties));
if (!properties.Any())
if (properties.Length == 0)
throw new ArgumentOutOfRangeException(nameof(properties));

return properties.Select(property =>
Expand Down Expand Up @@ -185,15 +185,15 @@ public IEnumerable<CodeClass> AddInnerClass(params CodeClass[] codeClasses)
{
if (codeClasses == null || codeClasses.Any(static x => x == null))
throw new ArgumentNullException(nameof(codeClasses));
if (!codeClasses.Any())
if (codeClasses.Length == 0)
throw new ArgumentOutOfRangeException(nameof(codeClasses));
return AddRange(codeClasses);
}
public IEnumerable<CodeInterface> AddInnerInterface(params CodeInterface[] codeInterfaces)
{
if (codeInterfaces == null || codeInterfaces.Any(x => x == null))
if (codeInterfaces == null || codeInterfaces.Any(static x => x == null))
throw new ArgumentNullException(nameof(codeInterfaces));
if (!codeInterfaces.Any())
if (codeInterfaces.Length == 0)
throw new ArgumentOutOfRangeException(nameof(codeInterfaces));
return AddRange(codeInterfaces);
}
Expand Down
Loading

0 comments on commit dea00b4

Please sign in to comment.