Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
72 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
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
77 changes: 77 additions & 0 deletions lang/java/gradle-plugin/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# Avro Gradle plugin (in development)

Gradle plugin that generates Java code from Avro schemas

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

## 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")
}
```

60 changes: 60 additions & 0 deletions lang/java/gradle-plugin/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/*
* 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"
}

group = "eu.eventloopsoftware"
version = "0.0.9-SNAPSHOT"

repositories {
mavenCentral()
mavenLocal()
}

dependencies {
// TODO: for release use ${version}
implementation("org.apache.avro:avro-compiler:1.12.1")
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin-api:2.3.0")
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"
}
}
}
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