Skip to content

Commit

Permalink
Refactor and update configurations and dependencies
Browse files Browse the repository at this point in the history
Updated `CreateMergedConfigurations` in `CsOnlinerSourceBuilder.cs` to include additional `using` statements and added a closing brace. Introduced a partial class `unitsTwinController` in `Configurations.g.cs` with new properties. Updated `units.csproj` to reference newer versions of `AXSharp.Abstractions` and `AXSharp.Connector`. Adjusted test cases in `CliProgramTest.cs` to account for an additional output file. Disabled test parallelization in `Usings.cs`. Updated `apax-lock.json` for `@ax/sld` package version change and re-added `@ax/st-docs` package. Removed large blocks of code defining `ix_integration_plcTwinController` and `integratedTwinController` classes in `configuration.g.cs`. Removed multiple properties from `integratedTwinController` class in the `Pocos` namespace, while keeping the `Pokus` class unchanged.
  • Loading branch information
PTKu committed Dec 11, 2024
1 parent de7e0da commit 63dc7a2
Show file tree
Hide file tree
Showing 11 changed files with 43 additions and 273 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,24 @@ public void CreateMergedConfigurations(IxNodeVisitor visitor, Compilation compil
var configurations = compilation.GetActiveConfigurations();
if(configurations.Count == 0)
return;

AddToSource("using System;");
AddToSource("using AXSharp.Connector;");
AddToSource("using AXSharp.Connector.ValueTypes;");
AddToSource("using System.Collections.Generic;");
AddToSource("using AXSharp.Connector.Localizations;");
AddToSource("using AXSharp.Abstractions.Presentation;");

TypeCommAccessibility = configurations.First().GetCommAccessibility(this);

AddToSource(
$"public partial class {Project.TargetProject.ProjectRootNamespace}TwinController : ITwinController {{");
AddToSource($"public {typeof(Connector.Connector).n()} Connector {{ get; }}");

AddToSource(CsOnlinerMemberBuilder.Create(visitor, configurations, this).Output);
AddToSource(CsOnlinerConfigurationConstructorBuilder.Create(visitor, configurations, Project, this).Output);
AddToSource(CsOnlinerConfigurationConstructorBuilder.Create(visitor, configurations, Project, this).Output);
AddToSource("}");

}

/// <inheritdoc />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
using System;
using AXSharp.Connector;
using AXSharp.Connector.ValueTypes;
using System.Collections.Generic;
using AXSharp.Connector.Localizations;
using AXSharp.Abstractions.Presentation;

public partial class unitsTwinController : ITwinController
{
public AXSharp.Connector.Connector Connector { get; }
Expand Down Expand Up @@ -170,4 +177,5 @@ public unitsTwinController(AXSharp.Connector.ConnectorAdapter adapter)
s1 = new struct1(this.Connector, "", "s1");
s4 = new struct4(this.Connector, "", "s4");
mot1 = new SpecificMotorA(this.Connector, "", "mot1");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="AXSharp.Abstractions" Version="0.20.1-354-Update-to-stc-v8.274" />
<PackageReference Include="AXSharp.Connector" Version="0.20.1-354-Update-to-stc-v8.274" />
<PackageReference Include="AXSharp.Abstractions" Version="0.20.1-354-Update-to-stc-v8.275" />
<PackageReference Include="AXSharp.Connector" Version="0.20.1-354-Update-to-stc-v8.275" />
</ItemGroup>

<ItemGroup>
Expand Down
13 changes: 4 additions & 9 deletions src/AXSharp.compiler/tests/AXSharp.ixc.Tests/CliProgramTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public void should_run_with_default_settings()
ixc.Program.Main(new string[0]);

Assert.True(Directory.Exists(outputDirectory));
Assert.Equal(6, Directory.EnumerateFiles(outputDirectory, "*.*", SearchOption.AllDirectories).Count());
Assert.Equal(7, Directory.EnumerateFiles(outputDirectory, "*.*", SearchOption.AllDirectories).Count());
}
catch
{
Expand Down Expand Up @@ -79,7 +79,7 @@ public void should_run_with_setting_retrieved_from_config_file_settings()

Assert.True(Directory.Exists(outputDirectory));

Assert.Equal(8, Directory.EnumerateFiles(outputDirectory, "*.*", SearchOption.AllDirectories).Count());
Assert.Equal(9, Directory.EnumerateFiles(outputDirectory, "*.*", SearchOption.AllDirectories).Count());
}
catch
{
Expand All @@ -98,12 +98,7 @@ public void should_run_with_setting_retrieved_from_config_file_settings_but_over
var axProjectFolder = Path.Combine(TestFolder, "samples","plt","lib");
var config = AXSharpConfig.UpdateAndGetAXSharpConfig(axProjectFolder);
var outputDirectory = Path.GetFullPath(Path.Combine(axProjectFolder, $"..{Path.DirectorySeparatorChar}ix-lib-override"));

if (Directory.Exists(outputDirectory))
{
Directory.Delete(outputDirectory, true);
}


var recoverDirectory = Environment.CurrentDirectory;
Environment.CurrentDirectory = axProjectFolder;

Expand All @@ -113,7 +108,7 @@ public void should_run_with_setting_retrieved_from_config_file_settings_but_over

Assert.True(Directory.Exists(outputDirectory));

Assert.Equal(6, Directory.EnumerateFiles(outputDirectory, "*.*", SearchOption.AllDirectories).Count());
Assert.Equal(7, Directory.EnumerateFiles(outputDirectory, "*.*", SearchOption.AllDirectories).Count());
}
catch
{
Expand Down
4 changes: 3 additions & 1 deletion src/AXSharp.compiler/tests/AXSharp.ixc.Tests/Usings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,6 @@
// https://github.com/ix-ax/axsharp/blob/dev/LICENSE
// Third party licenses: https://github.com/ix-ax/axsharp/blob/master/notices.md

global using Xunit;
global using Xunit;

[assembly: CollectionBehavior(DisableTestParallelization = true)]
20 changes: 10 additions & 10 deletions src/AXSharp.connectors/tests/ax-test-project/apax-lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@
},
"@ax/sld": {
"name": "@ax/sld",
"version": "3.0.8",
"integrity": "sha512-4YSQf0eXLTGN0LmBBKFYUyhuhZAxH11W+kZfHAjXy5cIkJhhf5g50d/GDZHj5q5hcY/GEIerKLL+B3RUBejHgg==",
"resolved": "https://registry.simatic-ax.siemens.io/@ax/sld/-/sld-3.0.8.tgz",
"version": "3.0.9",
"integrity": "sha512-9JijTgtQdxjJOwTScqCciAMMMXn59whSKfYWTtndbjKkDhmds+GnuPJz2w0lQdS4IcFm9odxNWWV5I5lfwrZ0Q==",
"resolved": "https://registry.simatic-ax.siemens.io/@ax/sld/-/sld-3.0.9.tgz",
"cpu": [
"x64"
],
Expand Down Expand Up @@ -617,13 +617,6 @@
],
"dependencies": {}
},
"@ax/st-docs": {
"name": "@ax/st-docs",
"version": "7.1.87",
"integrity": "sha512-J5BthD1BR0fu1dkqQFyW3yOByC14TxhG+b/NUl2zXkSqjnsAQQbNtdheZquZ225x0qkJAR8wRrBx9Kr3QdYg8w==",
"resolved": "https://registry.simatic-ax.siemens.io/@ax/st-docs/-/st-docs-7.1.87.tgz",
"dependencies": {}
},
"@ax/system-strings": {
"name": "@ax/system-strings",
"version": "7.1.47",
Expand Down Expand Up @@ -686,6 +679,13 @@
],
"dependencies": {}
},
"@ax/st-docs": {
"name": "@ax/st-docs",
"version": "7.1.87",
"integrity": "sha512-J5BthD1BR0fu1dkqQFyW3yOByC14TxhG+b/NUl2zXkSqjnsAQQbNtdheZquZ225x0qkJAR8wRrBx9Kr3QdYg8w==",
"resolved": "https://registry.simatic-ax.siemens.io/@ax/st-docs/-/st-docs-7.1.87.tgz",
"dependencies": {}
},
"@ax/system-math": {
"name": "@ax/system-math",
"version": "7.1.47",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,73 +4,4 @@
using System.Collections.Generic;
using AXSharp.Connector.Localizations;
using AXSharp.Abstractions.Presentation;
using MonsterData;

public partial class ix_integration_plcTwinController : ITwinController
{
public AXSharp.Connector.Connector Connector { get; }
public all_primitives all_primitives { get; }
public weather weather { get; }
public weathers weathers { get; }
public Layouts.Stacked.weather weather_stacked { get; }
public Layouts.Wrapped.weather weather_wrapped { get; }
public Layouts.Tabbed.weather weather_tabbed { get; }

[ReadOnce()]
public Layouts.Stacked.weather weather_readOnce { get; }

[ReadOnly()]
public Layouts.Stacked.weather weather_readOnly { get; }
public example test_example { get; }
public MeasurementExample.Measurements measurements { get; }
public ixcomponent ixcomponent { get; }
public MonsterData.Monster monster { get; }

public ix_integration_plcTwinController(AXSharp.Connector.ConnectorAdapter adapter, object[] parameters)
{
this.Connector = adapter.GetConnector(parameters);
all_primitives = new all_primitives(this.Connector, "", "all_primitives");
weather = new weather(this.Connector, "", "weather");
weathers = new weathers(this.Connector, "", "weathers");
weather_stacked = new Layouts.Stacked.weather(this.Connector, "", "weather_stacked");
weather_stacked.AttributeName = "Weather in a stack pannel and grouped in group box";
weather_wrapped = new Layouts.Wrapped.weather(this.Connector, "", "weather_wrapped");
weather_wrapped.AttributeName = "Weather in a wrap pannel and grouped in group box";
weather_tabbed = new Layouts.Tabbed.weather(this.Connector, "", "weather_tabbed");
weather_tabbed.AttributeName = "Weather in a tabs and grouped in group box";
weather_readOnce = new Layouts.Stacked.weather(this.Connector, "", "weather_readOnce");
weather_readOnce.AttributeName = "Weather structure set to read once";
weather_readOnce.MakeReadOnce();
weather_readOnly = new Layouts.Stacked.weather(this.Connector, "", "weather_readOnly");
weather_readOnly.AttributeName = "Weather structure set to read only";
weather_readOnly.MakeReadOnly();
test_example = new example(this.Connector, "", "test_example");
measurements = new MeasurementExample.Measurements(this.Connector, "", "measurements");
ixcomponent = new ixcomponent(this.Connector, "", "ixcomponent");
monster = new MonsterData.Monster(this.Connector, "", "monster");
}

public ix_integration_plcTwinController(AXSharp.Connector.ConnectorAdapter adapter)
{
this.Connector = adapter.GetConnector(adapter.Parameters);
all_primitives = new all_primitives(this.Connector, "", "all_primitives");
weather = new weather(this.Connector, "", "weather");
weathers = new weathers(this.Connector, "", "weathers");
weather_stacked = new Layouts.Stacked.weather(this.Connector, "", "weather_stacked");
weather_stacked.AttributeName = "Weather in a stack pannel and grouped in group box";
weather_wrapped = new Layouts.Wrapped.weather(this.Connector, "", "weather_wrapped");
weather_wrapped.AttributeName = "Weather in a wrap pannel and grouped in group box";
weather_tabbed = new Layouts.Tabbed.weather(this.Connector, "", "weather_tabbed");
weather_tabbed.AttributeName = "Weather in a tabs and grouped in group box";
weather_readOnce = new Layouts.Stacked.weather(this.Connector, "", "weather_readOnce");
weather_readOnce.AttributeName = "Weather structure set to read once";
weather_readOnce.MakeReadOnce();
weather_readOnly = new Layouts.Stacked.weather(this.Connector, "", "weather_readOnly");
weather_readOnly.AttributeName = "Weather structure set to read only";
weather_readOnly.MakeReadOnly();
test_example = new example(this.Connector, "", "test_example");
measurements = new MeasurementExample.Measurements(this.Connector, "", "measurements");
ixcomponent = new ixcomponent(this.Connector, "", "ixcomponent");
monster = new MonsterData.Monster(this.Connector, "", "monster");
}
}
using MonsterData;
Original file line number Diff line number Diff line change
Expand Up @@ -5,29 +5,4 @@

namespace Pocos
{
public partial class ix_integration_plcTwinController
{
public all_primitives all_primitives { get; set; } = new all_primitives();
public weather weather { get; set; } = new weather();
public weathers weathers { get; set; } = new weathers();

[AXSharp.Connector.AddedPropertiesAttribute("AttributeName", "Weather in a stack pannel and grouped in group box")]
public Layouts.Stacked.weather weather_stacked { get; set; } = new Layouts.Stacked.weather();

[AXSharp.Connector.AddedPropertiesAttribute("AttributeName", "Weather in a wrap pannel and grouped in group box")]
public Layouts.Wrapped.weather weather_wrapped { get; set; } = new Layouts.Wrapped.weather();

[AXSharp.Connector.AddedPropertiesAttribute("AttributeName", "Weather in a tabs and grouped in group box")]
public Layouts.Tabbed.weather weather_tabbed { get; set; } = new Layouts.Tabbed.weather();

[AXSharp.Connector.AddedPropertiesAttribute("AttributeName", "Weather structure set to read once")]
public Layouts.Stacked.weather weather_readOnce { get; set; } = new Layouts.Stacked.weather();

[AXSharp.Connector.AddedPropertiesAttribute("AttributeName", "Weather structure set to read only")]
public Layouts.Stacked.weather weather_readOnly { get; set; } = new Layouts.Stacked.weather();
public example test_example { get; set; } = new example();
public MeasurementExample.Measurements measurements { get; set; } = new MeasurementExample.Measurements();
public ixcomponent ixcomponent { get; set; } = new ixcomponent();
public MonsterData.Monster monster { get; set; } = new MonsterData.Monster();
}
}
6 changes: 3 additions & 3 deletions src/tests.integrations/integrated/src/ax/apax-lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@
},
"@ax/sld": {
"name": "@ax/sld",
"version": "3.0.8",
"integrity": "sha512-4YSQf0eXLTGN0LmBBKFYUyhuhZAxH11W+kZfHAjXy5cIkJhhf5g50d/GDZHj5q5hcY/GEIerKLL+B3RUBejHgg==",
"resolved": "https://registry.simatic-ax.siemens.io/@ax/sld/-/sld-3.0.8.tgz",
"version": "3.0.9",
"integrity": "sha512-9JijTgtQdxjJOwTScqCciAMMMXn59whSKfYWTtndbjKkDhmds+GnuPJz2w0lQdS4IcFm9odxNWWV5I5lfwrZ0Q==",
"resolved": "https://registry.simatic-ax.siemens.io/@ax/sld/-/sld-3.0.9.tgz",
"cpu": [
"x64"
],
Expand Down
Loading

0 comments on commit 63dc7a2

Please sign in to comment.