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.5.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.6.0
Choose a head ref
  • 12 commits
  • 17 files changed
  • 3 contributors

Commits on Sep 19, 2022

  1. version: 1.5.1-SNAPSHOT

    davidmc24 committed Sep 19, 2022
    Copy the full SHA
    9b81a23 View commit details

Commits on Jan 30, 2023

  1. Copy the full SHA
    5a7e497 View commit details

Commits on Jan 31, 2023

  1. Copy the full SHA
    e4f1ede View commit details
  2. Merge pull request #222 from crtlib/master

    Support specifying classpath for additional velocity tool classes
    davidmc24 authored Jan 31, 2023

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    e69bbe7 View commit details
  3. Minor cleanup

    davidmc24 committed Jan 31, 2023

    Verified

    This commit was signed with the committer’s verified signature.
    davidmc24 David M. Carr
    Copy the full SHA
    1947802 View commit details

Commits on Feb 1, 2023

  1. Copy the full SHA
    e778f21 View commit details

Commits on Feb 2, 2023

  1. Merge pull request #223 from crtlib/master

    Fix test: escape backslashes in a Windows path
    davidmc24 authored Feb 2, 2023

    Verified

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

Commits on Feb 3, 2023

  1. Copy the full SHA
    b18c0fd View commit details
  2. Copy the full SHA
    e8f7ee7 View commit details
  3. Copy the full SHA
    f1d84f7 View commit details

Commits on Feb 6, 2023

  1. Update changelog

    davidmc24 committed Feb 6, 2023
    Copy the full SHA
    96cffb3 View commit details
  2. version: 1.6.0

    davidmc24 committed Feb 6, 2023
    Copy the full SHA
    05e1a8b View commit details
2 changes: 1 addition & 1 deletion .github/workflows/avro-compatibility.yml
Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@ jobs:
strategy:
matrix:
avro: ["1.11.0", "1.11.1"]
gradle: ["5.1", "7.3"]
gradle: ["5.1", "7.6"]
java: ["8"]
steps:
- uses: actions/checkout@v2
4 changes: 2 additions & 2 deletions .github/workflows/gradle-compatibility.yml
Original file line number Diff line number Diff line change
@@ -10,8 +10,8 @@ jobs:
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", "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"
"6.8", "6.8.1", "6.8.2", "6.8.3", "6.9", "6.9.1", "6.9.2", "6.9.3",
"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", "7.6"
# See here for latest versions: https://services.gradle.org/versions/
]
java: ["8", "11"]
78 changes: 14 additions & 64 deletions .github/workflows/java-compatibility.yml
Original file line number Diff line number Diff line change
@@ -8,8 +8,8 @@ jobs:
strategy:
matrix:
avro: ["1.11.0"]
gradle: ["5.1", "7.5.1"]
java: ["8", "9", "10", "11", "12"]
gradle: ["5.1", "7.6"]
java: ["8", "11"]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v2
@@ -19,65 +19,14 @@ jobs:
- uses: gradle/gradle-build-action@v2
with:
arguments: testCompatibility -PavroVersion=${{ matrix.avro }} -PgradleVersion=${{ matrix.gradle }}
java13:
name: "Compatibility: java ${{ matrix.java }}/gradle ${{ matrix.gradle }}"
runs-on: "ubuntu-latest"
strategy:
matrix:
avro: ["1.11.0"]
gradle: ["6.0", "7.5.1"]
java: ["13"]
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 }}
java14:
name: "Compatibility: java ${{ matrix.java }}/gradle ${{ matrix.gradle }}"
runs-on: "ubuntu-latest"
strategy:
matrix:
avro: ["1.11.0"]
gradle: ["6.3", "7.5.1"]
java: ["14"]
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 }}
java15:
name: "Compatibility: java ${{ matrix.java }}/gradle ${{ matrix.gradle }}"
runs-on: "ubuntu-latest"
strategy:
matrix:
avro: ["1.11.0"]
gradle: ["6.7", "7.5.1"]
java: ["15"]
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 }}
java16:
java17:
name: "Compatibility: java ${{ matrix.java }}/gradle ${{ matrix.gradle }}"
runs-on: "ubuntu-latest"
strategy:
matrix:
avro: ["1.11.0"]
gradle: ["7.0", "7.5.1"] # See here for latest versions: https://services.gradle.org/versions/
java: ["16"]
gradle: ["7.3", "7.6"] # See here for latest versions: https://services.gradle.org/versions/
java: ["17"]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v2
@@ -87,14 +36,14 @@ jobs:
- uses: gradle/gradle-build-action@v2
with:
arguments: testCompatibility -PavroVersion=${{ matrix.avro }} -PgradleVersion=${{ matrix.gradle }}
java17:
java18:
name: "Compatibility: java ${{ matrix.java }}/gradle ${{ matrix.gradle }}"
runs-on: "ubuntu-latest"
strategy:
matrix:
avro: ["1.11.0"]
gradle: ["7.3", "7.5.1"] # See here for latest versions: https://services.gradle.org/versions/
java: ["17"]
gradle: ["7.5", "7.6"] # See here for latest versions: https://services.gradle.org/versions/
java: ["18"]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v2
@@ -104,21 +53,22 @@ jobs:
- uses: gradle/gradle-build-action@v2
with:
arguments: testCompatibility -PavroVersion=${{ matrix.avro }} -PgradleVersion=${{ matrix.gradle }}
java18:
java-19:
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"]
gradle: ["7.6"] # See here for latest versions: https://services.gradle.org/versions/
java: ["19"]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v2
with:
distribution: "zulu"
java-version: ${{ matrix.java }}
- uses: gradle/gradle-build-action@v2
continue-on-error: true
with:
arguments: testCompatibility -PavroVersion=${{ matrix.avro }} -PgradleVersion=${{ matrix.gradle }}
java-ea:
@@ -127,8 +77,8 @@ jobs:
strategy:
matrix:
avro: ["1.11.0"]
gradle: ["7.5.1"] # See here for latest versions: https://services.gradle.org/versions/
java: ["19-ea"]
gradle: ["7.6"] # See here for latest versions: https://services.gradle.org/versions/
java: ["20-ea"]
fail-fast: false
steps:
- uses: actions/checkout@v2
5 changes: 5 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
# Change Log

## Unreleased
* Add support for configuring classpath for `GenerateAvroJavaTask` (thanks to [crtlib](https://github.com/crtlib)); see https://github.com/davidmc24/gradle-avro-plugin/pull/222
* Drop compatibility testing for old versions of Java (9, 10, 12, 13, 14, 15, 16)
* Built using Gradle 7.6
* Updated compatibility testing through Gradle 7.6
* Updated compatibility testing through Java 19

## 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
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -22,7 +22,7 @@ All enhancements should be accompanied by test coverage.
Our tests are based on [Spock](https://github.com/spockframework/spock).
Generally, it's best to extend our `FunctionalSpec` class, which provides useful functions for running the plugin within Gradle.

Note that the "build" task only tests the plugin against the a single version of Gradle/Avro.
Note that the "build" task only tests the plugin against a single version of Gradle/Avro.
If you want to test compatibility with a larger range, consider using the `testRecentVersionCompatibility` task or `testVersionCompatibility` task.

For information on how to use GitHub to submit a pull request, see [Collaborating on projects using issues and pull requests](https://help.github.com/categories/collaborating-on-projects-using-issues-and-pull-requests/).
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -14,17 +14,18 @@ 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-18
* Though not supported yet, tests are also run against Java 19 to provide early notification of potential incompatibilities.
* Currently tested against Java 8, 11, and 17-19
* Though not supported yet, tests are also run against Java 20 to provide early notification of potential incompatibilities.
* Java 19 support requires Gradle 7.6 or higher (as per Gradle's release notes)
* 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.5.1
* Currently tested against Gradle 5.1-5.6.4 and 6.0-7.5.1
* Currently built against Gradle 7.6
* Currently tested against Gradle 5.1-5.6.4 and 6.0-7.6
* 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
2 changes: 1 addition & 1 deletion 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.5.0"
version = "1.6.0"

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

Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
3 changes: 2 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
12 changes: 8 additions & 4 deletions gradlew
Original file line number Diff line number Diff line change
@@ -55,7 +55,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
@@ -80,10 +80,10 @@ do
esac
done

APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit

APP_NAME="Gradle"
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
@@ -143,12 +143,16 @@ fi
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
1 change: 1 addition & 0 deletions gradlew.bat
Original file line number Diff line number Diff line change
@@ -26,6 +26,7 @@ if "%OS%"=="Windows_NT" setlocal

set DIRNAME=%~dp0
if "%DIRNAME%"=="" set DIRNAME=.
@rem This is normally unused
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

Original file line number Diff line number Diff line change
@@ -62,11 +62,10 @@ private static void configureIntelliJ(final Project project) {
.add(getAvroSourceDir(project, mainSourceSet))
.add(getGeneratedOutputDir(project, mainSourceSet, Constants.JAVA_EXTENSION).map(Directory::getAsFile).get())
.build());
module.setTestSourceDirs(new SetBuilder<File>()
.addAll(module.getTestSourceDirs())
.add(getAvroSourceDir(project, testSourceSet))
.add(getGeneratedOutputDir(project, testSourceSet, Constants.JAVA_EXTENSION).map(Directory::getAsFile).get())
.build());
GradleCompatibility.addTestSources(module,
getAvroSourceDir(project, testSourceSet),
getGeneratedOutputDir(project, testSourceSet, Constants.JAVA_EXTENSION).map(Directory::getAsFile).get()
);
// IntelliJ doesn't allow source directories beneath an excluded directory.
// Thus, we remove the build directory exclude and add all non-generated sub-directories as excludes.
SetBuilder<File> excludeDirs = new SetBuilder<>();
Original file line number Diff line number Diff line change
@@ -18,8 +18,12 @@
import java.io.File;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLClassLoader;
import java.nio.charset.Charset;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -43,6 +47,7 @@
import org.gradle.api.provider.Provider;
import org.gradle.api.specs.NotSpec;
import org.gradle.api.tasks.CacheableTask;
import org.gradle.api.tasks.Classpath;
import org.gradle.api.tasks.Input;
import org.gradle.api.tasks.Optional;
import org.gradle.api.tasks.TaskAction;
@@ -67,6 +72,7 @@ public class GenerateAvroJavaTask extends OutputDirTask {
private final Property<Boolean> optionalGettersForNullableFieldsOnly;
private final Property<Boolean> createSetters;
private final Property<Boolean> enableDecimalLogicalType;
private FileCollection classpath;
private final MapProperty<String, Class<? extends LogicalTypes.LogicalTypeFactory>> logicalTypeFactories;
private final ListProperty<Class<? extends Conversion<?>>> customConversions;

@@ -91,18 +97,32 @@ public GenerateAvroJavaTask(ObjectFactory objects) {
.convention(Constants.DEFAULT_OPTIONAL_GETTERS_FOR_NULLABLE_FIELDS_ONLY);
this.createSetters = objects.property(Boolean.class).convention(Constants.DEFAULT_CREATE_SETTERS);
this.enableDecimalLogicalType = objects.property(Boolean.class).convention(Constants.DEFAULT_ENABLE_DECIMAL_LOGICAL_TYPE);
this.stringTypeProvider = getStringType()
.map(input -> Enums.parseCaseInsensitive(Constants.OPTION_STRING_TYPE, StringType.values(), input));
this.fieldVisibilityProvider = getFieldVisibility()
.map(input -> Enums.parseCaseInsensitive(Constants.OPTION_FIELD_VISIBILITY, FieldVisibility.values(), input));
this.classpath = GradleCompatibility.createConfigurableFileCollection(getProject());
this.logicalTypeFactories = objects.mapProperty(String.class, Constants.LOGICAL_TYPE_FACTORY_TYPE.getConcreteClass())
.convention(Constants.DEFAULT_LOGICAL_TYPE_FACTORIES);
this.customConversions =
objects.listProperty(Constants.CONVERSION_TYPE.getConcreteClass()).convention(Constants.DEFAULT_CUSTOM_CONVERSIONS);
this.stringTypeProvider = getStringType()
.map(input -> Enums.parseCaseInsensitive(Constants.OPTION_STRING_TYPE, StringType.values(), input));
this.fieldVisibilityProvider = getFieldVisibility()
.map(input -> Enums.parseCaseInsensitive(Constants.OPTION_FIELD_VISIBILITY, FieldVisibility.values(), input));
this.projectLayout = getProject().getLayout();
this.resolver = new SchemaResolver(projectLayout, getLogger());
}

public void setClasspath(FileCollection classpath) {
this.classpath = classpath;
}

public void classpath(Object... paths) {
this.classpath.plus(getProject().files(paths));
}

@Classpath
public FileCollection getClasspath() {
return this.classpath;
}

@Optional
@Input
public Property<String> getOutputCharacterEncoding() {
@@ -340,10 +360,11 @@ private void compile(SpecificCompiler compiler, File sourceFile) throws IOExcept
compiler.setTemplateDir(getTemplateDirectory().get());
}
if (getAdditionalVelocityToolClasses().isPresent()) {
ClassLoader loader = assembleClassLoader();
List<Object> tools = getAdditionalVelocityToolClasses().get().stream()
.map(s -> {
try {
return Class.forName(s);
return Class.forName(s, true, loader);
} catch (ClassNotFoundException e) {
throw new RuntimeException("unable to load velocity tool class " + s, e);
}
@@ -394,4 +415,17 @@ private void registerLogicalTypes() {
private void registerCustomConversions(SpecificCompiler compiler) {
customConversions.get().forEach(compiler::addCustomConversion);
}

private ClassLoader assembleClassLoader() {
getLogger().debug("Using additional classpath: {}", classpath.getFiles());
List<URL> urls = new LinkedList<>();
for (File file : classpath) {
try {
urls.add(file.toURI().toURL());
} catch (MalformedURLException e) {
getLogger().debug(e.getMessage());
}
}
return new URLClassLoader(urls.toArray(new URL[0]), Thread.currentThread().getContextClassLoader());
}
}
Loading