Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
language: java
jdk:
- oraclejdk8
- openjdk17

branches:
only:
Expand Down
29 changes: 18 additions & 11 deletions copybook4java-codegen-maven-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@

<groupId>com.nordea.oss</groupId>
<artifactId>copybook4java-codegen-maven-plugin</artifactId>
<version>1.0.6</version>
<version>1.2.0</version>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.version>3.3.9</maven.version>
<maven.plugin.version>3.4</maven.plugin.version>
<maven.version>3.8.7</maven.version>
<maven.plugin.version>3.7.1</maven.plugin.version>
</properties>

<packaging>maven-plugin</packaging>
Expand Down Expand Up @@ -83,8 +83,8 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<source>17</source>
<target>17</target>
<compilerArgument>-Xlint:all</compilerArgument>
<showWarnings>true</showWarnings>
<showDeprecation>true</showDeprecation>
Expand All @@ -93,7 +93,7 @@
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.6.3</version>
<version>1.6.13</version>
<extensions>true</extensions>
<configuration>
<serverId>ossrh</serverId>
Expand All @@ -104,23 +104,23 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.18</version>
<version>2.22.2</version>
<configuration>
<parallel>methods</parallel>
<threadCount>10</threadCount>
</configuration>
</plugin>
<plugin>
<artifactId>maven-scm-plugin</artifactId>
<version>1.8.1</version>
<version>1.13.0</version>
<configuration>
<tag>v${project.version}</tag>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>versions-maven-plugin</artifactId>
<version>2.1</version>
<version>2.14.2</version>
<configuration>
<generateBackupPoms>false</generateBackupPoms>
</configuration>
Expand Down Expand Up @@ -186,7 +186,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.9.1</version>
<version>2.10.4</version>
<executions>
<execution>
<id>attach-javadocs</id>
Expand All @@ -199,7 +199,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>1.5</version>
<version>1.6</version>
<executions>
<execution>
<id>sign-artifacts</id>
Expand All @@ -223,6 +223,13 @@
<version>1.0.3</version>
</dependency>

<!-- generation engine -->
<dependency>
<groupId>org.openjdk.nashorn</groupId>
<artifactId>nashorn-core</artifactId>
<version>15.4</version>
</dependency>

<!-- maven stuff : https://blog.sagaoftherealms.net/?p=528 , https://github.com/jcabi/jcabi-maven-plugin/blob/master/pom.xml-->
<dependency>
<groupId>org.apache.maven</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
package com.nordea.oss.copybook.codegen;

import com.nordea.oss.ByteUtils;
import jdk.nashorn.api.scripting.ScriptObjectMirror;
import org.openjdk.nashorn.api.scripting.ScriptObjectMirror;

import javax.script.*;
import java.io.*;
Expand All @@ -29,7 +29,7 @@ public CopyBookConverter() throws Exception {
InputStream inputStream = this.getClass().getResourceAsStream("classconverter.html");
String js = extractJS(inputStream);

manager = new ScriptEngineManager(null);
manager = new ScriptEngineManager();
engine = manager.getEngineByName("nashorn");

if(engine == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public static List<String> check(List<String> sources) throws Exception {

StandardJavaFileManager fileManager = javac.getStandardFileManager(null, null, StandardCharsets.UTF_8);
DiagnosticCollector<JavaFileObject> diagnostics = new DiagnosticCollector<>();
JavaCompiler.CompilationTask task = javac.getTask(null, new InMemmoryFileManager(javac.getStandardFileManager(null, null, null)), diagnostics, null, null, stringSourceCodes);
JavaCompiler.CompilationTask task = javac.getTask(null, new InMemoryFileManager(fileManager), diagnostics, null, null, stringSourceCodes);
task.call();

List<String> errors = new ArrayList<>();
Expand All @@ -62,11 +62,11 @@ public CharSequence getCharContent(boolean ignoreEncodingErrors) throws IOExcept
}
}

private static class InMemmoryFileManager implements JavaFileManager {
private static class InMemoryFileManager implements JavaFileManager {
private final StandardJavaFileManager fileManager;
private final Map<String, ByteArrayOutputStream> buffers = new LinkedHashMap<>();

InMemmoryFileManager(StandardJavaFileManager fileManager) {
InMemoryFileManager(StandardJavaFileManager fileManager) {
this.fileManager = fileManager;
}

Expand Down Expand Up @@ -125,7 +125,7 @@ public FileObject getFileForOutput(Location location, String packageName, String
return fileManager.getFileForOutput(location, packageName, relativeName, sibling);
}

public void flush() throws IOException {
public void flush() {
// Do nothing
}

Expand All @@ -136,6 +136,13 @@ public void close() throws IOException {
public int isSupportedOption(String option) {
return fileManager.isSupportedOption(option);
}
}

public String inferModuleName(Location location) throws IOException {
return fileManager.inferModuleName(location);
}

public Iterable<Set<Location>> listLocationsForModules(Location location) throws IOException {
return fileManager.listLocationsForModules(location);
}
}
}
8 changes: 4 additions & 4 deletions copybook4java-codegen-maven-test/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.2</version>
<version>3.8.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<source>17</source>
<target>17</target>
<compilerArgument>-Xlint:all</compilerArgument>
<showWarnings>true</showWarnings>
<showDeprecation>true</showDeprecation>
Expand All @@ -31,7 +31,7 @@
<plugin>
<groupId>com.nordea.oss</groupId>
<artifactId>copybook4java-codegen-maven-plugin</artifactId>
<version>1.0.6</version>
<version>1.2.0</version>
<configuration>
<inputFilter>^.*\.txt$</inputFilter>
<inputPath>src/test/resources/</inputPath>
Expand Down