Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
88 commits
Select commit Hold shift + click to select a range
3f04a2c
Add Gradle plugin bootstrap
Nov 19, 2025
7a18d79
Add test for generating Java code
Nov 22, 2025
e6082e6
Rename task
Nov 22, 2025
8947e41
Add Maven publish
Nov 23, 2025
d0b8794
Rever change to Java file
Nov 23, 2025
ea3e5b6
Rever changes to Java files
Nov 23, 2025
2589fdd
Cleanup
Nov 23, 2025
28934e0
Add schemaType
Nov 23, 2025
737e585
Cleanup test
Nov 24, 2025
543c66b
Use Path instead of File for tests
Nov 29, 2025
5f1ac64
Remove null checks because it's Kotlin
Nov 29, 2025
3a9ae61
Improve test
Nov 29, 2025
93d7194
Add test source and output dir
Nov 30, 2025
afd90c8
Refactor
Nov 30, 2025
b765eb7
Add field visibility property
Nov 30, 2025
1b0d7f5
Add excludes property
Nov 30, 2025
fafd298
Add stringType and templateDirectory
Nov 30, 2025
634cd63
Add properties
Nov 30, 2025
f71ba50
Add properties
Nov 30, 2025
7c67834
Check if source directories exist
Nov 30, 2025
453c7a0
Cleanup
Nov 30, 2025
1b449b4
Cleanup
Nov 30, 2025
4fdab98
Cleanup
Nov 30, 2025
c4a06ae
Add readme
Nov 30, 2025
1b6efe7
Move to SourceTask
Dec 7, 2025
6c0b29e
Update readme
Dec 7, 2025
444d91c
Add dependency for generated sources
Dec 7, 2025
6daa02e
Update reamde
Dec 7, 2025
626e90c
Remove unneeded adding of dependency
Dec 7, 2025
21c8340
Update readme
Dec 7, 2025
4beb01d
Update readme
Dec 7, 2025
c42fee9
Update readme
Dec 7, 2025
0e2a47f
Rename class
frevib Dec 20, 2025
e22d2c3
Use different Gradle Task for generating test sources
frevib Dec 20, 2025
3dccc3c
Add support for Velocity class names
frevib Dec 20, 2025
5525f61
Add test for recordSpecificClass
frevib Dec 20, 2025
e746bbd
Merge remote-tracking branch 'upstream/main' into feat/gradle-plugin
frevib Dec 20, 2025
529144f
Add generate options
frevib Dec 20, 2025
ae791a0
Update README
frevib Dec 21, 2025
a989843
AVRO-4223
frevib Jan 5, 2026
1e73f02
AVRO-4223
frevib Jan 5, 2026
de150a2
AVRO-4223
frevib Jan 5, 2026
485dbfd
AVRO-4223
frevib Jan 5, 2026
91807d8
AVRO-4223
frevib Jan 5, 2026
916a732
AVRO-4223
frevib Jan 5, 2026
2a5b93c
AVRO-4223
frevib Jan 5, 2026
8cb27ef
Merge remote-tracking branch 'upstream/main' into AVRO-4223-gradle-pl…
frevib Jan 5, 2026
8b1acc5
AVRO-4223
frevib Jan 5, 2026
89378cf
AVRO-4223
frevib Jan 6, 2026
e247865
AVRO-4223
frevib Jan 6, 2026
01f1ae7
AVRO-4223
frevib Jan 6, 2026
47b34d4
AVRO-4223
frevib Jan 6, 2026
8094451
AVRO-4223
frevib Jan 6, 2026
61ed721
AVRO-4223
frevib Jan 6, 2026
6a6f3c9
AVRO-4223
frevib Jan 7, 2026
cb6fbf4
AVRO-4223
frevib Jan 7, 2026
f041b10
AVRO-4223
frevib Jan 7, 2026
3853d9a
AVRO-4223
frevib Jan 7, 2026
3ac3f41
AVRO-4223
frevib Jan 7, 2026
8c805ba
AVRO-4223
frevib Jan 10, 2026
cdd6861
AVRO-4223
frevib Jan 10, 2026
f8c4152
AVRO-4223
frevib Jan 10, 2026
90c0e66
AVRO-4223
frevib Jan 10, 2026
1809d6f
AVRO-4223
frevib Jan 10, 2026
4eef735
AVRO-4223
frevib Jan 11, 2026
78b67d7
AVRO-4223
frevib Jan 11, 2026
f309faf
AVRO-4223
frevib Jan 11, 2026
3519eb8
AVRO-4223
frevib Jan 11, 2026
89a4629
AVRO-4223
frevib Jan 11, 2026
9e7bd24
AVRO-4223
frevib Jan 11, 2026
1cf8762
AVRO-4223
frevib Jan 11, 2026
6183c73
AVRO-4223
frevib Jan 11, 2026
f0af7c5
AVRO-4223
frevib Jan 18, 2026
1443f18
AVRO-4223
frevib Jan 18, 2026
cce2cfc
AVRO-4223
frevib Jan 18, 2026
0e06ead
AVRO-4223
frevib Jan 26, 2026
761371f
AVRO-4223
frevib Jan 26, 2026
c75d6c4
AVRO-4223
frevib Jan 26, 2026
c36cb61
AVRO-4223
frevib Jan 26, 2026
eccfed6
AVRO-4223
frevib Jan 26, 2026
9e52ae0
Merge remote-tracking branch 'upstream/main' into AVRO-4223-gradle-pl…
frevib Feb 2, 2026
83c3a50
AVRO-4223
frevib Feb 2, 2026
aec2b3d
AVRO-4223
frevib Feb 2, 2026
43803fd
AVRO-4223
frevib Feb 2, 2026
201e4fb
AVRO-4223
frevib Feb 2, 2026
8428a16
AVRO-4223
frevib Feb 2, 2026
e1d5284
AVRO-4223
frevib Feb 2, 2026
2db64b1
AVRO-4223
frevib Feb 2, 2026
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
3 changes: 3 additions & 0 deletions lang/java/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,6 @@
dependency-reduced-pom.xml
mapred/userlogs/
tools/userlogs/
gradle-plugin/build
gradle-plugin/.kotlin
gradle-plugin/.gradle
89 changes: 89 additions & 0 deletions lang/java/gradle-plugin/README.md
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
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Replace bare URLs with Markdown links.

Markdownlint flags bare URLs; use inline links instead.

🔗 Suggested edit
-Now released on Gradle plugin portal: https://plugins.gradle.org/plugin/eu.eventloopsoftware.avro-gradle-plugin
+Now released on Gradle plugin portal: [Gradle Plugin Portal](https://plugins.gradle.org/plugin/eu.eventloopsoftware.avro-gradle-plugin)

-https://codeberg.org/frevib/use-gradle-plugin-test
+[use-gradle-plugin-test](https://codeberg.org/frevib/use-gradle-plugin-test)

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
In `@lang/java/gradle-plugin/README.md` at line 20, Replace bare URLs in the
README lines that contain "Now released on Gradle plugin portal:
https://plugins.gradle.org/plugin/eu.eventloopsoftware.avro-gradle-plugin" and
the other occurrence (line 68) with inline Markdown links; e.g., convert the
plain URL to a descriptive link like [Gradle Plugin
Portal](https://plugins.gradle.org/plugin/eu.eventloopsoftware.avro-gradle-plugin)
so the text uses Markdown link syntax instead of a bare URL.


`0.0.7`

It is not needed to add `tasks.named("compileKotlin") { dependsOn(tasks.named("avroGenerateJavaClasses")) }` any more
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

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

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
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
🧰 Tools
🪛 LanguageTool

[uncategorized] ~24-~24: Did you mean the adverb “anymore”?
Context: ...ks.named("avroGenerateJavaClasses")) }any more 0.0.8 AddsourceZipFiles` property...

(ANY_MORE)

🤖 Prompt for AI Agents
In `@lang/java/gradle-plugin/README.md` at line 24, Replace the two-word phrase
"any more" with the adverb "anymore" in the README sentence that mentions
tasks.named("compileKotlin") { dependsOn(tasks.named("avroGenerateJavaClasses"))
}, i.e., update the wording so it reads "It is not needed to add ... anymore" to
correct the wording flagged by LanguageTool.


`0.0.8`

Add `sourceZipFiles` property to add zip files with schemas in them
pu

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

There appears to be a typo here. It seems like an unfinished word.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Accidentally committed text in README

Low Severity

The text pu on line 29 appears to be accidentally committed text, possibly a typo or incomplete edit that should be removed from the documentation.

Fix in Cursor Fix in Web


Comment on lines +28 to +30
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

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

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
Add `sourceZipFiles` property to add zip files with schemas in them
pu
Add `sourceZipFiles` property to add zip files with schemas in them
🤖 Prompt for AI Agents
In `@lang/java/gradle-plugin/README.md` around lines 28 - 30, Remove the stray
fragment "pu" that was accidentally added after the sentence "Add
`sourceZipFiles` property to add zip files with schemas in them" in the README;
edit the README.md to delete that lone "pu" line so the documentation reads
cleanly without the accidental fragment.

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The plugin version in this usage example is 0.0.8, but the version defined in build.gradle.kts is 0.1.0. To avoid confusion for users, it's best to keep the documentation examples aligned with the actual version being developed.

Suggested change
id("eu.eventloopsoftware.avro-gradle-plugin") version "0.0.8"
id("eu.eventloopsoftware.avro-gradle-plugin") version "0.1.0"

}
```
### 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
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

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
Expected: h3; Actual: h4

(MD001, heading-increment)

🤖 Prompt for AI Agents
In `@lang/java/gradle-plugin/README.md` around lines 72 - 78, The FAQ section in
the README jumps heading levels (H2 to H4); normalize them so markdownlint
passes by changing the FAQ subheadings to H3. Specifically update the headings
"How can I benefit from Kotlin's null safety?" and "I get my Avro schemas from a
Maven dependency, how can I add JAR files that contain schemas?" from H4 to H3
(or make the parent FAQ an H2 and these H3s) so the hierarchy is consistent.


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

57 changes: 57 additions & 0 deletions lang/java/gradle-plugin/build.gradle.kts
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
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

cat -n lang/java/gradle-plugin/build.gradle.kts

Repository: martin-augment/avro

Length of output: 2239


🌐 Web query:

Kotlin gradle plugin version compatibility 2.2 2.3 2024 2025 2026

💡 Result:

Kotlin Gradle Plugin (KGP) 2.2 vs 2.3 compatibility (2025–2026)

KGP version Release date Supported Gradle versions (per Kotlin docs) Android Gradle Plugin (AGP) notes
2.2.0 Jun 23, 2025 7.6.3 – 8.14 (AGP-specific requirements vary by AGP line; see AGP 9.0 note below.) (plugins.gradle.org)
2.3.0 Dec 16, 2025 7.6.3 – 9.0.0 Min AGP 8.2.2, max AGP 8.13.0 (per Kotlin 2.3.0 release notes). (kotlinlang.org)

Key 2026 detail (AGP 9.0)

  • AGP 9.0 (Jan 2026) includes built-in Kotlin support and has a runtime dependency on KGP 2.2.10; if you declare a lower KGP, Gradle/AGP will upgrade it to 2.2.10. (developer.android.com)

Early 2026 (preview/EAP)

  • Kotlin 2.3.20 Beta2 (Jan 29, 2026) notes compatibility with Gradle 9.3.0 (EAP, not necessarily “stable support”). (kotlinlang.org)
  • Kotlin’s release page lists 2.3.20 planned for Jan–Mar 2026. (kotlinlang.org)

Citations:


Align Kotlin plugin and API versions for consistency.

The build declares Kotlin JVM plugin 2.2.10 (line 20) but depends on kotlin-gradle-plugin-api:2.3.0 (line 37). While both versions are stable and have overlapping compatibility ranges, aligning them prevents potential subtle compatibility issues and improves build reproducibility.

Suggested alignment options

Update 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

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
plugins {
kotlin("jvm") version "2.2.10"
`java-gradle-plugin`
id("com.gradle.plugin-publish") version "2.0.0"
}
plugins {
kotlin("jvm") version "2.3.0"
`java-gradle-plugin`
id("com.gradle.plugin-publish") version "2.0.0"
}
🤖 Prompt for AI Agents
In `@lang/java/gradle-plugin/build.gradle.kts` around lines 19 - 23, The Kotlin
JVM plugin version declared in the plugins block (kotlin("jvm") version
"2.2.10") is mismatched with the kotlin-gradle-plugin-api dependency version
("kotlin-gradle-plugin-api:2.3.0"); update one so both match (either bump the
plugin version to 2.3.0 or change the dependency to 2.2.10) to ensure consistent
Kotlin API/runtime; modify the version string in the plugins block or the
dependency declaration accordingly (look for kotlin("jvm") version and the
kotlin-gradle-plugin-api dependency).


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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The avro-compiler version is hardcoded. The comment on the preceding line suggests this is a known issue. For better maintainability and to ensure version consistency within the Avro project, this should be replaced with a property that references the main project version (e.g., ${project.version} or a similar mechanism if possible in a mixed Maven/Gradle build). The hardcoded version 1.12.1 also differs from the parent project's version 1.13.0-SNAPSHOT.

implementation("org.jetbrains.kotlin:kotlin-gradle-plugin-api:2.3.0")
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The build uses kotlin("jvm") 2.2.10 but depends on kotlin-gradle-plugin-api 2.3.0; this version skew can lead to binary incompatibilities at compile/runtime.

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

The group, plugin id, and implementationClass are all using eu.eventloopsoftware. As this plugin is being contributed to the Apache Avro project, these should be updated to use the org.apache.avro namespace to align with the project's conventions and ownership. This is a critical change for integration into the Apache ecosystem.

}
}
Binary file not shown.
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
Loading