Skip to content

Commit 5d54e52

Browse files
committed
build: Update SMC library and corresponding maven plugin
Motivation: A newer version of the SMC library and its corresponding maven plugin would: - Enable Graphviz `.dot` file generatation for state machines. - Enable use of logging in `.sm` files directly. Modification: - `Companion.java`: avoid using an enum for comparison which is no longer generated by newer SMC. - `pom.xml`: - `version.smc` updated to 7.6.0. - Top level dependency artifact is now `smc` of type `pom` rather than `statemap`. - `modules/dcache/pom.xml`: - Runtime dependency is `library` artifact instead of `statemap`. - `smc-maven-plugin` now obtained from `net.sf.smc` and version-pegged to `${version.smc}`. - Build dependency is `main` instead of `smc`. - `<execution>` blocks have an explicit `<id>`. - `<phase>generate-sources</phase>` is specified explicitly. - `<targetLanguage>` is now required. - Sources must be listed explicitly in a `<sources>` block rather than wildcarded. - Add a new `<execution>` block to generate the Graphviz files, relocating `<targetLanguage>java7</targetLanguage>` from plugin-wide to execution-local. - Add the generated `.dot` files as resources that are shipped in the `.jar` file. Results: - Graphviz files corresponding to processed `.sm` state machine files are automatically generated and packaged as part of the build. Target: master Patch: https://rb.dcache.org/r/14528/ Requires-notes: NO Reqiores-book: NO Acked-by: Tigran Mkrtchyan
1 parent 39c7320 commit 5d54e52

File tree

3 files changed

+45
-9
lines changed

3 files changed

+45
-9
lines changed

modules/dcache/pom.xml

Lines changed: 41 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,8 @@
279279

280280
<dependency>
281281
<groupId>net.sf.smc</groupId>
282-
<artifactId>statemap</artifactId>
282+
<artifactId>library</artifactId>
283+
<version>${version.smc}</version>
283284
</dependency>
284285

285286
<dependency>
@@ -384,16 +385,50 @@
384385
</dependencies>
385386

386387
<build>
388+
<resources>
389+
<resource>
390+
<directory>${project.build.directory}/generated-resources/smc-graphs</directory>
391+
<includes>
392+
<include>**/*.dot</include>
393+
</includes>
394+
</resource>
395+
</resources>
387396
<plugins>
388397
<plugin>
389-
<groupId>org.codehaus.mojo</groupId>
398+
<groupId>net.sf.smc</groupId>
390399
<artifactId>smc-maven-plugin</artifactId>
391-
<version>1.0-alpha-1</version>
400+
<version>${version.smc}</version>
392401
<executions>
393402
<execution>
403+
<id>src-build</id>
404+
<phase>generate-sources</phase>
405+
<goals>
406+
<goal>smc</goal>
407+
</goals>
408+
<configuration>
409+
<sources>
410+
<source>org/dcache/pool/migration/Task.sm</source>
411+
<source>org/dcache/pool/p2p/Companion.sm</source>
412+
</sources>
413+
<targetLanguage>java7</targetLanguage>
414+
</configuration>
415+
</execution>
416+
<execution>
417+
<id>graphviz-build</id>
418+
<phase>generate-resources</phase>
394419
<goals>
395420
<goal>smc</goal>
396421
</goals>
422+
<configuration>
423+
<sourceDirectory>${project.basedir}/src/main/smc</sourceDirectory>
424+
<targetDirectory>${project.build.directory}/generated-resources/smc-graphs</targetDirectory>
425+
<sources>
426+
<source>org/dcache/pool/migration/Task.sm</source>
427+
<source>org/dcache/pool/p2p/Companion.sm</source>
428+
</sources>
429+
<targetLanguage>graph</targetLanguage>
430+
<glevel>2</glevel>
431+
</configuration>
397432
</execution>
398433
</executions>
399434
<configuration>
@@ -402,7 +437,7 @@
402437
<dependencies>
403438
<dependency>
404439
<groupId>net.sf.smc</groupId>
405-
<artifactId>smc</artifactId>
440+
<artifactId>main</artifactId>
406441
<version>${version.smc}</version>
407442
</dependency>
408443
</dependencies>
@@ -482,9 +517,9 @@
482517
</pluginExecution>
483518
<pluginExecution>
484519
<pluginExecutionFilter>
485-
<groupId>org.codehaus.mojo</groupId>
520+
<groupId>net.sf.smc</groupId>
486521
<artifactId>smc-maven-plugin</artifactId>
487-
<versionRange>[1.0-alpha-1,)</versionRange>
522+
<versionRange>[${version.smc},)</versionRange>
488523
<goals>
489524
<goal>smc</goal>
490525
</goals>

modules/dcache/src/main/java/org/dcache/pool/p2p/Companion.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ public long getPingPeriod() {
259259
*/
260260
public synchronized boolean cancel(Object cause) {
261261
_fsm.cancel(cause);
262-
return (_fsm.getState() != CompanionContext.FSM.Done);
262+
return (_fsm.getState().getId() != CompanionContext.FSM_Done_STATE_ID);
263263
}
264264

265265
public String toString() {

pom.xml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
<version.spring>5.3.39</version.spring>
6666
<!-- Remember to sync aspectj version in dcache.properties -->
6767
<version.aspectj>1.9.24</version.aspectj>
68-
<version.smc>6.6.0</version.smc>
68+
<version.smc>7.6.0</version.smc>
6969
<version.xerces>2.12.0</version.xerces>
7070
<version.jetty>9.4.57.v20241219</version.jetty>
7171
<version.xrootd4j>4.6.0</version.xrootd4j>
@@ -644,8 +644,9 @@
644644

645645
<dependency>
646646
<groupId>net.sf.smc</groupId>
647-
<artifactId>statemap</artifactId>
647+
<artifactId>smc</artifactId>
648648
<version>${version.smc}</version>
649+
<type>pom</type>
649650
</dependency>
650651

651652
<dependency>

0 commit comments

Comments
 (0)