Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modulable avro plugin #196

Merged
merged 11 commits into from
Oct 22, 2024
Merged

Modulable avro plugin #196

merged 11 commits into from
Oct 22, 2024

Conversation

RustedBones
Copy link
Collaborator

@RustedBones RustedBones commented Sep 12, 2024

Currently sbt-avro can only use a single avro compiler version in the whole build.

This PR intend to change this by using a custom avro configuration, containing the required artifacts for the compilation phase.

Other notable change: As the plugin now adds the avro dependency, it is not automatically triggered.

@RustedBones RustedBones force-pushed the handle-multiple-versions branch 2 times, most recently from f2ebb3d to b76111f Compare September 23, 2024 15:41
@RustedBones RustedBones changed the title Proposal to handle multiple avro versions in the same build Modulable avro plugin Sep 23, 2024
@RustedBones RustedBones marked this pull request as ready for review September 23, 2024 15:43
@RustedBones RustedBones force-pushed the handle-multiple-versions branch from e88e18e to be074f4 Compare October 15, 2024 09:25
Comment on lines 135 to 148
if (AvroVersion.getMinor() > 8) {
compiler.setGettersReturnOptional(optionalGetters);
}
if (AvroVersion.getMinor() > 9) {
compiler.setOptionalGettersForNullableFieldsOnly(optionalGetters);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't the AvroVersion.getMinor ifs also check major version?

Also I suppose maintaining this bridge class means we need to track the avro API changes with each new version to correctly pass the new parameters. Is that right?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yes. If there is a new compiler parameter, we can add it to the sbt plugin but we must make sure that if the runtime avro version does not support it, we won't call the method.

plugin/src/main/scala/com/github/sbt/avro/SbtAvro.scala Outdated Show resolved Hide resolved
@RustedBones RustedBones force-pushed the handle-multiple-versions branch 3 times, most recently from 7becea6 to 23e69a2 Compare October 18, 2024 12:17
@RustedBones RustedBones force-pushed the handle-multiple-versions branch from 23e69a2 to 51f6065 Compare October 22, 2024 13:03
@RustedBones RustedBones merged commit 19ada60 into main Oct 22, 2024
3 checks passed
@RustedBones RustedBones deleted the handle-multiple-versions branch October 22, 2024 13:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants