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

Fixes Issue #4705 - Wrong version numbers in dlls #4706

Merged
merged 27 commits into from
May 26, 2024
Merged
Show file tree
Hide file tree
Changes from 23 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
c0e3970
Fixes Issue #4705
OsirisTerje May 7, 2024
55737bb
Delete src/src.sln
OsirisTerje May 9, 2024
54a699d
Changed to using conditionals in the directory.build.props and adjust…
OsirisTerje May 10, 2024
67f2016
Merge branch 'fileversionissue' of https://github.com/nunit/nunit int…
OsirisTerje May 10, 2024
361e24d
Adding caketest
OsirisTerje May 13, 2024
9d66172
Update src/NUnitFramework/framework/nunit.framework.csproj
OsirisTerje May 13, 2024
a100204
Update src/NUnitFramework/nunit.framework.legacy/nunit.framework.lega…
OsirisTerje May 13, 2024
8bcdfd9
Update src/NUnitFramework/nunitlite/nunitlite.csproj
OsirisTerje May 13, 2024
013a570
updated files and directory.build.props
OsirisTerje May 13, 2024
d9673d0
commented out Choose, didnt work, in directory.build.props
OsirisTerje May 13, 2024
f2066b4
Merge branch 'fileversionissue' of https://github.com/nunit/nunit int…
OsirisTerje May 13, 2024
0840495
Updated some tests, fixing nullrefs
OsirisTerje May 13, 2024
d9758f2
reverted formatting
OsirisTerje May 13, 2024
6a357c4
fix compiler warnings/errors
OsirisTerje May 13, 2024
1b6232a
updated cake
OsirisTerje May 13, 2024
b644884
Raise Error when compiling for a TargetFramework with no AssemblyConf…
manfred-brands May 14, 2024
8e05bb3
Fixed null suppressions
OsirisTerje May 16, 2024
0aed733
Merge branch 'fileversionissue' of https://github.com/nunit/nunit int…
OsirisTerje May 16, 2024
51ad8bd
Moved cake scripts to its own project and loaded the code into the bu…
OsirisTerje May 16, 2024
35ea372
Fix null
OsirisTerje May 21, 2024
e67372a
Fix more minor stuff
OsirisTerje May 21, 2024
94fd293
Fix SA warnings
OsirisTerje May 21, 2024
dc6ba23
Using same file and assembly version numbers, same as we have done ea…
OsirisTerje May 23, 2024
a604a39
Final review changes
manfred-brands May 25, 2024
3eb3e00
Fetch tags in CI
manfred-brands May 25, 2024
7d5efb0
Updated to cake 4. Get a warnign about other cake tools like minver, …
OsirisTerje May 25, 2024
543d782
Now we can use AsSpan in CakeScript
manfred-brands May 26, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions CakeScripts.Tests/CakeScripts.Tests.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>

<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageReference Include="NUnit" Version="4.1.0" />
<PackageReference Include="NUnit3TestAdapter" version="4.5.0" />
OsirisTerje marked this conversation as resolved.
Show resolved Hide resolved
<PackageReference Include="coverlet.collector" Version="6.0.2">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\CakeScripts\CakeScripts.csproj" />
</ItemGroup>

</Project>
3 changes: 3 additions & 0 deletions CakeScripts.Tests/Usings.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// Copyright (c) Charlie Poole, Rob Prouse and Contributors. MIT License - see LICENSE.txt

global using NUnit.Framework;
OsirisTerje marked this conversation as resolved.
Show resolved Hide resolved
14 changes: 14 additions & 0 deletions CakeScripts.Tests/VersionParsersTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// Copyright (c) Charlie Poole, Rob Prouse and Contributors. MIT License - see LICENSE.txt

namespace CakeScripts.Tests;

public class CakeTests
{
[TestCase("1.2.3-beta.1", "1.2.3.0")]
[TestCase("1.2.3", "1.2.3.0")]
public void ThatWeCanParseAssemblyVersionStrings(string versionString, string expected)
{
var parsedVersion = VersionParsers.ParseAssemblyVersion(versionString);
Assert.That(parsedVersion, Is.EqualTo(expected));
}
}
9 changes: 9 additions & 0 deletions CakeScripts/CakeScripts.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

</Project>
14 changes: 14 additions & 0 deletions CakeScripts/VersionParsers.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// Copyright (c) Charlie Poole, Rob Prouse and Contributors. MIT License - see LICENSE.txt

public static class VersionParsers
{
public static string ParseAssemblyVersion(string version)
{
var dash = version.LastIndexOf('-');
if (dash > 0)
{
return string.Concat(version.Substring(0, dash), ".0");
OsirisTerje marked this conversation as resolved.
Show resolved Hide resolved
}
return version + ".0";
}
}
25 changes: 19 additions & 6 deletions build.cake
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#addin "nuget:?package=Cake.MinVer&version=3.0.0"
#load "CakeScripts/VersionParsers.cs"

//////////////////////////////////////////////////////////////////////
// ARGUMENTS
Expand Down Expand Up @@ -128,17 +129,29 @@ Task("Build")
DotNetBuild(SOLUTION_FILE, CreateDotNetBuildSettings());
});

DotNetBuildSettings CreateDotNetBuildSettings() =>
new DotNetBuildSettings
DotNetBuildSettings CreateDotNetBuildSettings()
{
var version = packageVersion.ToString();
var assemblyVersion = version.Substring(0, version.LastIndexOf('-')) + ".0";
OsirisTerje marked this conversation as resolved.
Show resolved Hide resolved
OsirisTerje marked this conversation as resolved.
Show resolved Hide resolved
var msBuildSettings = new DotNetMSBuildSettings {
ContinuousIntegrationBuild = BuildSystem.GitHubActions.IsRunningOnGitHubActions,
AssemblyVersion = VersionParsers.ParseAssemblyVersion(version),
FileVersion = VersionParsers.ParseAssemblyVersion(version),
OsirisTerje marked this conversation as resolved.
Show resolved Hide resolved
InformationalVersion = version
};
Information("AssemblyVersion: {0}", msBuildSettings.AssemblyVersion);
Information("FileVersion: {0}", msBuildSettings.FileVersion);
Information("InformationalVersion: {0}", msBuildSettings.InformationalVersion);

var settings = new DotNetBuildSettings
{
Configuration = configuration,
NoRestore = true,
Verbosity = DotNetVerbosity.Minimal,
MSBuildSettings = new DotNetMSBuildSettings {
Version = packageVersion,
ContinuousIntegrationBuild = BuildSystem.GitHubActions.IsRunningOnGitHubActions
}
MSBuildSettings = msBuildSettings
};
return settings;
}

//////////////////////////////////////////////////////////////////////
// TEST
Expand Down
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
"sdk": {
"version": "8.0.100",
"allowPrerelease": false,
"rollForward": "latestPatch"
"rollForward": "latestFeature"
}
}
14 changes: 13 additions & 1 deletion nunit.sln
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".github", ".github", "{AA24
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "workflows", "workflows", "{8C31C709-FAC1-445C-BAD6-7FFFB3F1D39E}"
ProjectSection(SolutionItems) = preProject
.github\workflows\NUnit.Myget.Publish.yml = .github\workflows\NUnit.Myget.Publish.yml
.github\workflows\NUnit.CI.yml = .github\workflows\NUnit.CI.yml
.github\workflows\NUnit.Myget.Publish.yml = .github\workflows\NUnit.Myget.Publish.yml
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".config", ".config", "{08744334-2350-4885-B57E-347010A27ABB}"
Expand All @@ -80,6 +80,10 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".config", ".config", "{0874
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "windows-tests", "src\NUnitFramework\windows-tests\windows-tests.csproj", "{7C19F745-B5F0-4A3A-B545-1E1DF4FA1F78}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CakeScripts", "CakeScripts\CakeScripts.csproj", "{8A7B6926-0FDF-4AC7-9E78-BBAC01187414}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CakeScripts.Tests", "CakeScripts.Tests\CakeScripts.Tests.csproj", "{FCF45E25-C1CB-42E8-8E83-F7FCB818E8D3}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -138,6 +142,14 @@ Global
{7C19F745-B5F0-4A3A-B545-1E1DF4FA1F78}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7C19F745-B5F0-4A3A-B545-1E1DF4FA1F78}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7C19F745-B5F0-4A3A-B545-1E1DF4FA1F78}.Release|Any CPU.Build.0 = Release|Any CPU
{8A7B6926-0FDF-4AC7-9E78-BBAC01187414}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8A7B6926-0FDF-4AC7-9E78-BBAC01187414}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8A7B6926-0FDF-4AC7-9E78-BBAC01187414}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8A7B6926-0FDF-4AC7-9E78-BBAC01187414}.Release|Any CPU.Build.0 = Release|Any CPU
{FCF45E25-C1CB-42E8-8E83-F7FCB818E8D3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FCF45E25-C1CB-42E8-8E83-F7FCB818E8D3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FCF45E25-C1CB-42E8-8E83-F7FCB818E8D3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FCF45E25-C1CB-42E8-8E83-F7FCB818E8D3}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
33 changes: 0 additions & 33 deletions src/CommonAssemblyInfo.cs

This file was deleted.

38 changes: 37 additions & 1 deletion src/NUnitFramework/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,17 @@
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
<NUnitLibraryFrameworks>net462;net6.0</NUnitLibraryFrameworks>
<NUnitRuntimeFrameworks>net462;net6.0;net8.0</NUnitRuntimeFrameworks>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<GenerateAssemblyInfo>true</GenerateAssemblyInfo>
<!--<OutputPath>..\..\..\bin\$(Configuration)\</OutputPath>-->
<CheckEolTargetFramework>false</CheckEolTargetFramework>
<Nullable>enable</Nullable>
<AnnotatedReferenceAssemblyVersion>7.0.0</AnnotatedReferenceAssemblyVersion>
<GenerateNullableAttributes>false</GenerateNullableAttributes>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
<Company>NUnit Software</Company>
<Product>NUnit 4</Product>
<Copyright>Copyright (c) Charlie Poole, Rob Prouse and Contributors. MIT License - see LICENSE.txt</Copyright>
<Trademark>NUnit is a trademark of NUnit Software</Trademark>
</PropertyGroup>

<PropertyGroup Condition="'$(BuildingInsideVisualStudio)' != 'true'">
Expand All @@ -35,6 +39,38 @@
<EmbedUntrackedSources>true</EmbedUntrackedSources>
</PropertyGroup>

<Choose>
<When Condition="'$(TargetFramework)' == 'net462'">
<PropertyGroup>
<AssemblyConfiguration>.NET Framework 4.6.2 $(Configuration)</AssemblyConfiguration>
</PropertyGroup>
</When>
<When Condition="$(TargetFramework.StartsWith('net6.0'))">
<PropertyGroup>
<AssemblyConfiguration>.NET 6.0 $(Configuration)</AssemblyConfiguration>
</PropertyGroup>
</When>
<When Condition="$(TargetFramework.StartsWith('net8.0'))">
<PropertyGroup>
<AssemblyConfiguration>.NET 8.0 $(Configuration)</AssemblyConfiguration>
</PropertyGroup>
</When>
<When Condition="$(TargetFramework.StartsWith('net9.0'))">
<PropertyGroup>
<AssemblyConfiguration>.NET 9.0 $(Configuration)</AssemblyConfiguration>
</PropertyGroup>
</When>
<Otherwise>
<PropertyGroup>
<AssemblyConfiguration />
</PropertyGroup>
</Otherwise>
</Choose>

<Target Name="CheckConfiguration" BeforeTargets="Compile">
<Error Condition="'$(AssemblyConfiguration)' == ''" Text="Missing AssemblyConfiguration for $(TargetFramework)" />
</Target>

<ItemGroup>
<PackageReference Include="Microsoft.SourceLink.GitHub" PrivateAssets="All" />
<PackageReference Include="DotNetAnalyzers.DocumentationAnalyzers" PrivateAssets="all" />
Expand Down
9 changes: 0 additions & 9 deletions src/NUnitFramework/FrameworkVersion.cs

This file was deleted.

Loading