From 82760fb5112b3411c652af1d71270a080f378ee8 Mon Sep 17 00:00:00 2001 From: TomKovac <61820360+TomKovac@users.noreply.github.com> Date: Mon, 13 Feb 2023 14:25:50 +0100 Subject: [PATCH 1/5] Sequencer Restore call on step with error state in Step_by_step mode added, when StepIn called --- .config/dotnet-tools.json | 2 +- .../src/Coordination/Sequencer/Sequencer.st | 5 +- .../abstractions/CommandTask/ICommandTask.st | 1 + .../ctrl/test/Coordination/SequencerTests.st | 54 +++++++++++++++++++ 4 files changed, 60 insertions(+), 2 deletions(-) diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index 4618d152c..721d4ae24 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -3,7 +3,7 @@ "isRoot": true, "tools": { "ix.ixc": { - "version": "0.13.0-alpha.32", + "version": "0.13.3-alpha.52", "commands": [ "ixc" ] diff --git a/src/core/ctrl/src/Coordination/Sequencer/Sequencer.st b/src/core/ctrl/src/Coordination/Sequencer/Sequencer.st index 35e71fc96..ccf6f34fc 100644 --- a/src/core/ctrl/src/Coordination/Sequencer/Sequencer.st +++ b/src/core/ctrl/src/Coordination/Sequencer/Sequencer.st @@ -113,12 +113,15 @@ NAMESPACE ix.framework.core step.SetIsDisabled(NOT step.GetIsActive()); END_IF; - IF step.GetIsActive() AND (step.IsReady() OR step.IsDone()) THEN + IF step.GetIsActive() AND (step.IsReady() OR step.IsDone() OR SteppingMode = eSteppingMode#StepByStep) THEN IF (SteppingMode = eSteppingMode#Continous) THEN step.Invoke(); // Invoke the step in a case of step mode when StepIn Command is invoked ELSIF (SteppingMode = eSteppingMode#StepByStep) THEN IF StepIn.Execute() THEN + IF _step.HasError() THEN + _step.Restore(); + END_IF; step.Invoke(); END_IF; END_IF; diff --git a/src/core/ctrl/src/abstractions/CommandTask/ICommandTask.st b/src/core/ctrl/src/abstractions/CommandTask/ICommandTask.st index a70087fc4..f88410492 100644 --- a/src/core/ctrl/src/abstractions/CommandTask/ICommandTask.st +++ b/src/core/ctrl/src/abstractions/CommandTask/ICommandTask.st @@ -10,6 +10,7 @@ NAMESPACE ix.framework.core METHOD IsReady : BOOL END_METHOD METHOD IsDone : BOOL END_METHOD METHOD IsBusy : BOOL END_METHOD + METHOD HasError : BOOL END_METHOD END_INTERFACE INTERFACE INTERNAL ICommandTaskInt METHOD SetIsDisabled VAR_INPUT Disabled : BOOL; END_VAR END_METHOD diff --git a/src/core/ctrl/test/Coordination/SequencerTests.st b/src/core/ctrl/test/Coordination/SequencerTests.st index 3459d7764..6772caff2 100644 --- a/src/core/ctrl/test/Coordination/SequencerTests.st +++ b/src/core/ctrl/test/Coordination/SequencerTests.st @@ -1647,6 +1647,60 @@ NAMESPACE ix.core.sequencer_tests Assert.Equal(THIS._counter,_sequencer.GetOnCompleteSequenceCounter()); END_METHOD + {Test} + METHOD PUBLIC StepInCommand_should_restore_and_invoke_the_current_step_when_it_was_in_error_state + VAR + count :ULINT; + END_VAR + // Arrange + _sequencer.SteppingMode := eSteppingMode#StepByStep; + Assert.Equal(TRUE ,THIS.Equal(_sequencer.SteppingMode, eSteppingMode#StepByStep)); + + THIS.ExecuteSequence(FALSE,FALSE); + _sequencer.StepIn.Invoke(); + + THIS.PrepareSequence(); + _context.Open(); + _sequencer.Open(); + + IF _step_1.Execute(_sequencer) THEN + count := count + ULINT#1; + _step_1.ThrowWhen(TRUE); + END_IF; + _step_2.Execute(_sequencer); + _step_3.Execute(_sequencer); + _context.Close(); + + Assert.Equal(ULINT#1, _sequencer.CurrentOrder); + Assert.Equal(TRUE,_step_1.IsActive); + Assert.Equal(FALSE,_step_1.IsReady()); + Assert.Equal(FALSE,_step_1.IsBusy()); + Assert.Equal(TRUE,_step_1.HasError()); + Assert.Equal(ULINT#1, count); + + // Act + _sequencer.StepIn.Invoke(); + + THIS.PrepareSequence(); + _context.Open(); + _sequencer.Open(); + + IF _step_1.Execute(_sequencer) THEN + count := count + ULINT#1; + END_IF; + _step_2.Execute(_sequencer); + _step_3.Execute(_sequencer); + _context.Close(); + + // Assert + Assert.Equal(ULINT#1, _sequencer.CurrentOrder); + Assert.Equal(TRUE,_step_1.IsActive); + Assert.Equal(FALSE,_step_1.IsReady()); + Assert.Equal(TRUE,_step_1.IsBusy()); + Assert.Equal(FALSE,_step_1.HasError()); + Assert.Equal(ULINT#2, count); + + END_METHOD END_CLASS END_NAMESPACE From 208002d28d816295d091977169eea818e54633f2 Mon Sep 17 00:00:00 2001 From: TomKovac <61820360+TomKovac@users.noreply.github.com> Date: Mon, 13 Feb 2023 16:42:00 +0100 Subject: [PATCH 2/5] Arrows added into the currently active step in the sequencer --- src/integrations/ctrl/src/recipe.st | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/integrations/ctrl/src/recipe.st b/src/integrations/ctrl/src/recipe.st index 2939f9737..22a3f9533 100644 --- a/src/integrations/ctrl/src/recipe.st +++ b/src/integrations/ctrl/src/recipe.st @@ -1,5 +1,5 @@ {#ix-attr:[Container(Layout.Tabs)]} -{#ix-attr:[Group(Layout.GroupBox)]} +{#ix-attr:[Group(GroupLayout.GroupBox)]} {#ix-set:AttributeName = "This is some structure"} CLASS PUBLIC Recipe VAR PUBLIC @@ -37,7 +37,7 @@ CLASS PUBLIC Measurements END_CLASS {#ix-attr:[Container(Layout.Wrap)]} -{#ix-attr:[Group(Layout.GroupBox)]} +{#ix-attr:[Group(GroupLayout.GroupBox)]} CLASS PUBLIC ContinuesValueCheckData VAR PUBLIC Min : REAL; From e18619945e80b086e98b952be9e6e85f3336fc62 Mon Sep 17 00:00:00 2001 From: TomKovac <61820360+TomKovac@users.noreply.github.com> Date: Mon, 13 Feb 2023 16:43:06 +0100 Subject: [PATCH 3/5] Arrows added into the description of the currently active step in the sequencer --- .../ctrl/test/Coordination/SequencerTests.st | 1 - .../Coordination/SequencerView.razor | 6 ++-- .../Coordination/StepView.razor | 34 +++++++++++++------ .../ix.framework.core.blazor.csproj | 4 +-- .../ix.framework.core.csproj | 2 +- .../integration.blazor.csproj | 2 +- .../integration.blazor/package-lock.json | 11 ++++++ src/integrations/ix.integrations/Entry.cs | 6 +++- .../ix.integrations/integrations.csproj | 6 ++-- 9 files changed, 50 insertions(+), 22 deletions(-) create mode 100644 src/integrations/integration.blazor/package-lock.json diff --git a/src/core/ctrl/test/Coordination/SequencerTests.st b/src/core/ctrl/test/Coordination/SequencerTests.st index 6772caff2..ab5cacf70 100644 --- a/src/core/ctrl/test/Coordination/SequencerTests.st +++ b/src/core/ctrl/test/Coordination/SequencerTests.st @@ -1699,7 +1699,6 @@ NAMESPACE ix.core.sequencer_tests Assert.Equal(TRUE,_step_1.IsBusy()); Assert.Equal(FALSE,_step_1.HasError()); Assert.Equal(ULINT#2, count); - END_METHOD END_CLASS END_NAMESPACE diff --git a/src/core/src/ix.framework.core.blazor/Coordination/SequencerView.razor b/src/core/src/ix.framework.core.blazor/Coordination/SequencerView.razor index 346ad941a..ef8c70228 100644 --- a/src/core/src/ix.framework.core.blazor/Coordination/SequencerView.razor +++ b/src/core/src/ix.framework.core.blazor/Coordination/SequencerView.razor @@ -7,14 +7,14 @@ -
+
+ Context="@Component.SequenceMode"/>
+ Context="@Component.SteppingMode"/>
diff --git a/src/core/src/ix.framework.core.blazor/Coordination/StepView.razor b/src/core/src/ix.framework.core.blazor/Coordination/StepView.razor index ef29e7444..7dcca53f3 100644 --- a/src/core/src/ix.framework.core.blazor/Coordination/StepView.razor +++ b/src/core/src/ix.framework.core.blazor/Coordination/StepView.razor @@ -3,23 +3,37 @@ @inherits RenderableComplexComponentBase -
-
-
+
+
+
+ @if (IsActive) + { + + + + @Component.Description + + + + } + else + { @Component.Description -
-
- @Component.Order.Cyclic -
-
- @Component.IsActive.Cyclic -
+ } +
+
+ @Component.Order.Cyclic +
+
+ @Component.IsActive.Cyclic
+
@code { public string RowClass = "bg-white text-dark"; + public bool IsActive => Component.IsActive.Cyclic == true; protected override void OnInitialized() { diff --git a/src/core/src/ix.framework.core.blazor/ix.framework.core.blazor.csproj b/src/core/src/ix.framework.core.blazor/ix.framework.core.blazor.csproj index be2e43355..07abfa87c 100644 --- a/src/core/src/ix.framework.core.blazor/ix.framework.core.blazor.csproj +++ b/src/core/src/ix.framework.core.blazor/ix.framework.core.blazor.csproj @@ -21,8 +21,8 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - - + + diff --git a/src/core/src/ix.framework.core/ix.framework.core.csproj b/src/core/src/ix.framework.core/ix.framework.core.csproj index fd5153571..dedb06dfc 100644 --- a/src/core/src/ix.framework.core/ix.framework.core.csproj +++ b/src/core/src/ix.framework.core/ix.framework.core.csproj @@ -10,7 +10,7 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/src/integrations/integration.blazor/integration.blazor.csproj b/src/integrations/integration.blazor/integration.blazor.csproj index ae405cc21..ab6e978b2 100644 --- a/src/integrations/integration.blazor/integration.blazor.csproj +++ b/src/integrations/integration.blazor/integration.blazor.csproj @@ -33,7 +33,7 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/src/integrations/integration.blazor/package-lock.json b/src/integrations/integration.blazor/package-lock.json new file mode 100644 index 000000000..a1067c7ca --- /dev/null +++ b/src/integrations/integration.blazor/package-lock.json @@ -0,0 +1,11 @@ +{ + "requires": true, + "lockfileVersion": 1, + "dependencies": { + "bootstrap-icons": { + "version": "1.10.3", + "resolved": "https://registry.npmjs.org/bootstrap-icons/-/bootstrap-icons-1.10.3.tgz", + "integrity": "sha512-7Qvj0j0idEm/DdX9Q0CpxAnJYqBCFCiUI6qzSPYfERMcokVuV9Mdm/AJiVZI8+Gawe4h/l6zFcOzvV7oXCZArw==" + } + } +} diff --git a/src/integrations/ix.integrations/Entry.cs b/src/integrations/ix.integrations/Entry.cs index e5e86d456..1baed6375 100644 --- a/src/integrations/ix.integrations/Entry.cs +++ b/src/integrations/ix.integrations/Entry.cs @@ -12,6 +12,10 @@ public static class Entry { public static integrationsTwinController Plc { get; } = new(ConnectorAdapterBuilder.Build() - .CreateWebApi(System.Environment.GetEnvironmentVariable("AXTARGET"), "Everybody", "", true)); + .CreateWebApi(System.Environment.GetEnvironmentVariable("AXTARGET"), "Everybody", "", true)); + + //public static integrationsTwinController Plc { get; } + // = new(ConnectorAdapterBuilder.Build() + // .CreateDummy()); } } diff --git a/src/integrations/ix.integrations/integrations.csproj b/src/integrations/ix.integrations/integrations.csproj index 5f3d4a3f9..972461b29 100644 --- a/src/integrations/ix.integrations/integrations.csproj +++ b/src/integrations/ix.integrations/integrations.csproj @@ -10,9 +10,9 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - - - + + + From 9be7c1488d9f43f03a4e773ee97edf91a647817c Mon Sep 17 00:00:00 2001 From: Peter <61538034+PTKu@users.noreply.github.com> Date: Tue, 14 Feb 2023 06:01:54 +0100 Subject: [PATCH 4/5] [infrastructure] improvement to cake --- .config/dotnet-tools.json | 2 +- cake/ApaxCmd.cs | 111 ++++++++++++++++++ cake/BuildContext.cs | 104 +++++----------- cake/Program.cs | 72 ++---------- publish.ps1 | 4 + src/core/ctrl/apax.yml | 2 +- .../ix.framework.core.blazor.csproj | 4 +- .../ix.framework.core.csproj | 2 +- src/integrations/ctrl/src/recipe.st | 4 +- .../integration.blazor.csproj | 2 +- .../ix.integrations/integrations.csproj | 6 +- src/workspace.ix.framework.code-workspace | 8 +- test.ps1 | 4 + 13 files changed, 178 insertions(+), 147 deletions(-) create mode 100644 cake/ApaxCmd.cs create mode 100644 publish.ps1 create mode 100644 test.ps1 diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index 4618d152c..984bb4c9f 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -3,7 +3,7 @@ "isRoot": true, "tools": { "ix.ixc": { - "version": "0.13.0-alpha.32", + "version": "0.13.3-alpha.53", "commands": [ "ixc" ] diff --git a/cake/ApaxCmd.cs b/cake/ApaxCmd.cs new file mode 100644 index 000000000..f27c7e1c7 --- /dev/null +++ b/cake/ApaxCmd.cs @@ -0,0 +1,111 @@ +// Build +// Copyright (c) 2023 Peter Kurhajec (PTKu), MTS, and Contributors. All Rights Reserved. +// Contributors: https://github.com/ix-ax/ix/graphs/contributors +// See the LICENSE file in the repository root for more information. +// https://github.com/ix-ax/ix/blob/master/LICENSE +// Third party licenses: https://github.com/ix-ax/ix/blob/master/notices.md + +using System.IO; +using Cake.Core.IO; +using Path = System.IO.Path; + +public static class ApaxCmd +{ + public static void ApaxInstall(this BuildContext context, (string folder, string name) lib) + { + context.ProcessRunner.Start(Helpers.GetApaxCommand(), new ProcessSettings() + { + Arguments = "install -L", + WorkingDirectory = context.GetAxFolder(lib), + RedirectStandardOutput = false, + RedirectStandardError = false, + Silent = false + }).WaitForExit(); + } + + public static void ApaxClean(this BuildContext context, (string folder, string name) lib) + { + context.ProcessRunner.Start(Helpers.GetApaxCommand(), new ProcessSettings() + { + Arguments = "clean", + WorkingDirectory = context.GetAxFolder(lib), + RedirectStandardOutput = false, + RedirectStandardError = false, + Silent = false + }).WaitForExit(); + } + + public static void ApaxBuild(this BuildContext context, (string folder, string name) lib) + { + context.ProcessRunner.Start(Helpers.GetApaxCommand(), new ProcessSettings() + { + Arguments = "build", + WorkingDirectory = context.GetAxFolder(lib), + RedirectStandardOutput = false, + RedirectStandardError = false, + Silent = false + }).WaitForExit(); + } + + public static void ApaxPack(this BuildContext context, (string folder, string name) lib) + { + context.ProcessRunner.Start(Helpers.GetApaxCommand(), new ProcessSettings() + { + Arguments = "pack", + WorkingDirectory = context.GetAxFolder(lib), + RedirectStandardOutput = false, + RedirectStandardError = false, + Silent = false + }).WaitForExit(); + } + + public static void ApaxTest(this BuildContext context, (string folder, string name) lib) + { + context.ProcessRunner.Start(Helpers.GetApaxCommand(), new ProcessSettings() + { + Arguments = "test", + WorkingDirectory = context.GetAxFolder(lib), + RedirectStandardOutput = false, + RedirectStandardError = false, + Silent = false + }).WaitForExit(); + } + + public static void ApaxCopyArtifacts(this BuildContext context, (string folder, string name) lib) + { + var libraryFolder = Path.Combine(Path.Combine(context.RootDir, lib.folder), "ctrl"); + var packageFile = $"ix-ax-{lib.name}-{GitVersionInformation.SemVer}.apax.tgz"; + var sourceFile = Path.Combine(libraryFolder, packageFile); + + File.Copy(sourceFile, Path.Combine(context.ArtifactsApax, packageFile)); + } + + + public static void ApaxPublish(this BuildContext context, (string folder, string name) lib) + { + + foreach (var apaxPackageFile in Directory.EnumerateFiles(context.ArtifactsApax)) + { + context.ProcessRunner.Start(Helpers.GetApaxCommand(), new ProcessSettings() + { + Arguments = $"publish -p {apaxPackageFile} -r https://npm.pkg.github.com", + WorkingDirectory = context.ArtifactsApax, + RedirectStandardOutput = false, + RedirectStandardError = false, + Silent = false + }).WaitForExit(); + } + + + //var libraryFolder = Path.Combine(Path.Combine(context.RootDir, lib.folder), "ctrl"); + //var packageFile = $"ix-ax-{lib.name}-{GitVersionInformation.SemVer}.apax.tgz"; + //context.ProcessRunner.Start(Helpers.GetApaxCommand(), new ProcessSettings() + //{ + // Arguments = $"publish -p {packageFile} -r https://npm.pkg.github.com", + // WorkingDirectory = libraryFolder, + // RedirectStandardOutput = false, + // RedirectStandardError = false, + // Silent = false + //}).WaitForExit(); + } +} \ No newline at end of file diff --git a/cake/BuildContext.cs b/cake/BuildContext.cs index b2344ea02..1689460a1 100644 --- a/cake/BuildContext.cs +++ b/cake/BuildContext.cs @@ -8,21 +8,46 @@ using System.Collections; using System.Collections.Generic; using System.IO; +using System.Text; using Cake.Common.Tools.DotNet; using Cake.Common.Tools.DotNet.Build; using Cake.Common.Tools.DotNet.MSBuild; using Cake.Common.Tools.DotNet.Run; using Cake.Common.Tools.DotNet.Test; using Cake.Core; -using Cake.Core.IO; using Cake.Frosting; using Polly; using Path = System.IO.Path; public class BuildContext : FrostingContext { + + public void UpdateApaxVersion(string file, string version) + { + var sb = new StringBuilder(); + foreach (var line in System.IO.File.ReadLines(file)) + { + var newLine = line; + + if (line.Trim().StartsWith("version")) + { + var semicPosition = line.IndexOf(":"); + var lenght = line.Length - semicPosition; + + newLine = $"{line.Substring(0, semicPosition)} : '{version}'"; + } + sb.AppendLine(newLine); + } + + System.IO.File.WriteAllText(file, sb.ToString()); + } public string Artifacts => Path.Combine(Environment.WorkingDirectory.FullPath, "..//artifacts//"); + public string ArtifactsApax => EnsureFolder(Path.Combine(Artifacts, "apax")); + public string ArtifactsNugets => EnsureFolder(Path.Combine(Artifacts, "nugets")); + + public string PackableNugetsSlnf => Path.Combine(RootDir, "ix.framework-packable-only.slnf"); + public string WorkDirName => Environment.WorkingDirectory.GetDirectoryName(); public string ApiDocumentationDir => Path.GetFullPath(Path.Combine(Environment.WorkingDirectory.FullPath, "..//docs//api//")); @@ -92,81 +117,14 @@ public string GetApaxFile((string folder, string name) library) { return Path.Combine(Path.Combine(RootDir, library.folder), "ctrl", "apax.yml"); } -} -public static class Apax -{ - public static void ApaxInstall(this BuildContext context, (string folder, string name) lib) + public string EnsureFolder(string path) { - context.ProcessRunner.Start(Helpers.GetApaxCommand(), new ProcessSettings() + if (!Directory.Exists(path)) { - Arguments = "install -L", - WorkingDirectory = context.GetAxFolder(lib), - RedirectStandardOutput = false, - RedirectStandardError = false, - Silent = false - }).WaitForExit(); - } + Directory.CreateDirectory(path); + } - public static void ApaxClean(this BuildContext context, (string folder, string name) lib) - { - context.ProcessRunner.Start(Helpers.GetApaxCommand(), new ProcessSettings() - { - Arguments = "clean", - WorkingDirectory = context.GetAxFolder(lib), - RedirectStandardOutput = false, - RedirectStandardError = false, - Silent = false - }).WaitForExit(); - } - - public static void ApaxBuild(this BuildContext context, (string folder, string name) lib) - { - context.ProcessRunner.Start(Helpers.GetApaxCommand(), new ProcessSettings() - { - Arguments = "build", - WorkingDirectory = context.GetAxFolder(lib), - RedirectStandardOutput = false, - RedirectStandardError = false, - Silent = false - }).WaitForExit(); - } - - public static void ApaxPack(this BuildContext context, (string folder, string name) lib) - { - context.ProcessRunner.Start(Helpers.GetApaxCommand(), new ProcessSettings() - { - Arguments = "pack", - WorkingDirectory = context.GetAxFolder(lib), - RedirectStandardOutput = false, - RedirectStandardError = false, - Silent = false - }).WaitForExit(); - } - - public static void ApaxTest(this BuildContext context, (string folder, string name) lib) - { - context.ProcessRunner.Start(Helpers.GetApaxCommand(), new ProcessSettings() - { - Arguments = "test", - WorkingDirectory = context.GetAxFolder(lib), - RedirectStandardOutput = false, - RedirectStandardError = false, - Silent = false - }).WaitForExit(); - } - - public static void ApaxPublish(this BuildContext context, (string folder, string name) lib) - { - var libraryFolder = Path.Combine(Path.Combine(context.RootDir, lib.folder), "ctrl"); - var packageFile = $"ix-ax-{lib.name}-{GitVersionInformation.SemVer}.apax.tgz"; - context.ProcessRunner.Start(Helpers.GetApaxCommand(), new ProcessSettings() - { - Arguments = $"publish -p {packageFile} -r https://npm.pkg.github.com", - WorkingDirectory = libraryFolder, - RedirectStandardOutput = false, - RedirectStandardError = false, - Silent = false - }).WaitForExit(); + return path; } } \ No newline at end of file diff --git a/cake/Program.cs b/cake/Program.cs index 00f9d5db5..e6e95be95 100644 --- a/cake/Program.cs +++ b/cake/Program.cs @@ -131,25 +131,7 @@ public override void Run(BuildContext context) [IsDependentOn(typeof(TestsTask))] public sealed class CreateArtifactsTask : FrostingTask { - private void UpdateApaxVersion(string file, string version) - { - var sb = new StringBuilder(); - foreach (var line in System.IO.File.ReadLines(file)) - { - var newLine = line; - - if (line.Trim().StartsWith("version")) - { - var semicPosition = line.IndexOf(":"); - var lenght = line.Length - semicPosition; - - newLine = $"{line.Substring(0, semicPosition)} : '{version}'"; - } - sb.AppendLine(newLine); - } - - System.IO.File.WriteAllText(file, sb.ToString()); - } + public override void Run(BuildContext context) { @@ -159,33 +141,27 @@ public override void Run(BuildContext context) return; } + PackApax(context); + PackNugets(context); + } + + private static void PackApax(BuildContext context) + { context.Libraries.ToList().ForEach(lib => { - UpdateApaxVersion(context.GetApaxFile(lib), GitVersionInformation.SemVer); + context.UpdateApaxVersion(context.GetApaxFile(lib), GitVersionInformation.SemVer); context.ApaxPack(lib); + context.ApaxCopyArtifacts(lib); }); - - PackPackages(context, Path.Combine(context.RootDir, "ix.framework-packable-only.slnf")); } - private static void PackTemplatePackages(BuildContext context, string solutionToPack) - { - context.DotNetPack(solutionToPack, - new Cake.Common.Tools.DotNet.Pack.DotNetPackSettings() - { - OutputDirectory = Path.Combine(context.Artifacts, @"nugets"), - Sources = new List() { Path.Combine(context.Artifacts, "nugets") }, - NoRestore = false, - NoBuild = false, - }); - } - private static void PackPackages(BuildContext context, string solutionToPack) + private static void PackNugets(BuildContext context) { - context.DotNetPack(solutionToPack, + context.DotNetPack(context.PackableNugetsSlnf, new Cake.Common.Tools.DotNet.Pack.DotNetPackSettings() { - OutputDirectory = Path.Combine(context.Artifacts, @"nugets"), + OutputDirectory = Path.Combine(context.ArtifactsNugets), NoRestore = true, NoBuild = false, }); @@ -206,29 +182,7 @@ public override void Run(BuildContext context) if (Helpers.CanReleaseInternal()) { - //GenerateApiDocumentation(context, - // @$"ix.connectors\src\Ix.Connector\bin\{context.DotNetBuildSettings.Configuration}\net6.0\Ix.Connector.dll", - // @"Ix.Connector"); - //GenerateApiDocumentation(context, - // @$"ix.connectors\src\Ix.Connector.S71500.WebAP\bin\{context.DotNetBuildSettings.Configuration}\net6.0\Ix.Connector.S71500.WebAPI.dll", - // @"Ix.Connector.S71500.WebAPI"); - - //GenerateApiDocumentation(context, - // @$"ix.builder\src\IX.Compiler\bin\{context.DotNetBuildSettings.Configuration}\net6.0\IX.Compiler.dll", - // @"IX.Compiler"); - //GenerateApiDocumentation(context, - // @$"ix.builder\src\IX.Cs.Compiler\bin\{context.DotNetBuildSettings.Configuration}\net6.0\IX.Compiler.Cs.dll", - // @"IX.Compiler.Cs"); - - //GenerateApiDocumentation(context, - // @$"ix.abstractions\src\Ix.Abstractions\bin\{context.DotNetBuildSettings.Configuration}\net6.0\Ix.Abstractions.dll", - // @"Ix.Abstractions"); - //GenerateApiDocumentation(context, - // @$"ix.blazor\src\Ix.Presentation.Blazor\bin\{context.DotNetBuildSettings.Configuration}\net6.0\Ix.Presentation.Blazor.dll", - // @"Ix.Presentation.Blazor"); - //GenerateApiDocumentation(context, - // @$"ix.blazor\src\Ix.Presentation.Blazor.Controls\bin\{context.DotNetBuildSettings.Configuration}\net6.0\Ix.Presentation.Blazor.Controls.dll", - // @"Ix.Presentation.Blazor.Controls"); + } } diff --git a/publish.ps1 b/publish.ps1 new file mode 100644 index 000000000..9e332447b --- /dev/null +++ b/publish.ps1 @@ -0,0 +1,4 @@ +# run build + +dotnet run --project cake/Build.csproj --do-test true --do-pack true --do-publish true --test-level 100 +exit $LASTEXITCODE; \ No newline at end of file diff --git a/src/core/ctrl/apax.yml b/src/core/ctrl/apax.yml index 028b9a221..fd43360f9 100644 --- a/src/core/ctrl/apax.yml +++ b/src/core/ctrl/apax.yml @@ -1,5 +1,5 @@ name: "@ix-ax/ix.framework.core" -version : '0.1.0-updates-from-pku-org.1' +version : '0.1.0-20-complete-build-script-for-ixframework.1' type: lib targets: - "1500" diff --git a/src/core/src/ix.framework.core.blazor/ix.framework.core.blazor.csproj b/src/core/src/ix.framework.core.blazor/ix.framework.core.blazor.csproj index be2e43355..03e04f908 100644 --- a/src/core/src/ix.framework.core.blazor/ix.framework.core.blazor.csproj +++ b/src/core/src/ix.framework.core.blazor/ix.framework.core.blazor.csproj @@ -21,8 +21,8 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - - + + diff --git a/src/core/src/ix.framework.core/ix.framework.core.csproj b/src/core/src/ix.framework.core/ix.framework.core.csproj index fd5153571..c0c935d49 100644 --- a/src/core/src/ix.framework.core/ix.framework.core.csproj +++ b/src/core/src/ix.framework.core/ix.framework.core.csproj @@ -10,7 +10,7 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/src/integrations/ctrl/src/recipe.st b/src/integrations/ctrl/src/recipe.st index 2939f9737..22a3f9533 100644 --- a/src/integrations/ctrl/src/recipe.st +++ b/src/integrations/ctrl/src/recipe.st @@ -1,5 +1,5 @@ {#ix-attr:[Container(Layout.Tabs)]} -{#ix-attr:[Group(Layout.GroupBox)]} +{#ix-attr:[Group(GroupLayout.GroupBox)]} {#ix-set:AttributeName = "This is some structure"} CLASS PUBLIC Recipe VAR PUBLIC @@ -37,7 +37,7 @@ CLASS PUBLIC Measurements END_CLASS {#ix-attr:[Container(Layout.Wrap)]} -{#ix-attr:[Group(Layout.GroupBox)]} +{#ix-attr:[Group(GroupLayout.GroupBox)]} CLASS PUBLIC ContinuesValueCheckData VAR PUBLIC Min : REAL; diff --git a/src/integrations/integration.blazor/integration.blazor.csproj b/src/integrations/integration.blazor/integration.blazor.csproj index ae405cc21..0b4602412 100644 --- a/src/integrations/integration.blazor/integration.blazor.csproj +++ b/src/integrations/integration.blazor/integration.blazor.csproj @@ -33,7 +33,7 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/src/integrations/ix.integrations/integrations.csproj b/src/integrations/ix.integrations/integrations.csproj index 5f3d4a3f9..5f80df9d8 100644 --- a/src/integrations/ix.integrations/integrations.csproj +++ b/src/integrations/ix.integrations/integrations.csproj @@ -10,9 +10,9 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - - - + + + diff --git a/src/workspace.ix.framework.code-workspace b/src/workspace.ix.framework.code-workspace index bfc0bc92f..a7eb14f23 100644 --- a/src/workspace.ix.framework.code-workspace +++ b/src/workspace.ix.framework.code-workspace @@ -1,12 +1,12 @@ { "folders": [ - { - "name": "core", - "path": "core\\ctrl" - }, { "name": "integrations", "path": "integrations\\ctrl" + }, + { + "name": "core", + "path": "core\\ctrl" } ], "settings": {} diff --git a/test.ps1 b/test.ps1 new file mode 100644 index 000000000..eeb4d0b95 --- /dev/null +++ b/test.ps1 @@ -0,0 +1,4 @@ +# run build + +dotnet run --project cake/Build.csproj --do-test true --do-pack true --test-level 10 +exit $LASTEXITCODE; \ No newline at end of file From 7b0c1042952eb8f6584a83d9e75aeb306badb2b1 Mon Sep 17 00:00:00 2001 From: Peter <61538034+PTKu@users.noreply.github.com> Date: Tue, 14 Feb 2023 09:39:31 +0100 Subject: [PATCH 5/5] failed plc test prevent pipeline to finish, adds version update for plc dependencies of this repo --- cake/ApaxCmd.cs | 33 +++++++++++++----------- cake/BuildContext.cs | 29 +++++++++++++++++++++ cake/BuildParameters.cs | 2 +- cake/Program.cs | 46 +++++++++++----------------------- cake/TestFailedException.cs | 12 +++++++++ src/core/ctrl/apax.yml | 2 +- src/integrations/ctrl/apax.yml | 8 +++--- 7 files changed, 81 insertions(+), 51 deletions(-) create mode 100644 cake/TestFailedException.cs diff --git a/cake/ApaxCmd.cs b/cake/ApaxCmd.cs index f27c7e1c7..680430d19 100644 --- a/cake/ApaxCmd.cs +++ b/cake/ApaxCmd.cs @@ -61,20 +61,37 @@ public static void ApaxPack(this BuildContext context, (string folder, string na public static void ApaxTest(this BuildContext context, (string folder, string name) lib) { - context.ProcessRunner.Start(Helpers.GetApaxCommand(), new ProcessSettings() + var process = context.ProcessRunner.Start(Helpers.GetApaxCommand(), new ProcessSettings() { Arguments = "test", WorkingDirectory = context.GetAxFolder(lib), RedirectStandardOutput = false, RedirectStandardError = false, Silent = false + }); + + process.WaitForExit(); + + if(process.GetExitCode() != 0) + throw new TestFailedException(); + } + + public static void ApaxIxc(this BuildContext context, (string folder, string name) lib) + { + context.ProcessRunner.Start(Helpers.GetApaxCommand(), new ProcessSettings() + { + Arguments = "ixc", + WorkingDirectory = context.GetAxFolder(lib), + RedirectStandardOutput = false, + RedirectStandardError = false, + Silent = false }).WaitForExit(); } public static void ApaxCopyArtifacts(this BuildContext context, (string folder, string name) lib) { var libraryFolder = Path.Combine(Path.Combine(context.RootDir, lib.folder), "ctrl"); - var packageFile = $"ix-ax-{lib.name}-{GitVersionInformation.SemVer}.apax.tgz"; + var packageFile = $"{context.ApaxRegistry}-{lib.name}-{GitVersionInformation.SemVer}.apax.tgz"; var sourceFile = Path.Combine(libraryFolder, packageFile); File.Copy(sourceFile, Path.Combine(context.ArtifactsApax, packageFile)); @@ -95,17 +112,5 @@ public static void ApaxPublish(this BuildContext context, (string folder, string Silent = false }).WaitForExit(); } - - - //var libraryFolder = Path.Combine(Path.Combine(context.RootDir, lib.folder), "ctrl"); - //var packageFile = $"ix-ax-{lib.name}-{GitVersionInformation.SemVer}.apax.tgz"; - //context.ProcessRunner.Start(Helpers.GetApaxCommand(), new ProcessSettings() - //{ - // Arguments = $"publish -p {packageFile} -r https://npm.pkg.github.com", - // WorkingDirectory = libraryFolder, - // RedirectStandardOutput = false, - // RedirectStandardError = false, - // Silent = false - //}).WaitForExit(); } } \ No newline at end of file diff --git a/cake/BuildContext.cs b/cake/BuildContext.cs index 1689460a1..a22263a21 100644 --- a/cake/BuildContext.cs +++ b/cake/BuildContext.cs @@ -8,6 +8,7 @@ using System.Collections; using System.Collections.Generic; using System.IO; +using System.Linq; using System.Text; using Cake.Common.Tools.DotNet; using Cake.Common.Tools.DotNet.Build; @@ -22,6 +23,8 @@ public class BuildContext : FrostingContext { + public string ApaxRegistry => "ix-ax"; + public void UpdateApaxVersion(string file, string version) { var sb = new StringBuilder(); @@ -41,9 +44,35 @@ public void UpdateApaxVersion(string file, string version) System.IO.File.WriteAllText(file, sb.ToString()); } + + public void UpdateApaxDependencies(string file, IEnumerable dependencies, string version) + { + var sb = new StringBuilder(); + foreach (var line in System.IO.File.ReadLines(file)) + { + var newLine = line; + + foreach (var dependency in dependencies.Select(p => $"\"@{ApaxRegistry}/{p}\"")) + { + if (line.Trim().StartsWith(dependency)) + { + var semicPosition = line.IndexOf(":"); + var lenght = line.Length - semicPosition; + + newLine = $"{line.Substring(0, semicPosition)} : '{version}'"; + } + } + + sb.AppendLine(newLine); + } + + System.IO.File.WriteAllText(file, sb.ToString()); + } + public string Artifacts => Path.Combine(Environment.WorkingDirectory.FullPath, "..//artifacts//"); public string ArtifactsApax => EnsureFolder(Path.Combine(Artifacts, "apax")); + public string ArtifactsNugets => EnsureFolder(Path.Combine(Artifacts, "nugets")); public string PackableNugetsSlnf => Path.Combine(RootDir, "ix.framework-packable-only.slnf"); diff --git a/cake/BuildParameters.cs b/cake/BuildParameters.cs index 3c35d6d76..f9538a1b1 100644 --- a/cake/BuildParameters.cs +++ b/cake/BuildParameters.cs @@ -10,7 +10,7 @@ public class BuildParameters { - [Option('t', "do-test", Required = false, Default = false, HelpText = "Runs tests")] + [Option('t', "do-test", Required = false, Default = true, HelpText = "Runs tests")] public bool DoTest { get; set; } [Option('d', "do-docs", Required = false, Default = false, HelpText = "Generates documentation")] diff --git a/cake/Program.cs b/cake/Program.cs index e6e95be95..fd7f247ea 100644 --- a/cake/Program.cs +++ b/cake/Program.cs @@ -95,14 +95,25 @@ public sealed class BuildTask : FrostingTask { public override void Run(BuildContext context) { - context.Libraries.ToList().ForEach(lib => + context.Libraries.ToList().ForEach(lib => { + context.UpdateApaxVersion(context.GetApaxFile(lib), GitVersionInformation.SemVer); + context.UpdateApaxDependencies(context.GetApaxFile(lib), context.Libraries.Select(p => context.GetApaxFile(p)), GitVersionInformation.SemVer); context.ApaxInstall(lib); context.ApaxBuild(lib); + //context.ApaxIxc(lib); }); - context.Integrations.ToList().ForEach(proj => context.ApaxInstall(proj)); - context.Integrations.ToList().ForEach(proj => context.ApaxBuild(proj)); + context.Integrations.ToList().ForEach(proj => + { + context.UpdateApaxVersion(context.GetApaxFile(proj), GitVersionInformation.SemVer); + context.UpdateApaxDependencies(context.GetApaxFile(proj), context.Libraries.Select(p => p.name), GitVersionInformation.SemVer); + context.ApaxInstall(proj); + context.ApaxBuild(proj); + //context.ApaxIxc(proj); + }); + + context.DotNetBuild(Path.Combine(context.RootDir, "ix.framework.sln"), context.DotNetBuildSettings); } @@ -149,7 +160,6 @@ private static void PackApax(BuildContext context) { context.Libraries.ToList().ForEach(lib => { - context.UpdateApaxVersion(context.GetApaxFile(lib), GitVersionInformation.SemVer); context.ApaxPack(lib); context.ApaxCopyArtifacts(lib); }); @@ -205,33 +215,7 @@ public sealed class LicenseComplianceCheckTask : FrostingTask { public override void Run(BuildContext context) { - ////var licensedFiles = Directory.EnumerateFiles(Path.Combine(context.RootDir, "apax", ".apax", "packages"), - //var licensedFiles = Directory.EnumerateFiles(Path.Combine(context.RootDir, "apax", "stc"), - // "AX.*.*", - // SearchOption.AllDirectories) - // .Select(p => new FileInfo(p)); - - //if (licensedFiles.Count() < 5) - // throw new Exception(""); - - - //foreach (var nugetFile in Directory.EnumerateFiles(context.Artifacts, "*.nupkg", SearchOption.AllDirectories)) - //{ - // using (var zip = ZipFile.OpenRead(nugetFile)) - // { - // var ouptutDir = Path.Combine(context.Artifacts, "verif"); - // zip.ExtractToDirectory(Path.Combine(context.Artifacts, "verif")); - - // if (Directory.EnumerateFiles(ouptutDir, "*.*", SearchOption.AllDirectories) - // .Select(p => new FileInfo(p)) - // .Any(p => licensedFiles.Any(l => l.Name == p.Name))) - // { - // throw new Exception(""); - // } - - // Directory.Delete(ouptutDir, true); - // } - //} + } } diff --git a/cake/TestFailedException.cs b/cake/TestFailedException.cs new file mode 100644 index 000000000..0faec77ad --- /dev/null +++ b/cake/TestFailedException.cs @@ -0,0 +1,12 @@ +// Build +// Copyright (c) 2023 Peter Kurhajec (PTKu), MTS, and Contributors. All Rights Reserved. +// Contributors: https://github.com/ix-ax/ix/graphs/contributors +// See the LICENSE file in the repository root for more information. +// https://github.com/ix-ax/ix/blob/master/LICENSE +// Third party licenses: https://github.com/ix-ax/ix/blob/master/notices.md + +using System; + +public class TestFailedException : Exception +{ +} \ No newline at end of file diff --git a/src/core/ctrl/apax.yml b/src/core/ctrl/apax.yml index fd43360f9..e029a3539 100644 --- a/src/core/ctrl/apax.yml +++ b/src/core/ctrl/apax.yml @@ -1,5 +1,5 @@ name: "@ix-ax/ix.framework.core" -version : '0.1.0-20-complete-build-script-for-ixframework.1' +version : '0.1.0-20-complete-build-script-for-ixframework.1' type: lib targets: - "1500" diff --git a/src/integrations/ctrl/apax.yml b/src/integrations/ctrl/apax.yml index 123533dcc..23dacaa89 100644 --- a/src/integrations/ctrl/apax.yml +++ b/src/integrations/ctrl/apax.yml @@ -1,13 +1,13 @@ name: "integrations" -version: 0.0.0 +version : '0.1.0-20-complete-build-script-for-ixframework.1' type: app targets: - "1500" - plcsim -# - axunit-llvm -# - axunit + - axunit-llvm + - axunit dependencies: - "@ix-ax/ix.framework.core": '^0.1.0-alpha.0' + "@ix-ax/ix.framework.core" : '0.1.0-20-complete-build-script-for-ixframework.1' "@ax/sdk": ^3.0.8 variables: APAX_BUILD_ARGS: [ -d ]