forked from OPCFoundation/UA-ModelCompiler
-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #68 from mpostol/CLP
main synchronization to release 2.1.1-Bravo
- Loading branch information
Showing
14 changed files
with
270 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
//__________________________________________________________________________________________________ | ||
// | ||
// Copyright (C) 2022, Mariusz Postol LODZ POLAND. | ||
// | ||
// To be in touch join the community at GitHub: https://github.com/mpostol/OPC-UA-OOI/discussions | ||
//__________________________________________________________________________________________________ | ||
|
||
using CommandLine; | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
using OOI.ModelCompilerUI.CommandLineSyntax; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
|
||
namespace OOI.ModelCompilerUI | ||
{ | ||
[TestClass] | ||
public class CommandLineSyntaxUnitTest | ||
{ | ||
[TestMethod] | ||
public void TestMethod1() | ||
{ | ||
List<string> commandLine = new List<string>() | ||
{ | ||
"exeName", | ||
"compile", | ||
"--d2", @".\Opc.Ua.ModelCompiler\Design.v104\StandardTypes.xml", @".\Opc.Ua.ModelCompiler\Design.v104\UA Core Services.xml", | ||
"--version", "v104", | ||
// "-d2", @".\Opc.Ua.ModelCompiler\Design.v104\UA Core Services.xml", | ||
"-c", @".\Opc.Ua.ModelCompiler\CSVs\StandardTypes.csv", | ||
"--o2", @".\Bin\nodesets\master\Schema\", | ||
// "-stack", @".\Bin\nodesets\master\DotNet\", | ||
// "-ansic", @".\Bin\nodesets\master\AnsiC\" | ||
}; | ||
string args = string.Join(",", commandLine.ToArray<string>()); | ||
Assert.IsNotNull(args); | ||
ParserResult<object> result = Parser.Default.ParseArguments<CompilerOptions, DotNetStackOptions>(commandLine); | ||
CompilerOptions compilerOptions = null; | ||
IEnumerable<Error> error = null; | ||
result.WithParsed<CompilerOptions>(options => compilerOptions = options).WithNotParsed(errors => error = errors); | ||
Assert.IsNotNull(compilerOptions); | ||
Assert.IsNull(error); | ||
//TODO CLI Syntax #67 | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,23 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<configuration> | ||
<runtime> | ||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> | ||
<dependentAssembly> | ||
<assemblyIdentity name="System.Formats.Asn1" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral"/> | ||
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0"/> | ||
<assemblyIdentity name="System.Formats.Asn1" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" /> | ||
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" /> | ||
</dependentAssembly> | ||
<dependentAssembly> | ||
<assemblyIdentity name="BouncyCastle.Crypto" publicKeyToken="0e99375e54769942" culture="neutral"/> | ||
<bindingRedirect oldVersion="0.0.0.0-1.9.0.0" newVersion="1.9.0.0"/> | ||
<assemblyIdentity name="BouncyCastle.Crypto" publicKeyToken="0e99375e54769942" culture="neutral" /> | ||
<bindingRedirect oldVersion="0.0.0.0-1.9.0.0" newVersion="1.9.0.0" /> | ||
</dependentAssembly> | ||
<dependentAssembly> | ||
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/> | ||
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0"/> | ||
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> | ||
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" /> | ||
</dependentAssembly> | ||
<dependentAssembly> | ||
<assemblyIdentity name="System.Buffers" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral"/> | ||
<bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0"/> | ||
<assemblyIdentity name="System.Buffers" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" /> | ||
<bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" /> | ||
</dependentAssembly> | ||
</assemblyBinding> | ||
</runtime> | ||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/></startup></configuration> | ||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" /></startup></configuration> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
//__________________________________________________________________________________________________ | ||
// | ||
// Copyright (C) 2022, Mariusz Postol LODZ POLAND. | ||
// | ||
// To be in touch join the community at GitHub: https://github.com/mpostol/OPC-UA-OOI/discussions | ||
//__________________________________________________________________________________________________ | ||
|
||
using CommandLine; | ||
using System.Collections.Generic; | ||
|
||
namespace OOI.ModelCompilerUI.CommandLineSyntax | ||
{ | ||
[Verb("compile", true, HelpText = "Generates classes that implement a UA information model")] | ||
internal class CompilerOptions | ||
{ | ||
[Option('d', "d2", HelpText = d2Help, MetaValue = "ModelDesign", Required = true)] | ||
public IList<string> DesignFiles { get; set; } | ||
|
||
[Option('c', "CSVfile", SetName = "csv", HelpText = cHelp, MetaValue = "CSVfile", Required = false)] | ||
public string IdentifierFile { get; set; } | ||
|
||
[Option('g', "cg", SetName = "csv", HelpText = cgHelp, MetaValue = "CSVfileGenrate", Required = false)] | ||
public bool CreateIdentifierFile { get; set; } | ||
|
||
[Option('o', "o2", HelpText = oHelp, MetaValue = "output", Required = false)] | ||
public string OutputPath { get; set; } | ||
|
||
[Option('i', "id", HelpText = idHelp, Required = false, Default = (uint)0)] | ||
public uint StartId { get; set; } | ||
|
||
[Option('e', "exclude", HelpText = excludeHeelp, Required = false)] | ||
public IList<string> Exclusions { get; set; } | ||
|
||
[Option('v', "version", HelpText = versionHelp, Required = false, Default = "v104")] | ||
public string Version { get; set; } | ||
|
||
[Option('s', "useAllowSubtypes", HelpText = useAllowSubtypesHelp, Required = false)] | ||
public bool UseAllowSubtypes { get; set; } | ||
|
||
[Option('m', "mv", HelpText = mvHelp, Required = false)] | ||
public string ModelVersion { get; set; } | ||
|
||
[Option('m', "mv", HelpText = pdHelp, Required = false)] | ||
public string ModelPublicationDate { get; set; } | ||
|
||
public string InputPath; | ||
public string FilePattern; | ||
public LicenseType LicenseType; | ||
public bool Silent; | ||
public string Annex1Path; | ||
public string Annex2Path; | ||
|
||
private const string d2Help = | ||
"The path to the ModelDesign files which contain the UA information model. The new version of the code generator is used (option -stack forces to use -d2 switch)"; | ||
|
||
private const string cHelp = "The path to the CSV file which contains the unique identifiers for the types defined in the UA information model."; | ||
private const string cgHelp = "Creates the identifier file if it does not exist (used instead of the -c option)."; | ||
private const string oHelp = "The output directory for the generated files."; | ||
private const string idHelp = "The first identifier to use when assigning new ids to nodes."; | ||
private const string excludeHeelp = "Comma seperated list of ReleaseStatus values to exclude from output."; | ||
private const string versionHelp = "Selects the source for the input files. v103 | v104 | v105 are supported."; | ||
private const string useAllowSubtypesHelp = " When subtypes are allowed for a field, C# code with the class name from the model is created instead of ExtensionObject. No effect when subtypes are not allowed."; | ||
private const string mvHelp = "The version of the model to produce."; | ||
private const string pdHelp = "The publication date of the model to produce."; | ||
} | ||
|
||
[Verb("DotNetStack", false, HelpText = "Generates code for the core model (not used for vendor defined models)")] | ||
public class DotNetStackOptions | ||
{ | ||
[Option('n', "stack", HelpText = stackHelp, Group = "StackType", Required = true)] | ||
public string DotNetStackPath { get; set; } | ||
|
||
[Option('a', "ansic", HelpText = ansicHelp, Group = "StackType", Required = true)] | ||
public string AnsiCStackPath { get; set; } | ||
|
||
private const string ansicHelp = "Generates the ANSI C stack code for the core model (not used for vendor defined models). The path to use when generating ANSI C stack code."; | ||
private const string stackHelp = "Generates the .NET stack code for the core model (not used for vendor defined models). The path to use when generating .NET stack code."; | ||
} | ||
|
||
[Verb("units", false, HelpText = "Generates the OPC UA Engineering Units CSV from the official UNECE table of units.")] | ||
public class UnitsOptions | ||
{ | ||
[Option("annex1", HelpText = annex1Help, Required = false)] | ||
public string Annex1Path { get; set; } | ||
|
||
[Option("annex2", HelpText = annex2Help, Required = false)] | ||
public string Annex2Path { get; set; } | ||
|
||
[Option("output", HelpText = outputHelp, Required = false)] | ||
public string OutputPath { get; set; } | ||
|
||
private const string annex1Help = "The path to the UNECE Annex 1 CSV file."; | ||
private const string annex2Help = "The path to the UNECE Annex 2/3 CSV file."; | ||
private const string outputHelp = "The units output directory."; | ||
} | ||
|
||
public class UpdateHeadersOptions | ||
{ | ||
} | ||
} | ||
|
||
//Opc.Ua.ModelCompiler.exe - d2 < filepath > -c[g] < filepath > -o2 < directorypath > | ||
|
||
//-console The output goes to the standard error output (console) instead of error window | ||
|
||
// OptionsNames: | ||
// | ||
//InputPath = "input"; | ||
//FilePattern = "pattern"; | ||
//LicenseType = "license"; | ||
//Silent = "silent"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.