Skip to content

Commit

Permalink
Initial support for java module system
Browse files Browse the repository at this point in the history
  • Loading branch information
weissreto committed Oct 18, 2018
1 parent fd79575 commit 4f42fdc
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 17 deletions.
6 changes: 3 additions & 3 deletions .classpath
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="test" value="true"/>
<attribute name="optional" value="true"/>
<attribute name="test" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
Expand All @@ -30,7 +30,7 @@
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
<attributes>
<attribute name="test" value="true"/>
<attribute name="test" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
Expand Down
10 changes: 7 additions & 3 deletions .settings/org.eclipse.jdt.core.prefs
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=11
org.eclipse.jdt.core.compiler.compliance=11
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.source=1.8
org.eclipse.jdt.core.compiler.release=enabled
org.eclipse.jdt.core.compiler.source=11
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
language: java
jdk: oraclejdk8
jdk: openjdk11
install: true
script: mvn --settings .travis.settings.xml clean deploy
cache:
Expand Down
32 changes: 27 additions & 5 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,39 @@
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.6.2</version>
<version>3.8.0</version>
<executions>
<execution>
<id>module-compile</id>
<goals>
<goal>compile</goal>
</goals>
<configuration>
<!-- compile module-info.java to be compatible with java 11 -->
<release>11</release>
<includes>
<include>module-info.java</include>
</includes>
</configuration>
</execution>
<execution>
<id>default-compile</id>
<!-- Compile all other classes to be compatible with java 8 -->
<configuration>
<excludes>
<exclude>module-info.java</exclude>
</excludes>
</configuration>
</execution>
</executions>
<configuration>
<source>1.8</source>
<target>1.8</target>
<release>8</release>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.21.0</version>
<version>2.22.1</version>
<dependencies>
<dependency>
<groupId>org.junit.platform</groupId>
Expand All @@ -38,7 +61,6 @@
<configuration>
<archive>
<manifestEntries>
<Automatic-Module-Name>ch.rweiss.ansi.terminal.chart</Automatic-Module-Name>
<Built-By>Reto Weiss</Built-By>
<Implementation-Title>${project.artifactId}</Implementation-Title>
<Implementation-Vendor>Reto Weiss</Implementation-Vendor>
Expand Down
10 changes: 10 additions & 0 deletions src/main/java/module-info.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
module ch.rweiss.terminal.chart
{
exports ch.rweiss.terminal.chart;
exports ch.rweiss.terminal.chart.format;
exports ch.rweiss.terminal.chart.serie;
exports ch.rweiss.terminal.chart.unit;

requires transitive ch.rweiss.terminal;
requires ch.rweiss.check;
}
11 changes: 6 additions & 5 deletions src/test/java/ch/rweiss/terminal/chart/TestUnit.java
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
package ch.rweiss.terminal.chart;

import static org.assertj.core.api.Assertions.assertThat;

import org.junit.jupiter.api.Test;

import ch.rweiss.terminal.chart.unit.Unit;

class TestUnit
public class TestUnit
{
@Test
void testToString()
public void testToString()
{
assertThat(Unit.BYTES.toString()).isEqualTo("B (bytes)");
assertThat(Unit.KILO_BYTES.toString()).isEqualTo("kB (kilo bytes)");
Expand All @@ -18,7 +19,7 @@ void testToString()
}

@Test
void symbol()
public void symbol()
{
assertThat(Unit.BYTES.symbol()).isEqualTo("B");
assertThat(Unit.KILO_BYTES.symbol()).isEqualTo("kB");
Expand All @@ -28,7 +29,7 @@ void symbol()
}

@Test
void scaleUp()
public void scaleUp()
{
long value = Unit.BYTES.convertTo(1024*1024*1024, Unit.KILO_BYTES);
assertThat(value).isEqualTo(1024*1024);
Expand All @@ -39,7 +40,7 @@ void scaleUp()
}

@Test
void scaleDown()
public void scaleDown()
{
long value = Unit.MINUTES.convertTo(1, Unit.SECONDS);
assertThat(value).isEqualTo(60);
Expand Down

0 comments on commit 4f42fdc

Please sign in to comment.