martin-g commented on code in PR #3614:
URL: https://github.com/apache/avro/pull/3614#discussion_r2779263473


##########
lang/java/gradle-plugin/src/main/kotlin/eu/eventloopsoftware/avro/gradle/plugin/AvroGradlePlugin.kt:
##########
@@ -0,0 +1,198 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements.  See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership.  The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License.  You may obtain a copy of the License at
+*
+*     https://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package eu.eventloopsoftware.avro.gradle.plugin
+
+import 
eu.eventloopsoftware.avro.gradle.plugin.extension.AvroGradlePluginExtension
+import eu.eventloopsoftware.avro.gradle.plugin.tasks.AbstractCompileTask
+import eu.eventloopsoftware.avro.gradle.plugin.tasks.CompileAvroSchemaTask
+import org.gradle.api.Plugin
+import org.gradle.api.Project
+import org.gradle.api.plugins.JavaPlugin
+import org.gradle.api.plugins.JavaPluginExtension
+import org.gradle.api.provider.Property
+import org.gradle.api.tasks.TaskProvider
+import org.jetbrains.kotlin.gradle.dsl.KotlinJvmExtension
+
+abstract class AvroGradlePlugin : Plugin<Project> {
+
+  override fun apply(project: Project) {
+    project.logger.info("Running Avro Gradle plugin for project: 
${project.name}")
+
+    val extension = project.extensions.create("avro", 
AvroGradlePluginExtension::class.java)
+
+    // Required so that we can get the sourceSets from the java extension 
below.
+    project.pluginManager.apply("java")
+
+    val compileAvroSchemaTask = registerSchemaTask(extension, project)
+    val compileTestAvroSchemaTask = registerSchemaTestTask(extension, project)
+    addGeneratedSourcesHook(project, compileAvroSchemaTask, 
compileTestAvroSchemaTask)
+  }
+
+  private fun addGeneratedSourcesHook(
+      project: Project,
+      compileAvroSchemaTask: TaskProvider<CompileAvroSchemaTask>,
+      compileTestAvroSchemaTask: TaskProvider<CompileAvroSchemaTask>,
+  ) {
+    project.pluginManager.withPlugin("org.jetbrains.kotlin.jvm") {
+      addGeneratedSourcesToKotlinProject(project, compileAvroSchemaTask, 
compileTestAvroSchemaTask)
+    }
+
+    project.plugins.withType(JavaPlugin::class.java) {
+      addGeneratedSourcesToJavaProject(project, compileAvroSchemaTask, 
compileTestAvroSchemaTask)
+    }
+  }
+
+  private fun registerSchemaTask(extension: AvroGradlePluginExtension, 
project: Project) =
+      project.tasks.register("avroGenerateJavaClasses", 
CompileAvroSchemaTask::class.java) { compileSchemaTask ->
+        val includesAvsc: Set<String> = extension.includedSchemaFiles.get()
+        val includesProtocol: Set<String> = 
extension.includedProtocolFiles.get()
+
+        addProperties(compileSchemaTask, extension, project, 
extension.outputDirectory)
+
+        addSchemaFiles(
+            compileSchemaTask,
+            project,
+            extension,
+            includesAvsc,
+            extension.sourceDirectory,
+        )
+        addProtocolFiles(
+            compileSchemaTask,
+            project,
+            extension,
+            includesProtocol,
+            extension.testSourceDirectory,

Review Comment:
   ```suggestion
               extension.sourceDirectory,
   ```



##########
lang/java/gradle-plugin/src/main/kotlin/eu/eventloopsoftware/avro/gradle/plugin/extension/AvroGradlePluginExtension.kt:
##########
@@ -0,0 +1,226 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements.  See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership.  The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License.  You may obtain a copy of the License at
+*
+*     https://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package eu.eventloopsoftware.avro.gradle.plugin.extension
+
+import javax.inject.Inject
+import org.gradle.api.model.ObjectFactory
+import org.gradle.api.provider.ListProperty
+import org.gradle.api.provider.Property
+import org.gradle.api.provider.SetProperty
+
+abstract class AvroGradlePluginExtension @Inject constructor(objects: 
ObjectFactory) {
+
+  /**
+   * The source directory containing Avro schema files.
+   *
+   * <p>
+   * Defaults to {@code src/main/avro}.
+   */
+  val sourceDirectory: Property<String> = 
objects.property(String::class.java).convention("src/main/avro")
+
+  /**
+   * A list of zip files that contain Avro schema files. All generated Java 
classes are added to the classpath.
+   *
+   * <p>
+   * Defaults to {@code emptyList()}.
+   */
+  val sourceZipFiles: ListProperty<String> = 
objects.listProperty(String::class.java).convention(emptyList())
+
+  /** The output directory for the generated Java code. */
+  val outputDirectory: Property<String> = 
objects.property(String::class.java).convention("generated-sources-avro")
+
+  /** The output directory for the generated test Java code. */
+  val testSourceDirectory: Property<String> = 
objects.property(String::class.java).convention("src/test/avro")
+
+  /**
+   * @parameter property="outputDirectory" 
default-value="${project.layout.buildDirectory}/generated-test-sources/avro"

Review Comment:
   This Javadoc seems like a copy/paste from Maven



##########
lang/java/gradle-plugin/src/main/kotlin/eu/eventloopsoftware/avro/gradle/plugin/tasks/CompileAvroSchemaTask.kt:
##########
@@ -0,0 +1,81 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements.  See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership.  The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License.  You may obtain a copy of the License at
+*
+*     https://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package eu.eventloopsoftware.avro.gradle.plugin.tasks
+
+import java.io.File
+import java.io.IOException
+import org.apache.avro.Protocol
+import org.apache.avro.SchemaParseException
+import org.apache.avro.SchemaParser
+import org.apache.avro.compiler.specific.SpecificCompiler
+import org.gradle.api.file.ConfigurableFileCollection
+import org.gradle.api.tasks.InputFiles
+import org.gradle.api.tasks.SkipWhenEmpty
+import org.gradle.api.tasks.TaskAction
+
+abstract class CompileAvroSchemaTask : AbstractCompileTask() {
+
+  @get:InputFiles @get:SkipWhenEmpty abstract val schemaFiles: 
ConfigurableFileCollection
+
+  @get:InputFiles @get:SkipWhenEmpty abstract val protocolFiles: 
ConfigurableFileCollection
+
+  @TaskAction
+  fun compileSchema() {
+    logger.info("Generating Java files from ${schemaFiles.files.size} Avro 
schemas...")
+
+    compileSchemas(schemaFiles, outputDirectory.get().asFile)
+
+    logger.info("Done generating Java files from Avro schemas...")
+  }
+
+  private fun compileSchemas(schemaFileTree: ConfigurableFileCollection, 
outputDirectory: File) {
+    val sourceFileForModificationDetection: File? =
+        schemaFileTree.asFileTree.files.filter { file: File -> 
file.lastModified() > 0 }.maxBy { it.lastModified() }
+
+    // Need to register custom logical type factories before schema 
compilation.
+    try {
+      loadLogicalTypesFactories()
+    } catch (e: IOException) {
+      throw RuntimeException("Error while loading logical types factories ", e)
+    }
+
+    try {
+      val parser = SchemaParser()
+      for (sourceFile in schemaFileTree.files) {
+        parser.parse(sourceFile)
+      }
+      val schemas = parser.parsedNamedSchemas
+      doCompile(sourceFileForModificationDetection, SpecificCompiler(schemas), 
outputDirectory)
+
+      for (sourceFile in protocolFiles.files) {
+        val protocol = Protocol.parse(sourceFile)
+        doCompile(sourceFile, protocol, outputDirectory)
+      }
+    } catch (ex: IOException) {
+      throw RuntimeException(
+          "IO ex: Error compiling a file in " + schemaFileTree.asPath + " to " 
+ outputDirectory,
+          ex,
+      )
+    } catch (ex: SchemaParseException) {
+      throw RuntimeException(

Review Comment:
   ```suggestion
         throw org.gradle.api.GradleException(
   ```



##########
lang/java/gradle-plugin/src/main/kotlin/eu/eventloopsoftware/avro/gradle/plugin/AvroGradlePlugin.kt:
##########
@@ -0,0 +1,198 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements.  See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership.  The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License.  You may obtain a copy of the License at
+*
+*     https://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package eu.eventloopsoftware.avro.gradle.plugin
+
+import 
eu.eventloopsoftware.avro.gradle.plugin.extension.AvroGradlePluginExtension
+import eu.eventloopsoftware.avro.gradle.plugin.tasks.AbstractCompileTask
+import eu.eventloopsoftware.avro.gradle.plugin.tasks.CompileAvroSchemaTask
+import org.gradle.api.Plugin
+import org.gradle.api.Project
+import org.gradle.api.plugins.JavaPlugin
+import org.gradle.api.plugins.JavaPluginExtension
+import org.gradle.api.provider.Property
+import org.gradle.api.tasks.TaskProvider
+import org.jetbrains.kotlin.gradle.dsl.KotlinJvmExtension
+
+abstract class AvroGradlePlugin : Plugin<Project> {
+
+  override fun apply(project: Project) {
+    project.logger.info("Running Avro Gradle plugin for project: 
${project.name}")
+
+    val extension = project.extensions.create("avro", 
AvroGradlePluginExtension::class.java)
+
+    // Required so that we can get the sourceSets from the java extension 
below.
+    project.pluginManager.apply("java")
+
+    val compileAvroSchemaTask = registerSchemaTask(extension, project)
+    val compileTestAvroSchemaTask = registerSchemaTestTask(extension, project)
+    addGeneratedSourcesHook(project, compileAvroSchemaTask, 
compileTestAvroSchemaTask)
+  }
+
+  private fun addGeneratedSourcesHook(
+      project: Project,
+      compileAvroSchemaTask: TaskProvider<CompileAvroSchemaTask>,
+      compileTestAvroSchemaTask: TaskProvider<CompileAvroSchemaTask>,
+  ) {
+    project.pluginManager.withPlugin("org.jetbrains.kotlin.jvm") {
+      addGeneratedSourcesToKotlinProject(project, compileAvroSchemaTask, 
compileTestAvroSchemaTask)
+    }
+
+    project.plugins.withType(JavaPlugin::class.java) {
+      addGeneratedSourcesToJavaProject(project, compileAvroSchemaTask, 
compileTestAvroSchemaTask)
+    }
+  }
+
+  private fun registerSchemaTask(extension: AvroGradlePluginExtension, 
project: Project) =
+      project.tasks.register("avroGenerateJavaClasses", 
CompileAvroSchemaTask::class.java) { compileSchemaTask ->
+        val includesAvsc: Set<String> = extension.includedSchemaFiles.get()
+        val includesProtocol: Set<String> = 
extension.includedProtocolFiles.get()
+
+        addProperties(compileSchemaTask, extension, project, 
extension.outputDirectory)
+
+        addSchemaFiles(
+            compileSchemaTask,
+            project,
+            extension,
+            includesAvsc,
+            extension.sourceDirectory,
+        )
+        addProtocolFiles(
+            compileSchemaTask,
+            project,
+            extension,
+            includesProtocol,
+            extension.testSourceDirectory,
+        )
+
+        compileSchemaTask.runtimeClassPathFileCollection.from(
+            project.configurations.getByName("runtimeClasspath").files
+        )
+      }
+
+  private fun registerSchemaTestTask(extension: AvroGradlePluginExtension, 
project: Project) =
+      project.tasks.register(
+          "avroGenerateTestJavaClasses",
+          CompileAvroSchemaTask::class.java,
+      ) { compileSchemaTask ->
+        val includesAvsc: Set<String> = extension.includedSchemaFiles.get()
+        val includesProtocol: Set<String> = 
extension.includedProtocolFiles.get()
+
+        addProperties(compileSchemaTask, extension, project, 
extension.testOutputDirectory)
+
+        addSchemaFiles(
+            compileSchemaTask,
+            project,
+            extension,
+            includesAvsc,
+            extension.testSourceDirectory,
+        )
+        addProtocolFiles(
+            compileSchemaTask,
+            project,
+            extension,
+            includesProtocol,
+            extension.testSourceDirectory,
+        )
+
+        compileSchemaTask.runtimeClassPathFileCollection.from(
+            project.configurations.getByName("testRuntimeClasspath").files
+        )
+      }
+
+  private fun addProperties(
+      compileTask: AbstractCompileTask,
+      extension: AvroGradlePluginExtension,
+      project: Project,
+      outputDirectory: Property<String>,
+  ) {
+    
compileTask.outputDirectory.set(project.layout.buildDirectory.dir(outputDirectory))
+    compileTask.fieldVisibility.set(extension.fieldVisibility)
+    compileTask.testExcludes.set(extension.testExcludes)
+    compileTask.stringType.set(extension.stringType)
+    
compileTask.velocityToolsClassesNames.set(extension.velocityToolsClassesNames.get())
+    compileTask.templateDirectory.set(extension.templateDirectory)
+    compileTask.recordSpecificClass.set(extension.recordSpecificClass)
+    compileTask.errorSpecificClass.set(extension.errorSpecificClass)
+    compileTask.createOptionalGetters.set(extension.createOptionalGetters)
+    compileTask.gettersReturnOptional.set(extension.gettersReturnOptional)
+    compileTask.createSetters.set(extension.createSetters)
+    
compileTask.createNullSafeAnnotations.set(extension.createNullSafeAnnotations)
+    
compileTask.nullSafeAnnotationNullable.set(extension.nullSafeAnnotationNullable)
+    
compileTask.nullSafeAnnotationNotNull.set(extension.nullSafeAnnotationNotNull)
+    
compileTask.optionalGettersForNullableFieldsOnly.set(extension.optionalGettersForNullableFieldsOnly)
+    compileTask.customConversions.set(extension.customConversions)
+    
compileTask.customLogicalTypeFactories.set(extension.customLogicalTypeFactories)
+    
compileTask.enableDecimalLogicalType.set(extension.enableDecimalLogicalType)
+  }
+
+  private fun addSchemaFiles(
+      compileSchemaTask: CompileAvroSchemaTask,
+      project: Project,
+      extension: AvroGradlePluginExtension,
+      includes: Set<String>,
+      sourceDirectory: Property<String>,
+  ) {
+    compileSchemaTask.schemaFiles.from(
+        project.fileTree(sourceDirectory).apply {
+          setIncludes(includes)
+          setExcludes(extension.excludes.get())
+        }
+    )
+    extension.sourceZipFiles.get().forEach { zipPath ->
+      compileSchemaTask.schemaFiles.from(project.zipTree(zipPath).matching { 
it.include(includes) })
+    }
+  }
+
+  private fun addProtocolFiles(
+      compileSchemaTask: CompileAvroSchemaTask,
+      project: Project,
+      extension: AvroGradlePluginExtension,
+      includesProtocol: Set<String>,
+      sourceDirectory: Property<String>,
+  ) {
+    compileSchemaTask.protocolFiles.from(
+        project.fileTree(sourceDirectory).apply {
+          setIncludes(includesProtocol)
+          setExcludes(extension.excludes.get())

Review Comment:
   Same here - testExcludes



##########
lang/java/gradle-plugin/src/main/kotlin/eu/eventloopsoftware/avro/gradle/plugin/tasks/AbstractCompileTask.kt:
##########
@@ -0,0 +1,166 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements.  See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership.  The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License.  You may obtain a copy of the License at
+*
+*     https://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package eu.eventloopsoftware.avro.gradle.plugin.tasks
+
+import java.io.File
+import java.io.IOException
+import java.net.URL
+import java.net.URLClassLoader
+import org.apache.avro.LogicalTypes
+import org.apache.avro.Protocol
+import org.apache.avro.compiler.specific.SpecificCompiler
+import org.apache.avro.compiler.specific.SpecificCompiler.FieldVisibility
+import org.apache.avro.generic.GenericData
+import org.gradle.api.DefaultTask
+import org.gradle.api.GradleException
+import org.gradle.api.file.ConfigurableFileCollection
+import org.gradle.api.file.DirectoryProperty
+import org.gradle.api.provider.ListProperty
+import org.gradle.api.provider.Property
+import org.gradle.api.tasks.Classpath
+import org.gradle.api.tasks.Input
+import org.gradle.api.tasks.InputFiles
+import org.gradle.api.tasks.OutputDirectory
+
+abstract class AbstractCompileTask : DefaultTask() {
+
+  @get:OutputDirectory abstract val outputDirectory: DirectoryProperty
+
+  @get:Input abstract val fieldVisibility: Property<String>
+
+  @get:Input abstract val testExcludes: ListProperty<String>
+
+  @get:Input abstract val stringType: Property<String>
+
+  @get:Input abstract val velocityToolsClassesNames: ListProperty<String>
+
+  @get:Input abstract val templateDirectory: Property<String>
+
+  @get:Input abstract val recordSpecificClass: Property<String>
+
+  @get:Input abstract val errorSpecificClass: Property<String>
+
+  @get:Input abstract val createOptionalGetters: Property<Boolean>
+
+  @get:Input abstract val gettersReturnOptional: Property<Boolean>
+
+  @get:Input abstract val optionalGettersForNullableFieldsOnly: 
Property<Boolean>
+
+  @get:Input abstract val createSetters: Property<Boolean>
+
+  @get:Input abstract val createNullSafeAnnotations: Property<Boolean>
+
+  @get:Input abstract val nullSafeAnnotationNullable: Property<String>
+
+  @get:Input abstract val nullSafeAnnotationNotNull: Property<String>
+
+  @get:Input abstract val customConversions: ListProperty<String>
+
+  @get:Input abstract val customLogicalTypeFactories: ListProperty<String>
+
+  @get:Input abstract val enableDecimalLogicalType: Property<Boolean>
+
+  @get:InputFiles @get:Classpath abstract val runtimeClassPathFileCollection: 
ConfigurableFileCollection
+
+  protected fun doCompile(
+      sourceFileForModificationDetection: File?,
+      protocol: Protocol,
+      outputDirectory: File?,
+  ) {
+    doCompile(sourceFileForModificationDetection, SpecificCompiler(protocol), 
outputDirectory!!)
+  }
+
+  protected fun doCompile(
+      sourceFileForModificationDetection: File?,
+      compiler: SpecificCompiler,
+      outputDirectory: File,
+  ) {
+    setCompilerProperties(compiler)
+    try {
+      for (customConversion in customConversions.get()) {
+        
compiler.addCustomConversion(Thread.currentThread().getContextClassLoader().loadClass(customConversion))
+      }
+    } catch (e: ClassNotFoundException) {
+      throw IOException(e)
+    }
+    compiler.compileToDestination(sourceFileForModificationDetection, 
outputDirectory)
+  }
+
+  private fun setCompilerProperties(compiler: SpecificCompiler) {
+    compiler.setTemplateDir(templateDirectory.get())
+    compiler.setStringType(GenericData.StringType.valueOf(stringType.get()))
+    compiler.setFieldVisibility(getFieldV())
+    compiler.setCreateOptionalGetters(createOptionalGetters.get())
+    compiler.setGettersReturnOptional(gettersReturnOptional.get())
+    
compiler.setOptionalGettersForNullableFieldsOnly(optionalGettersForNullableFieldsOnly.get())
+    compiler.setCreateSetters(createSetters.get())
+    compiler.setCreateNullSafeAnnotations(createNullSafeAnnotations.get())
+    compiler.setNullSafeAnnotationNullable(nullSafeAnnotationNullable.get())
+    compiler.setNullSafeAnnotationNotNull(nullSafeAnnotationNotNull.get())
+    compiler.setEnableDecimalLogicalType(enableDecimalLogicalType.get())
+    // TODO: likely not needed
+    //
+    // 
compiler.setOutputCharacterEncoding(project.getProperties().getProperty("project.build.sourceEncoding"))
+    
compiler.setAdditionalVelocityTools(instantiateAdditionalVelocityTools(velocityToolsClassesNames.get()))
+    compiler.setRecordSpecificClass(recordSpecificClass.get())
+    compiler.setErrorSpecificClass(errorSpecificClass.get())
+  }
+
+  private fun getFieldV(): FieldVisibility {
+    try {
+      val upperCaseFieldVisibility = fieldVisibility.get().trim().uppercase()
+      return FieldVisibility.valueOf(upperCaseFieldVisibility)
+    } catch (_: IllegalArgumentException) {
+      logger.warn("Could not parse field visibility: ${fieldVisibility.get()}, 
using PRIVATE")
+      return FieldVisibility.PRIVATE
+    }
+  }
+
+  private fun instantiateAdditionalVelocityTools(velocityToolsClassesNames: 
List<String>): List<Any> {
+    return velocityToolsClassesNames.map { velocityToolClassName ->
+      try {
+        
Class.forName(velocityToolClassName).getDeclaredConstructor().newInstance()
+      } catch (e: Exception) {
+        throw RuntimeException(e)

Review Comment:
   ```suggestion
           throw org.gradle.api.GradleException(e)
   ```



##########
lang/java/gradle-plugin/src/main/kotlin/eu/eventloopsoftware/avro/gradle/plugin/tasks/CompileAvroSchemaTask.kt:
##########
@@ -0,0 +1,81 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements.  See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership.  The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License.  You may obtain a copy of the License at
+*
+*     https://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package eu.eventloopsoftware.avro.gradle.plugin.tasks
+
+import java.io.File
+import java.io.IOException
+import org.apache.avro.Protocol
+import org.apache.avro.SchemaParseException
+import org.apache.avro.SchemaParser
+import org.apache.avro.compiler.specific.SpecificCompiler
+import org.gradle.api.file.ConfigurableFileCollection
+import org.gradle.api.tasks.InputFiles
+import org.gradle.api.tasks.SkipWhenEmpty
+import org.gradle.api.tasks.TaskAction
+
+abstract class CompileAvroSchemaTask : AbstractCompileTask() {
+
+  @get:InputFiles @get:SkipWhenEmpty abstract val schemaFiles: 
ConfigurableFileCollection
+
+  @get:InputFiles @get:SkipWhenEmpty abstract val protocolFiles: 
ConfigurableFileCollection
+
+  @TaskAction
+  fun compileSchema() {
+    logger.info("Generating Java files from ${schemaFiles.files.size} Avro 
schemas...")
+
+    compileSchemas(schemaFiles, outputDirectory.get().asFile)
+
+    logger.info("Done generating Java files from Avro schemas...")
+  }
+
+  private fun compileSchemas(schemaFileTree: ConfigurableFileCollection, 
outputDirectory: File) {
+    val sourceFileForModificationDetection: File? =
+        schemaFileTree.asFileTree.files.filter { file: File -> 
file.lastModified() > 0 }.maxBy { it.lastModified() }

Review Comment:
   ```suggestion
           schemaFileTree.asFileTree.files.filter { file: File -> 
file.lastModified() > 0 }.maxByOrNull { it.lastModified() }
   ```
   to avoid NoSuchElementException if there are no files to filter



##########
lang/java/gradle-plugin/pom.xml:
##########
@@ -0,0 +1,223 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+       https://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+-->
+<project
+    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd";
+    xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <artifactId>avro-parent</artifactId>
+    <groupId>org.apache.avro</groupId>
+    <version>1.13.0-SNAPSHOT</version>
+    <relativePath>../pom.xml</relativePath>
+  </parent>
+
+  <artifactId>gradle-plugin</artifactId>
+  <packaging>pom</packaging>
+
+  <name>Apache Avro Gradle Plugin</name>
+  <description>Gradle plugin for Avro IDL and Specific API 
Compilers</description>
+
+  <properties>
+    <main.basedir>${project.parent.parent.basedir}</main.basedir>
+    <pluginTestingVersion>3.3.0</pluginTestingVersion>
+  </properties>
+
+  <!-- Relocation https://maven.apache.org/guides/mini/guide-relocation.html 
-->
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.codehaus.mojo</groupId>
+        <artifactId>exec-maven-plugin</artifactId>
+        <version>3.1.0</version>
+
+        <executions>
+          <execution>
+            <id>run-gradle-task-assemble</id>
+            <phase>compile</phase>
+            <goals>
+              <goal>exec</goal>
+            </goals>
+            <configuration>
+              <executable>./gradlew</executable>
+              <arguments>
+                <argument>assemble</argument>
+                <argument>-i</argument>
+              </arguments>
+            </configuration>
+          </execution>
+          <execution>
+            <id>run-gradle-task-test</id>
+            <phase>test</phase>
+            <goals>
+              <goal>exec</goal>
+            </goals>
+            <configuration>
+              <executable>./gradlew</executable>
+              <arguments>
+                <argument>test</argument>
+                <argument>-i</argument>
+              </arguments>
+            </configuration>
+          </execution>
+          <execution>
+            <id>run-gradle-task-build</id>
+            <phase>package</phase>
+            <goals>
+              <goal>exec</goal>
+            </goals>
+            <configuration>
+              <executable>./gradlew</executable>
+              <arguments>
+                <argument>build</argument>
+                <argument>-i</argument>
+              </arguments>
+            </configuration>
+          </execution>
+          <execution>
+            <id>run-gradle-task-publish</id>
+            <phase>deploy</phase>

Review Comment:
   We use `deploy` to deploy -SNAPSHOTs for the Maven artefacts.
   AFAIK Gradle plugins repo does not allow -SNAPSHOTs



##########
lang/java/gradle-plugin/src/main/kotlin/eu/eventloopsoftware/avro/gradle/plugin/tasks/CompileAvroSchemaTask.kt:
##########
@@ -0,0 +1,81 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements.  See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership.  The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License.  You may obtain a copy of the License at
+*
+*     https://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package eu.eventloopsoftware.avro.gradle.plugin.tasks
+
+import java.io.File
+import java.io.IOException
+import org.apache.avro.Protocol
+import org.apache.avro.SchemaParseException
+import org.apache.avro.SchemaParser
+import org.apache.avro.compiler.specific.SpecificCompiler
+import org.gradle.api.file.ConfigurableFileCollection
+import org.gradle.api.tasks.InputFiles
+import org.gradle.api.tasks.SkipWhenEmpty
+import org.gradle.api.tasks.TaskAction
+
+abstract class CompileAvroSchemaTask : AbstractCompileTask() {
+
+  @get:InputFiles @get:SkipWhenEmpty abstract val schemaFiles: 
ConfigurableFileCollection
+
+  @get:InputFiles @get:SkipWhenEmpty abstract val protocolFiles: 
ConfigurableFileCollection
+
+  @TaskAction
+  fun compileSchema() {
+    logger.info("Generating Java files from ${schemaFiles.files.size} Avro 
schemas...")
+
+    compileSchemas(schemaFiles, outputDirectory.get().asFile)
+
+    logger.info("Done generating Java files from Avro schemas...")
+  }
+
+  private fun compileSchemas(schemaFileTree: ConfigurableFileCollection, 
outputDirectory: File) {
+    val sourceFileForModificationDetection: File? =
+        schemaFileTree.asFileTree.files.filter { file: File -> 
file.lastModified() > 0 }.maxBy { it.lastModified() }
+
+    // Need to register custom logical type factories before schema 
compilation.
+    try {
+      loadLogicalTypesFactories()
+    } catch (e: IOException) {
+      throw RuntimeException("Error while loading logical types factories ", e)

Review Comment:
   ```suggestion
         throw org.gradle.api.GradleException("Error while loading logical 
types factories ", e)
   ```



##########
lang/java/gradle-plugin/src/main/kotlin/eu/eventloopsoftware/avro/gradle/plugin/tasks/AbstractCompileTask.kt:
##########
@@ -0,0 +1,166 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements.  See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership.  The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License.  You may obtain a copy of the License at
+*
+*     https://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package eu.eventloopsoftware.avro.gradle.plugin.tasks
+
+import java.io.File
+import java.io.IOException
+import java.net.URL
+import java.net.URLClassLoader
+import org.apache.avro.LogicalTypes
+import org.apache.avro.Protocol
+import org.apache.avro.compiler.specific.SpecificCompiler
+import org.apache.avro.compiler.specific.SpecificCompiler.FieldVisibility
+import org.apache.avro.generic.GenericData
+import org.gradle.api.DefaultTask
+import org.gradle.api.GradleException
+import org.gradle.api.file.ConfigurableFileCollection
+import org.gradle.api.file.DirectoryProperty
+import org.gradle.api.provider.ListProperty
+import org.gradle.api.provider.Property
+import org.gradle.api.tasks.Classpath
+import org.gradle.api.tasks.Input
+import org.gradle.api.tasks.InputFiles
+import org.gradle.api.tasks.OutputDirectory
+
+abstract class AbstractCompileTask : DefaultTask() {
+
+  @get:OutputDirectory abstract val outputDirectory: DirectoryProperty
+
+  @get:Input abstract val fieldVisibility: Property<String>
+
+  @get:Input abstract val testExcludes: ListProperty<String>
+
+  @get:Input abstract val stringType: Property<String>
+
+  @get:Input abstract val velocityToolsClassesNames: ListProperty<String>
+
+  @get:Input abstract val templateDirectory: Property<String>
+
+  @get:Input abstract val recordSpecificClass: Property<String>
+
+  @get:Input abstract val errorSpecificClass: Property<String>
+
+  @get:Input abstract val createOptionalGetters: Property<Boolean>
+
+  @get:Input abstract val gettersReturnOptional: Property<Boolean>
+
+  @get:Input abstract val optionalGettersForNullableFieldsOnly: 
Property<Boolean>
+
+  @get:Input abstract val createSetters: Property<Boolean>
+
+  @get:Input abstract val createNullSafeAnnotations: Property<Boolean>
+
+  @get:Input abstract val nullSafeAnnotationNullable: Property<String>
+
+  @get:Input abstract val nullSafeAnnotationNotNull: Property<String>
+
+  @get:Input abstract val customConversions: ListProperty<String>
+
+  @get:Input abstract val customLogicalTypeFactories: ListProperty<String>
+
+  @get:Input abstract val enableDecimalLogicalType: Property<Boolean>
+
+  @get:InputFiles @get:Classpath abstract val runtimeClassPathFileCollection: 
ConfigurableFileCollection
+
+  protected fun doCompile(
+      sourceFileForModificationDetection: File?,
+      protocol: Protocol,
+      outputDirectory: File?,
+  ) {
+    doCompile(sourceFileForModificationDetection, SpecificCompiler(protocol), 
outputDirectory!!)
+  }
+
+  protected fun doCompile(
+      sourceFileForModificationDetection: File?,
+      compiler: SpecificCompiler,
+      outputDirectory: File,
+  ) {
+    setCompilerProperties(compiler)
+    try {
+      for (customConversion in customConversions.get()) {
+        
compiler.addCustomConversion(Thread.currentThread().getContextClassLoader().loadClass(customConversion))
+      }
+    } catch (e: ClassNotFoundException) {
+      throw IOException(e)
+    }
+    compiler.compileToDestination(sourceFileForModificationDetection, 
outputDirectory)
+  }
+
+  private fun setCompilerProperties(compiler: SpecificCompiler) {
+    compiler.setTemplateDir(templateDirectory.get())
+    compiler.setStringType(GenericData.StringType.valueOf(stringType.get()))
+    compiler.setFieldVisibility(getFieldV())
+    compiler.setCreateOptionalGetters(createOptionalGetters.get())
+    compiler.setGettersReturnOptional(gettersReturnOptional.get())
+    
compiler.setOptionalGettersForNullableFieldsOnly(optionalGettersForNullableFieldsOnly.get())
+    compiler.setCreateSetters(createSetters.get())
+    compiler.setCreateNullSafeAnnotations(createNullSafeAnnotations.get())
+    compiler.setNullSafeAnnotationNullable(nullSafeAnnotationNullable.get())
+    compiler.setNullSafeAnnotationNotNull(nullSafeAnnotationNotNull.get())
+    compiler.setEnableDecimalLogicalType(enableDecimalLogicalType.get())
+    // TODO: likely not needed
+    //
+    // 
compiler.setOutputCharacterEncoding(project.getProperties().getProperty("project.build.sourceEncoding"))
+    
compiler.setAdditionalVelocityTools(instantiateAdditionalVelocityTools(velocityToolsClassesNames.get()))
+    compiler.setRecordSpecificClass(recordSpecificClass.get())
+    compiler.setErrorSpecificClass(errorSpecificClass.get())
+  }
+
+  private fun getFieldV(): FieldVisibility {
+    try {
+      val upperCaseFieldVisibility = fieldVisibility.get().trim().uppercase()
+      return FieldVisibility.valueOf(upperCaseFieldVisibility)
+    } catch (_: IllegalArgumentException) {
+      logger.warn("Could not parse field visibility: ${fieldVisibility.get()}, 
using PRIVATE")
+      return FieldVisibility.PRIVATE
+    }
+  }
+
+  private fun instantiateAdditionalVelocityTools(velocityToolsClassesNames: 
List<String>): List<Any> {
+    return velocityToolsClassesNames.map { velocityToolClassName ->
+      try {
+        
Class.forName(velocityToolClassName).getDeclaredConstructor().newInstance()

Review Comment:
   Why this uses the current class' loader ?
   `loadLogicalTypesFactories()` and `doCompile()` use the thread's class loader



##########
lang/java/gradle-plugin/src/main/kotlin/eu/eventloopsoftware/avro/gradle/plugin/tasks/CompileAvroSchemaTask.kt:
##########
@@ -0,0 +1,81 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements.  See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership.  The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License.  You may obtain a copy of the License at
+*
+*     https://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package eu.eventloopsoftware.avro.gradle.plugin.tasks
+
+import java.io.File
+import java.io.IOException
+import org.apache.avro.Protocol
+import org.apache.avro.SchemaParseException
+import org.apache.avro.SchemaParser
+import org.apache.avro.compiler.specific.SpecificCompiler
+import org.gradle.api.file.ConfigurableFileCollection
+import org.gradle.api.tasks.InputFiles
+import org.gradle.api.tasks.SkipWhenEmpty
+import org.gradle.api.tasks.TaskAction
+
+abstract class CompileAvroSchemaTask : AbstractCompileTask() {
+
+  @get:InputFiles @get:SkipWhenEmpty abstract val schemaFiles: 
ConfigurableFileCollection
+
+  @get:InputFiles @get:SkipWhenEmpty abstract val protocolFiles: 
ConfigurableFileCollection
+
+  @TaskAction
+  fun compileSchema() {
+    logger.info("Generating Java files from ${schemaFiles.files.size} Avro 
schemas...")
+
+    compileSchemas(schemaFiles, outputDirectory.get().asFile)
+
+    logger.info("Done generating Java files from Avro schemas...")
+  }
+
+  private fun compileSchemas(schemaFileTree: ConfigurableFileCollection, 
outputDirectory: File) {
+    val sourceFileForModificationDetection: File? =
+        schemaFileTree.asFileTree.files.filter { file: File -> 
file.lastModified() > 0 }.maxBy { it.lastModified() }
+
+    // Need to register custom logical type factories before schema 
compilation.
+    try {
+      loadLogicalTypesFactories()
+    } catch (e: IOException) {
+      throw RuntimeException("Error while loading logical types factories ", e)
+    }
+
+    try {
+      val parser = SchemaParser()
+      for (sourceFile in schemaFileTree.files) {
+        parser.parse(sourceFile)
+      }
+      val schemas = parser.parsedNamedSchemas
+      doCompile(sourceFileForModificationDetection, SpecificCompiler(schemas), 
outputDirectory)
+
+      for (sourceFile in protocolFiles.files) {
+        val protocol = Protocol.parse(sourceFile)
+        doCompile(sourceFile, protocol, outputDirectory)
+      }
+    } catch (ex: IOException) {
+      throw RuntimeException(

Review Comment:
   ```suggestion
         throw org.gradle.api.GradleException(
   ```



##########
lang/java/gradle-plugin/README.md:
##########
@@ -0,0 +1,89 @@
+# Avro Gradle plugin (in development)
+
+Gradle plugin that generates Java code from Avro schemas
+
+## Requirements
+* Java 21 or higher
+* Gradle 9 or higher
+
+## Version
+`0.0.2`
+
+first beta
+
+`0.0.5`
+
+Possible breaking change: rename `CompileSchemaTask` to `CompileAvroSchemaTask`
+
+Add logical type factories
+
+Now released on Gradle plugin portal: 
https://plugins.gradle.org/plugin/eu.eventloopsoftware.avro-gradle-plugin
+
+`0.0.7`
+
+It is not needed to add `tasks.named("compileKotlin") { 
dependsOn(tasks.named("avroGenerateJavaClasses")) }` any more
+
+`0.0.8`
+
+Add `sourceZipFiles` property to add zip files with schemas in them

Review Comment:
   This sentence seems unfinished



##########
lang/java/gradle-plugin/src/main/kotlin/eu/eventloopsoftware/avro/gradle/plugin/AvroGradlePlugin.kt:
##########
@@ -0,0 +1,198 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements.  See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership.  The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License.  You may obtain a copy of the License at
+*
+*     https://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package eu.eventloopsoftware.avro.gradle.plugin
+
+import 
eu.eventloopsoftware.avro.gradle.plugin.extension.AvroGradlePluginExtension
+import eu.eventloopsoftware.avro.gradle.plugin.tasks.AbstractCompileTask
+import eu.eventloopsoftware.avro.gradle.plugin.tasks.CompileAvroSchemaTask
+import org.gradle.api.Plugin
+import org.gradle.api.Project
+import org.gradle.api.plugins.JavaPlugin
+import org.gradle.api.plugins.JavaPluginExtension
+import org.gradle.api.provider.Property
+import org.gradle.api.tasks.TaskProvider
+import org.jetbrains.kotlin.gradle.dsl.KotlinJvmExtension
+
+abstract class AvroGradlePlugin : Plugin<Project> {
+
+  override fun apply(project: Project) {
+    project.logger.info("Running Avro Gradle plugin for project: 
${project.name}")
+
+    val extension = project.extensions.create("avro", 
AvroGradlePluginExtension::class.java)
+
+    // Required so that we can get the sourceSets from the java extension 
below.
+    project.pluginManager.apply("java")
+
+    val compileAvroSchemaTask = registerSchemaTask(extension, project)
+    val compileTestAvroSchemaTask = registerSchemaTestTask(extension, project)
+    addGeneratedSourcesHook(project, compileAvroSchemaTask, 
compileTestAvroSchemaTask)
+  }
+
+  private fun addGeneratedSourcesHook(
+      project: Project,
+      compileAvroSchemaTask: TaskProvider<CompileAvroSchemaTask>,
+      compileTestAvroSchemaTask: TaskProvider<CompileAvroSchemaTask>,
+  ) {
+    project.pluginManager.withPlugin("org.jetbrains.kotlin.jvm") {
+      addGeneratedSourcesToKotlinProject(project, compileAvroSchemaTask, 
compileTestAvroSchemaTask)
+    }
+
+    project.plugins.withType(JavaPlugin::class.java) {
+      addGeneratedSourcesToJavaProject(project, compileAvroSchemaTask, 
compileTestAvroSchemaTask)
+    }
+  }
+
+  private fun registerSchemaTask(extension: AvroGradlePluginExtension, 
project: Project) =
+      project.tasks.register("avroGenerateJavaClasses", 
CompileAvroSchemaTask::class.java) { compileSchemaTask ->
+        val includesAvsc: Set<String> = extension.includedSchemaFiles.get()
+        val includesProtocol: Set<String> = 
extension.includedProtocolFiles.get()
+
+        addProperties(compileSchemaTask, extension, project, 
extension.outputDirectory)
+
+        addSchemaFiles(
+            compileSchemaTask,
+            project,
+            extension,
+            includesAvsc,
+            extension.sourceDirectory,
+        )
+        addProtocolFiles(
+            compileSchemaTask,
+            project,
+            extension,
+            includesProtocol,
+            extension.testSourceDirectory,
+        )
+
+        compileSchemaTask.runtimeClassPathFileCollection.from(
+            project.configurations.getByName("runtimeClasspath").files
+        )
+      }
+
+  private fun registerSchemaTestTask(extension: AvroGradlePluginExtension, 
project: Project) =
+      project.tasks.register(
+          "avroGenerateTestJavaClasses",
+          CompileAvroSchemaTask::class.java,
+      ) { compileSchemaTask ->
+        val includesAvsc: Set<String> = extension.includedSchemaFiles.get()
+        val includesProtocol: Set<String> = 
extension.includedProtocolFiles.get()
+
+        addProperties(compileSchemaTask, extension, project, 
extension.testOutputDirectory)
+
+        addSchemaFiles(
+            compileSchemaTask,
+            project,
+            extension,
+            includesAvsc,
+            extension.testSourceDirectory,
+        )
+        addProtocolFiles(
+            compileSchemaTask,
+            project,
+            extension,
+            includesProtocol,
+            extension.testSourceDirectory,
+        )
+
+        compileSchemaTask.runtimeClassPathFileCollection.from(
+            project.configurations.getByName("testRuntimeClasspath").files
+        )
+      }
+
+  private fun addProperties(
+      compileTask: AbstractCompileTask,
+      extension: AvroGradlePluginExtension,
+      project: Project,
+      outputDirectory: Property<String>,
+  ) {
+    
compileTask.outputDirectory.set(project.layout.buildDirectory.dir(outputDirectory))
+    compileTask.fieldVisibility.set(extension.fieldVisibility)
+    compileTask.testExcludes.set(extension.testExcludes)
+    compileTask.stringType.set(extension.stringType)
+    
compileTask.velocityToolsClassesNames.set(extension.velocityToolsClassesNames.get())
+    compileTask.templateDirectory.set(extension.templateDirectory)
+    compileTask.recordSpecificClass.set(extension.recordSpecificClass)
+    compileTask.errorSpecificClass.set(extension.errorSpecificClass)
+    compileTask.createOptionalGetters.set(extension.createOptionalGetters)
+    compileTask.gettersReturnOptional.set(extension.gettersReturnOptional)
+    compileTask.createSetters.set(extension.createSetters)
+    
compileTask.createNullSafeAnnotations.set(extension.createNullSafeAnnotations)
+    
compileTask.nullSafeAnnotationNullable.set(extension.nullSafeAnnotationNullable)
+    
compileTask.nullSafeAnnotationNotNull.set(extension.nullSafeAnnotationNotNull)
+    
compileTask.optionalGettersForNullableFieldsOnly.set(extension.optionalGettersForNullableFieldsOnly)
+    compileTask.customConversions.set(extension.customConversions)
+    
compileTask.customLogicalTypeFactories.set(extension.customLogicalTypeFactories)
+    
compileTask.enableDecimalLogicalType.set(extension.enableDecimalLogicalType)
+  }
+
+  private fun addSchemaFiles(
+      compileSchemaTask: CompileAvroSchemaTask,
+      project: Project,
+      extension: AvroGradlePluginExtension,
+      includes: Set<String>,
+      sourceDirectory: Property<String>,
+  ) {
+    compileSchemaTask.schemaFiles.from(
+        project.fileTree(sourceDirectory).apply {
+          setIncludes(includes)
+          setExcludes(extension.excludes.get())

Review Comment:
   `addSchemaFiles()` is also used for tests, so this should use 
`setTestExcludes(extension.testExcludes.get())` in that cases



##########
lang/java/gradle-plugin/build.gradle.kts:
##########
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+plugins {
+  kotlin("jvm") version "2.2.10"

Review Comment:
   Should this be 2.3.0 ?
   Below it uses `org.jetbrains.kotlin:kotlin-gradle-plugin-api:2.3.0`



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to