Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[examples] Enable compilation on OpenJDK 8.
Signed-off-by: Stéphane Galland <galland@arakhne.org>
  • Loading branch information
gallandarakhneorg committed Jan 21, 2020
1 parent 866c46b commit 27bd76b
Show file tree
Hide file tree
Showing 3 changed files with 91 additions and 19 deletions.
37 changes: 37 additions & 0 deletions contribs/io.sarl.examples/io.sarl.examples.tests/pom.xml
Expand Up @@ -10,6 +10,11 @@
<artifactId>io.sarl.examples.tests</artifactId>
<name>Example Tests</name>

<properties>
<mvn.command>mvn</mvn.command>
<openjfx.fxml.linux.path>${project.basedir}/../../../build-tools/libs/jfxrt.jar</openjfx.fxml.linux.path>
</properties>

<dependencies>
<dependency>
<groupId>io.sarl</groupId>
Expand All @@ -29,4 +34,36 @@
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>com.google.code.maven-replacer-plugin</groupId>
<artifactId>replacer</artifactId>
<executions>
<execution>
<id>prepare-mavenbatchcompiler-class</id>
<phase>process-sources</phase>
<goals>
<goal>replace</goal>
</goals>
<configuration>
<encoding>${project.build.sourceEncoding}</encoding>
<file>${project.basedir}/src/test/java/io/sarl/examples/tests/ExamplesTest.java</file>
<regexFlags><regexFlag>MULTILINE</regexFlag></regexFlags>
<replacements>
<replacement>
<token>(MAVEN_COMMAND *= *")([^"]+)(";)</token>
<value>$1${mvn.command}$3</value>
</replacement>
<replacement>
<token>(DEFAULT_JAVAFX_PATH *= *")([^"]+)(";)</token>
<value>$1${openjfx.fxml.linux.path}$3</value>
</replacement>
</replacements>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Expand Up @@ -90,6 +90,11 @@ public class ExamplesTest extends AbstractSarlTest {

private static final String PROJECTS_FOLDER_NAME = "projects"; //$NON-NLS-1$

private static final String MAVEN_COMMAND = "mvn"; //$NON-NLS-1$

// TODO Remove this definition when moving to Java 9 or higher (because JavaFX is mavenized)
private static final String DEFAULT_JAVAFX_PATH = "/home/sgalland/git/sarl/contribs/io.sarl.examples/io.sarl.examples.tests/../../../build-tools/libs/jfxrt.jar"; //$NON-NLS-1$

/** Replies the archives for the examples.
*
* @return the archive locations.
Expand Down Expand Up @@ -326,9 +331,13 @@ private String compileMaven(File root) throws Exception {
compiledFile.createNewFile();

final String[] command = new String[] {
"mvn", "-q", "clean", "package"
MAVEN_COMMAND, "-q", "clean", "package"
};
// TODO Remove this definition when moving to JAva 9 or higher (because JavaFX is mavenized)
final String[] environmentVariables = new String[] {
"OPENJFX_LIB_PATH=" + DEFAULT_JAVAFX_PATH,
};
final Process p = Runtime.getRuntime().exec(command, null, root);
final Process p = Runtime.getRuntime().exec(command, environmentVariables, root);
p.waitFor();
final StringBuilder output = new StringBuilder();
output.append("Exit code: ").append(p.exitValue()).append("\n");
Expand Down
60 changes: 43 additions & 17 deletions tycho-parent/pom.xml
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

<modelVersion>4.0.0</modelVersion>
Expand Down Expand Up @@ -88,20 +89,49 @@
<version>${zeromq.version}</version>
</restrictTo>
</filter>
<filter>
<type>eclipse-plugin</type>
<id>org.arakhne.afc.core.vmutils</id>
<restrictTo>
<version>${afc.osgi.version}</version>
</restrictTo>
</filter>
<filter>
<type>eclipse-plugin</type>
<id>org.arakhne.afc.core.text</id>
<restrictTo>
<version>${afc.osgi.version}</version>
</restrictTo>
</filter>
<filter>
<type>eclipse-plugin</type>
<id>org.arakhne.afc.core.util</id>
<restrictTo>
<version>${afc.osgi.version}</version>
</restrictTo>
</filter>
<filter>
<type>eclipse-plugin</type>
<id>org.arakhne.afc.core.references</id>
<restrictTo>
<version>${afc.osgi.version}</version>
</restrictTo>
</filter>
</filters>
<!-- The following dependency-resolution is added for obtaining a runnable
product on MacOS -->
<!-- The following dependency-resolution is added for obtaining a runnable
product on MacOS -->
<dependency-resolution>
<extraRequirements>
<!-- to ensure that the generated product is not using the bad Xtext version. -->
<!-- to ensure that the generated product is not using the bad Xtext
version. -->
<requirement>
<type>eclipse-feature</type>
<id>org.eclipse.xtext.xbase.lib</id>
<versionRange>[${xtext.version.current},${xtext.version.next})</versionRange>
</requirement>
<!-- to get the org.eclipse.osgi.compatibility.state plugin iff
the targeted Eclipse version (e.g., Luna) has it
(backwards compatible with kepler and previous versions) -->
<!-- to get the org.eclipse.osgi.compatibility.state plugin iff the
targeted Eclipse version (e.g., Luna) has it (backwards compatible with kepler
and previous versions) -->
<requirement>
<type>eclipse-feature</type>
<id>org.eclipse.rcp</id>
Expand Down Expand Up @@ -229,22 +259,18 @@
</property>
</activation>
</profile>
</profiles>
</profiles>

<!-- ===================== -->
<!-- ==== Repositories === -->
<!-- ===================== -->

<repositories>
<!-- Use the different P2 repositories in place of the P2 composite repository.
The list of the available P2 repositories is available at:
https://eclipse.org/Xtext/documentation/350_continuous_integration.html
-->
<!--<repository>
<id>org.eclipse.modeling.tmf.xtext.updates</id>
<layout>p2</layout>
<url>http://download.eclipse.org/modeling/tmf/xtext/updates/releases/${xtext.version.current}/</url>
</repository>-->
<!-- Use the different P2 repositories in place of the P2 composite repository.
The list of the available P2 repositories is available at: https://eclipse.org/Xtext/documentation/350_continuous_integration.html -->
<!--<repository> <id>org.eclipse.modeling.tmf.xtext.updates</id> <layout>p2</layout>
<url>http://download.eclipse.org/modeling/tmf/xtext/updates/releases/${xtext.version.current}/</url>
</repository> -->
<!-- Eclipse and related libraries -->
<repository>
<id>org.eclipse.ide.lastest</id>
Expand Down

0 comments on commit 27bd76b

Please sign in to comment.