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

Don't close URLClassLoader #233

Merged
merged 1 commit into from
Jan 15, 2025
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
11 changes: 3 additions & 8 deletions bridge/src/main/java/com/github/sbt/avro/AvroCompilerBridge.java
Original file line number Diff line number Diff line change
Expand Up @@ -96,16 +96,11 @@ public void compileIdls(File[] idls, File target) throws Exception {

@Override
public void compileAvscs(File[] avscs, File target) throws Exception {
List<File> files = new ArrayList<>(avscs.length);
for (File schema : avscs) {
System.out.println("Compiling Avro schema: " + schema);
files.add(schema);
}
Map<File, Schema> schemas = parser.parseFiles(files);

Map<File, Schema> schemas = parser.parseFiles(Arrays.asList(avscs));
for (Map.Entry<File, Schema> entry: schemas.entrySet()) {
File file = entry.getKey();
Schema schema = entry.getValue();
System.out.println("Compiling Avro schema: " + file + ":" + schema.getFullName());
SpecificCompiler compiler = new SpecificCompiler(schema);
configureCompiler(compiler);
compiler.compileToDestination(file, target);
Expand All @@ -119,7 +114,7 @@ public void compileAvprs(File[] avprs, File target) throws Exception {
Protocol protocol = Protocol.parse(avpr);
SpecificCompiler compiler = new SpecificCompiler(protocol);
configureCompiler(compiler);
compiler.compileToDestination(null, target);
compiler.compileToDestination(avpr, target);
}
}
}
3 changes: 0 additions & 3 deletions plugin/src/main/scala/com/github/sbt/avro/SbtAvro.scala
Original file line number Diff line number Diff line change
Expand Up @@ -242,8 +242,6 @@ object SbtAvro extends AutoPlugin {
// - no previous cache and we have records to recompile
// - input files have changed
// - output files are missing

// TODO Cache class loader
val avroClassLoader = new AvroCompilerPluginClassLoader(
(AvroCompiler / dependencyClasspath).value
.map(toNioPath)
Expand Down Expand Up @@ -287,7 +285,6 @@ object SbtAvro extends AutoPlugin {
throw new AvroGenerateFailedException
} finally {
Thread.currentThread().setContextClassLoader(initLoader)
avroClassLoader.close()
}
} else {
outReport.checked
Expand Down
Loading