Skip to content
This repository was archived by the owner on Dec 28, 2023. It is now read-only.
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: davidmc24/gradle-avro-plugin
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 1.4.0
Choose a base ref
...
head repository: davidmc24/gradle-avro-plugin
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 1.5.0
Choose a head ref
  • 6 commits
  • 18 files changed
  • 2 contributors

Commits on Sep 7, 2022

  1. version: 1.4.1-SNAPSHOT

    davidmc24 committed Sep 7, 2022
    Copy the full SHA
    6784b20 View commit details

Commits on Sep 15, 2022

  1. Add 'additionalVelocityTool' capability. Allows user to provide tools…

    … that will be available in Velocity templates at generation time.
    Dave Cracauer committed Sep 15, 2022
    Copy the full SHA
    9dd9790 View commit details

Commits on Sep 17, 2022

  1. Merge pull request #211 from dcracauer/master

    Add 'additionalVelocityTool' capability.
    davidmc24 authored Sep 17, 2022

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    65577c5 View commit details
  2. Update changelog

    davidmc24 committed Sep 17, 2022
    Copy the full SHA
    8e2ac1a View commit details
  3. Copy the full SHA
    7ad29b1 View commit details

Commits on Sep 19, 2022

  1. version: 1.5.0

    davidmc24 committed Sep 19, 2022
    Copy the full SHA
    9e8c9af View commit details
2 changes: 1 addition & 1 deletion .github/workflows/avro-compatibility.yml
Original file line number Diff line number Diff line change
@@ -6,7 +6,7 @@ jobs:
runs-on: "ubuntu-latest"
strategy:
matrix:
avro: ["1.11.0"]
avro: ["1.11.0", "1.11.1"]
gradle: ["5.1", "7.3"]
java: ["8"]
steps:
7 changes: 3 additions & 4 deletions .github/workflows/gradle-compatibility.yml
Original file line number Diff line number Diff line change
@@ -9,10 +9,9 @@ jobs:
avro: ["1.11.0"]
gradle: [
"5.1", "5.1.1", "5.2", "5.2.1", "5.3", "5.3.1", "5.4", "5.4.1", "5.5", "5.5.1", "5.6", "5.6.1", "5.6.2", "5.6.3", "5.6.4",
"6.0", "6.0.1", "6.1", "6.1.1", "6.2", "6.2.1", "6.2.2",
"6.3", "6.4", "6.4.1", "6.5", "6.5.1", "6.6", "6.6.1",
"6.7", "6.7.1", "6.8", "6.8.1", "6.8.2", "6.8.3", "6.9", "6.9.1",
"7.0", "7.0.1", "7.0.2", "7.1", "7.1.1", "7.2", "7.3"
"6.0", "6.0.1", "6.1", "6.1.1", "6.2", "6.2.1", "6.2.2", "6.3", "6.4", "6.4.1", "6.5", "6.5.1", "6.6", "6.6.1", "6.7", "6.7.1",
"6.8", "6.8.1", "6.8.2", "6.8.3", "6.9", "6.9.1", "6.9.2",
"7.0", "7.0.1", "7.0.2", "7.1", "7.1.1", "7.2", "7.3", "7.3.1", "7.3.2", "7.3.3", "7.4", "7.4.1", "7.4.2", "7.5", "7.5.1"
# See here for latest versions: https://services.gradle.org/versions/
]
java: ["8", "11"]
33 changes: 25 additions & 8 deletions .github/workflows/java-compatibility.yml
Original file line number Diff line number Diff line change
@@ -8,7 +8,7 @@ jobs:
strategy:
matrix:
avro: ["1.11.0"]
gradle: ["5.1", "7.3"]
gradle: ["5.1", "7.5.1"]
java: ["8", "9", "10", "11", "12"]
steps:
- uses: actions/checkout@v2
@@ -25,7 +25,7 @@ jobs:
strategy:
matrix:
avro: ["1.11.0"]
gradle: ["6.0", "7.3"]
gradle: ["6.0", "7.5.1"]
java: ["13"]
steps:
- uses: actions/checkout@v2
@@ -42,7 +42,7 @@ jobs:
strategy:
matrix:
avro: ["1.11.0"]
gradle: ["6.3", "7.3"]
gradle: ["6.3", "7.5.1"]
java: ["14"]
steps:
- uses: actions/checkout@v2
@@ -59,7 +59,7 @@ jobs:
strategy:
matrix:
avro: ["1.11.0"]
gradle: ["6.7", "7.3"]
gradle: ["6.7", "7.5.1"]
java: ["15"]
steps:
- uses: actions/checkout@v2
@@ -76,7 +76,7 @@ jobs:
strategy:
matrix:
avro: ["1.11.0"]
gradle: ["7.0", "7.3"] # See here for latest versions: https://services.gradle.org/versions/
gradle: ["7.0", "7.5.1"] # See here for latest versions: https://services.gradle.org/versions/
java: ["16"]
steps:
- uses: actions/checkout@v2
@@ -93,7 +93,7 @@ jobs:
strategy:
matrix:
avro: ["1.11.0"]
gradle: ["7.3"] # See here for latest versions: https://services.gradle.org/versions/
gradle: ["7.3", "7.5.1"] # See here for latest versions: https://services.gradle.org/versions/
java: ["17"]
steps:
- uses: actions/checkout@v2
@@ -104,14 +104,31 @@ jobs:
- uses: gradle/gradle-build-action@v2
with:
arguments: testCompatibility -PavroVersion=${{ matrix.avro }} -PgradleVersion=${{ matrix.gradle }}
java18:
name: "Compatibility: java ${{ matrix.java }}/gradle ${{ matrix.gradle }}"
runs-on: "ubuntu-latest"
strategy:
matrix:
avro: ["1.11.0"]
gradle: ["7.5", "7.5.1"] # See here for latest versions: https://services.gradle.org/versions/
java: ["18"]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v2
with:
distribution: "zulu"
java-version: ${{ matrix.java }}
- uses: gradle/gradle-build-action@v2
with:
arguments: testCompatibility -PavroVersion=${{ matrix.avro }} -PgradleVersion=${{ matrix.gradle }}
java-ea:
name: "Compatibility: java ${{ matrix.java }}/gradle ${{ matrix.gradle }}"
runs-on: "ubuntu-latest"
strategy:
matrix:
avro: ["1.11.0"]
gradle: ["7.3"] # See here for latest versions: https://services.gradle.org/versions/
java: ["18-ea"]
gradle: ["7.5.1"] # See here for latest versions: https://services.gradle.org/versions/
java: ["19-ea"]
fail-fast: false
steps:
- uses: actions/checkout@v2
7 changes: 7 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -2,6 +2,13 @@

## Unreleased

## 1.5.0
* Added support for `additionalVelocityTool` thanks to a contribution from [dcracauer](https://github.com/dcracauer); see https://github.com/davidmc24/gradle-avro-plugin/pull/211
* Built using Avro 1.11.1
* Built using Gradle 7.5.1
* Updated compatibility testing through Gradle 7.5.1
* Updated compatibility testing through Java 18

## 1.4.0
* Drop support for Kotlin plugin integration

30 changes: 23 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -14,18 +14,19 @@ This is a [Gradle](http://www.gradle.org/) plugin to allow easily performing Jav

**NOTE**: Pre-1.0 versions used a different publishing process/namespace. It is strongly recommended to upgrade to a newer version. Further details can be found in the [change log](CHANGES.md).

* Currently tested against Java 8-16
* Though not supported yet, tests are also run against Java 18 to provide early notification of potential incompatibilities.
* Currently tested against Java 8-18
* Though not supported yet, tests are also run against Java 19 to provide early notification of potential incompatibilities.
* Java 18 support requires Gradle 7.5 or higher (as per Gradle's release notes)
* Java 17 support requires Gradle 7.3 or higher (as per Gradle's release notes)
* Java 16 support requires Gradle 7.0 or higher (as per Gradle's release notes)
* Java 15 support requires Gradle 6.7 or higher (as per Gradle's release notes)
* Java 14 support requires Gradle 6.3 or higher (as per Gradle's release notes)
* Java 13 support requires Gradle 6.0 or higher
* Java 8-12 support requires Gradle 5.1 or higher (versions lower than 5.1 are no longer supported)
* Currently built against Gradle 7.3
* Currently tested against Gradle 5.1-5.6.4 and 6.0-7.3
* Currently built against Avro 1.11.0
* Currently tested against Avro 1.11.0
* Currently built against Gradle 7.5.1
* Currently tested against Gradle 5.1-5.6.4 and 6.0-7.5.1
* Currently built against Avro 1.11.1
* Currently tested against Avro 1.11.0-1.11.1
* Avro 1.9.0-1.10.2 were last supported in version 1.2.1
* Support for Kotlin
* Dropped integration with the Kotlin plugin in plugin version 1.4.0, as Kotlin 1.7.x would require compile-time dependency on a specific Kotlin version
@@ -82,7 +83,7 @@ Actually, it will attempt to process an "avro" directory in every `SourceSet` (m
There are a number of configuration options supported in the `avro` block.

| option | default | description |
| -------------------------------------| --------------------- | ---------------------------------------------------------------|
|--------------------------------------| --------------------- |----------------------------------------------------------------|
| createSetters | `true` | `createSetters` passed to Avro compiler |
| createOptionalGetters | `false` | `createOptionalGetters` passed to Avro compiler |
| gettersReturnOptional | `false` | `gettersReturnOptional` passed to Avro compiler |
@@ -91,6 +92,7 @@ There are a number of configuration options supported in the `avro` block.
| outputCharacterEncoding | see below | `outputCharacterEncoding` passed to Avro compiler |
| stringType | `"String"` | `stringType` passed to Avro compiler |
| templateDirectory | see below | `templateDir` passed to Avro compiler |
| additionalVelocityToolClasses | see below | `additionalVelocityTools` passed to Avro compiler |
| enableDecimalLogicalType | `true` | `enableDecimalLogicalType` passed to Avro compiler |

Additionally, the `avro` extension exposes the following methods:
@@ -224,6 +226,20 @@ avro {
}
```

## additionalVelocityToolClasses

When overriding the default set of Velocity templates provided with Avro, it is often desirable to provide additional tools to use during generation.
The class names you provide will be made available for use in your Velocity templates. An instance of each class provided will be created using
the default constructor (required). When registered, they will be available as $class.simpleName(). Given the example configuration below,
two tools would be registered, and be available as escape and json.


```groovy
avro {
additionalVelocityToolClasses = ['com.yourpackage.Escape', 'com.yourpackage.JSON']
}
```

## enableDecimalLogicalType

Valid values: `true` (default), `false`; supports equivalent `String` values
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -21,7 +21,7 @@ plugins {
// support.

group = "com.github.davidmc24.gradle.plugin"
version = "1.4.0"
version = "1.5.0"

def isCI = System.getenv("CI") == "true"

@@ -34,7 +34,7 @@ repositories {
}
}

def compileAvroVersion = "1.11.0"
def compileAvroVersion = "1.11.1"

// Write the plugin's classpath to a file to share with the tests
task createClasspathManifest {
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
6 changes: 6 additions & 0 deletions gradlew
Original file line number Diff line number Diff line change
@@ -205,6 +205,12 @@ set -- \
org.gradle.wrapper.GradleWrapperMain \
"$@"

# Stop when "xargs" is not available.
if ! command -v xargs >/dev/null 2>&1
then
die "xargs is not available"
fi

# Use "xargs" to parse quoted args.
#
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
14 changes: 8 additions & 6 deletions gradlew.bat
Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@
@rem limitations under the License.
@rem

@if "%DEBUG%" == "" @echo off
@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@@ -25,7 +25,7 @@
if "%OS%"=="Windows_NT" setlocal

set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
if "%DIRNAME%"=="" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

@@ -40,7 +40,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome

set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto execute
if %ERRORLEVEL% equ 0 goto execute

echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
@@ -75,13 +75,15 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar

:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
if %ERRORLEVEL% equ 0 goto mainEnd

:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
set EXIT_CODE=%ERRORLEVEL%
if %EXIT_CODE% equ 0 set EXIT_CODE=1
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
exit /b %EXIT_CODE%

:mainEnd
if "%OS%"=="Windows_NT" endlocal
Original file line number Diff line number Diff line change
@@ -32,6 +32,7 @@ private static void configureExtension(final Project project) {
task.getStringType().convention(avroExtension.getStringType());
task.getFieldVisibility().convention(avroExtension.getFieldVisibility());
task.getTemplateDirectory().convention(avroExtension.getTemplateDirectory());
task.getAdditionalVelocityToolClasses().convention(avroExtension.getAdditionalVelocityToolClasses());
task.isCreateSetters().convention(avroExtension.isCreateSetters());
task.isCreateOptionalGetters().convention(avroExtension.isCreateOptionalGetters());
task.isGettersReturnOptional().convention(avroExtension.isGettersReturnOptional());
Original file line number Diff line number Diff line change
@@ -27,6 +27,7 @@ public interface AvroExtension {
Property<String> getStringType();
Property<String> getFieldVisibility();
Property<String> getTemplateDirectory();
ListProperty<String> getAdditionalVelocityToolClasses();
Property<Boolean> isCreateSetters();
Property<Boolean> isCreateOptionalGetters();
Property<Boolean> isGettersReturnOptional();
Original file line number Diff line number Diff line change
@@ -16,6 +16,8 @@
package com.github.davidmc24.gradle.plugin.avro;

import java.nio.charset.Charset;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import javax.inject.Inject;
import org.apache.avro.Conversion;
@@ -27,13 +29,16 @@
import org.gradle.api.provider.MapProperty;
import org.gradle.api.provider.Property;
import org.gradle.api.provider.Provider;
import org.gradle.api.tasks.Input;
import org.gradle.api.tasks.Optional;

@SuppressWarnings({"unused", "WeakerAccess"})
public class DefaultAvroExtension implements AvroExtension {
private final Property<String> outputCharacterEncoding;
private final Property<String> stringType;
private final Property<String> fieldVisibility;
private final Property<String> templateDirectory;
private final ListProperty<String> additionalVelocityToolClasses;
private final Property<Boolean> createSetters;
private final Property<Boolean> createOptionalGetters;
private final Property<Boolean> gettersReturnOptional;
@@ -48,6 +53,8 @@ public DefaultAvroExtension(ObjectFactory objects) {
this.stringType = objects.property(String.class).convention(Constants.DEFAULT_STRING_TYPE);
this.fieldVisibility = objects.property(String.class).convention(Constants.DEFAULT_FIELD_VISIBILITY);
this.templateDirectory = objects.property(String.class);
this.additionalVelocityToolClasses =
objects.listProperty(String.class).convention(Collections.emptyList());
this.createSetters = objects.property(Boolean.class).convention(Constants.DEFAULT_CREATE_SETTERS);
this.createOptionalGetters = objects.property(Boolean.class).convention(Constants.DEFAULT_CREATE_OPTIONAL_GETTERS);
this.gettersReturnOptional = objects.property(Boolean.class).convention(Constants.DEFAULT_GETTERS_RETURN_OPTIONAL);
@@ -108,6 +115,16 @@ public void setTemplateDirectory(String templateDirectory) {
this.templateDirectory.set(templateDirectory);
}

@Optional
@Input
public ListProperty<String> getAdditionalVelocityToolClasses() {
return additionalVelocityToolClasses;
}

public void setAdditionalVelocityToolClasses(List<String> additionalVelocityToolClasses) {
this.additionalVelocityToolClasses.set(additionalVelocityToolClasses);
}

@Override
public Property<Boolean> isCreateSetters() {
return createSetters;
Loading