Skip to content

Commit

Permalink
adds apax update option to the cake script, (#127)
Browse files Browse the repository at this point in the history
- providing the possibility of bulk update to latest apax packages
- updates libraries and projects to the latest apax packages
  • Loading branch information
PTKu authored Jul 17, 2023
1 parent 5fdb517 commit 8256e4a
Show file tree
Hide file tree
Showing 13 changed files with 69 additions and 11 deletions.
2 changes: 2 additions & 0 deletions build_with_update.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
dotnet run --project cake/Build.csproj --do-apax-update --do-test --test-level 10
exit $LASTEXITCODE;
27 changes: 27 additions & 0 deletions cake/ApaxCmd.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,33 @@ public static void ApaxBuild(this BuildContext context, (string folder, string n
context.ApaxBuild((app.folder, app.name));
}

public static void ApaxUpdate(this BuildContext context, (string folder, string name) lib)
{
context.Log.Information($"apax update started for '{lib.folder} : {lib.name}'");
var process = context.ProcessRunner.Start(Helpers.GetApaxCommand(), new ProcessSettings()
{
Arguments = "update --all",
WorkingDirectory = context.GetAxFolder(lib),
RedirectStandardOutput = false,
RedirectStandardError = false,
Silent = false
});

process.WaitForExit();
var exitcode = process.GetExitCode();
context.Log.Information($"apax update exited with '{exitcode}'");

if (exitcode != 0)
{
throw new BuildFailedException();
}
}

public static void ApaxUpdate(this BuildContext context, (string folder, string name, string targetIp, string targetPlatform) app)
{
context.ApaxUpdate((app.folder, app.name));
}

public static void ApaxPack(this BuildContext context, (string folder, string name) lib)
{
context.ProcessRunner.Start(Helpers.GetApaxCommand(), new ProcessSettings()
Expand Down
3 changes: 3 additions & 0 deletions cake/BuildParameters.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,7 @@ public class BuildParameters

[Option('r', "do-publish-release", Required = false, Default = false, HelpText = "Publishes release on GH")]
public bool DoPublishRelease { get; set; }

[Option('u', "do-apax-update", Required = false, Default = false, HelpText = "Publishes release on GH")]
public bool DoApaxUpdate { get; set; }
}
28 changes: 27 additions & 1 deletion cake/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
// https://github.com/ix-ax/ix/blob/master/LICENSE
// Third party licenses: https://github.com/ix-ax/ix/blob/master/notices.md


using System;
using System.Collections.Generic;
using System.Diagnostics.Contracts;
Expand Down Expand Up @@ -92,8 +93,33 @@ private static void ProvisionTools(BuildContext context)
}
}

[TaskName("Build")]
[TaskName("ApaxUpdateTask")]
[IsDependentOn(typeof(ProvisionTask))]
public sealed class ApaxUpdateTask : FrostingTask<BuildContext>
{
public override void Run(BuildContext context)
{
if (!context.BuildParameters.DoApaxUpdate)
return;

context.Libraries.ToList().ForEach(lib =>
{
context.ApaxUpdate(lib);
});

context.Integrations.ToList().ForEach(proj =>
{
context.ApaxUpdate(proj);
});



context.DotNetBuild(Path.Combine(context.RootDir, "AXOpen.sln"), context.DotNetBuildSettings);
}
}

[TaskName("Build")]
[IsDependentOn(typeof(ApaxUpdateTask))]
public sealed class BuildTask : FrostingTask<BuildContext>
{
public override void Run(BuildContext context)
Expand Down
2 changes: 1 addition & 1 deletion src/abstractions/ctrl/apax.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ targets:
files:
- src
devDependencies:
"@ax/sdk": ^4.0.2
"@ax/sdk": ^4.0.3
dependencies:
"@ax/system-strings": ^5.0.12
scripts:
Expand Down
2 changes: 1 addition & 1 deletion src/core/ctrl/apax.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ targets:
files:
- src
devDependencies:
"@ax/sdk": ^4.0.2
"@ax/sdk": ^4.0.3
scripts:
postbuild:
- dotnet ixc
Expand Down
2 changes: 1 addition & 1 deletion src/data/ctrl/apax.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ files:
dependencies:
"@ix-ax/axopen.core": '0.1.4-alpha.79'
devDependencies:
"@ax/sdk": ^4.0.2
"@ax/sdk": ^4.0.3
scripts:
postbuild:
- dotnet ixc
2 changes: 1 addition & 1 deletion src/integrations/ctrl/apax.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ targets:
- plcsim
- axunit-llvm
devDependencies:
"@ax/sdk": ^4.0.2
"@ax/sdk": ^4.0.3
"@ax/sld": ^0.15.9
dependencies:
"@ix-ax/axopen.data": '0.1.4-alpha.79'
Expand Down
2 changes: 1 addition & 1 deletion src/probers/ctrl/apax.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ files:
dependencies:
"@ix-ax/axopen.core": '0.1.4-alpha.79'
devDependencies:
"@ax/sdk": ^4.0.2
"@ax/sdk": ^4.0.3
variables:
APAX_BUILD_ARGS: [ -d ]

Expand Down
2 changes: 1 addition & 1 deletion src/simatic1500/ctrl/apax.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ dependencies:
"@ax/simatic-1500": ^4.0.8
"@ix-ax/axopen.abstractions": '0.1.4-alpha.79'
devDependencies:
"@ax/sdk": ^4.0.2
"@ax/sdk": ^4.0.3

scripts:
postbuild:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,10 @@
</data>
<data name="GROUND" xml:space="preserve">
<value>GROUND</value>
<comment>src\Examples\PneumaticManipulator.st,303</comment>
<comment>src\Examples\PneumaticManipulator.st,212</comment>
</data>
<data name="SERVICE" xml:space="preserve">
<value>SERVICE</value>
<comment>src\Examples\PneumaticManipulator.st,357</comment>
<comment>src\Examples\PneumaticManipulator.st,266</comment>
</data>
</root>
2 changes: 1 addition & 1 deletion src/templates.simple/ctrl/apax.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ targets:
- plcsim
- axunit-llvm
devDependencies:
"@ax/sdk": ^4.0.2
"@ax/sdk": ^4.0.3
"@ax/sld": ^0.15.9
dependencies:
"@ix-ax/axopen.data": '0.1.4-alpha.79'
Expand Down
2 changes: 1 addition & 1 deletion src/utils/ctrl/apax.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ targets:
files:
- src
devDependencies:
"@ax/sdk": ^4.0.2
"@ax/sdk": ^4.0.3
scripts:
postbuild:
- dotnet ixc
Expand Down

0 comments on commit 8256e4a

Please sign in to comment.