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

Issue 1216b #1220

Merged
merged 4 commits into from
Sep 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
13 changes: 13 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,19 @@ branches:
except:
- /^azure-/

install:
- ps: $urlNet70RC = "https://download.visualstudio.microsoft.com/download/pr/b3b5dce4-d810-4477-a8a3-97cbb0bdf3ea/91d0dd167239cfdfb48ae18166f444d4/dotnet-sdk-7.0.100-rc.1.22431.12-win-x64.zip"
- ps: echo "Download from $urlNet70RC"
- ps: $env:DOTNET_INSTALL_DIR = "$pwd\.dotnetsdk"
- ps: mkdir $env:DOTNET_INSTALL_DIR -Force | Out-Null
- ps: echo "Created directory $env:DOTNET_INSTALL_DIR"
- ps: echo "Starting download"
- ps: $tempFileNet70RC = [System.IO.Path]::Combine([System.IO.Path]::GetTempPath(), [System.IO.Path]::GetRandomFileName())
- ps: (New-Object System.Net.WebClient).DownloadFile($urlNet70RC, $tempFileNet70RC)
- ps: Add-Type -AssemblyName System.IO.Compression.FileSystem; [System.IO.Compression.ZipFile]::ExtractToDirectory($tempFileNet70RC, $env:DOTNET_INSTALL_DIR)
- ps: echo "Download complete"
- ps: $env:Path = "$env:DOTNET_INSTALL_DIR;$env:Path"

build_script:
- ps: .\build.ps1 --target=Appveyor --configuration=Release

Expand Down
7 changes: 6 additions & 1 deletion build.cake
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,13 @@ public void BuildSolution()
.WithProperty("TargetFramework", "netcoreapp2.1")
.WithProperty("PublishDir", BIN_DIR + "netcoreapp2.1"));

DisplayBanner("Publishing MOCK ASSEMBLY Project for NET7.0");
MSBuild(MOCK_ASSEMBLY_PROJECT, CreateMSBuildSettings("Publish")
.WithProperty("TargetFramework", "net7.0")
.WithProperty("PublishDir", BIN_DIR + "net7.0"));

// TODO: May not be needed
foreach (var framework in new[] { "netcoreapp3.1", "net5.0" })
foreach (var framework in new[] { "netcoreapp3.1", "net5.0", "net7.0" })
{
DisplayBanner($"Publishing AGENT Project for {framework.ToUpper()}");
MSBuild(AGENT_PROJECT, CreateMSBuildSettings("Publish")
Expand Down
16 changes: 13 additions & 3 deletions cake/package-definitions.cake
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ public void InitializePackageDefinitions(ICakeContext context)
NetCore31Test,
Net50Test,
Net60Test,
// Net70Test,
NetCore21PlusNetCore31Test,
NetCore21PlusNetCore31PlusNet50PlusNet60Test,
Net40PlusNet60Test
Expand Down Expand Up @@ -71,15 +72,17 @@ public void InitializePackageDefinitions(ICakeContext context)
HasDirectory("tools/agents/net40").WithFiles(AGENT_FILES).AndFile("nunit.agent.addins"),
HasDirectory("tools/agents/netcoreapp3.1").WithFiles(AGENT_FILES_NETCORE).AndFile("nunit.agent.addins"),
HasDirectory("tools/agents/net5.0").WithFiles(AGENT_FILES_NETCORE).AndFile("nunit.agent.addins"),
HasDirectory("tools/agents/net6.0").WithFiles(AGENT_FILES_NETCORE).AndFile("nunit.agent.addins")
HasDirectory("tools/agents/net6.0").WithFiles(AGENT_FILES_NETCORE).AndFile("nunit.agent.addins"),
HasDirectory("tools/agents/net7.0").WithFiles(AGENT_FILES_NETCORE).AndFile("nunit.agent.addins")
},
symbols: new PackageCheck[] {
HasDirectory("tools").WithFiles(ENGINE_PDB_FILES).AndFile("nunit3-console.pdb"),
HasDirectory("tools/agents/net20").WithFiles(AGENT_PDB_FILES),
HasDirectory("tools/agents/net40").WithFiles(AGENT_PDB_FILES),
HasDirectory("tools/agents/netcoreapp3.1").WithFiles(AGENT_PDB_FILES_NETCORE),
HasDirectory("tools/agents/net5.0").WithFiles(AGENT_PDB_FILES_NETCORE),
HasDirectory("tools/agents/net6.0").WithFiles(AGENT_PDB_FILES_NETCORE)
HasDirectory("tools/agents/net6.0").WithFiles(AGENT_PDB_FILES_NETCORE),
HasDirectory("tools/agents/net7.0").WithFiles(AGENT_PDB_FILES_NETCORE)
},
executable: "tools/nunit3-console.exe",
tests: StandardRunnerTests),
Expand Down Expand Up @@ -110,7 +113,8 @@ public void InitializePackageDefinitions(ICakeContext context)
HasDirectory("tools/agents/net40").WithFiles(AGENT_FILES).AndFile("nunit.agent.addins"),
HasDirectory("tools/agents/netcoreapp3.1").WithFiles(AGENT_FILES_NETCORE).AndFile("nunit.agent.addins"),
HasDirectory("tools/agents/net5.0").WithFiles(AGENT_FILES_NETCORE).AndFile("nunit.agent.addins"),
HasDirectory("tools/agents/net6.0").WithFiles(AGENT_FILES_NETCORE).AndFile("nunit.agent.addins")
HasDirectory("tools/agents/net6.0").WithFiles(AGENT_FILES_NETCORE).AndFile("nunit.agent.addins"),
HasDirectory("tools/agents/net7.0").WithFiles(AGENT_FILES_NETCORE).AndFile("nunit.agent.addins")
},
executable: "tools/nunit3-console.exe",
tests: StandardRunnerTests),
Expand All @@ -123,6 +127,12 @@ public void InitializePackageDefinitions(ICakeContext context)
checks: new PackageCheck[] {
HasDirectory("NUnit.org").WithFiles("LICENSE.txt", "NOTICES.txt", "nunit.ico"),
HasDirectory("NUnit.org/nunit-console").WithFiles(CONSOLE_FILES).AndFiles(ENGINE_FILES).AndFile("nunit.bundle.addins"),
HasDirectory("NUnit.org/nunit-console/agents/net20").WithFiles("nunit-agent.exe", "nunit-agent.exe.config"),
HasDirectory("NUnit.org/nunit-console/agents/net40").WithFiles("nunit-agent.exe", "nunit-agent.exe.config"),
HasDirectory("NUnit.org/nunit-console/agents/netcoreapp3.1").WithFile("nunit-agent.dll"),
HasDirectory("NUnit.org/nunit-console/agents/net5.0").WithFile("nunit-agent.dll"),
HasDirectory("NUnit.org/nunit-console/agents/net6.0").WithFile("nunit-agent.dll"),
//HasDirectory("NUnit.org/nunit-console/agents/net7.0").WithFile("nunit-agent.dll"),
HasDirectory("Nunit.org/nunit-console/addins").WithFiles("nunit.core.dll", "nunit.core.interfaces.dll", "nunit.v2.driver.dll", "nunit-project-loader.dll", "vs-project-loader.dll", "nunit-v2-result-writer.dll", "teamcity-event-listener.dll")
},
executable: "NUnit.org/nunit-console/nunit3-console.exe",
Expand Down
6 changes: 6 additions & 0 deletions cake/package-tests.cake
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,12 @@ static PackageTest Net60Test = new PackageTest(
"net6.0/mock-assembly.dll",
MockAssemblyExpectedResult(1));

static PackageTest Net70Test = new PackageTest(
"Net70Test",
"Run mock-assembly.dll under .NET 7.0",
"net7.0/mock-assembly.dll",
MockAssemblyExpectedResult(1));

static PackageTest Net50Test = new PackageTest(
"Net50Test",
"Run mock-assembly.dll under .NET 5.0",
Expand Down
10 changes: 10 additions & 0 deletions choco/nunit-console-runner.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -92,5 +92,15 @@
<file src = "$BIN_DIR$agents/net6.0/nunit.engine.core.dll" target="tools/agents/net6.0" />
<file src = "$BIN_DIR$agents/net6.0/testcentric.engine.metadata.dll" target="tools/agents/net6.0" />
<file src = "nunit.agent.addins" target = "tools/agents/net6.0" />

<file src = "$BIN_DIR$agents/net7.0/nunit-agent.dll" target="tools/agents/net7.0" />
<file src = "$BIN_DIR$agents/net7.0/nunit-agent.dll.config" target="tools/agents/net7.0" />
<file src = "$BIN_DIR$agents/net7.0/nunit-agent.deps.json" target="tools/agents/net7.0" />
<file src = "$BIN_DIR$agents/net7.0/nunit-agent.runtimeconfig.json" target="tools/agents/net7.0" />
<file src = "$BIN_DIR$agents/net7.0/nunit.engine.api.dll" target="tools/agents/net7.0" />
<file src = "$BIN_DIR$agents/net7.0/nunit.engine.api.xml" target="tools/agents/net7.0" />
<file src = "$BIN_DIR$agents/net7.0/nunit.engine.core.dll" target="tools/agents/net7.0" />
<file src = "$BIN_DIR$agents/net7.0/testcentric.engine.metadata.dll" target="tools/agents/net7.0" />
<file src = "nunit.agent.addins" target = "tools/agents/net7.0" />
</files>
</package>
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"sdk": {
"version": "6.0.101",
"version": "7.0.100-rc.1.22431.12",
"rollForward": "feature"
}
}
30 changes: 30 additions & 0 deletions msi/nunit/engine-files.wxi
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
<ComponentGroupRef Id="NETCORE31_AGENT" />
<ComponentGroupRef Id="NET50_AGENT" />
<ComponentGroupRef Id="NET60_AGENT" />
<ComponentGroupRef Id="NET70_AGENT" />
</ComponentGroup>
</Fragment>
<Fragment>
Expand Down Expand Up @@ -174,5 +175,34 @@
Source="$(var.InstallImage)bin/net6.0/testcentric.engine.metadata.dll" />
</Component>
</ComponentGroup>
<ComponentGroup Id="NET70_AGENT" Directory="NET70_AGENT_DIR">
<Component Id="NUNIT_AGENT_NET70" Location="local" Guid="5D10D513-F5C4-461F-B11C-D51C0CD14F89">
<File Id="nunit_agent_net70.exe"
ProcessorArchitecture="msil"
Source="$(var.InstallImage)bin/agents/net7.0/nunit-agent.dll" />
<File Id="nunit_agent_net70.deps.json"
Source="$(var.InstallImage)bin/agents/net7.0/nunit-agent.deps.json" />
<File Id="nunit_agent_net70.runtimeconfig.json"
Source="$(var.InstallImage)bin/agents/net7.0/nunit-agent.runtimeconfig.json" />
</Component>
<!-- Engine files are currently not built for .NET 7.0 so we use 6.0 -->
<Component Id="NUNIT_AGENT_NET70_ENGINE_API" Location="local" Guid="A1318B84-3E15-45A9-B49E-475ED06ADCCD">
<File Id="nunit.agent.net70.engine.api.dll"
ProcessorArchitecture="msil"
Source="$(var.InstallImage)bin/net6.0/nunit.engine.api.dll" />
<File Id="nunit.agent.net70.engine.api.xml"
Source="$(var.InstallImage)bin/net6.0/nunit.engine.api.xml" />
</Component>
<Component Id="NUNIT_AGENT_NET70_ENGINE_CORE" Location="local" Guid="CBA7AA8D-B7D8-43F5-901A-2044DE1E07A7">
<File Id="nunit.agent.net70.engine.core.dll"
ProcessorArchitecture="msil"
Source="$(var.InstallImage)bin/net6.0/nunit.engine.core.dll" />
</Component>
<Component Id="NUNIT_AGENT_NET70_ENGINE_METADATA" Location="local" Guid="1F887300-4C7A-4574-A1DD-D925228DA217">
<File Id="nunit.agent.net70.engine.metadata.dll"
ProcessorArchitecture="msil"
Source="$(var.InstallImage)bin/net6.0/testcentric.engine.metadata.dll" />
</Component>
</ComponentGroup>
</Fragment>
</Include>
1 change: 1 addition & 0 deletions msi/nunit/runner-directories.wxi
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
<Directory Id="NETCORE31_AGENT_DIR" Name="netcoreapp3.1" />
<Directory Id="NET50_AGENT_DIR" Name="net5.0" />
<Directory Id="NET60_AGENT_DIR" Name="net6.0" />
<Directory Id="NET70_AGENT_DIR" Name="net7.0" />
</Directory>
</Directory>
</DirectoryRef>
Expand Down
13 changes: 13 additions & 0 deletions nuget/runners/nunit.console-runner.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,19 @@
<file src="agents/net6.0/testcentric.engine.metadata.dll" target="tools/agents/net6.0" />
<file src="../../nuget/engine/nunit.agent.addins" target="tools/agents/net6.0"/>

<file src="agents/net7.0/nunit-agent.dll" target="tools/agents/net7.0" />
<file src="agents/net7.0/nunit-agent.pdb" target="tools/agents/net7.0" />
<file src="agents/net7.0/nunit-agent.dll.config" target="tools/agents/net7.0" />
<file src="agents/net7.0/nunit-agent.deps.json" target="tools/agents/net7.0" />
<file src="agents/net7.0/nunit-agent.runtimeconfig.json" target="tools/agents/net7.0" />
<file src="agents/net7.0/nunit.engine.api.dll" target="tools/agents/net7.0" />
<file src="agents/net7.0/nunit.engine.api.pdb" target="tools/agents/net7.0" />
<file src="agents/net7.0/nunit.engine.api.xml" target="tools/agents/net7.0" />
<file src="agents/net7.0/nunit.engine.core.dll" target="tools/agents/net7.0" />
<file src="agents/net7.0/nunit.engine.core.pdb" target="tools/agents/net7.0" />
<file src="agents/net7.0/testcentric.engine.metadata.dll" target="tools/agents/net7.0" />
<file src="../../nuget/engine/nunit.agent.addins" target="tools/agents/net7.0"/>

<file src="net20/nunit3-console.exe" target="tools" />
<file src="net20/nunit3-console.pdb" target="tools" />
<file src="net20/nunit3-console.exe.config" target="tools" />
Expand Down
2 changes: 1 addition & 1 deletion src/NUnitEngine/mock-assembly/mock-assembly.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<RootNamespace>NUnit.Tests</RootNamespace>
<TargetFrameworks>net35;net40;netcoreapp2.1;netcoreapp3.1;net5.0;net6.0</TargetFrameworks>
<TargetFrameworks>net35;net40;netcoreapp2.1;netcoreapp3.1;net5.0;net6.0;net7.0</TargetFrameworks>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>..\..\nunit.snk</AssemblyOriginatorKeyFile>
<CheckEolTargetFramework>false</CheckEolTargetFramework>
Expand Down
8 changes: 7 additions & 1 deletion src/NUnitEngine/nunit-agent/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,13 @@ public static void Main(string[] args)

LocateAgencyProcess(agencyPid);

#if NETCOREAPP3_1
#if NET7_0
log.Info($"Running .NET 7.0 agent under {RuntimeInformation.FrameworkDescription}");
#elif NET6_0
log.Info($"Running .NET 6.0 agent under {RuntimeInformation.FrameworkDescription}");
#elif NET5_0
log.Info($"Running .NET 5.0 agent under {RuntimeInformation.FrameworkDescription}");
#elif NETCOREAPP3_1
log.Info($"Running .NET Core 3.1 agent under {RuntimeInformation.FrameworkDescription}");
#elif NET40
log.Info($"Running .NET 4.0 agent under {RuntimeFramework.CurrentFramework.DisplayName}");
Expand Down
2 changes: 1 addition & 1 deletion src/NUnitEngine/nunit-agent/nunit-agent.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<RootNamespace>nunit.agent</RootNamespace>
<TargetFrameworks>net20;net40;netcoreapp3.1;net5.0;net6.0</TargetFrameworks>
<TargetFrameworks>net20;net40;netcoreapp3.1;net5.0;net6.0;net7.0</TargetFrameworks>
<ApplicationManifest>app.manifest</ApplicationManifest>
<ApplicationIcon>..\..\..\nunit.ico</ApplicationIcon>
<GenerateSupportedRuntime>false</GenerateSupportedRuntime>
Expand Down
11 changes: 4 additions & 7 deletions src/NUnitEngine/nunit.engine/Services/AgentProcess.cs
Original file line number Diff line number Diff line change
Expand Up @@ -116,27 +116,24 @@ public static string GetTestAgentExePath(RuntimeFramework targetRuntime, bool re

string runtimeDir;
string agentName;
string agentExtension;
int major = targetRuntime.FrameworkVersion.Major;
switch (targetRuntime.Runtime)
{
case RuntimeType.Net:
case RuntimeType.Mono:
runtimeDir = major >= 4 ? "net40" : "net20";
agentName = requires32Bit ? "nunit-agent-x86" : "nunit-agent";
agentExtension = ".exe";
agentName = requires32Bit ? "nunit-agent-x86.exe" : "nunit-agent.exe";
break;
case RuntimeType.NetCore:
runtimeDir = major >= 6 ? "net6.0" : major == 5 ? "net5.0" : "netcoreapp3.1";
agentName = "nunit-agent";
agentExtension = ".dll";
runtimeDir = major >= 7 ? "net7.0" : major == 6 ? "net6.0" : major == 5 ? "net5.0" : "netcoreapp3.1";
agentName = "nunit-agent.dll";
break;
default:
log.Error($"Unknown runtime type: {targetRuntime.Runtime}");
return null;
}

return Path.Combine(Path.Combine(agentsDir, runtimeDir), agentName + agentExtension);
return Path.Combine(Path.Combine(agentsDir, runtimeDir), agentName);
}
}
}
Expand Down