Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Target java 8 #215

Merged
merged 1 commit into from
Nov 11, 2024
Merged
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
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