-
Notifications
You must be signed in to change notification settings - Fork 0
3614: WIP: AVRO-4223 Gradle plugin for generating Java code #32
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
base: main
Are you sure you want to change the base?
Changes from all commits
3f04a2c
7a18d79
e6082e6
8947e41
d0b8794
ea3e5b6
2589fdd
28934e0
737e585
543c66b
5f1ac64
3a9ae61
93d7194
afd90c8
b765eb7
1b0d7f5
fafd298
634cd63
f71ba50
7c67834
453c7a0
1b449b4
4fdab98
c4a06ae
1b6efe7
6c0b29e
444d91c
6daa02e
626e90c
21c8340
4beb01d
c42fee9
0e2a47f
e22d2c3
3dccc3c
5525f61
e746bbd
529144f
ae791a0
a989843
1e73f02
de150a2
485dbfd
91807d8
916a732
2a5b93c
8cb27ef
8b1acc5
89378cf
e247865
01f1ae7
47b34d4
8094451
61ed721
6a6f3c9
cb6fbf4
f041b10
3853d9a
3ac3f41
8c805ba
cdd6861
f8c4152
90c0e66
1809d6f
4eef735
78b67d7
f309faf
3519eb8
89a4629
9e7bd24
1cf8762
6183c73
f0af7c5
1443f18
cce2cfc
0e06ead
761371f
c75d6c4
c36cb61
eccfed6
9e52ae0
83c3a50
aec2b3d
43803fd
201e4fb
8428a16
e1d5284
2db64b1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
| @@ -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 | ||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use “anymore” (adverb) here. Minor wording fix flagged by LanguageTool. ✏️ Suggested edit-It is not needed to add `tasks.named("compileKotlin") { dependsOn(tasks.named("avroGenerateJavaClasses")) }` any more
+It is not needed to add `tasks.named("compileKotlin") { dependsOn(tasks.named("avroGenerateJavaClasses")) }` anymore📝 Committable suggestion
Suggested change
🧰 Tools🪛 LanguageTool[uncategorized] ~24-~24: Did you mean the adverb “anymore”? (ANY_MORE) 🤖 Prompt for AI Agents |
||||||||
|
|
||||||||
| `0.0.8` | ||||||||
|
|
||||||||
| Add `sourceZipFiles` property to add zip files with schemas in them | ||||||||
| pu | ||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||||||||
|
|
||||||||
|
Comment on lines
+28
to
+30
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove stray “pu” line. This looks like an accidental fragment. 🧹 Suggested edit-Add `sourceZipFiles` property to add zip files with schemas in them
-pu
+Add `sourceZipFiles` property to add zip files with schemas in them📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||
| `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" | ||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The plugin version in this usage example is
Suggested change
|
||||||||
| } | ||||||||
| ``` | ||||||||
| ### 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 `Configuration` to get a reference to the JAR files and add to `sourceZipFiles`: | ||||||||
|
Comment on lines
+72
to
+78
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Normalize FAQ heading levels. Heading level jumps from H2 to H4; markdownlint expects H3 under FAQ. 🪜 Suggested edit-#### How can I benefit from Kotlin's null safety?
+### How can I benefit from Kotlin's null safety?
@@
-#### I get my Avro schemas from a Maven dependency, how can I add JAR files that contain schemas?
+### I get my Avro schemas from a Maven dependency, how can I add JAR files that contain schemas?🧰 Tools🪛 markdownlint-cli2 (0.20.0)[warning] 72-72: Heading levels should only increment by one level at a time (MD001, heading-increment) 🤖 Prompt for AI Agents |
||||||||
|
|
||||||||
| ```kotlin | ||||||||
| val avroSources: Configuration by configurations.creating | ||||||||
|
|
||||||||
| avroSources("some.group.id:dependency-containing-avro-sources-artifact-id:1.0.0") | ||||||||
|
|
||||||||
| avro { | ||||||||
| sourceZipFiles = avroSources.files.map { it.path } | ||||||||
| } | ||||||||
| ``` | ||||||||
|
|
||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -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" | ||||||||||||||||||||||||||||||||||
| `java-gradle-plugin` | ||||||||||||||||||||||||||||||||||
| id("com.gradle.plugin-publish") version "2.0.0" | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
|
Comment on lines
+19
to
+23
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: cat -n lang/java/gradle-plugin/build.gradle.ktsRepository: martin-augment/avro Length of output: 2239 🌐 Web query:
💡 Result: Kotlin Gradle Plugin (KGP) 2.2 vs 2.3 compatibility (2025–2026)
Key 2026 detail (AGP 9.0)
Early 2026 (preview/EAP)
Citations:
Align Kotlin plugin and API versions for consistency. The build declares Kotlin JVM plugin Suggested alignment optionsUpdate the plugin to match the API: plugins {
- kotlin("jvm") version "2.2.10"
+ kotlin("jvm") version "2.3.0"
`java-gradle-plugin`
id("com.gradle.plugin-publish") version "2.0.0"
}Or update the API to match the plugin: - implementation("org.jetbrains.kotlin:kotlin-gradle-plugin-api:2.3.0")
+ implementation("org.jetbrains.kotlin:kotlin-gradle-plugin-api:2.2.10")📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| group = "eu.eventloopsoftware" | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| version = "0.1.0" | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| repositories { | ||||||||||||||||||||||||||||||||||
| mavenCentral() | ||||||||||||||||||||||||||||||||||
| mavenLocal() | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| dependencies { | ||||||||||||||||||||||||||||||||||
| // TODO: for release use ${version} | ||||||||||||||||||||||||||||||||||
| implementation("org.apache.avro:avro-compiler:1.12.1") | ||||||||||||||||||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||||||||||||||||||||||||||||||||||
| implementation("org.jetbrains.kotlin:kotlin-gradle-plugin-api:2.3.0") | ||||||||||||||||||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||||||||||||||||||||||||||||||||||
| testImplementation(kotlin("test")) | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| tasks.test { useJUnitPlatform() } | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| kotlin { jvmToolchain(21) } | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| gradlePlugin { | ||||||||||||||||||||||||||||||||||
| plugins { | ||||||||||||||||||||||||||||||||||
| website = "https://avro.apache.org/" | ||||||||||||||||||||||||||||||||||
| vcsUrl = "https://github.com/apache/avro.git" | ||||||||||||||||||||||||||||||||||
| register("gradlePlugin") { | ||||||||||||||||||||||||||||||||||
| id = "eu.eventloopsoftware.avro-gradle-plugin" | ||||||||||||||||||||||||||||||||||
| displayName = "Avro Gradle Plugin" | ||||||||||||||||||||||||||||||||||
| description = "Avro Gradle plugin for generating Java code" | ||||||||||||||||||||||||||||||||||
| tags = listOf("avro", "kotlin", "java", "apache") | ||||||||||||||||||||||||||||||||||
| implementationClass = "eu.eventloopsoftware.avro.gradle.plugin.AvroGradlePlugin" | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
|
Comment on lines
+25
to
+55
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| distributionBase=GRADLE_USER_HOME | ||
| distributionPath=wrapper/dists | ||
| distributionUrl=https\://services.gradle.org/distributions/gradle-9.2.1-bin.zip | ||
| networkTimeout=10000 | ||
| validateDistributionUrl=true | ||
| zipStoreBase=GRADLE_USER_HOME | ||
| zipStorePath=wrapper/dists |


There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replace bare URLs with Markdown links.
Markdownlint flags bare URLs; use inline links instead.
🔗 Suggested edit
Also applies to: 68-68
🧰 Tools
🪛 markdownlint-cli2 (0.20.0)
[warning] 20-20: Bare URL used
(MD034, no-bare-urls)
🤖 Prompt for AI Agents