Skip to content

Commit

Permalink
Add axopen library template project (#166)
Browse files Browse the repository at this point in the history
* wip

* mend

* wip

* wip adds workspaces

* wip e

* wip

* add template for axo libraries
  • Loading branch information
PTKu authored Aug 15, 2023
1 parent a26ca47 commit f2cc119
Show file tree
Hide file tree
Showing 75 changed files with 2,304 additions and 1 deletion.
Binary file added assets/icons/icon_128_128.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions cake/BuildContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ public BuildContext(ICakeContext context, BuildParameters buildParameters)
{
("integrations", "ix.integrations", System.Environment.GetEnvironmentVariable("AXTARGET"), System.Environment.GetEnvironmentVariable("AXTARGETPLATFORMINPUT")),
("templates.simple", "templates.simple", System.Environment.GetEnvironmentVariable("AXTARGET"), System.Environment.GetEnvironmentVariable("AXTARGETPLATFORMINPUT")),
("template.axolibrary", "template.axolibrary", System.Environment.GetEnvironmentVariable("AXTARGET"), System.Environment.GetEnvironmentVariable("AXTARGETPLATFORMINPUT")),
};

public string GitHubUser { get; } = System.Environment.GetEnvironmentVariable("GH_USER");
Expand Down
29 changes: 29 additions & 0 deletions src/AXOpen.sln
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,18 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AxOpen.Inspectors.Blazor",
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ix_ax_axopen_inspectors", "inspectors\src\AxOpen.Inspectors\ix_ax_axopen_inspectors.csproj", "{358D781D-BE42-4298-A60F-BE0358B5B405}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "templates.axolibrary", "templates.axolibrary", "{6CE1BA0C-BB5F-4105-A792-7CE352471827}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ix_ax_axolib", "template.axolibrary\src\dotnetlibs\ix_ax_axolib.csproj", "{310B3968-727B-4A66-860C-42B3AA3E22E6}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "dotnetlibs.blazor", "template.axolibrary\src\dotnetlibs.blazor\dotnetlibs.blazor.csproj", "{D58C5E03-2FFC-4C03-964B-7836A0F31538}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{F8D7E66F-3F2B-40EC-8CBB-C42B30D3AC9C}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{3CE75CCD-E907-49F7-8871-D9AE0E47EB8F}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "dotnetlibs_tests", "template.axolibrary\tests\dotnetlibs.Tests\dotnetlibs_tests.csproj", "{ADAF1255-8D10-4C83-B6D2-73347D677D15}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -319,6 +331,18 @@ Global
{B3B2A1D3-A1A5-443A-975F-C44F7C2648E6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B3B2A1D3-A1A5-443A-975F-C44F7C2648E6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B3B2A1D3-A1A5-443A-975F-C44F7C2648E6}.Release|Any CPU.Build.0 = Release|Any CPU
{310B3968-727B-4A66-860C-42B3AA3E22E6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{310B3968-727B-4A66-860C-42B3AA3E22E6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{310B3968-727B-4A66-860C-42B3AA3E22E6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{310B3968-727B-4A66-860C-42B3AA3E22E6}.Release|Any CPU.Build.0 = Release|Any CPU
{D58C5E03-2FFC-4C03-964B-7836A0F31538}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D58C5E03-2FFC-4C03-964B-7836A0F31538}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D58C5E03-2FFC-4C03-964B-7836A0F31538}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D58C5E03-2FFC-4C03-964B-7836A0F31538}.Release|Any CPU.Build.0 = Release|Any CPU
{ADAF1255-8D10-4C83-B6D2-73347D677D15}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{ADAF1255-8D10-4C83-B6D2-73347D677D15}.Debug|Any CPU.Build.0 = Debug|Any CPU
{ADAF1255-8D10-4C83-B6D2-73347D677D15}.Release|Any CPU.ActiveCfg = Release|Any CPU
{ADAF1255-8D10-4C83-B6D2-73347D677D15}.Release|Any CPU.Build.0 = Release|Any CPU
{6A796A98-F570-4F35-B46B-177B4C0178DC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6A796A98-F570-4F35-B46B-177B4C0178DC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6A796A98-F570-4F35-B46B-177B4C0178DC}.Release|Any CPU.ActiveCfg = Release|Any CPU
Expand Down Expand Up @@ -391,6 +415,11 @@ Global
{4D4B57A7-55C4-4AE2-8991-250937389412} = {7A82F34B-A479-47D4-8FB6-F9A66FE6591A}
{D3094A68-880C-4637-8F90-6034951E141B} = {E2BFDC17-38C1-43AD-9CB5-4FA440D2DEEA}
{B3B2A1D3-A1A5-443A-975F-C44F7C2648E6} = {FEF28A3F-E141-4492-8055-3B21A1BDDAAB}
{310B3968-727B-4A66-860C-42B3AA3E22E6} = {F8D7E66F-3F2B-40EC-8CBB-C42B30D3AC9C}
{D58C5E03-2FFC-4C03-964B-7836A0F31538} = {F8D7E66F-3F2B-40EC-8CBB-C42B30D3AC9C}
{F8D7E66F-3F2B-40EC-8CBB-C42B30D3AC9C} = {6CE1BA0C-BB5F-4105-A792-7CE352471827}
{3CE75CCD-E907-49F7-8871-D9AE0E47EB8F} = {6CE1BA0C-BB5F-4105-A792-7CE352471827}
{ADAF1255-8D10-4C83-B6D2-73347D677D15} = {3CE75CCD-E907-49F7-8871-D9AE0E47EB8F}
{6B847420-D488-4E16-B599-14F7558EBD66} = {E644E81B-36C4-44B3-837F-AC1DDDB609C5}
{ACDBA197-69BA-49E9-9624-DC7B912E4C3D} = {E644E81B-36C4-44B3-837F-AC1DDDB609C5}
{6A796A98-F570-4F35-B46B-177B4C0178DC} = {6B847420-D488-4E16-B599-14F7558EBD66}
Expand Down
3 changes: 3 additions & 0 deletions src/NUGET-README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# AXOpen

This package is part of AXOpen.
26 changes: 26 additions & 0 deletions src/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Creating new library from template

1. Navigate to ..src/ folder of this repository
2. Run following command in terminal to update library template

~~~PowerShell
dotnet new install .\template.axolibrary\ --force
~~~

3. Create library template using following command:

~~~PowerShell
dotnet new axolibrary -o OutputFolder -n LibraryName -ax axlibraryname
-p AXOpen.Components.Pneumatics
~~~

> ![IMPORTANT]
> Make sure you run all the commands from within the `src` folder of the repostory. And paramter -o OutputFolder must be in the `src` folder.
> ![IMPORTANT]
> Paramter -n `LibraryName` must contain ONLY alphanumerical characters
> ![IMPORTANT]
> Paramter -ax `axlibraryname` should be lower case (can contain characters that are permissible for npm package/library name, including '.')

6 changes: 6 additions & 0 deletions src/template.axolibrary/.cr/personal/FavoritesList/List.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Root Type="DevExpress.CodeRush.Foundation.CodePlaces.Options.FavoritesListContainer">
<Options Language="Neutral">
<Groups />
</Options>
</Root>
69 changes: 69 additions & 0 deletions src/template.axolibrary/.template.config/template.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
{
"$schema": "http://json.schemastore.org/template",
"author": "PTKu",
"classifications": [ "AXOpen", "axolibrary" ],
"identity": "librarytemplate",
"name": "AXOpen Library Template",
"shortName": "axolibrary",
"tags": {
"language": "C#",
"type": "project"
},
"sourceName": "librarytemplate",
"symbols": {
"axlibname": {
"type": "parameter",
"description": "AX library project name",
"datatype": "text",
"defaultValue": "axolib",
"replaces": "axolib"
},
"renameDotNetTwinCsProjFileName": {
"type": "derived",
"valueSource": "axlibname",
"valueTransform": "ReplaceDotsInFileName",
"fileRename": "axolib",
"description": "A value derived from the 'name' param, used to rename Application1.cs"
},
"renameDotNetTwinCsProjReferences": {
"include" : "*.csproj",
"type": "derived",
"valueSource": "axlibname",
"valueTransform": "ReplaceDotsInFileName",
"replaces": "axolib",
"description": "A value derived from the 'name' param, used to rename Application1.cs"
},
"projname": {
"type": "parameter",
"description": ".NET name",
"datatype": "text",
"defaultValue": "dotnetlibs",
"replaces": "dotnetlibs",
"fileRename" : "dotnetlibs"
},
"nameLower":{
"type": "generated",
"generator": "casing",
"parameters": {
"source":"axlibname",
"toLower": true
},
"nameUpper":{
"type": "generated",
"generator": "casing",
"parameters": {
"source":"projname",
"toLower": false
}
}
}
},
"forms": {
"ReplaceDotsInFileName": {
"identifier": "replace",
"pattern": "\\.",
"replacement": "_"
}
}
}

3 changes: 3 additions & 0 deletions src/template.axolibrary/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"dotnet.defaultSolution": "librarytemplate.sln"
}
6 changes: 6 additions & 0 deletions src/template.axolibrary/app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.apax
.env
bin

obj
testresult
1 change: 1 addition & 0 deletions src/template.axolibrary/app/AXSharp.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"OutputProjectFolder":"ix"}
22 changes: 22 additions & 0 deletions src/template.axolibrary/app/apax.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: "librarytemplate"
version: 0.0.0
type: app
targets:
- "1500"
- plcsim
- axunit-llvm
variables:
APAX_BUILD_ARGS:
- "--debug" # Generate debug information for target "1500"
devDependencies:
"@ax/sdk": 4.0.3
dependencies:
"@ix-ax/axolib" : 0.1.4-alpha.79
scripts:
download:
- apax install -L
- apax build
- dotnet ixc
- apax sld -i $AXTARGETPLATFORMINPUT -t $AXTARGET --accept-security-disclaimer --default-server-interface -r


12 changes: 12 additions & 0 deletions src/template.axolibrary/app/ix-blazor/JSONREPOS/Groups/AdminGroup
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"Changes": [],
"RecordId": null,
"DataEntityId": "AdminGroup",
"Name": "AdminGroup",
"Roles": [
"Administrator"
],
"RolesHash": "AQAAAAIAAYagAAAAEOnVgoEc0N/grlrKHOmSswEnXUk0/PHHYrCCns0sBFfQdP27cLrZ3LZPIFyLd6X/oA==",
"Created": "2023-08-09T12:33:03.2736142+02:00",
"Modified": "2023-08-09T12:33:03.4914502+02:00"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<Router AppAssembly="@typeof(App).Assembly">
<Found Context="routeData">
<RouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" />
<FocusOnNavigate RouteData="@routeData" Selector="h1" />
</Found>
<NotFound>
<PageTitle>Not found</PageTitle>
<LayoutView Layout="@typeof(MainLayout)">
<p role="alert">Sorry, there's nothing at this address.</p>
</LayoutView>
</NotFound>
</Router>
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
@page "/Documentation"

<PageTitle>Documentation</PageTitle>

<RenderableContentControl Context="@Entry.Plc.documentation" Presentation="Command-Control" PollingInterval="100"/>
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
@page
@model librarytemplate.blazor.Pages.ErrorModel

<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<title>Error</title>
<link href="~/css/bootstrap/bootstrap.min.css" rel="stylesheet" />
<link href="~/css/site.css" rel="stylesheet" asp-append-version="true" />
</head>

<body>
<div class="main">
<div class="content px-4">
<h1 class="text-danger">Error.</h1>
<h2 class="text-danger">An error occurred while processing your request.</h2>

@if (Model.ShowRequestId)
{
<p>
<strong>Request ID:</strong> <code>@Model.RequestId</code>
</p>
}

<h3>Development Mode</h3>
<p>
Swapping to the <strong>Development</strong> environment displays detailed information about the error that occurred.
</p>
<p>
<strong>The Development environment shouldn't be enabled for deployed applications.</strong>
It can result in displaying sensitive information from exceptions to end users.
For local debugging, enable the <strong>Development</strong> environment by setting the <strong>ASPNETCORE_ENVIRONMENT</strong> environment variable to <strong>Development</strong>
and restarting the app.
</p>
</div>
</div>
</body>

</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using System.Diagnostics;

namespace librarytemplate.blazor.Pages
{
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
[IgnoreAntiforgeryToken]
public class ErrorModel : PageModel
{
public string? RequestId { get; set; }

public bool ShowRequestId => !string.IsNullOrEmpty(RequestId);

private readonly ILogger<ErrorModel> _logger;

public ErrorModel(ILogger<ErrorModel> logger)
{
_logger = logger;
}

public void OnGet()
{
RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
@page "/"

<PageTitle>Index</PageTitle>

<h1>Hello, world!</h1>

Welcome to your new app.

<SurveyPrompt Title="How is Blazor working for you?" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
@page "/testing"
@using librarytemplate

<PageTitle>Testing</PageTitle>

<RenderableContentControl Context="@Entry.Plc.sandbox" Presentation="Command-Control" PollingInterval="100"/>
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
@page "/"
@using Microsoft.AspNetCore.Components.Web
@namespace librarytemplate.blazor.Pages
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<base href="~/" />
<link rel="stylesheet" href="css/bootstrap/bootstrap.min.css" />
<link href="css/site.css" rel="stylesheet" />
<link href="librarytemplate.blazor.styles.css" rel="stylesheet" />
<link rel="icon" type="image/png" href="favicon.png"/>
<component type="typeof(HeadOutlet)" render-mode="ServerPrerendered" />
</head>
<body>
<component type="typeof(App)" render-mode="ServerPrerendered" />

<div id="blazor-error-ui">
<environment include="Staging,Production">
An error has occurred. This application may no longer respond until reloaded.
</environment>
<environment include="Development">
An unhandled exception has occurred. See browser dev tools for details.
</environment>
<a href="" class="reload">Reload</a>
<a class="dismiss">🗙</a>
</div>

<script src="_framework/blazor.server.js"></script>
</body>
</html>
Loading

0 comments on commit f2cc119

Please sign in to comment.