Skip to content

Commit

Permalink
Create assembly2 for VDMCheck2+
Browse files Browse the repository at this point in the history
  • Loading branch information
nickbattle committed Jan 16, 2024
1 parent fccc22b commit 7abea6c
Show file tree
Hide file tree
Showing 4 changed files with 122 additions and 26 deletions.
52 changes: 34 additions & 18 deletions fmi2/vdmcheck/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,17 @@
<maven.build.timestamp.format>yyMMdd</maven.build.timestamp.format>
</properties>


<dependencies>
<dependency>
<groupId>org.into-cps.vdmcheck.fmi2</groupId>
<artifactId>static-model</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.into-cps.vdmcheck.fmi2</groupId>
<artifactId>rule-model</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.into-cps.vdmcheck</groupId>
<artifactId>xsd2vdm</artifactId>
Expand Down Expand Up @@ -65,23 +69,35 @@
</finalName>
</configuration>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<descriptors>
<descriptor>src/assembly/assembly.xml</descriptor>
</descriptors>
<finalName>FMI2-vdmcheck-${project.version}</finalName>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<id>static</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<descriptors>
<descriptor>src/assembly/assembly.xml</descriptor>
</descriptors>
</configuration>
</execution>
<execution>
<id>rules</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<descriptors>
<descriptor>src/assembly/assembly2.xml</descriptor>
</descriptors>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
5 changes: 0 additions & 5 deletions fmi2/vdmcheck/src/assembly/assembly.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,6 @@
<destName>VDMCheck2.sh</destName>
<filtered>true</filtered>
</file>
<file>
<source>src/main/scripts/VDMCheck2+.sh</source>
<destName>VDMCheck2+.sh</destName>
<filtered>true</filtered>
</file>
<file>
<source>../../GPL3-LICENCE</source>
<destName>GPL3-LICENCE</destName>
Expand Down
68 changes: 68 additions & 0 deletions fmi2/vdmcheck/src/assembly/assembly2.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
<assembly xmlns="http://maven.apache.org/ASSEMBLY/2.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/ASSEMBLY/2.0.0 http://maven.apache.org/xsd/assembly-2.0.0.xsd">
<id>distribution2</id>

<formats>
<format>zip</format>
</formats>

<baseDirectory>vdmcheck-${project.version}</baseDirectory>

<files>
<file>
<source>src/main/scripts/VDMCheck2+.sh</source>
<destName>VDMCheck2+.sh</destName>
<filtered>true</filtered>
</file>
<file>
<source>../../GPL3-LICENCE</source>
<destName>GPL3-LICENCE</destName>
</file>
<file>
<source>../../MIT-LICENCE</source>
<destName>MIT-LICENCE</destName>
</file>
<file>
<source>../../LICENCE</source>
<destName>LICENCE</destName>
</file>
<file>
<source>src/main/resources/XSD.vdmsl</source>
<destName>model/XSD.vdmsl</destName>
</file>
</files>

<fileSets>
<fileSet>
<directory>src/main/resources/schema</directory>
<outputDirectory>schema</outputDirectory>
</fileSet>
</fileSets>

<dependencySets>
<dependencySet>
<includes>
<include>org.into-cps.vdmcheck.fmi2:rule-model</include>
</includes>
<unpack>true</unpack>
<outputDirectory>model</outputDirectory>
<unpackOptions>
<excludes>
<exclude>Tests/**</exclude>
<exclude>META-INF/**</exclude>
</excludes>
</unpackOptions>
</dependencySet>
<dependencySet>
<includes>
<include>org.into-cps.vdmcheck:xsd2vdm</include>
<include>org.into-cps.vdmcheck:fmuReader</include>
<include>org.into-cps.vdmcheck.fmi2:vdmcheck2</include>
<include>dk.au.ece.vdmj:vdmj</include>
<include>dk.au.ece.vdmj:annotations</include>
</includes>
<outputFileNameMapping>${artifact.artifactId}.${artifact.extension}</outputFileNameMapping>
</dependencySet>
</dependencySets>
</assembly>
23 changes: 20 additions & 3 deletions fmi2/vdmcheck/src/main/scripts/VDMCheck2+.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,17 @@
# Process an FMI V2 FMU or XML file, and validate the XML structure using the VDM-SL model.
#

USAGE="Usage: VDMCheck2.sh [-v <VDM outfile>] -x <XML> | <file>.fmu | <file>.xml"
USAGE="Usage: VDMCheck2.sh [-h2|-h3 <FMI2/3 Standard base URL>] [-v <VDM outfile>] -x <XML> | <file>.fmu | <file>.xml"

while getopts ":h:v:x:s:" OPT
do
case "$OPT" in
h2)
LINK2=${OPTARG}
;;
h3)
LINK3=${OPTARG}
;;
x)
XML=${OPTARG}
;;
Expand All @@ -52,6 +58,16 @@ then
FILE=$(realpath "$1")
fi

if [ -z "$LINK2" ]
then
LINK2="https://fmi-standard.org/docs/2.0/"
fi

if [ -z "$LINK3" ]
then
LINK3="https://fmi-standard.org/docs/3.0/"
fi

if [ "$XML" ]
then
FILE=/tmp/input$$.xml
Expand Down Expand Up @@ -80,7 +96,7 @@ SCRIPT=$0
cd "$dir"

XSD="schema/fmi2.xsd"
MODEL="model"
MODEL="model model/Rules"

# Fix Class Path Separator - Default to colon for Unix-like systems, , semicolon for msys
CLASSPATH_SEPARATOR=":"
Expand All @@ -93,8 +109,9 @@ SCRIPT=$0
-Dfmureader.xsd=schema/fmi2.xsd \
-Dfmureader.vdmfile="$SAVE" \
-cp vdmj.jar${CLASSPATH_SEPARATOR}annotations.jar${CLASSPATH_SEPARATOR}xsd2vdm.jar${CLASSPATH_SEPARATOR}fmuReader.jar com.fujitsu.vdmj.VDMJ \
-vdmsl -q -annotations -e "isValidFMIConfiguration2(modelDescription, buildDescription, terminalsAndIcons)" \
-vdmsl -q -annotations -e "isValidFMIConfiguration(modelDescription, buildDescription, terminalsAndIcons)" \
$MODEL "$FILE" |
sed -e "s+<FMI2_STANDARD>+$LINK2+;s+<FMI3_STANDARD>+$LINK3+" |
awk '/^true$/{ print "No errors found."; exit 0 };/^false$/{ print "Errors found."; exit 1 };{ print }'
)

Expand Down

0 comments on commit 7abea6c

Please sign in to comment.