Skip to content

Gradle Build Plugin

Ben Fagin edited this page Mar 30, 2015 · 9 revisions

Starting with version 0.8, a Gradle build plugin is available. This allows you to define your descriptor in a separate module, and have the code generation occur on the fly with each build.

There are several components:

  • The build plugin, which reads descriptors, generates sources, and compiles them. The plugin can also write out the runtime files so that consumers of your jar do not have to include the runtime jar either as a dependency or transitive dependency.
  • The runtime, either included as a dependency ('flapi-runtime') or embedded in your output sources.

An example of this setup is included in the project. See the build-test-producer and build-test-consumer modules.

Add the plugin.

Add to your buildscript.

buildscript {

}
apply

Configure the task.

Modify the plugin configuration closure as needed.

flapi {
  includeRuntime = true
}

Run the build.

gradle build The new flapi task will be called after the Java compilation completes.

Clone this wiki locally