Skip to content

Commit f789e1b

Browse files
[Add] uml based htmlDocsGenerator, remove ecore based htmldocs generator; fixes #40
1 parent e4201b5 commit f789e1b

File tree

13 files changed

+421
-400
lines changed

13 files changed

+421
-400
lines changed

HtmlDocs/Dockerfile

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,4 @@ WORKDIR /usr/share/nginx/html
44

55
COPY HtmlDocs/nginx.conf /etc/nginx/nginx.conf
66

7-
COPY ../SysML2.NET.CodeGenerator.Tests/bin/Debug/net9.0/_SysML2.NET.Core.AutoGenHtmlDocs/index.html .
8-
COPY ../SysML2.NET.CodeGenerator.Tests/bin/Debug/net9.0/_SysML2.NET.Core.AutoGenHtmlDocs/sysml2-class-inheritance.svg .
9-
COPY ../SysML2.NET.CodeGenerator/Resources/HtmlDocs .
7+
COPY ../SysML2.NET.CodeGenerator.Tests/bin/Debug/net9.0/UML/_SysML2.NET.Core.AutoGenHtmlDocs/index.html .
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#!/bin/bash
2+
3+
# Exit on error
4+
set -e
5+
6+
# Ensure version is passed
7+
if [ -z "$1" ]; then
8+
echo "Usage: $0 <version>"
9+
echo "Example: $0 x.y.z"
10+
exit 1
11+
fi
12+
13+
VERSION="$1"
14+
BUILDER="buildkit-container"
15+
16+
# Create builder if it doesn't exist
17+
if ! docker buildx inspect "$BUILDER" >/dev/null 2>&1; then
18+
echo "Creating BuildKit builder: $BUILDER"
19+
docker buildx create --name "$BUILDER" --driver docker-container --use
20+
docker buildx inspect --bootstrap
21+
else
22+
docker buildx use "$BUILDER"
23+
fi
24+
25+
echo "pulling latest version of nginx:alpine"
26+
docker pull nginx:alpine
27+
28+
echo "Building and Pushing Docker image with SBOM and provenance for version: $VERSION"
29+
30+
docker buildx build \
31+
--platform=linux/amd64 \
32+
-f Dockerfile \
33+
-t stariongroup/sysml2.net.docs:latest \
34+
-t stariongroup/sysml2.net.docs:$VERSION \
35+
--sbom=true \
36+
--provenance=true \
37+
--push \
38+
.
39+
40+
echo "Build complete."
41+
echo "Tags: latest, $VERSION"
42+
echo "Provenance attached as image metadata"
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/bin/bash
2+
3+
# Exit on error
4+
set -e
5+
6+
# Ensure version is passed
7+
if [ -z "$1" ]; then
8+
echo "Usage: $0 <version>"
9+
echo "Example: $0 x.y.z"
10+
exit 1
11+
fi
12+
13+
VERSION="$1"
14+
15+
echo "pulling latest version of nginx:alpine"
16+
docker pull nginx:alpine
17+
18+
echo "Building local Docker image for version: $VERSION"
19+
20+
docker build \
21+
-f HtmlDocs/Dockerfile \
22+
-t stariongroup/sysml2.net.docs:latest \
23+
-t stariongroup/sysml2.net.docs:$VERSION \
24+
.
25+
26+
echo "Build complete."
27+
echo "Tags: latest, $VERSION"

SysML2.NET.CodeGenerator.Tests/Generators/EcoreHandleBarsGenerators/HtmlDocsGeneratorTestFixture.cs

Lines changed: 0 additions & 62 deletions
This file was deleted.
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
// -------------------------------------------------------------------------------------------------
2+
// <copyright file="HtmlReportGeneratorTestFixture.cs" company="Starion Group S.A.">
3+
//
4+
// Copyright 2022-2025 Starion Group S.A.
5+
//
6+
// Licensed under the Apache License, Version 2.0 (the "License");
7+
// you may not use this file except in compliance with the License.
8+
// You may obtain a copy of the License at
9+
//
10+
// http://www.apache.org/licenses/LICENSE-2.0
11+
//
12+
// Unless required by applicable law or agreed to in writing, software
13+
// distributed under the License is distributed on an "AS IS" BASIS,
14+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
// See the License for the specific language governing permissions and
16+
// limitations under the License.
17+
//
18+
// </copyright>
19+
// ------------------------------------------------------------------------------------------------
20+
21+
namespace SysML2.NET.CodeGenerator.Tests.Generators
22+
{
23+
using System.Collections.Generic;
24+
using System.IO;
25+
26+
using Microsoft.Extensions.Logging;
27+
28+
using NUnit.Framework;
29+
30+
using Serilog;
31+
32+
using uml4net.Reporting.Drawing;
33+
using uml4net.Reporting.Generators;
34+
using uml4net.xmi;
35+
using uml4net.xmi.Readers;
36+
37+
public class HtmlReportGeneratorTestFixture
38+
{
39+
private FileInfo modelFileInfo;
40+
41+
private FileInfo outputFileInfo;
42+
43+
private DirectoryInfo rootDirectoryInfo;
44+
45+
private HtmlReportGenerator htmlReportGenerator;
46+
47+
private ILoggerFactory loggerFactory;
48+
49+
private Dictionary<string, string> pathMaps;
50+
51+
private string rootDirectory;
52+
53+
[OneTimeSetUp]
54+
public void OneTimeSetUp()
55+
{
56+
Log.Logger = new LoggerConfiguration()
57+
.MinimumLevel.Debug()
58+
.WriteTo.Console()
59+
.CreateLogger();
60+
61+
this.loggerFactory = LoggerFactory.Create(builder => { builder.AddSerilog(); });
62+
}
63+
64+
[SetUp]
65+
public void SetUp()
66+
{
67+
this.rootDirectory = Path.Combine(TestContext.CurrentContext.TestDirectory, "datamodel");
68+
69+
this.rootDirectoryInfo = new DirectoryInfo(this.rootDirectory);
70+
71+
this.pathMaps = new Dictionary<string, string>
72+
{
73+
["pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml"] =
74+
Path.Combine(this.rootDirectory, "PrimitiveTypes.xmi")
75+
};
76+
77+
this.modelFileInfo = new FileInfo(Path.Combine(TestContext.CurrentContext.TestDirectory, "datamodel",
78+
"SysML_xmi.uml"));
79+
80+
this.outputFileInfo = new FileInfo(Path.Combine(TestContext.CurrentContext.TestDirectory, "UML", "_SysML2.NET.Core.AutoGenHtmlDocs", "index.html"));
81+
82+
var inheritanceDiagramRenderer = new InheritanceDiagramRenderer(loggerFactory.CreateLogger<InheritanceDiagramRenderer>());
83+
this.htmlReportGenerator = new HtmlReportGenerator(inheritanceDiagramRenderer, this.loggerFactory);
84+
}
85+
86+
[Test]
87+
public void verify_HTML_docs_Are_generated()
88+
{
89+
var customHtml = """
90+
<div style="text-align: center;">
91+
<H1>OMG SysML&#174; Version 2 <a href="https://github.com/Systems-Modeling/SysML-v2-Pilot-Implementation/blob/master/org.omg.sysml/model/SysML_xmi.uml" target="_blank" rel="noopener noreferrer">UML based Meta Model Documentation</a></H1>
92+
<H3><a href="https://github.com/Systems-Modeling/SysML-v2-Pilot-Implementation/releases/tag/2025-07" target="_blank" rel="noopener noreferrer">Release 2025-07</a></H3>
93+
<p class="small">Powered By <a href="https://www.stariongroup.eu" target="_blank" rel="noopener noreferrer">Starion Group</a>, 2022-2025</p>
94+
<div>
95+
""";
96+
97+
Assert.That(() => this.htmlReportGenerator.GenerateReport(this.modelFileInfo, this.rootDirectoryInfo, false, this.pathMaps,
98+
this.outputFileInfo, customHtml),
99+
Throws.Nothing);
100+
}
101+
}
102+
}

SysML2.NET.CodeGenerator/Generators/EcoreHandleBarsGenerators/HtmlDocsGenerator.cs

Lines changed: 0 additions & 136 deletions
This file was deleted.

0 commit comments

Comments
 (0)