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

Updated ids-tool #140

Merged
merged 1 commit into from
Mar 26, 2023
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ build/obj/
.tmp/
/build/.vs/
/.nuke/temp/
/.vs/
4 changes: 4 additions & 0 deletions .nuke/build.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@
"items": {
"type": "string",
"enum": [
"AuditDevelopment",
"AuditDocTestCases",
"CheckTestCases"
]
}
Expand All @@ -82,6 +84,8 @@
"items": {
"type": "string",
"enum": [
"AuditDevelopment",
"AuditDocTestCases",
"CheckTestCases"
]
}
Expand Down
46 changes: 29 additions & 17 deletions build/Build.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using Nuke.Common;
using Nuke.Common.Tooling;
using System;
using System.IO;

class Build : NukeBuild
Expand All @@ -21,31 +22,42 @@ class Build : NukeBuild
private string IdsToolPath => System.IO.Path.GetDirectoryName(ToolPathResolver.GetPackageExecutable("ids-tool.CommandLine", "tools/net6.0/ids-tool.dll"));

/// <summary>
/// Checks the validity of IDS files in the repository, using ids-tool.
/// Checks the validity of development folder in the repository, using ids-tool.
/// The tool is deployed by the annotated <see cref="IdsTool"/>.
/// </summary>
Target CheckTestCases => _ => _
Target AuditDevelopment => _ => _
.AssuredAfterFailure()
.Executes(() =>
{
// development samples
var schemaFile = Path.Combine(
RootDirectory,
"Development/ids.xsd"
);
var inputFolder = Path.Combine(
RootDirectory,
"Development"
);
var arguments = $"check \"{inputFolder}\" -x \"{schemaFile}\"";
var schemaFile = RootDirectory / "Development" / "ids.xsd";
var inputFolder = RootDirectory / "Development";
var arguments = $"audit \"{inputFolder}\" -x \"{schemaFile}\"";
IdsTool(arguments, workingDirectory: IdsToolPath);
});

// test cases
inputFolder = Path.Combine(
RootDirectory,
"Documentation/testcases"
);
arguments = $"check \"{inputFolder}\" -x \"{schemaFile}\"";
Target AuditDocTestCases => _ => _
.AssuredAfterFailure()
.Executes(() =>
{
// we are omitting tests on the content of the Documentation/testcases folder,
// because they include IDSs that intentionally contain errors
//
var schemaFile = RootDirectory / "Development" / "ids.xsd";
var inputFolder = RootDirectory / "Documentation" / "testcases";
var arguments = $"audit \"{inputFolder}\" --omitContent -x \"{schemaFile}\"";
IdsTool(arguments, workingDirectory: IdsToolPath);
});

/// <summary>
/// Perform all tests via DependsOn, this is the one invoked by default
/// </summary>
Target CheckTestCases => _ => _
.AssuredAfterFailure()
.DependsOn(AuditDocTestCases)
.DependsOn(AuditDevelopment)
.Executes(() =>
{
Console.WriteLine("Empty target, to launch all available checking targets.");
});
}
2 changes: 1 addition & 1 deletion build/_build.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="ids-tool.CommandLine" Version="1.0.9" />
<PackageReference Include="ids-tool.CommandLine" Version="1.0.11" />
<PackageReference Include="Nuke.Common" Version="6.2.1" />
</ItemGroup>

Expand Down