Skip to content
Draft
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
3 changes: 1 addition & 2 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,7 @@
<!-- Build & Packaging -->
<PackageVersion Include="Microsoft.NET.ILLink.Tasks" Version="9.0.8" />
<PackageVersion Include="Microsoft.AspNetCore.Identity" Version="2.2.0" />
<PackageVersion Include="CliWrap" Version="3.6.7" />
<PackageVersion Include="CommandLineParser" Version="2.9.1" />
<PackageVersion Include="CliWrap" Version="3.6.7" />
<PackageVersion Include="Octokit" Version="8.0.0" />
<PackageVersion Include="Octokit.Extensions" Version="1.0.7" />
<PackageVersion Include="Cake.Frosting" Version="4.0.0" />
Expand Down
95 changes: 95 additions & 0 deletions cake/BuildContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Text;
using Cake.Common.Build;
using Cake.Common;
Expand All @@ -27,6 +28,7 @@
using Cake.Core.IO;
using System;
using YamlDotNet.RepresentationModel;
using Cake.Core.Diagnostics;


public partial class BuildContext : FrostingContext
Expand Down Expand Up @@ -337,4 +339,97 @@ public string EnsureFolder(string path)

return path;
}

internal void ProvisionNodeJs()
{
// Check if node is available
var nodeCommand = RuntimeInformation.IsOSPlatform(OSPlatform.Linux) ? "node" : "node.exe";
var npmCommand = RuntimeInformation.IsOSPlatform(OSPlatform.Linux) ? "npm" : "npm.cmd";

try
{
var nodeProcess = ProcessRunner.Start(nodeCommand, new ProcessSettings()
{
Arguments = "--version",
RedirectStandardOutput = true,
RedirectStandardError = true,
Silent = true
});

nodeProcess.WaitForExit();

if (nodeProcess.GetExitCode() == 0)
{
var version = string.Join("", nodeProcess.GetStandardOutput());
Log.Information($"Node.js is already installed: {version.Trim()}");
return;
}
}
catch (Exception ex)
{
Log.Warning($"Node.js not found or failed to execute: {ex.Message}");
}

// Node.js is not available, provision it
Log.Information("Node.js not found. Provisioning Node.js...");

if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
// Use winget to install Node.js on Windows
Log.Information("Attempting to install Node.js using winget...");
var wingetProcess = ProcessRunner.Start("winget", new ProcessSettings()
{
Arguments = "install OpenJS.NodeJS.LTS --accept-source-agreements --accept-package-agreements",
RedirectStandardOutput = false,
RedirectStandardError = false,
Silent = false
});

wingetProcess.WaitForExit();

if (wingetProcess.GetExitCode() != 0)
{
Log.Warning("winget installation failed. Trying Chocolatey...");

// Fallback to Chocolatey
var chocoProcess = ProcessRunner.Start("choco", new ProcessSettings()
{
Arguments = "install nodejs-lts -y",
RedirectStandardOutput = false,
RedirectStandardError = false,
Silent = false
});

chocoProcess.WaitForExit();

if (chocoProcess.GetExitCode() != 0)
{
throw new Exception("Failed to provision Node.js. Please install Node.js manually from https://nodejs.org/");
}
}
}
else
{
// Linux - use package manager or nvm
Log.Information("Attempting to install Node.js on Linux...");

// Try using apt (Debian/Ubuntu)
var aptProcess = ProcessRunner.Start("bash", new ProcessSettings()
{
Arguments = "-c \"curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash - && sudo apt-get install -y nodejs\"",
RedirectStandardOutput = false,
RedirectStandardError = false,
Silent = false
});

aptProcess.WaitForExit();

if (aptProcess.GetExitCode() != 0)
{
throw new Exception("Failed to provision Node.js on Linux. Please install Node.js manually.");
}
}

Log.Information("Node.js provisioning completed.");
}
}
80 changes: 80 additions & 0 deletions cake/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,9 @@ public override void Run(BuildContext context)
context.CopyFiles(Path.Combine(context.RootDir, "traversals", "traversalBuilds", "**/*.*"), Path.Combine(context.RootDir, library.folder));
}

// provision nodejs
context.ProvisionNodeJs();

// with this we will enforce use of specific apax version at least temporarily
// due to issues with apax versions in some environments.
context.ApaxSelfUpdate("4.1.1");
Expand Down Expand Up @@ -174,6 +177,7 @@ public override void Run(BuildContext context)
return;
}


if (context.BuildParameters.DoPack)
{
var apaxFiles = new List<string>();
Expand Down Expand Up @@ -202,14 +206,23 @@ public override void Run(BuildContext context)
context.ApaxInstall(new[] { traversalProjectFolder });
context.DotnetIxc(new[] { traversalProjectFolder });
context.DotNetBuildSettings.Verbosity = DotNetVerbosity.Quiet;
context.DotNetBuildSettings.NoRestore = true;
context.DotNetBuildSettings.MSBuildSettings.Properties.Add("NoWarn", new List<string>()
{ "1234;2345;8602;10012;8618;0162;8605;1416;3270;1504;8600;8618;" +
"CS0618;CS1591;BL0007;BL0005;CA1416;CA2200;CS0105;CS0108;CS0109;CS0162;CS0168;CS0169;CS219;CS0414;CS0436;CS0472;CS0618;CS1591;CS1998;CS8604;" +
"CS8601;SYSLIB0051;SYSLIB0014;CS8625;CS0219;CS8625;CS8625;CS8620;RZ2012;RZ10012;CS4014;CS8981;CS8603;CS8766;CS8619;CS0649;CS8321"
});


context.DotNetRestore(Path.Combine(context.RootDir, "AXOpen.proj"));
BuildTailwindCss(context);

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




if (!context.BuildParameters.NoBuild && !context.BuildParameters.DoTest && !context.BuildParameters.DoPack)
{
context.Log.Information("Creating apax traversal.");
Expand All @@ -223,6 +236,73 @@ public override void Run(BuildContext context)
//System.IO.Directory.Delete(Path.Combine(traversalProjectFolder, ".apax"), true);

}

private void BuildTailwindCss(BuildContext context)
{
var stylingFolder = Path.Combine(context.RootDir, "styling", "src");
var nodeModulesFolder = Path.Combine(stylingFolder, "node_modules");

context.Log.Information($"Building Tailwind CSS in folder: {stylingFolder}");

// Check if node_modules exists, if not install packages
if (!Directory.Exists(nodeModulesFolder))
{
context.Log.Information("node_modules not found. Installing npm packages...");
var npmInstall = new Process
{
StartInfo = new ProcessStartInfo
{
FileName = "cmd.exe",
Arguments = "/c npm install",
WorkingDirectory = stylingFolder,
UseShellExecute = false,
RedirectStandardOutput = true,
RedirectStandardError = true,
CreateNoWindow = true
}
};
npmInstall.OutputDataReceived += (sender, e) => { if (e.Data != null) Console.WriteLine(e.Data); };
npmInstall.ErrorDataReceived += (sender, e) => { if (e.Data != null) Console.Error.WriteLine(e.Data); };
npmInstall.Start();
npmInstall.BeginOutputReadLine();
npmInstall.BeginErrorReadLine();
npmInstall.WaitForExit();

if (npmInstall.ExitCode != 0)
{
throw new Exception($"npm install failed with exit code {npmInstall.ExitCode}");
}
}

// Run the tailwind build using npx
context.Log.Information("Running Tailwind build...");
var npxBuild = new Process
{
StartInfo = new ProcessStartInfo
{
FileName = "cmd.exe",
Arguments = "/c npx @tailwindcss/cli -i ./wwwroot/tailwind.css -o ./wwwroot/css/axopenstyling.css --minify",
WorkingDirectory = stylingFolder,
UseShellExecute = false,
RedirectStandardOutput = true,
RedirectStandardError = true,
CreateNoWindow = true
}
};
npxBuild.OutputDataReceived += (sender, e) => { if (e.Data != null) Console.WriteLine(e.Data); };
npxBuild.ErrorDataReceived += (sender, e) => { if (e.Data != null) Console.Error.WriteLine(e.Data); };
npxBuild.Start();
npxBuild.BeginOutputReadLine();
npxBuild.BeginErrorReadLine();
npxBuild.WaitForExit();

if (npxBuild.ExitCode != 0)
{
throw new Exception($"Tailwind CSS build failed with exit code {npxBuild.ExitCode}");
}

context.Log.Information("Tailwind CSS build completed.");
}
}

[TaskName("Tests")]
Expand Down
2 changes: 1 addition & 1 deletion docfx/docfx.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"disableDefaultFilter": false,
"noRestore" : true,
"properties": {
"TargetFramework": "net7.0"
"TargetFramework": "net10.0"
}
}
],
Expand Down
4 changes: 3 additions & 1 deletion src/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,6 @@ sandbox/**
.application/**
.sandbox/**

.runtime
.runtime

src/**/node_modules
19 changes: 2 additions & 17 deletions src/AXOpen-packable-only.proj
Original file line number Diff line number Diff line change
@@ -1,21 +1,6 @@
<Project Sdk="Microsoft.Build.Traversal/4.1.0">
<ItemGroup>
<ProjectReference Include="**\src\**\*.csproj" Exclude="**\.apax\**\*.*;templates.simple\**;template.axolibrary\**;integrations\**;clientchat\**;tools\**"/>
<ProjectReference Include="**\ctrl\ix\**\*.csproj" Exclude="**\.apax\**\*.*"/>
<!-- <ProjectReference Include="base\src\**\*.csproj" Exclude="**\.apax\**\*.*"/>
<ProjectReference Include="abstractions\src\**\*.csproj" Exclude="**\.apax\**\*.*"/>
<ProjectReference Include="components.abstractions\src\**\*.csproj" Exclude="**\.apax\**\*.*"/>
<ProjectReference Include="components.elements\src\**\*.csproj" Exclude="**\.apax\**\*.*"/>
<ProjectReference Include="components.pneumatics\src\**\*.csproj" Exclude="**\.apax\**\*.*"/>
<ProjectReference Include="components.cognex.vision\src\**\*.csproj" Exclude="**\.apax\**\*.*"/>
<ProjectReference Include="core\src\**\*.csproj" Exclude="**\.apax\**\*.*"/>
<ProjectReference Include="data\src\**\*.csproj" Exclude="**\.apax\**\*.*"/>
<ProjectReference Include="inspectors\src\**\*.csproj" Exclude="**\.apax\**\*.*"/>
<ProjectReference Include="probers\src\**\*.csproj" Exclude="**\.apax\**\*.*"/>
<ProjectReference Include="security\src\**\*.csproj" Exclude="**\.apax\**\*.*"/>
<ProjectReference Include="simatic1500\ctrl\**\*.csproj" Exclude="**\.apax\**\*.*"/>
<ProjectReference Include="timers\src\**\*.csproj" Exclude="**\.apax\**\*.*"/>
<ProjectReference Include="utils\src\**\*.csproj" Exclude="**\.apax\**\*.*"/>
<ProjectReference Include="toolbox\src\**\*.csproj" Exclude="**\.apax\**\*.*"/> -->
<ProjectReference Include="**\src\**\*.csproj" Exclude="**\.apax\**\*.*;templates.simple\**;template.axolibrary\**;integrations\**;clientchat\**;tools\**"/>
<ProjectReference Include="**\ctrl\ix\**\*.csproj" Exclude="**\.apax\**\*.*"/>
</ItemGroup>
</Project>
12 changes: 12 additions & 0 deletions src/AXOpen.sln
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "simatic1500_app", "simatic1
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "inxton_axopen_simatic1500", "simatic1500\ctrl\ix\inxton_axopen_simatic1500.csproj", "{CB225FD9-C89F-47BA-AA24-F3ED16D5AED7}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AXOpen.Operon.Blazor", "styling\src\AXOpen.Operon.Blazor.csproj", "{41948055-9ECB-4857-A118-787A38284083}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "app_apaxappname", "template.axolibrary\app\ix\app_apaxappname.csproj", "{8B6A64B4-E027-42FE-9E48-BA52518B03F2}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "inxton_apaxlibname", "template.axolibrary\src\projname\inxton_apaxlibname.csproj", "{51616177-E7B5-4F81-BD81-1B293B014D18}"
Expand Down Expand Up @@ -927,6 +929,10 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ctrl", "simatic1500\ctrl",
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "simatic1500", "simatic1500", "{2F0E9866-DDAF-4D5E-A8C5-7344401C2851}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "styling\src", "{D14C62C1-16F6-4809-BA5D-B00E0B2DBFC3}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "styling", "styling", "{0A8146C8-F030-4BCA-957E-0A8E7F3F1C68}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ix", "template.axolibrary\app\ix", "{A1ABE56B-3978-494D-8656-66C3D8B89F23}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "app", "template.axolibrary\app", "{49A3693A-2562-40FA-9A34-7677BD7B5798}"
Expand Down Expand Up @@ -1627,6 +1633,10 @@ Global
{CB225FD9-C89F-47BA-AA24-F3ED16D5AED7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CB225FD9-C89F-47BA-AA24-F3ED16D5AED7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CB225FD9-C89F-47BA-AA24-F3ED16D5AED7}.Release|Any CPU.Build.0 = Release|Any CPU
{41948055-9ECB-4857-A118-787A38284083}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{41948055-9ECB-4857-A118-787A38284083}.Debug|Any CPU.Build.0 = Debug|Any CPU
{41948055-9ECB-4857-A118-787A38284083}.Release|Any CPU.ActiveCfg = Release|Any CPU
{41948055-9ECB-4857-A118-787A38284083}.Release|Any CPU.Build.0 = Release|Any CPU
{8B6A64B4-E027-42FE-9E48-BA52518B03F2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8B6A64B4-E027-42FE-9E48-BA52518B03F2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8B6A64B4-E027-42FE-9E48-BA52518B03F2}.Release|Any CPU.ActiveCfg = Release|Any CPU
Expand Down Expand Up @@ -2098,6 +2108,8 @@ Global
{CB225FD9-C89F-47BA-AA24-F3ED16D5AED7} = {54B2DC6D-B862-470C-901E-B864099E3BA6}
{54B2DC6D-B862-470C-901E-B864099E3BA6} = {CE7EED86-FBB3-498C-B0BA-DB7A03D78335}
{CE7EED86-FBB3-498C-B0BA-DB7A03D78335} = {2F0E9866-DDAF-4D5E-A8C5-7344401C2851}
{41948055-9ECB-4857-A118-787A38284083} = {D14C62C1-16F6-4809-BA5D-B00E0B2DBFC3}
{D14C62C1-16F6-4809-BA5D-B00E0B2DBFC3} = {0A8146C8-F030-4BCA-957E-0A8E7F3F1C68}
{8B6A64B4-E027-42FE-9E48-BA52518B03F2} = {A1ABE56B-3978-494D-8656-66C3D8B89F23}
{A1ABE56B-3978-494D-8656-66C3D8B89F23} = {49A3693A-2562-40FA-9A34-7677BD7B5798}
{49A3693A-2562-40FA-9A34-7677BD7B5798} = {4AD4F5F9-CE2A-4CB6-89CF-F0B8EF35694F}
Expand Down
12 changes: 12 additions & 0 deletions src/AXOpen.solution.sln
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "simatic1500_app", "simatic1
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "inxton_axopen_simatic1500", "simatic1500\ctrl\ix\inxton_axopen_simatic1500.csproj", "{B7C5F2A5-1EE3-4C7D-9EB7-17B72B13CDD5}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AXOpen.Operon.Blazor", "styling\src\AXOpen.Operon.Blazor.csproj", "{35448DD7-36BC-4544-9702-7A0C7F0F5C5A}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "app_apaxappname", "template.axolibrary\app\ix\app_apaxappname.csproj", "{F670A600-8655-46EF-B08A-2095164DFB07}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "inxton_apaxlibname", "template.axolibrary\src\projname\inxton_apaxlibname.csproj", "{F5B04A41-EC08-40FC-92D3-70D085EFC77C}"
Expand Down Expand Up @@ -927,6 +929,10 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ctrl", "simatic1500\ctrl",
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "simatic1500", "simatic1500", "{B87D748D-CD0C-447F-8478-A0B69304FFF6}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "styling\src", "{CFDBDC48-D553-40D2-8DF7-491CD99D83F4}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "styling", "styling", "{0893B6CF-8AC8-4707-9AF1-E295FEB8BE51}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ix", "template.axolibrary\app\ix", "{DDE64F35-C578-4F28-BD95-03C8C76DEFA1}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "app", "template.axolibrary\app", "{4ED637A3-E59E-4D26-BBFE-80ED270E11AF}"
Expand Down Expand Up @@ -1627,6 +1633,10 @@ Global
{B7C5F2A5-1EE3-4C7D-9EB7-17B72B13CDD5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B7C5F2A5-1EE3-4C7D-9EB7-17B72B13CDD5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B7C5F2A5-1EE3-4C7D-9EB7-17B72B13CDD5}.Release|Any CPU.Build.0 = Release|Any CPU
{35448DD7-36BC-4544-9702-7A0C7F0F5C5A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{35448DD7-36BC-4544-9702-7A0C7F0F5C5A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{35448DD7-36BC-4544-9702-7A0C7F0F5C5A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{35448DD7-36BC-4544-9702-7A0C7F0F5C5A}.Release|Any CPU.Build.0 = Release|Any CPU
{F670A600-8655-46EF-B08A-2095164DFB07}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F670A600-8655-46EF-B08A-2095164DFB07}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F670A600-8655-46EF-B08A-2095164DFB07}.Release|Any CPU.ActiveCfg = Release|Any CPU
Expand Down Expand Up @@ -2098,6 +2108,8 @@ Global
{B7C5F2A5-1EE3-4C7D-9EB7-17B72B13CDD5} = {A4364976-727B-4ACC-9922-CBE29E129DD2}
{A4364976-727B-4ACC-9922-CBE29E129DD2} = {9AA64314-3D41-4177-80A6-E4C033C45393}
{9AA64314-3D41-4177-80A6-E4C033C45393} = {B87D748D-CD0C-447F-8478-A0B69304FFF6}
{35448DD7-36BC-4544-9702-7A0C7F0F5C5A} = {CFDBDC48-D553-40D2-8DF7-491CD99D83F4}
{CFDBDC48-D553-40D2-8DF7-491CD99D83F4} = {0893B6CF-8AC8-4707-9AF1-E295FEB8BE51}
{F670A600-8655-46EF-B08A-2095164DFB07} = {DDE64F35-C578-4F28-BD95-03C8C76DEFA1}
{DDE64F35-C578-4F28-BD95-03C8C76DEFA1} = {4ED637A3-E59E-4D26-BBFE-80ED270E11AF}
{4ED637A3-E59E-4D26-BBFE-80ED270E11AF} = {37328946-09D5-4422-BA21-91015DCE3BEF}
Expand Down
11 changes: 2 additions & 9 deletions src/base/src/AXOpen.VisualComposer/AXOpen.VisualComposer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,7 @@
<ItemGroup>
<FrameworkReference Include="Microsoft.AspNetCore.App" />
</ItemGroup>

<ItemGroup>
<None Include="Components\**\*.*" Exclude="Components\**\*.js;Components\**\*.css" Pack="true" PackagePath="contentFiles\Components\%(RecursiveDir)%(Filename)%(Extension)" CopyToOutputDirectory="PreserveNewest" />
<None Include="build\AXOpen.VisualComposer.targets" Pack="true" PackagePath="build\AXOpen.VisualComposer.targets" CopyToOutputDirectory="PreserveNewest" />
</ItemGroup>

<PropertyGroup>
<DefaultItemExcludes>$(DefaultItemExcludes);temp\**\*</DefaultItemExcludes>
</PropertyGroup>



</Project>
2 changes: 1 addition & 1 deletion src/core/ctrl/apax.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ files:
registries:
"@inxton": "https://npm.pkg.github.com/"
catalogs:
"@inxton/ax.catalog": 0.0.40
"@inxton/ax.catalog": 0.0.40
devDependencies:
"@inxton/ax-sdk": '0.0.0-dev.0'
dependencies:
Expand Down
Loading
Loading