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

Commit

Permalink
Update for avro 1.11.0
Browse files Browse the repository at this point in the history
  • Loading branch information
davidmc24 committed Nov 9, 2021
1 parent 25f7a0e commit 023d4f9
Show file tree
Hide file tree
Showing 15 changed files with 93 additions and 66 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/avro-compatibility.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jobs:
runs-on: "ubuntu-latest"
strategy:
matrix:
avro: ["1.9.0", "1.9.1", "1.9.2", "1.10.0", "1.10.1", "1.10.2"]
avro: ["1.9.0", "1.9.1", "1.9.2", "1.10.0", "1.10.1", "1.10.2", "1.11.0"]
gradle: ["5.1", "6.8.3"]
java: ["8"]
steps:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/gradle-compatibility.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ jobs:
runs-on: "ubuntu-latest"
strategy:
matrix:
avro: ["1.10.2"]
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.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"
# See here for latest versions: https://services.gradle.org/versions/
]
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/java-compatibility.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
runs-on: "ubuntu-latest"
strategy:
matrix:
avro: ["1.10.2"]
avro: ["1.11.0"]
gradle: ["5.1", "6.8.3"]
java: ["8", "9", "10", "11", "12"]
steps:
Expand All @@ -26,7 +26,7 @@ jobs:
runs-on: "ubuntu-latest"
strategy:
matrix:
avro: ["1.10.2"]
avro: ["1.11.0"]
gradle: ["6.0", "6.8.3"]
java: ["13"]
steps:
Expand All @@ -45,7 +45,7 @@ jobs:
runs-on: "ubuntu-latest"
strategy:
matrix:
avro: ["1.10.2"]
avro: ["1.11.0"]
gradle: ["6.3", "6.8.3"]
java: ["14"]
steps:
Expand All @@ -64,7 +64,7 @@ jobs:
runs-on: "ubuntu-latest"
strategy:
matrix:
avro: ["1.10.2"]
avro: ["1.11.0"]
gradle: ["6.7", "6.8.3"]
java: ["15"]
steps:
Expand All @@ -83,7 +83,7 @@ jobs:
runs-on: "ubuntu-latest"
strategy:
matrix:
avro: ["1.10.2"]
avro: ["1.11.0"]
gradle: ["7.1.1", "7.2"] # See here for latest versions: https://services.gradle.org/versions/
java: ["16"]
steps:
Expand All @@ -102,7 +102,7 @@ jobs:
runs-on: "ubuntu-latest"
strategy:
matrix:
avro: ["1.10.2"]
avro: ["1.11.0"]
gradle: ["7.2"] # See here for latest versions: https://services.gradle.org/versions/
java: ["17", "18-ea"]
fail-fast: false
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/kotlin-plugin-compatibility.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ jobs:
runs-on: "ubuntu-latest"
strategy:
matrix:
avro: ["1.10.2"] # Latest version that this plugin supports
avro: ["1.11.0"] # Latest version that this plugin supports
gradle: ["5.6.4"]
java: ["11"] # Latest LTS version that this plugin supports
kotlin: [
Expand All @@ -81,7 +81,7 @@ jobs:
runs-on: "ubuntu-latest"
strategy:
matrix:
avro: ["1.10.2"] # Latest version that this plugin supports
avro: ["1.11.0"] # Latest version that this plugin supports
gradle: ["6.8.3"] # Latest version that this plugin supports
java: ["11"] # Latest LTS version that this plugin supports
kotlin: [
Expand Down
2 changes: 2 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Change Log

## Unreleased
* Built using Avro 1.11.0
* Default field visibility is now "PRIVATE" to match Avro's new default, as "PUBLIC_DEPRECATED" is no longer supported in Avro 1.11.0
* Built using Gradle 7.2
* Updated compatibility testing through Gradle 7.2
* `GenerateAvroProtocolTask` now has a debug log to output its classpath
Expand Down
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ This is a [Gradle](http://www.gradle.org/) plugin to allow easily performing Jav
* Though not supported yet, tests are also run against Java 16/17 to provide early notification of potential incompatibilities. It is expected that Java 16+ support will require Gradle 7.0 or higher.
* Currently built against Gradle 7.2
* Currently tested against Gradle 5.1-5.6.4 and 6.0-7.2
* Currently built against Avro 1.10.2
* Currently tested against Avro 1.9.0-1.10.2
* Currently built against Avro 1.11.0
* Currently tested against Avro 1.9.0-1.11.0
* Support for Kotlin
* Currently tested against Kotlin plugin versions 1.3.20-1.3.72 and 1.4.0-1.4.32 using the latest compatible version of Gradle
* Currently tested against Kotlin plugin versions 1.2.20-1.2.71 and 1.3.0-1.3.11 using Gradle 5.1
Expand Down Expand Up @@ -57,7 +57,7 @@ repositories {
mavenCentral()
}
dependencies {
implementation "org.apache.avro:avro:1.10.1"
implementation "org.apache.avro:avro:1.11.0"
}
```

Expand All @@ -74,7 +74,7 @@ There are a number of configuration options supported in the `avro` block.
| createOptionalGetters | `false` | `createOptionalGetters` passed to Avro compiler |
| gettersReturnOptional | `false` | `gettersReturnOptional` passed to Avro compiler |
| optionalGettersForNullableFieldsOnly | `false` | `optionalGettersForNullableFieldsOnly` passed to Avro compiler |
| fieldVisibility | `"PUBLIC_DEPRECATED"` | `fieldVisibility` passed to Avro compiler |
| fieldVisibility | `"PRIVATE"` | `fieldVisibility` passed to Avro compiler |
| outputCharacterEncoding | see below | `outputCharacterEncoding` passed to Avro compiler |
| stringType | `"String"` | `stringType` passed to Avro compiler |
| templateDirectory | see below | `templateDir` passed to Avro compiler |
Expand Down Expand Up @@ -153,16 +153,16 @@ avro {

## fieldVisibility

Valid values: any [FieldVisibility](http://avro.apache.org/docs/1.8.1/api/java/org/apache/avro/compiler/specific/SpecificCompiler.FieldVisibility.html) or equivalent `String` name (matched case-insensitively); default `"PUBLIC_DEPRECATED"` (default)
Valid values: any [FieldVisibility](https://avro.apache.org/docs/1.11.0/api/java/org/apache/avro/compiler/specific/SpecificCompiler.FieldVisibility.html) or equivalent `String` name (matched case-insensitively); default `"PRIVATE"` (default)

By default, the fields in generated Java files will have public visibility and be annotated with `@Deprecated`.
Set to `"PRIVATE"` to restrict visibility of the fields, or `"PUBLIC"` to remove the `@Deprecated` annotations.
By default, the fields in generated Java files will have private visibility.
Set to `"PRIVATE"` to explicitly specify private visibility of the fields, or `"PUBLIC"` to specify public visibility of the fields.

Example:

```groovy
avro {
fieldVisibility = "PRIVATE"
fieldVisibility = "PUBLIC"
}
```

Expand Down Expand Up @@ -247,7 +247,7 @@ apply plugin: "java"
apply plugin: "com.github.davidmc24.gradle.plugin.avro-base"
dependencies {
implementation "org.apache.avro:avro:1.10.1"
implementation "org.apache.avro:avro:1.11.0"
}
def generateAvro = tasks.register("generateAvro", GenerateAvroJavaTask) {
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ repositories {
}
}

def compileAvroVersion = "1.10.2"
def compileAvroVersion = "1.11.0"

// Write the plugin's classpath to a file to share with the tests
task createClasspathManifest {
Expand Down
2 changes: 1 addition & 1 deletion examples/default-custom-types/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ repositories {
}

dependencies {
implementation 'org.apache.avro:avro:1.10.2'
implementation 'org.apache.avro:avro:1.11.0'
}
2 changes: 1 addition & 1 deletion examples/default-custom-types/buildSrc/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ repositories {

dependencies {
implementation 'com.github.davidmc24.gradle.plugin:gradle-avro-plugin:1.2.0'
implementation 'org.apache.avro:avro:1.10.2'
implementation 'org.apache.avro:avro:1.11.0'
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class Constants {
static final String UTF8_ENCODING = "UTF-8";

static final String DEFAULT_STRING_TYPE = StringType.String.name();
static final String DEFAULT_FIELD_VISIBILITY = FieldVisibility.PUBLIC_DEPRECATED.name();
static final String DEFAULT_FIELD_VISIBILITY = FieldVisibility.PRIVATE.name();
static final boolean DEFAULT_CREATE_SETTERS = true;
static final boolean DEFAULT_CREATE_OPTIONAL_GETTERS = false;
static final boolean DEFAULT_GETTERS_RETURN_OPTIONAL = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class KotlinDSLCompatibilityFunctionalSpec extends FunctionalSpec {
| isCreateOptionalGetters.set(false)
| isGettersReturnOptional.set(false)
| isOptionalGettersForNullableFieldsOnly.set(false)
| fieldVisibility.set("PUBLIC_DEPRECATED")
| fieldVisibility.set("PUBLIC")
| outputCharacterEncoding.set("UTF-8")
| stringType.set("String")
| templateDirectory.set(null as String?)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ class OptionsFunctionalSpec extends FunctionalSpec {
and: "the stringType is string"
content.contains("public java.lang.String getName()")

and: "the fieldVisibility is PUBLIC_DEPRECATED"
content.contains("@Deprecated public java.lang.String name;")
and: "the fieldVisibility is PRIVATE"
content.contains("private java.lang.String name;")

and: "the default template is used"
!content.contains("Custom template")
Expand Down Expand Up @@ -122,7 +122,6 @@ class OptionsFunctionalSpec extends FunctionalSpec {
FieldVisibility.PRIVATE.name().toLowerCase() | "private java.lang.String name;"
FieldVisibility.PRIVATE.name() | "private java.lang.String name;"
FieldVisibility.PUBLIC.name() | "public java.lang.String name;"
FieldVisibility.PUBLIC_DEPRECATED.name() | "@Deprecated public java.lang.String name;"
}

@Unroll
Expand Down Expand Up @@ -300,7 +299,7 @@ class OptionsFunctionalSpec extends FunctionalSpec {

then:
result.task(":generateAvroJava").outcome == FAILED
result.output.contains("Invalid fieldVisibility 'badValue'. Value values are: [PUBLIC, PUBLIC_DEPRECATED, PRIVATE]")
result.output.contains("Invalid fieldVisibility 'badValue'. Value values are: [PUBLIC, PRIVATE]")
}

@Unroll
Expand Down
Loading

0 comments on commit 023d4f9

Please sign in to comment.