Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions notices.md
Original file line number Diff line number Diff line change
Expand Up @@ -370,3 +370,17 @@ INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PA
AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

# ResXResourceReader.NetStandard

https://github.com/farlee2121/ResXResourceReader.NetStandard/blob/main/LICENSE.md

MIT License

Copyright (c) 2020 Spencer Farley

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
4 changes: 3 additions & 1 deletion src/ix-L1-tests.slnf
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@
"ix.blazor\\tests\\sandbox\\Ix.RenderableContent.Tests\\Ix.RenderableContent.Tests.csproj",
"ix.blazor\\tests\\sandbox\\ax-blazor-example\\ix\\ax-blazor-example.csproj",
"ix.compiler\\tests\\IX.CompilerTests\\Ix.CompilerTests.csproj",
"ix.compiler\\tests\\Ix.Compiler.CsTests\\Ix.Compiler.CsTests.csproj",
"ix.compiler\\tests\\Ix.ixc.Tests\\Ix.ixc.Tests.csproj",
"ix.compiler\\tests\\Ix.ixr.Tests\\Ix.ixr.Tests.csproj",
"ix.connectors\\tests\\Ix.ConnectorLegacyTests\\Ix.ConnectorLegacyTests.csproj",
"ix.connectors\\tests\\Ix.ConnectorTests\\Ix.ConnectorTests\\Ix.ConnectorTests.csproj",
"ix.connectors\\tests\\Ix.ConnectorTests\\Ix.ConnectorTests\\Ix.ConnectorTests.csproj"
]
}
}
1 change: 1 addition & 0 deletions src/ix-L2-tests.slnf
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"ix.compiler\\tests\\IX.CompilerTests\\Ix.CompilerTests.csproj",
"ix.compiler\\tests\\Ix.Compiler.CsTests\\Ix.Compiler.CsTests.csproj",
"ix.compiler\\tests\\Ix.ixc.Tests\\Ix.ixc.Tests.csproj",
"ix.compiler\\tests\\Ix.ixr.Tests\\Ix.ixr.Tests.csproj",
"ix.connectors\\tests\\Ix.ConnectorLegacyTests\\Ix.ConnectorLegacyTests.csproj",
"ix.connectors\\tests\\Ix.ConnectorTests\\Ix.ConnectorTests\\Ix.ConnectorTests.csproj",
"ix.connectors\\tests\\ax-test-project\\ix\\ax_test_project.csproj",
Expand Down
3 changes: 3 additions & 0 deletions src/ix-L3-tests.slnf
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,12 @@
"ix.compiler\\src\\IX.Cs.Compiler\\Ix.Compiler.Cs.csproj",
"ix.compiler\\src\\Ix.Compiler.Abstractions\\Ix.Compiler.Abstractions.csproj",
"ix.compiler\\src\\ixc\\Ix.ixc.csproj",
"ix.compiler\\src\\ixd\\Ix.ixd.csproj",
"ix.compiler\\src\\ixr\\Ix.ixr.csproj",
"ix.compiler\\tests\\IX.CompilerTests\\Ix.CompilerTests.csproj",
"ix.compiler\\tests\\Ix.Compiler.CsTests\\Ix.Compiler.CsTests.csproj",
"ix.compiler\\tests\\Ix.ixc.Tests\\Ix.ixc.Tests.csproj",
"ix.compiler\\tests\\Ix.ixr.Tests\\Ix.ixr.Tests.csproj",
"ix.connectors\\src\\Ix.Connector.S71500.WebAPI\\Ix.Connector.S71500.WebAPI.csproj",
"ix.connectors\\src\\Ix.Connector\\Ix.Connector.csproj",
"ix.connectors\\tests\\Ix.Connector.Sax.WebAPITests\\Ix.Connector.S71500.WebAPITests.csproj",
Expand Down
1 change: 1 addition & 0 deletions src/ix.compiler/src/IX.Compiler/Ix.Compiler.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="CliWrap" Version="3.6.0" />
<PackageReference Include="GitVersion.MsBuild" Version="5.10.3">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
Expand Down
93 changes: 93 additions & 0 deletions src/ix.compiler/src/IX.Compiler/LegalAcrobatics.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
using CliWrap;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;

namespace Ix.Compiler
{
public static class LegalAcrobatics
{
public static async Task LegalComplianceAcrobatics(string entryAssemblyLocation)
{
/*
We need this to comply with the Siemens legal requirement to allow only users that have access
to simatic-ax to some APIs.
*/

var stcapipath = Path.GetFullPath(Path.Combine(entryAssemblyLocation, $".apax//.apax//packages//@ax//{GetStcNameByPlatform()}//bin//"));

if(!Directory.Exists(stcapipath))
{
await ApaxInstallLegalAcrobatics(entryAssemblyLocation);
}

SetupAssemblyResolverLegalAcrobatics(entryAssemblyLocation);
}

static IEnumerable<Assembly> AXAssemblies { get; set; }


static void SetupAssemblyResolverLegalAcrobatics(string entryAssemblyLocation)
{
var axAssemblies = new List<Assembly>();

foreach (var assemblyFile in Directory.EnumerateFiles(
Path.GetFullPath(Path.Combine(entryAssemblyLocation, $".apax//.apax//packages//@ax//{GetStcNameByPlatform()}//bin//")), "*.dll"))
{
try
{
axAssemblies.Add(Assembly.LoadFile(assemblyFile));
}
catch (System.BadImageFormatException e)
{
// We just ignore this...there might be some libraries that we just cannot load, but we do not need them.
}
}

AXAssemblies = axAssemblies;

AppDomain.CurrentDomain.AssemblyResolve += CurrentDomain_AssemblyResolve;
}

static async Task ApaxInstallLegalAcrobatics(string entryAssemblyLocation)
{
var stdOutBuffer = new StringBuilder();
var stdErrBuffer = new StringBuilder();
try
{
Directory.CreateDirectory(Path.Combine(entryAssemblyLocation, ".apax"));
Log.Logger.Information("Restoring apax packages.\n" +
"You need have access to apax registry.\n" +
"use 'apax login' if you did not do it yet.");
var result = await Cli.Wrap("apax")
.WithArguments("install")
.WithWorkingDirectory(Path.Combine(entryAssemblyLocation, ".apax"))
.WithValidation(CommandResultValidation.None)
.WithStandardOutputPipe(PipeTarget.ToStringBuilder(stdOutBuffer))
.WithStandardErrorPipe(PipeTarget.ToStringBuilder(stdErrBuffer))
.ExecuteAsync();
}
catch(Exception ex)
{
Log.Logger.Error("There was a problem restoring apax packages.", ex);
}
finally
{
Log.Logger.Information(stdOutBuffer.ToString());
Log.Logger.Information(stdErrBuffer.ToString());
}
}

static Assembly? CurrentDomain_AssemblyResolve(object? sender, ResolveEventArgs args)
{
return AXAssemblies.FirstOrDefault(p => p.FullName == args.Name);
}

static string GetStcNameByPlatform()
=> RuntimeInformation.IsOSPlatform(OSPlatform.Linux) ? "stc-linux-x64" : "stc-win-x64";
}
}
1 change: 0 additions & 1 deletion src/ix.compiler/src/ixc/Ix.ixc.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="CliWrap" Version="3.5.0" />
<PackageReference Include="CommandLineParser" Version="2.9.1" />
<PackageReference Include="GitVersion.MsBuild" Version="5.10.3">
<PrivateAssets>all</PrivateAssets>
Expand Down
81 changes: 1 addition & 80 deletions src/ix.compiler/src/ixc/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ public static class Program

public static void Main(string[] args)
{

LegalComplianceAcrobatics().Wait();
LegalAcrobatics.LegalComplianceAcrobatics(new FileInfo(Assembly.GetExecutingAssembly().Location).Directory.FullName).Wait();

DisplayInfo();

Expand All @@ -53,81 +52,6 @@ public static void Main(string[] args)
});
}

private static async Task LegalComplianceAcrobatics()
{
/*
We need this to comply with the Siemens legal requirement to allow only users that have access
to simatic-ax to some APIs.
*/

var entryAssemblyLocation = new FileInfo(Assembly.GetExecutingAssembly().Location).Directory.FullName;
var stcapipath = Path.GetFullPath(Path.Combine(entryAssemblyLocation, $".apax//.apax//packages//@ax//{GetStcNameByPlatform()}//bin//"));

if(!Directory.Exists(stcapipath))
{
await ApaxInstallLegalAcrobatics(entryAssemblyLocation);
}

SetupAssemblyResolverLegalAcrobatics(entryAssemblyLocation);
}

private static void SetupAssemblyResolverLegalAcrobatics(string entryAssemblyLocation)
{
var axAssemblies = new List<Assembly>();

foreach (var assemblyFile in Directory.EnumerateFiles(
Path.GetFullPath(Path.Combine(entryAssemblyLocation, $".apax//.apax//packages//@ax//{GetStcNameByPlatform()}//bin//")), "*.dll"))
{
try
{
axAssemblies.Add(Assembly.LoadFile(assemblyFile));
}
catch (System.BadImageFormatException e)
{
// We just ignore this...there might be some libraries that we just cannot load, but we do not need them.
}
}

AXAssemblies = axAssemblies;

AppDomain.CurrentDomain.AssemblyResolve += CurrentDomain_AssemblyResolve;
}

private static async Task ApaxInstallLegalAcrobatics(string entryAssemblyLocation)
{
var stdOutBuffer = new StringBuilder();
var stdErrBuffer = new StringBuilder();
try
{
Log.Logger.Information("Restoring apax packages.\n" +
"You need have access to apax registry.\n" +
"use 'apax login' if you did not do it yet.");
var result = await Cli.Wrap("apax")
.WithArguments("install")
.WithWorkingDirectory(Path.Combine(entryAssemblyLocation, ".apax"))
.WithValidation(CommandResultValidation.None)
.WithStandardOutputPipe(PipeTarget.ToStringBuilder(stdOutBuffer))
.WithStandardErrorPipe(PipeTarget.ToStringBuilder(stdErrBuffer))
.ExecuteAsync();
}
catch(Exception ex)
{
Log.Logger.Error("There was a problem restoring apax packages.", ex);
}
finally
{
Log.Logger.Information(stdOutBuffer.ToString());
Log.Logger.Information(stdErrBuffer.ToString());
}
}

private static IEnumerable<Assembly> AXAssemblies { get; set; }

private static Assembly? CurrentDomain_AssemblyResolve(object? sender, ResolveEventArgs args)
{
return AXAssemblies.FirstOrDefault(p => p.FullName == args.Name);
}

private static string GetFullPath(string path)
{
if (Path.IsPathRooted(path))
Expand Down Expand Up @@ -183,7 +107,4 @@ private static void DisplayInfo()
}
}

private static string GetStcNameByPlatform()
=> RuntimeInformation.IsOSPlatform(OSPlatform.Linux) ? "stc-linux-x64" : "stc-win-x64";

}
3 changes: 1 addition & 2 deletions src/ix.compiler/src/ixd/Ix.ixd.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<TargetFrameworks>net6.0;net7.0</TargetFrameworks>
<RootNamespace>Ix.ixc_doc</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
Expand Down Expand Up @@ -33,7 +33,6 @@
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="13.0.2" />
<PackageReference Include="YamlDotNet" Version="13.0.0" />
<PackageReference Include="CliWrap" Version="3.5.0" />
<PackageReference Include="CommandLineParser" Version="2.9.1" />
<PackageReference Include="GitVersion.MsBuild" Version="5.10.3">
<PrivateAssets>all</PrivateAssets>
Expand Down
85 changes: 1 addition & 84 deletions src/ix.compiler/src/ixd/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@


Console.WriteLine(Logo);
LegalAcrobatics.LegalComplianceAcrobatics().Wait();
LegalAcrobatics.LegalComplianceAcrobatics(new FileInfo(Assembly.GetExecutingAssembly().Location).Directory.FullName).Wait();
Console.WriteLine("Ixd compiler - st to yml compiler for Docfx");
Parser.Default.ParseArguments<Options>(args)
.WithParsed(o =>
Expand Down Expand Up @@ -91,87 +91,4 @@ void DeleteYamlFilesIfExists(string outputPath)
}
}

public static class LegalAcrobatics
{
public static async Task LegalComplianceAcrobatics()
{
/*
We need this to comply with the Siemens legal requirement to allow only users that have access
to simatic-ax to some APIs.
*/

var entryAssemblyLocation = new FileInfo(Assembly.GetExecutingAssembly().Location).Directory.FullName;
var stcapipath = Path.GetFullPath(Path.Combine(entryAssemblyLocation, $".apax//.apax//packages//@ax//{GetStcNameByPlatform()}//bin//"));

if(!Directory.Exists(stcapipath))
{
await ApaxInstallLegalAcrobatics(entryAssemblyLocation);
}

SetupAssemblyResolverLegalAcrobatics(entryAssemblyLocation);
}

static IEnumerable<Assembly> AXAssemblies { get; set; }


static void SetupAssemblyResolverLegalAcrobatics(string entryAssemblyLocation)
{
var axAssemblies = new List<Assembly>();

foreach (var assemblyFile in Directory.EnumerateFiles(
Path.GetFullPath(Path.Combine(entryAssemblyLocation, $".apax//.apax//packages//@ax//{GetStcNameByPlatform()}//bin//")), "*.dll"))
{
try
{
axAssemblies.Add(Assembly.LoadFile(assemblyFile));
}
catch (System.BadImageFormatException e)
{
// We just ignore this...there might be some libraries that we just cannot load, but we do not need them.
}
}

AXAssemblies = axAssemblies;

AppDomain.CurrentDomain.AssemblyResolve += CurrentDomain_AssemblyResolve;
}

static async Task ApaxInstallLegalAcrobatics(string entryAssemblyLocation)
{
var stdOutBuffer = new StringBuilder();
var stdErrBuffer = new StringBuilder();
try
{
Directory.CreateDirectory(Path.Combine(entryAssemblyLocation, ".apax"));
Log.Logger.Information("Restoring apax packages.\n" +
"You need have access to apax registry.\n" +
"use 'apax login' if you did not do it yet.");
var result = await Cli.Wrap("apax")
.WithArguments("install")
.WithWorkingDirectory(Path.Combine(entryAssemblyLocation, ".apax"))
.WithValidation(CommandResultValidation.None)
.WithStandardOutputPipe(PipeTarget.ToStringBuilder(stdOutBuffer))
.WithStandardErrorPipe(PipeTarget.ToStringBuilder(stdErrBuffer))
.ExecuteAsync();
}
catch(Exception ex)
{
Log.Logger.Error("There was a problem restoring apax packages.", ex);
}
finally
{
Log.Logger.Information(stdOutBuffer.ToString());
Log.Logger.Information(stdErrBuffer.ToString());
}
}

static Assembly? CurrentDomain_AssemblyResolve(object? sender, ResolveEventArgs args)
{
return AXAssemblies.FirstOrDefault(p => p.FullName == args.Name);
}

static string GetStcNameByPlatform()
=> RuntimeInformation.IsOSPlatform(OSPlatform.Linux) ? "stc-linux-x64" : "stc-win-x64";
}


1 change: 0 additions & 1 deletion src/ix.compiler/src/ixd/Schemas/YamlSchema.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using YamlDotNet.Serialization;
using static System.Runtime.InteropServices.JavaScript.JSType;
using YamlDotNet.Serialization.NamingConventions;

namespace Ix.ixc_doc.Schemas
Expand Down
2 changes: 1 addition & 1 deletion src/ix.compiler/src/ixd/Visitors/YamlBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
using System.Xml.Linq;
using YamlDotNet.Serialization;
using YamlDotNet.Serialization.NamingConventions;
using static System.Runtime.InteropServices.JavaScript.JSType;


namespace Ix.ixc_doc.Visitors
{
Expand Down
Loading