Skip to content

Commit

Permalink
add net9.0 support (#26)
Browse files Browse the repository at this point in the history
  • Loading branch information
emgarten authored Dec 1, 2024
1 parent 9eff589 commit 0db94b6
Show file tree
Hide file tree
Showing 10 changed files with 23 additions and 68 deletions.
4 changes: 4 additions & 0 deletions ReleaseNotes.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Release Notes

## 4.3.0
* Add net9.0 support
* Update NuGet.* packages to 6.12.1

## 4.2.0
* Add net8.0 support, remove net7.0 support
* Update NuGet.* packages to 6.9.1
Expand Down
5 changes: 1 addition & 4 deletions build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@ pushd $RepoRoot
# Download tools
Install-CommonBuildTools $RepoRoot

# Run dotnet-format to apply style fixes or fail on CI builds
Invoke-DotnetFormat $RepoRoot

# Clean and write git info
Remove-Artifacts $RepoRoot
Invoke-DotnetMSBuild $RepoRoot ("build\build.proj", "/t:Clean;WriteGitInfo", "/p:Configuration=$Configuration")
Expand All @@ -43,6 +40,6 @@ if (-not $SkipPack)

# Run build.proj
Invoke-DotnetMSBuild $RepoRoot ("build\build.proj", "/t:$buildTargets", "/p:Configuration=$Configuration")

popd
Write-Host "Success!"
2 changes: 1 addition & 1 deletion build/build.proj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project ToolsVersion="15.0" DefaultTargets="Run">
<!-- Import the default build targets and helpers. -->
<Import Project="common\build.shared.proj" />

<!-- Add custom targets and overrides here -->

</Project>
45 changes: 2 additions & 43 deletions build/common/common.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ Function Install-DotnetCLI {

& $installDotnet -Channel 6.0 -i $CLIRoot
& $installDotnet -Channel 8.0 -i $CLIRoot
& $installDotnet -Channel 9.0 -i $CLIRoot

if (-not (Test-Path $DotnetExe)) {
Write-Log "Missing $DotnetExe"
Expand Down Expand Up @@ -72,7 +73,7 @@ Function Install-NuGetExe {
$nugetDir = Split-Path $nugetExe
New-Item -ItemType Directory -Force -Path $nugetDir

Invoke-WebRequest https://dist.nuget.org/win-x86-commandline/v6.9.1/nuget.exe -OutFile $nugetExe
Invoke-WebRequest https://dist.nuget.org/win-x86-commandline/v6.12.1/nuget.exe -OutFile $nugetExe
}
}

Expand Down Expand Up @@ -126,53 +127,11 @@ Function Invoke-DotnetMSBuild {
Invoke-DotnetExe $RepoRoot $buildArgs
}

Function Install-DotnetTools {
param(
[string]$RepoRoot
)

$toolsPath = Join-Path $RepoRoot ".nuget/tools"

if (-not (Test-Path $toolsPath)) {
Write-Host "Installing dotnet tools to $toolsPath"
$args = @("tool","install","--tool-path",$toolsPath,"--ignore-failed-sources","dotnet-format","--version","5.1.250801")

Invoke-DotnetExe $RepoRoot $args
}
}

Function Install-CommonBuildTools {
param(
[string]$RepoRoot
)

Install-DotnetCLI $RepoRoot
Install-NuGetExe $RepoRoot
Install-DotnetTools $RepoRoot
}

Function Invoke-DotnetFormat {
param(
[string]$RepoRoot
)

# Only run in local dev envs
if ($env:CI -ne "True")
{
$formatExe = Join-Path $RepoRoot ".nuget/tools/dotnet-format.exe"

$args = @("--fix-whitespace", "--fix-style", "warn")

$command = "$formatExe $args"
Write-Host "[EXEC] $command" -ForegroundColor Cyan

& $formatExe $args

if (-not $?) {
Write-Warning "dotnet-format failed. Please fix the style errors!"

# Currently dotnet-format fails on CIs but not locally in some scenarios
# exit 1
}
}
}
13 changes: 1 addition & 12 deletions build/common/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ run_standard_tests()
# Download dotnet cli
REPO_ROOT=$(pwd)
DOTNET=$(pwd)/.cli/dotnet
DOTNET_TOOLS=$(pwd)/.nuget/tools
DOTNET_FORMAT=$DOTNET_TOOLS/dotnet-format

if [ ! -f $DOTNET ]; then
echo "Installing dotnet"
Expand All @@ -19,21 +17,12 @@ run_standard_tests()
chmod +x .cli/dotnet-install.sh
.cli/dotnet-install.sh -i .cli --channel 6.0
.cli/dotnet-install.sh -i .cli --channel 8.0
.cli/dotnet-install.sh -i .cli --channel 9.0
fi

# Display info
$DOTNET --info

# install dotnet-format
if [ ! -d $DOTNET_TOOLS ]; then
echo "Installing dotnet tools"
mkdir -p .nuget/tools

$DOTNET tool install --tool-path $DOTNET_TOOLS --ignore-failed-sources dotnet-format --version 5.1.250801
fi

$DOTNET_FORMAT --fix-whitespace --fix-style warn

# clean
rm -r -f $(pwd)/artifacts

Expand Down
6 changes: 3 additions & 3 deletions build/common/common.targets
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<IsDesktop>true</IsDesktop>
</PropertyGroup>
</When>
<When Condition="$(TargetFramework.Contains('netstandard')) OR $(TargetFramework.Contains('netcoreapp')) OR $(TargetFramework.Contains('net5')) OR $(TargetFramework.Contains('net6')) OR $(TargetFramework.Contains('net7')) OR $(TargetFramework.Contains('net8'))">
<When Condition="$(TargetFramework.Contains('netstandard')) OR $(TargetFramework.Contains('netcoreapp')) OR $(TargetFramework.Contains('net5')) OR $(TargetFramework.Contains('net6')) OR $(TargetFramework.Contains('net7')) OR $(TargetFramework.Contains('net8')) OR $(TargetFramework.Contains('net9'))">
<PropertyGroup>
<DefineConstants>$(DefineConstants);IS_CORECLR</DefineConstants>
<IsCore>true</IsCore>
Expand Down Expand Up @@ -69,7 +69,7 @@
<PropertyGroup Condition=" '$(PackProject)' == 'true' ">
<IsPackable>true</IsPackable>
<IncludeSymbols Condition=" '$(IncludeSymbols)' == '' AND '$(DebugType)' != 'embedded' ">true</IncludeSymbols>
<SymbolPackageFormat Condition=" '$(IncludeSymbols)' == '' AND '$(DebugType)' != 'embedded' ">snupkg</SymbolPackageFormat>
<SymbolPackageFormat Condition=" '$(IncludeSymbols)' == '' AND '$(DebugType)' != 'embedded' ">snupkg</SymbolPackageFormat>
<PackageOutputPath>$(NupkgOutputDirectory)</PackageOutputPath>
<NoPackageAnalysis>true</NoPackageAnalysis>
</PropertyGroup>
Expand Down Expand Up @@ -255,7 +255,7 @@
<ToolEntryPoint Condition=" '$(ToolEntryPoint)' == '' ">$(AssemblyName).dll</ToolEntryPoint>
<ToolOutputPath>$(PublishOutputDirectory)$(TargetFramework)\DotnetToolSettings.xml</ToolOutputPath>
</PropertyGroup>

<!-- Run publish -->
<MSBuild Projects="$(MSBuildProjectFullPath)"
Targets="WriteToolSettingsFile"
Expand Down
6 changes: 3 additions & 3 deletions build/config.props
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<Project ToolsVersion="15.0">
<!-- Dependency versions -->
<PropertyGroup>
<NuGetPackageVersion>6.9.1</NuGetPackageVersion>
<NuGetTestHelpersVersion>2.1.26</NuGetTestHelpersVersion>
<NuGetPackageVersion>6.12.1</NuGetPackageVersion>
<NuGetTestHelpersVersion>2.1.38</NuGetTestHelpersVersion>
<CommandLineUtilsVersion>2.0.0</CommandLineUtilsVersion>
<FileSystemGlobbingVersion>2.0.0</FileSystemGlobbingVersion>
</PropertyGroup>

<!-- Config -->
<PropertyGroup>
<RepositoryName>NupkgWrench</RepositoryName>
Expand Down
2 changes: 1 addition & 1 deletion src/NupkgWrench/NupkgWrench.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />

<PropertyGroup>
<TargetFrameworks>net6.0;net8.0</TargetFrameworks>
<TargetFrameworks>net6.0;net8.0;net9.0</TargetFrameworks>
</PropertyGroup>

<PropertyGroup Condition=" '$(PackProjectDotnetTool)' == 'true' ">
Expand Down
2 changes: 1 addition & 1 deletion test/NupkgWrench.Tests/NupkgWrench.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />

<PropertyGroup>
<TargetFrameworks>net6.0;net8.0</TargetFrameworks>
<TargetFrameworks>net6.0;net8.0;net9.0</TargetFrameworks>
</PropertyGroup>

<ItemGroup>
Expand Down
6 changes: 6 additions & 0 deletions test/Test.Common/Test.Common.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@
<PackageReference Include="System.IO.FileSystem" Version="4.3.0" />
</ItemGroup>

<ItemGroup>
<!-- Vuln fixes -->
<PackageReference Include="System.Net.Http" Version="4.3.4" />
<PackageReference Include="System.Text.RegularExpressions" Version="4.3.1" />
</ItemGroup>

<Import Project="$(BuildCommonDirectory)\common.targets" />
<Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" />
</Project>

0 comments on commit 0db94b6

Please sign in to comment.