WIP: AVRO-4223 Gradle plugin for generating Java code#3614
WIP: AVRO-4223 Gradle plugin for generating Java code#3614frevib wants to merge 99 commits intoapache:mainfrom
Conversation
Fix Intellij not finding generated sources Add generating BigDecimal property
Add dynamic output directory
|
Avro gradle plugin Protocol support has been added in this release |
|
@raphaelauv did you test the latest release https://plugins.gradle.org/plugin/eu.eventloopsoftware.avro-gradle-plugin? No need to add |
...va/gradle-plugin/src/main/kotlin/eu/eventloopsoftware/avro/gradle/plugin/AvroGradlePlugin.kt
Outdated
Show resolved
Hide resolved
|
I have created https://issues.apache.org/jira/browse/INFRA-27616 for the requirement from Gradle to prove the ownership of avro.apache.org DNS domain. |
...va/gradle-plugin/src/main/kotlin/eu/eventloopsoftware/avro/gradle/plugin/AvroGradlePlugin.kt
Outdated
Show resolved
Hide resolved
| private fun instantiateAdditionalVelocityTools(velocityToolsClassesNames: List<String>): List<Any> { | ||
| return velocityToolsClassesNames.map { velocityToolClassName -> | ||
| try { | ||
| Class.forName(velocityToolClassName).getDeclaredConstructor().newInstance() |
There was a problem hiding this comment.
Why this uses the current class' loader ?
loadLogicalTypesFactories() and doCompile() use the thread's class loader
There was a problem hiding this comment.
I've used the same as in the Maven plugin:
and:
...c/main/kotlin/eu/eventloopsoftware/avro/gradle/plugin/extension/AvroGradlePluginExtension.kt
Outdated
Show resolved
Hide resolved
...lugin/src/main/kotlin/eu/eventloopsoftware/avro/gradle/plugin/tasks/CompileAvroSchemaTask.kt
Outdated
Show resolved
Hide resolved
...-plugin/src/main/kotlin/eu/eventloopsoftware/avro/gradle/plugin/tasks/AbstractCompileTask.kt
Outdated
Show resolved
Hide resolved
...va/gradle-plugin/src/main/kotlin/eu/eventloopsoftware/avro/gradle/plugin/AvroGradlePlugin.kt
Outdated
Show resolved
Hide resolved
| compileSchemaTask.protocolFiles.from( | ||
| project.fileTree(sourceDirectory).apply { | ||
| setIncludes(includesProtocol) | ||
| setExcludes(extension.excludes.get()) |
There was a problem hiding this comment.
We're not making a distinction between main and test includes/excludes like in the Maven plugin. If you compile for the test classpath, the same value is used from includedSchemaFiles, excludedSchemaFiles, includedProtocolFiles and excludedProtocolFiles.
It's a bit of design choice, but I thought it's a bit unnecessary to have this distinction. Thoughts?
| </execution> | ||
| <execution> | ||
| <id>run-gradle-task-publish</id> | ||
| <phase>deploy</phase> |
There was a problem hiding this comment.
We use deploy to deploy -SNAPSHOTs for the Maven artefacts.
AFAIK Gradle plugins repo does not allow -SNAPSHOTs
There was a problem hiding this comment.
Correct, the Gradle plugin portal does not support snapshots. It works different than Sonatype, where you first push and later release via the Sonatype UI. With the Gradle publish plugin when you run ./gradlew publishPlugins you'll immediately publish the plugin to the portal.
You can however publish -SNAPSHOT to the local Maven repo with ./gradlew publishToMavenLocal
What is the purpose of the change
Gradle plugin to generate Java code from Avro files
Verifying this change
This change added tests and can be verified as follows:
cd to
avro/lang/java/gradle-plugin./gradlew testDocumentation
Release
https://plugins.gradle.org/plugin/eu.eventloopsoftware.avro-gradle-plugin
0.0.2is released and fully works with AVSC files:0.0.50.0.80.1.0this release adds Protocol support.0.1.1Fix issue with Gradle multi project, where sources would not appear on the classpathInstallation instructions: https://github.com/frevib/avro/blob/AVRO-4223-gradle-plugin/lang/java/gradle-plugin/README.md#version
An official release will be done in the coming month