Skip to content

Commit

Permalink
Updates to zipPackage, NUnitLiteRunner
Browse files Browse the repository at this point in the history
  • Loading branch information
CharliePoole committed Oct 7, 2024
1 parent cd5348b commit 94f01b5
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 7 deletions.
2 changes: 1 addition & 1 deletion recipe/package-definition.cake
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ public abstract class PackageDefinition
throw new Exception("One or more package tests had errors!");
}

private void InstallExtensions(ExtensionSpecifier[] extensionsNeeded)
protected virtual void InstallExtensions(ExtensionSpecifier[] extensionsNeeded)
{
foreach (ExtensionSpecifier extension in extensionsNeeded)
extension.InstallExtension(this);
Expand Down
13 changes: 11 additions & 2 deletions recipe/test-runners.cake
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,17 @@ public class TestRunnerSource
// For NUnitLite tests, the test is run directly
public class NUnitLiteRunner : TestRunner, IUnitTestRunner
{
public int RunUnitTest(FilePath testPath) =>
RunTest(testPath, BuildSettings.UnitTestArguments);
public int RunUnitTest(FilePath testPath)
{
var processSettings = new ProcessSettings { Arguments = BuildSettings.UnitTestArguments };
if (CommandLineOptions.TraceLevel.Exists)
processSettings.EnvironmentVariables = new Dictionary<string, string>
{
{ "NUNIT_INTERNAL_TRACE_LEVEL", CommandLineOptions.TraceLevel.Value }
};

return RunTest(testPath, processSettings);
}
}

/////////////////////////////////////////////////////////////////////////////
Expand Down
11 changes: 7 additions & 4 deletions recipe/zip-package.cake
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public class ZipPackage : PackageDefinition

// ZIP package supports bundling of extensions
public PackageReference[] BundledExtensions { get; }
public bool HasBundledExtensions => BundledExtensions != null;

// The file name of this package, including extension
public override string PackageFileName => $"{PackageId}-{PackageVersion}.zip";
Expand All @@ -46,6 +47,12 @@ public class ZipPackage : PackageDefinition
_context.Unzip($"{BuildSettings.PackageDirectory}{PackageFileName}", $"{PackageInstallDirectory}{PackageId}.{PackageVersion}");
}

protected override void InstallExtensions(ExtensionSpecifier[] extensionsNeeded)
{
// TODO: Do nothing for now. Future: only install extensions not bundled
// or previously installed.
}

private void CreateZipImage()
{
_context.CleanDirectory(BuildSettings.ZipImageDirectory);
Expand All @@ -58,10 +65,6 @@ public class ZipPackage : PackageDefinition
BuildSettings.OutputDirectory,
BuildSettings.ZipImageDirectory + "bin/" );

_context.CopyFileToDirectory(
BuildSettings.ZipDirectory + "nunit.bundle.addins",
BuildSettings.ZipImageDirectory);

var addinsDir = BuildSettings.ZipImageDirectory + "bin/net462/addins/";
_context.CreateDirectory(addinsDir);

Expand Down

0 comments on commit 94f01b5

Please sign in to comment.