Skip to content

Commit

Permalink
fix: Fix running of spoon-visualization (#5963)
Browse files Browse the repository at this point in the history
  • Loading branch information
I-Al-Istannen authored Sep 8, 2024
1 parent 5bff43f commit 3c8febb
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 102 deletions.
8 changes: 3 additions & 5 deletions spoon-visualisation/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,9 @@ It is an alternative to the Swing-based GUI of Spoon ASTs (`$ java -cp spoon...-

## How to run

The app requires a JDK 11.
We currently do not provide any packaging of the app (`jlink` cannot package apps having non-modular libraries, such as Spoon).

So, to run the app, run: `mvn clean package`.
Then go into the `target/modules` folder and launch: `java --module-path . --add-modules=ALL-MODULE-PATH -jar visualisation-1.1.jar`
1. Install Java **22** or newer.
2. Run: `mvn javafx:run`. Alternativatively, build a fat jar using `mvn
package` and then run `java -jar target/spoon-visualisation-all.jar`.

## Features Summary

Expand Down
141 changes: 45 additions & 96 deletions spoon-visualisation/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@
<licenses>
<license>
<name>The MIT license</name>
<url>http://www.opensource.org/licenses/mit-license.php</url>
<url>https://www.opensource.org/licenses/mit-license.php</url>
<distribution>repo</distribution>
</license>
</licenses>

<parent>
<groupId>fr.inria.gforge.spoon</groupId>
<artifactId>spoon-pom</artifactId>
<version>1.0</version>
<version>11.1.0</version>
<relativePath>../spoon-pom</relativePath>
</parent>

Expand All @@ -28,72 +28,50 @@

<build>
<plugins>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>3.4.2</version>
<configuration>
<outputDirectory>${project.build.directory}/modules</outputDirectory>
</configuration>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.8.0</version>
<executions>
<execution>
<id>main deps</id>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<excludeClassifiers>linux,win,mac</excludeClassifiers>
<outputDirectory>
${project.build.directory}/modules
</outputDirectory>
<includeScope>runtime</includeScope>
</configuration>
</execution>

<execution>
<id>JFX deps</id>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>
${project.build.directory}/modules
</outputDirectory>
<includeScope>runtime</includeScope>
</configuration>
<id>copy-dependencies</id>
<phase>none</phase>
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>3.4.1</version>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.6.0</version>
<executions>
<execution>
<id>main module</id>
<phase>package</phase>
<id>shade-jar</id>
<goals>
<goal>exec</goal>
<goal>shade</goal>
</goals>
<configuration>
<executable>${java.home}/bin/jar</executable>
<arguments>
<argument>--update</argument>
<argument>--file=${project.build.directory}/modules/${project.build.finalName}.jar</argument>
<argument>--main-class=spoon.visualisation.ShowMe</argument>
<argument>--module-version=${project.version}</argument>
</arguments>
</configuration>
<phase>package</phase>
</execution>
</executions>
<configuration>
<finalName>spoon-${project.name}-all</finalName>
<transformers>
<transformer
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<manifestEntries>
<Main-Class>spoon.visualisation.Launcher</Main-Class>
</manifestEntries>
</transformer>
</transformers>
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.DSA</exclude>
<exclude>META-INF/*.RSA</exclude>
</excludes>
</filter>
</filters>
</configuration>
</plugin>

<plugin>
Expand All @@ -102,13 +80,24 @@
<configuration>
<testFailureIgnore>false</testFailureIgnore>
<useModulePath>false</useModulePath>
<argLine>-Xmx2000m
-Dglass.platform=Monocle
<argLine>
-Xmx2000m
-Dheadless.geometry=1280x1024-32
-Djava.awt.headless=true
-Dtestfx.robot=glass
-Dtestfx.headless=true
-Dprism.order=sw</argLine>
-Dprism.order=sw
</argLine>
</configuration>
</plugin>

<plugin>
<groupId>org.openjfx</groupId>
<artifactId>javafx-maven-plugin</artifactId>
<version>0.0.8</version>
<configuration>
<mainClass>spoon.visualisation/spoon.visualisation.Launcher</mainClass>
<runtimePathOption>CLASSPATH</runtimePathOption>
</configuration>
</plugin>
</plugins>
Expand All @@ -130,36 +119,6 @@
<groupId>fr.inria.gforge.spoon</groupId>
<artifactId>spoon-core</artifactId>
<version>11.1.0</version>
<exclusions>
<exclusion>
<artifactId>*</artifactId>
<groupId>com.fasterxml.jackson.core</groupId>
</exclusion>
<exclusion>
<artifactId>*</artifactId>
<groupId>org.codehaus.plexus</groupId>
</exclusion>
<exclusion>
<artifactId>*</artifactId>
<groupId>org.apache.maven.shared</groupId>
</exclusion>
<exclusion>
<artifactId>*</artifactId>
<groupId>org.apache.maven</groupId>
</exclusion>
<exclusion>
<artifactId>*</artifactId>
<groupId>org.eclipse.platform</groupId>
</exclusion>
<exclusion>
<artifactId>*</artifactId>
<groupId>org.tukaani</groupId>
</exclusion>
<exclusion>
<artifactId>commons-compress</artifactId>
<groupId>org.apache.commons</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
Expand Down Expand Up @@ -212,14 +171,4 @@
</exclusions>
</dependency>
</dependencies>

<repositories>
<repository>
<id>spoon-snapshot</id>
<name>Maven Repository for Spoon Snapshots</name>
<url>https://repository.ow2.org/nexus/content/repositories/snapshots/</url>
<snapshots><enabled>true</enabled></snapshots>
<releases><enabled>false</enabled></releases>
</repository>
</repositories>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package spoon.visualisation;

import javafx.application.Application;

public class Launcher {
public static void main(String[] args) {
Application.launch(ShowMe.class);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ protected void doCmdBody() {
env.setAutoImports(true);
env.disableConsistencyChecks();
env.setLevel("OFF");
env.setComplianceLevel(11);
env.setComplianceLevel(22);

launcher.buildModel().getRootPackage().accept(new SpoonTreeScanner(createSpoonVisitor(levelsToIgnore), hideImplicit));

Expand Down

0 comments on commit 3c8febb

Please sign in to comment.