Skip to content

Commit

Permalink
Target java 8
Browse files Browse the repository at this point in the history
  • Loading branch information
RustedBones committed Nov 11, 2024
1 parent fd5fbff commit 3ab96f4
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
18 changes: 16 additions & 2 deletions bridge/src/main/java/com/github/sbt/avro/AvscFilesCompiler.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,14 @@ public void compileFiles(Set<AvroFileRef> 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);
Expand Down Expand Up @@ -87,7 +94,14 @@ public void compileClasses(Set<Class<? extends SpecificRecord>> 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);
}
Expand Down
5 changes: 4 additions & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion plugin/src/main/scala/com/github/sbt/avro/SbtAvro.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 3ab96f4

Please sign in to comment.