diff --git a/bridge/src/main/java/com/github/sbt/avro/AvroCompilerBridge.java b/bridge/src/main/java/com/github/sbt/avro/AvroCompilerBridge.java index fa9717b..a0d54b0 100644 --- a/bridge/src/main/java/com/github/sbt/avro/AvroCompilerBridge.java +++ b/bridge/src/main/java/com/github/sbt/avro/AvroCompilerBridge.java @@ -127,7 +127,7 @@ public void compileAvscs(AvroFileRef[] avscs, File target) throws Exception { System.out.println("Compiling Avro schema: " + ref.getFile()); files.add(ref); } - compiler.compileFiles(Set.of(avscs), target); + compiler.compileFiles(files, target); } @Override diff --git a/bridge/src/main/java/com/github/sbt/avro/AvscFilesCompiler.java b/bridge/src/main/java/com/github/sbt/avro/AvscFilesCompiler.java index dce30b9..4e6674a 100644 --- a/bridge/src/main/java/com/github/sbt/avro/AvscFilesCompiler.java +++ b/bridge/src/main/java/com/github/sbt/avro/AvscFilesCompiler.java @@ -56,7 +56,14 @@ public void compileFiles(Set files, File outputDirectory) { if (!uncompiledFiles.isEmpty()) { String failedFiles = uncompiledFiles.stream() - .flatMap(f -> Stream.ofNullable(compileExceptions.get(f)).map(e -> f.getFile().getName() + ": " + e.getMessage())) + .flatMap(f -> { + Exception e = compileExceptions.get(f); + if (e == null) { + return Stream.empty(); + } else { + return Stream.of(f.getFile().getName() + ": " + e.getMessage()); + } + }) .collect(Collectors.joining(",\n")); throw new SchemaGenerationException("Can not compile schema files:\n" + failedFiles); @@ -87,7 +94,14 @@ public void compileClasses(Set> classes, File ou if (!uncompiledClasses.isEmpty()) { String failedClasses = uncompiledClasses.stream() .map(Class::toString) - .flatMap(c -> Stream.ofNullable(compileExceptions.get(c)).map(e -> c + ": " + e.getMessage())) + .flatMap(c -> { + Exception e = compileExceptions.get(c); + if (e == null) { + return Stream.empty(); + } else { + return Stream.of(c + ": " + e.getMessage()); + } + }) .collect(Collectors.joining(",\n")); throw new SchemaGenerationException("Can not re-compile classes:\n" + failedClasses); } diff --git a/build.sbt b/build.sbt index da13862..5167c56 100644 --- a/build.sbt +++ b/build.sbt @@ -60,6 +60,10 @@ ThisBuild / githubWorkflowPublish := Seq( ) ) +// compilers +ThisBuild / javacOptions ++= Seq("--release", "8") +ThisBuild / scalacOptions ++= Seq("-release", "8") + lazy val `sbt-avro-parent`: Project = project .in(file(".")) .settings( @@ -113,7 +117,6 @@ lazy val `sbt-avro`: Project = project }, buildInfoKeys := Seq[BuildInfoKey](name, version), buildInfoPackage := "com.github.sbt.avro", - Compile / scalacOptions ++= Seq("-deprecation"), scriptedLaunchOpts ++= Seq( "-Xmx1024M", "-Dplugin.version=" + version.value diff --git a/plugin/src/main/scala/com/github/sbt/avro/SbtAvro.scala b/plugin/src/main/scala/com/github/sbt/avro/SbtAvro.scala index d655bea..e33d909 100644 --- a/plugin/src/main/scala/com/github/sbt/avro/SbtAvro.scala +++ b/plugin/src/main/scala/com/github/sbt/avro/SbtAvro.scala @@ -224,7 +224,6 @@ object SbtAvro extends AutoPlugin { // TODO Cache class loader val avroClassLoader = new URLClassLoader( - "AvroClassLoader", (Avro / dependencyClasspath).value .map(toNioPath) .map(_.toUri.toURL)