Skip to content

Commit 63dc7a2

Browse files
committed
Refactor and update configurations and dependencies
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.
1 parent de7e0da commit 63dc7a2

File tree

11 files changed

+43
-273
lines changed

11 files changed

+43
-273
lines changed

src/AXSharp.compiler/src/AXSharp.Cs.Compiler/Onliner/CsOnlinerSourceBuilder.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,24 @@ public void CreateMergedConfigurations(IxNodeVisitor visitor, Compilation compil
4545
var configurations = compilation.GetActiveConfigurations();
4646
if(configurations.Count == 0)
4747
return;
48+
49+
AddToSource("using System;");
50+
AddToSource("using AXSharp.Connector;");
51+
AddToSource("using AXSharp.Connector.ValueTypes;");
52+
AddToSource("using System.Collections.Generic;");
53+
AddToSource("using AXSharp.Connector.Localizations;");
54+
AddToSource("using AXSharp.Abstractions.Presentation;");
55+
4856
TypeCommAccessibility = configurations.First().GetCommAccessibility(this);
4957

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

5462
AddToSource(CsOnlinerMemberBuilder.Create(visitor, configurations, this).Output);
55-
AddToSource(CsOnlinerConfigurationConstructorBuilder.Create(visitor, configurations, Project, this).Output);
63+
AddToSource(CsOnlinerConfigurationConstructorBuilder.Create(visitor, configurations, Project, this).Output);
64+
AddToSource("}");
65+
5666
}
5767

5868
/// <inheritdoc />

src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/.g/Configurations.g.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
using System;
2+
using AXSharp.Connector;
3+
using AXSharp.Connector.ValueTypes;
4+
using System.Collections.Generic;
5+
using AXSharp.Connector.Localizations;
6+
using AXSharp.Abstractions.Presentation;
7+
18
public partial class unitsTwinController : ITwinController
29
{
310
public AXSharp.Connector.Connector Connector { get; }
@@ -170,4 +177,5 @@ public unitsTwinController(AXSharp.Connector.ConnectorAdapter adapter)
170177
s1 = new struct1(this.Connector, "", "s1");
171178
s4 = new struct4(this.Connector, "", "s4");
172179
mot1 = new SpecificMotorA(this.Connector, "", "mot1");
173-
}
180+
}
181+
}

src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/units.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
</PropertyGroup>
77

88
<ItemGroup>
9-
<PackageReference Include="AXSharp.Abstractions" Version="0.20.1-354-Update-to-stc-v8.274" />
10-
<PackageReference Include="AXSharp.Connector" Version="0.20.1-354-Update-to-stc-v8.274" />
9+
<PackageReference Include="AXSharp.Abstractions" Version="0.20.1-354-Update-to-stc-v8.275" />
10+
<PackageReference Include="AXSharp.Connector" Version="0.20.1-354-Update-to-stc-v8.275" />
1111
</ItemGroup>
1212

1313
<ItemGroup>

src/AXSharp.compiler/tests/AXSharp.ixc.Tests/CliProgramTest.cs

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public void should_run_with_default_settings()
4646
ixc.Program.Main(new string[0]);
4747

4848
Assert.True(Directory.Exists(outputDirectory));
49-
Assert.Equal(6, Directory.EnumerateFiles(outputDirectory, "*.*", SearchOption.AllDirectories).Count());
49+
Assert.Equal(7, Directory.EnumerateFiles(outputDirectory, "*.*", SearchOption.AllDirectories).Count());
5050
}
5151
catch
5252
{
@@ -79,7 +79,7 @@ public void should_run_with_setting_retrieved_from_config_file_settings()
7979

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

82-
Assert.Equal(8, Directory.EnumerateFiles(outputDirectory, "*.*", SearchOption.AllDirectories).Count());
82+
Assert.Equal(9, Directory.EnumerateFiles(outputDirectory, "*.*", SearchOption.AllDirectories).Count());
8383
}
8484
catch
8585
{
@@ -98,12 +98,7 @@ public void should_run_with_setting_retrieved_from_config_file_settings_but_over
9898
var axProjectFolder = Path.Combine(TestFolder, "samples","plt","lib");
9999
var config = AXSharpConfig.UpdateAndGetAXSharpConfig(axProjectFolder);
100100
var outputDirectory = Path.GetFullPath(Path.Combine(axProjectFolder, $"..{Path.DirectorySeparatorChar}ix-lib-override"));
101-
102-
if (Directory.Exists(outputDirectory))
103-
{
104-
Directory.Delete(outputDirectory, true);
105-
}
106-
101+
107102
var recoverDirectory = Environment.CurrentDirectory;
108103
Environment.CurrentDirectory = axProjectFolder;
109104

@@ -113,7 +108,7 @@ public void should_run_with_setting_retrieved_from_config_file_settings_but_over
113108

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

116-
Assert.Equal(6, Directory.EnumerateFiles(outputDirectory, "*.*", SearchOption.AllDirectories).Count());
111+
Assert.Equal(7, Directory.EnumerateFiles(outputDirectory, "*.*", SearchOption.AllDirectories).Count());
117112
}
118113
catch
119114
{

src/AXSharp.compiler/tests/AXSharp.ixc.Tests/Usings.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,6 @@
55
// https://github.com/ix-ax/axsharp/blob/dev/LICENSE
66
// Third party licenses: https://github.com/ix-ax/axsharp/blob/master/notices.md
77

8-
global using Xunit;
8+
global using Xunit;
9+
10+
[assembly: CollectionBehavior(DisableTestParallelization = true)]

src/AXSharp.connectors/tests/ax-test-project/apax-lock.json

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@
4141
},
4242
"@ax/sld": {
4343
"name": "@ax/sld",
44-
"version": "3.0.8",
45-
"integrity": "sha512-4YSQf0eXLTGN0LmBBKFYUyhuhZAxH11W+kZfHAjXy5cIkJhhf5g50d/GDZHj5q5hcY/GEIerKLL+B3RUBejHgg==",
46-
"resolved": "https://registry.simatic-ax.siemens.io/@ax/sld/-/sld-3.0.8.tgz",
44+
"version": "3.0.9",
45+
"integrity": "sha512-9JijTgtQdxjJOwTScqCciAMMMXn59whSKfYWTtndbjKkDhmds+GnuPJz2w0lQdS4IcFm9odxNWWV5I5lfwrZ0Q==",
46+
"resolved": "https://registry.simatic-ax.siemens.io/@ax/sld/-/sld-3.0.9.tgz",
4747
"cpu": [
4848
"x64"
4949
],
@@ -617,13 +617,6 @@
617617
],
618618
"dependencies": {}
619619
},
620-
"@ax/st-docs": {
621-
"name": "@ax/st-docs",
622-
"version": "7.1.87",
623-
"integrity": "sha512-J5BthD1BR0fu1dkqQFyW3yOByC14TxhG+b/NUl2zXkSqjnsAQQbNtdheZquZ225x0qkJAR8wRrBx9Kr3QdYg8w==",
624-
"resolved": "https://registry.simatic-ax.siemens.io/@ax/st-docs/-/st-docs-7.1.87.tgz",
625-
"dependencies": {}
626-
},
627620
"@ax/system-strings": {
628621
"name": "@ax/system-strings",
629622
"version": "7.1.47",
@@ -686,6 +679,13 @@
686679
],
687680
"dependencies": {}
688681
},
682+
"@ax/st-docs": {
683+
"name": "@ax/st-docs",
684+
"version": "7.1.87",
685+
"integrity": "sha512-J5BthD1BR0fu1dkqQFyW3yOByC14TxhG+b/NUl2zXkSqjnsAQQbNtdheZquZ225x0qkJAR8wRrBx9Kr3QdYg8w==",
686+
"resolved": "https://registry.simatic-ax.siemens.io/@ax/st-docs/-/st-docs-7.1.87.tgz",
687+
"dependencies": {}
688+
},
689689
"@ax/system-math": {
690690
"name": "@ax/system-math",
691691
"version": "7.1.47",

src/sanbox/integration/ix-integration-plc/ix/.g/Onliners/configuration.g.cs

Lines changed: 1 addition & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -4,73 +4,4 @@
44
using System.Collections.Generic;
55
using AXSharp.Connector.Localizations;
66
using AXSharp.Abstractions.Presentation;
7-
using MonsterData;
8-
9-
public partial class ix_integration_plcTwinController : ITwinController
10-
{
11-
public AXSharp.Connector.Connector Connector { get; }
12-
public all_primitives all_primitives { get; }
13-
public weather weather { get; }
14-
public weathers weathers { get; }
15-
public Layouts.Stacked.weather weather_stacked { get; }
16-
public Layouts.Wrapped.weather weather_wrapped { get; }
17-
public Layouts.Tabbed.weather weather_tabbed { get; }
18-
19-
[ReadOnce()]
20-
public Layouts.Stacked.weather weather_readOnce { get; }
21-
22-
[ReadOnly()]
23-
public Layouts.Stacked.weather weather_readOnly { get; }
24-
public example test_example { get; }
25-
public MeasurementExample.Measurements measurements { get; }
26-
public ixcomponent ixcomponent { get; }
27-
public MonsterData.Monster monster { get; }
28-
29-
public ix_integration_plcTwinController(AXSharp.Connector.ConnectorAdapter adapter, object[] parameters)
30-
{
31-
this.Connector = adapter.GetConnector(parameters);
32-
all_primitives = new all_primitives(this.Connector, "", "all_primitives");
33-
weather = new weather(this.Connector, "", "weather");
34-
weathers = new weathers(this.Connector, "", "weathers");
35-
weather_stacked = new Layouts.Stacked.weather(this.Connector, "", "weather_stacked");
36-
weather_stacked.AttributeName = "Weather in a stack pannel and grouped in group box";
37-
weather_wrapped = new Layouts.Wrapped.weather(this.Connector, "", "weather_wrapped");
38-
weather_wrapped.AttributeName = "Weather in a wrap pannel and grouped in group box";
39-
weather_tabbed = new Layouts.Tabbed.weather(this.Connector, "", "weather_tabbed");
40-
weather_tabbed.AttributeName = "Weather in a tabs and grouped in group box";
41-
weather_readOnce = new Layouts.Stacked.weather(this.Connector, "", "weather_readOnce");
42-
weather_readOnce.AttributeName = "Weather structure set to read once";
43-
weather_readOnce.MakeReadOnce();
44-
weather_readOnly = new Layouts.Stacked.weather(this.Connector, "", "weather_readOnly");
45-
weather_readOnly.AttributeName = "Weather structure set to read only";
46-
weather_readOnly.MakeReadOnly();
47-
test_example = new example(this.Connector, "", "test_example");
48-
measurements = new MeasurementExample.Measurements(this.Connector, "", "measurements");
49-
ixcomponent = new ixcomponent(this.Connector, "", "ixcomponent");
50-
monster = new MonsterData.Monster(this.Connector, "", "monster");
51-
}
52-
53-
public ix_integration_plcTwinController(AXSharp.Connector.ConnectorAdapter adapter)
54-
{
55-
this.Connector = adapter.GetConnector(adapter.Parameters);
56-
all_primitives = new all_primitives(this.Connector, "", "all_primitives");
57-
weather = new weather(this.Connector, "", "weather");
58-
weathers = new weathers(this.Connector, "", "weathers");
59-
weather_stacked = new Layouts.Stacked.weather(this.Connector, "", "weather_stacked");
60-
weather_stacked.AttributeName = "Weather in a stack pannel and grouped in group box";
61-
weather_wrapped = new Layouts.Wrapped.weather(this.Connector, "", "weather_wrapped");
62-
weather_wrapped.AttributeName = "Weather in a wrap pannel and grouped in group box";
63-
weather_tabbed = new Layouts.Tabbed.weather(this.Connector, "", "weather_tabbed");
64-
weather_tabbed.AttributeName = "Weather in a tabs and grouped in group box";
65-
weather_readOnce = new Layouts.Stacked.weather(this.Connector, "", "weather_readOnce");
66-
weather_readOnce.AttributeName = "Weather structure set to read once";
67-
weather_readOnce.MakeReadOnce();
68-
weather_readOnly = new Layouts.Stacked.weather(this.Connector, "", "weather_readOnly");
69-
weather_readOnly.AttributeName = "Weather structure set to read only";
70-
weather_readOnly.MakeReadOnly();
71-
test_example = new example(this.Connector, "", "test_example");
72-
measurements = new MeasurementExample.Measurements(this.Connector, "", "measurements");
73-
ixcomponent = new ixcomponent(this.Connector, "", "ixcomponent");
74-
monster = new MonsterData.Monster(this.Connector, "", "monster");
75-
}
76-
}
7+
using MonsterData;

src/sanbox/integration/ix-integration-plc/ix/.g/POCO/configuration.g.cs

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -5,29 +5,4 @@
55

66
namespace Pocos
77
{
8-
public partial class ix_integration_plcTwinController
9-
{
10-
public all_primitives all_primitives { get; set; } = new all_primitives();
11-
public weather weather { get; set; } = new weather();
12-
public weathers weathers { get; set; } = new weathers();
13-
14-
[AXSharp.Connector.AddedPropertiesAttribute("AttributeName", "Weather in a stack pannel and grouped in group box")]
15-
public Layouts.Stacked.weather weather_stacked { get; set; } = new Layouts.Stacked.weather();
16-
17-
[AXSharp.Connector.AddedPropertiesAttribute("AttributeName", "Weather in a wrap pannel and grouped in group box")]
18-
public Layouts.Wrapped.weather weather_wrapped { get; set; } = new Layouts.Wrapped.weather();
19-
20-
[AXSharp.Connector.AddedPropertiesAttribute("AttributeName", "Weather in a tabs and grouped in group box")]
21-
public Layouts.Tabbed.weather weather_tabbed { get; set; } = new Layouts.Tabbed.weather();
22-
23-
[AXSharp.Connector.AddedPropertiesAttribute("AttributeName", "Weather structure set to read once")]
24-
public Layouts.Stacked.weather weather_readOnce { get; set; } = new Layouts.Stacked.weather();
25-
26-
[AXSharp.Connector.AddedPropertiesAttribute("AttributeName", "Weather structure set to read only")]
27-
public Layouts.Stacked.weather weather_readOnly { get; set; } = new Layouts.Stacked.weather();
28-
public example test_example { get; set; } = new example();
29-
public MeasurementExample.Measurements measurements { get; set; } = new MeasurementExample.Measurements();
30-
public ixcomponent ixcomponent { get; set; } = new ixcomponent();
31-
public MonsterData.Monster monster { get; set; } = new MonsterData.Monster();
32-
}
338
}

src/tests.integrations/integrated/src/ax/apax-lock.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@
4141
},
4242
"@ax/sld": {
4343
"name": "@ax/sld",
44-
"version": "3.0.8",
45-
"integrity": "sha512-4YSQf0eXLTGN0LmBBKFYUyhuhZAxH11W+kZfHAjXy5cIkJhhf5g50d/GDZHj5q5hcY/GEIerKLL+B3RUBejHgg==",
46-
"resolved": "https://registry.simatic-ax.siemens.io/@ax/sld/-/sld-3.0.8.tgz",
44+
"version": "3.0.9",
45+
"integrity": "sha512-9JijTgtQdxjJOwTScqCciAMMMXn59whSKfYWTtndbjKkDhmds+GnuPJz2w0lQdS4IcFm9odxNWWV5I5lfwrZ0Q==",
46+
"resolved": "https://registry.simatic-ax.siemens.io/@ax/sld/-/sld-3.0.9.tgz",
4747
"cpu": [
4848
"x64"
4949
],

0 commit comments

Comments
 (0)