Sineaggi commented on code in PR #3614:
URL: https://github.com/apache/avro/pull/3614#discussion_r2733612740


##########
lang/java/gradle-plugin/README.md:
##########
@@ -0,0 +1,85 @@
+# 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
+pu
+
+`0.1.0`
+
+Add Avro Protocol support
+
+## Usage
+
+### Add avro extension
+In `build.gradle.kts`:
+
+### Add plugin
+
+```kotlin
+plugins {
+    id("eu.eventloopsoftware.avro-gradle-plugin") version "0.0.8"
+}
+```
+### Add Avro dependency
+
+```kotlin
+implementation("org.apache.avro:avro:1.12.1")
+```
+
+### Configure Avro Gradle plugin
+
+```kotlin
+avro {
+    sourceDirectory = "src/main/avro"
+    // All properties are available in `GradlePluginExtension.kt`
+} 
+```
+
+### Generate Java classes
+
+`./gradlew avroGenerateJavaClasses`
+
+
+## Example project that uses the Apache Avro gradle-plugin
+https://codeberg.org/frevib/use-gradle-plugin-test
+
+## FAQ
+
+#### How can I benefit from Kotlin's null safety?
+Use `createNullSafeAnnotations = true` and Java getters will be annotated with 
+`@org.jetbrains.annotations.NotNull`/ `@org.jetbrains.annotations.Nullable`. 
This way
+Kotlin will recognize which value is nullable.
+
+#### I get my Avro schemas from a Maven dependency, how can I add JAR files 
that contain schemas?
+Use `sourceZipFiles = listOf("file_path")`, e.g.
+
+```kotlin
+avro {
+    sourceZipFiles = 
listOf("/home/user/.gradle/caches/modules-2/files-2.1/eu.eventloopsoftware.group-id/artifact-id/1.0.0/92ac3d0533de9dd79ac35373c892ebaa01763d4d/jar_with_schemas-1.0.0.jar")

Review Comment:
   Instead of this, we probably want to add some pre-configured 
`configuration`, called `avroSources` or something that way people can add 
their dependencies as normal, like
   ```kotlin
   dependencies {
       avroSources("eu.eventloopsoftware.group-id:artifact-id:1.0.0") // ...
   ```
   Certain plugins ship their own dependencies block (like in [Gradle's test 
suites 
plugin](https://docs.gradle.org/current/userguide/jvm_test_suite_plugin.html#sec:declare_an_additional_test_suite))
 so perhaps something like 
   ```
   avro {
       sourceZipFiles {
           dependencies {
               avroSources("eu.eventloopsoftware.group-id:artifact-id:1.0.0") 
// ...
   ```
   could be used.



-- 
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