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


##########
lang/java/gradle-plugin/README.md:
##########
@@ -0,0 +1,72 @@
+# Avro Gradle plugin (in development)
+
+Gradle plugin that generates Java code from Avro schemas
+
+## Usage
+
+### Add avro extension
+In `build.gradle.kts`:
+
+### Add plugin
+
+```kotlin
+plugins {
+    id("eu.eventloopsoftware.avro-gradle-plugin") version "0.0.2"
+}
+```
+### 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`
+} 
+```
+
+### Configure Maven dependency repository
+In `settings.gradle.kts`:
+
+Plugin is published on Maven Central:
+```kotlin
+pluginManagement {
+    repositories {
+        mavenCentral()
+        gradlePluginPortal()
+    }
+}
+```
+
+### Add a task hook
+For Intellij to recognize the newly generated Java files add this to 
`build.gradle.kts`:
+
+```kotlin
+tasks.named("compileKotlin") { 
dependsOn(tasks.named("avroGenerateJavaClasses")) }
+```
+
+### 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.
+
+#### When I update my schemas and generate code, the Java classes stay the same
+Yes, for now you have to `./gradlew clean` every time you update your Avro 
schemas.

Review Comment:
   As discussed with @opwvhk , some users have a lot of schemas. Cleaning the 
output every time and recompiling can be time consuming. Now we check if a 
schema file has changed, and then we recompile: 
https://github.com/apache/avro/pull/3614/files#diff-b62c3ab833d002851028eeef7b6f9f8d81eaf73eb522dfb82d1d290d37633a43R43



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