Skip to content

Commit

Permalink
Build as Java 9 modules, fixes #70
Browse files Browse the repository at this point in the history
  • Loading branch information
gnodet committed Jan 5, 2017
1 parent 66ce215 commit e87bd21
Show file tree
Hide file tree
Showing 29 changed files with 1,108 additions and 91 deletions.
34 changes: 31 additions & 3 deletions builtins/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
</dependency>

<dependency>
<groupId>com.googlecode.juniversalchardet</groupId>
<artifactId>juniversalchardet</artifactId>
<groupId>org.jline.deps</groupId>
<artifactId>juniversalchardet-${juniversalchardet.version}</artifactId>
<optional>true</optional>
</dependency>

Expand All @@ -54,9 +54,13 @@
<execution>
<id>default-compile</id>
<configuration>
<!-- compile everything to ensure module-info contains right entries -->
<excludes>
<exclude>**/TTop.java</exclude>
</excludes>
<release>9</release>
<source>9</source>
<target>9</target>
<compilerArgs>
<arg>-Xlint:all,-options</arg>
<arg>-Werror</arg>
Expand All @@ -66,14 +70,38 @@
</configuration>
</execution>
<execution>
<id>noncompact</id>
<id>base-compile</id>
<goals>
<goal>compile</goal>
</goals>
<configuration>
<excludes>
<exclude>module-info.java</exclude>
<exclude>**/TTop.java</exclude>
</excludes>
<release>8</release>
<source>8</source>
<target>8</target>
<compilerArgs>
<arg>-Xlint:all,-options</arg>
<arg>-Werror</arg>
<arg>-profile</arg>
<arg>compact1</arg>
</compilerArgs>
</configuration>
</execution>
<execution>
<id>base-compile2</id>
<goals>
<goal>compile</goal>
</goals>
<configuration>
<includes>
<include>**/TTop.java</include>
</includes>
<release>8</release>
<source>8</source>
<target>8</target>
<compilerArgs>
<arg>-Xlint:all,-options</arg>
<arg>-Werror</arg>
Expand Down
6 changes: 6 additions & 0 deletions builtins/src/main/java/module-info.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module org.jline.builtins {
exports org.jline.builtins;
requires transitive org.jline.reader;
requires transitive org.jline.terminal;
requires static com.googlecode.juniversalchardet;
}
53 changes: 16 additions & 37 deletions demo/jline-gogo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,54 +17,26 @@ REALNAME=$(realpath "$0")
DIRNAME=$(dirname "${REALNAME}")
PROGNAME=$(basename "${REALNAME}")
ROOTDIR=${DIRNAME}/..
TARGETDIR=${DIRNAME}/target

if [ ! -e ${ROOTDIR}/jline/target ] ; then
echo "Build jline with maven before running the demo"
exit
fi;
if [ ! -e ${TARGETDIR} ] ; then
mkdir ${TARGETDIR}
fi;
if [ ! -e ${TARGETDIR}/lib ] ; then
mkdir ${TARGETDIR}/lib
fi;

JLINE_VERSION=$(ls ${ROOTDIR}/jline/target/jline-*-SNAPSHOT.jar | sed -e 's#.*/jline-## ; s#SNAPSHOT.*#SNAPSHOT#')
JANSI_VERSION=$(cat ${ROOTDIR}/pom.xml| grep jansi.version\> | sed -e 's#^.*<jansi.version>## ; s#</jansi.*##')
JNA_VERSION=$(cat ${ROOTDIR}/pom.xml| grep jna.version\> | sed -e 's#^.*<jna.version>## ; s#</jna.*##')
GOGO_RUNTIME_VERSION=1.0.2
GOGO_JLINE_VERSION=1.0.2
GOGO_RUNTIME_VERSION=$(cat ${ROOTDIR}/pom.xml| grep gogo.runtime.version\> | sed -e 's#^.*<gogo.runtime.version>## ; s#</gogo.*##')
GOGO_JLINE_VERSION=$(cat ${ROOTDIR}/pom.xml| grep gogo.jline.version\> | sed -e 's#^.*<gogo.jline.version>## ; s#</gogo.*##')

# JLINE
cp=${ROOTDIR}/jline/target/jline-${JLINE_VERSION}.jar

# Gogo Runtime
if [ ! -f ${TARGETDIR}/lib/org.apache.felix.gogo.runtime-${GOGO_RUNTIME_VERSION}.jar ] ; then
echo "Downloading Gogo Runtime ${GOGO_RUNTIME_VERSION}..."
wget -O ${TARGETDIR}/lib/org.apache.felix.gogo.runtime-${GOGO_RUNTIME_VERSION}.jar http://repo1.maven.org/maven2/org/apache/felix/org.apache.felix.gogo.runtime/${GOGO_RUNTIME_VERSION}/org.apache.felix.gogo.runtime-${GOGO_RUNTIME_VERSION}.jar
fi
cp=$cp:${TARGETDIR}/lib/org.apache.felix.gogo.runtime-${GOGO_RUNTIME_VERSION}.jar

cp=$cp:${ROOTDIR}/deps/gogo-runtime/target/gogo-runtime-${GOGO_RUNTIME_VERSION}-${JLINE_VERSION}.jar
# Gogo JLine
if [ ! -f ${TARGETDIR}/lib/org.apache.felix.gogo.jline-${GOGO_JLINE_VERSION}.jar ] ; then
echo "Downloading Gogo JLine ${GOGO_JLINE_VERSION}..."
wget -O ${TARGETDIR}/lib/org.apache.felix.gogo.jline-${GOGO_JLINE_VERSION}.jar http://repo1.maven.org/maven2/org/apache/felix/org.apache.felix.gogo.jline/${GOGO_JLINE_VERSION}/org.apache.felix.gogo.jline-${GOGO_JLINE_VERSION}.jar
fi
cp=$cp:${TARGETDIR}/lib/org.apache.felix.gogo.jline-${GOGO_JLINE_VERSION}.jar

# Jansi
if [ ! -f ${TARGETDIR}/lib/jansi-${JANSI_VERSION}.jar ] ; then
echo "Downloading Jansi ${JANSI_VERSION}..."
wget -O ${TARGETDIR}/lib/jansi-${JANSI_VERSION}.jar http://repo1.maven.org/maven2/org/fusesource/jansi/jansi/${JANSI_VERSION}/jansi-${JANSI_VERSION}.jar
fi

# JNA
if [ ! -f ${TARGETDIR}/lib/jna-${JNA_VERSION}.jar ] ; then
echo "Downloading JNA ${JNA_VERSION}..."
wget -O ${TARGETDIR}/lib/jna-${JNA_VERSION}.jar http://repo1.maven.org/maven2/net/java/dev/jna/jna/${JNA_VERSION}/jna-${JNA_VERSION}.jar
fi
cp=$cp:${ROOTDIR}/deps/gogo-jline/target/gogo-jline-${GOGO_JLINE_VERSION}-${JLINE_VERSION}.jar

usejars=false
opts=""
while [ "${1}" != "" ]; do
case ${1} in
Expand All @@ -77,11 +49,15 @@ while [ "${1}" != "" ]; do
shift
;;
'jansi')
cp=$cp:${TARGETDIR}/lib/jansi-${JANSI_VERSION}.jar
cp=$cp:${ROOTDIR}/deps/jansi/target/jansi-${JANSI_VERSION}-${JLINE_VERSION}.jar
shift
;;
'jna')
cp=$cp:${TARGETDIR}/lib/jna-${JNA_VERSION}.jar
cp=$cp:${ROOTDIR}/deps/jna/target/jna-${JNA_VERSION}-${JLINE_VERSION}.jar
shift
;;
'jars')
usejars=true
shift
;;
esac
Expand All @@ -105,5 +81,8 @@ fi
echo "Classpath: $cp"
echo "Launching Gogo JLine..."
set mouse=a
java -cp $cp $opts "-Dgosh.home=${DIRNAME}" org.apache.felix.gogo.jline.Main

if ${usejars}; then
java -cp $cp $opts "-Dgosh.home=${DIRNAME}" org.apache.felix.gogo.jline.Main
else
java --module-path $cp $opts "-Dgosh.home=${DIRNAME}" --module org.apache.felix.gogo.jline/org.apache.felix.gogo.jline.Main
fi
93 changes: 93 additions & 0 deletions deps/gogo-jline/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2002-2016, the original author or authors.
This software is distributable under the BSD license. See the terms of the
BSD license in the documentation provided with this software.
http://www.opensource.org/licenses/bsd-license.php
-->
<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/maven-v4_0_0.xsd">

<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.jline</groupId>
<artifactId>deps</artifactId>
<version>3.2.0-SNAPSHOT</version>
</parent>

<groupId>org.jline.deps</groupId>
<artifactId>gogo-jline-${gogo.jline.version}</artifactId>
<name>JLine Dependent Module: ${artifactId}</name>

<dependencies>
<dependency>
<groupId>org.jline</groupId>
<artifactId>jline</artifactId>
</dependency>
<dependency>
<groupId>org.jline.deps</groupId>
<artifactId>gogo-runtime-${gogo.runtime.version}</artifactId>
</dependency>
<dependency>
<groupId>org.jline.deps</groupId>
<artifactId>juniversalchardet-${juniversalchardet.version}</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.jline.deps</groupId>
<artifactId>jansi-${jansi.version}</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.jline.deps</groupId>
<artifactId>jna-${jna.version}</artifactId>
<scope>compile</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<phase>process-sources</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<artifactItems>
<!-- sources -->
<artifactItem>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.gogo.jline</artifactId>
<version>${gogo.jline.version}</version>
<classifier>sources</classifier>
<type>jar</type>
<overWrite>false</overWrite>
<outputDirectory>${project.build.directory}/generated-sources</outputDirectory>
</artifactItem>
<!-- resources -->
<artifactItem>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.gogo.jline</artifactId>
<version>${gogo.jline.version}</version>
<type>jar</type>
<overWrite>false</overWrite>
<outputDirectory>${project.build.directory}/generated-resources</outputDirectory>
<excludes>**/*.class</excludes>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>


</project>
7 changes: 7 additions & 0 deletions deps/gogo-jline/src/main/java/module-info.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module org.apache.felix.gogo.jline {
exports org.apache.felix.gogo.jline;
requires java.logging;
requires org.apache.felix.gogo.runtime;
requires org.jline;
requires static org.osgi.core;
}
83 changes: 83 additions & 0 deletions deps/gogo-runtime/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2002-2016, the original author or authors.
This software is distributable under the BSD license. See the terms of the
BSD license in the documentation provided with this software.
http://www.opensource.org/licenses/bsd-license.php
-->
<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/maven-v4_0_0.xsd">

<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.jline</groupId>
<artifactId>deps</artifactId>
<version>3.2.0-SNAPSHOT</version>
</parent>

<groupId>org.jline.deps</groupId>
<artifactId>gogo-runtime-${gogo.runtime.version}</artifactId>

<properties>
<gogo.runtime.version>1.0.2</gogo.runtime.version>
</properties>

<dependencies>
<dependency>
<groupId>org.jline.deps</groupId>
<artifactId>osgi-core-${osgi.core.version}</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.jline.deps</groupId>
<artifactId>osgi-event-${osgi.event.version}</artifactId>
<scope>compile</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<phase>process-sources</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<artifactItems>
<!-- sources -->
<artifactItem>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.gogo.runtime</artifactId>
<version>${gogo.runtime.version}</version>
<classifier>sources</classifier>
<type>jar</type>
<overWrite>false</overWrite>
<outputDirectory>${project.build.directory}/generated-sources</outputDirectory>
</artifactItem>
<!-- resources -->
<artifactItem>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.gogo.runtime</artifactId>
<version>${gogo.runtime.version}</version>
<type>jar</type>
<overWrite>false</overWrite>
<outputDirectory>${project.build.directory}/generated-resources</outputDirectory>
<excludes>**/*.class</excludes>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>


</project>
10 changes: 10 additions & 0 deletions deps/gogo-runtime/src/main/java/module-info.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
module org.apache.felix.gogo.runtime {
exports org.apache.felix.gogo.runtime;
exports org.apache.felix.gogo.runtime.activator;
exports org.apache.felix.gogo.runtime.threadio;
exports org.apache.felix.service.command;
exports org.apache.felix.service.threadio;
requires java.logging;
requires static org.osgi.service.event;
requires static org.osgi.core;
}

0 comments on commit e87bd21

Please sign in to comment.