From a2aa9b15393c64ca09cef242fcacbb6ccdd9082b Mon Sep 17 00:00:00 2001 From: Ivica Loncar Date: Tue, 23 Apr 2019 19:00:40 +0200 Subject: [PATCH] GH-97 Add an example how to invoke plugin from gradle --- README.md | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/README.md b/README.md index bd22144..3b63754 100644 --- a/README.md +++ b/README.md @@ -103,6 +103,36 @@ GenJavadoc can also be integrated into a Maven build (inspired by [this answer o ~~~ +You can integrate genjavadoc with gradle build: + +~~~ groovy +apply plugin: 'scala' + +configurations { + scalaCompilerPlugin +} + +dependencies { + // ... + scalaCompilerPlugin "com.typesafe.genjavadoc:genjavadoc-plugin_${scalaFullVersion}:0.13" + +} + +tasks.withType(ScalaCompile) { + scalaCompileOptions.with { + additionalParameters = [ + "-Xplugin:" + configurations.scalaCompilerPlugin.asPath, + "-P:genjavadoc:out=$buildDir/generated/java".toString() + ] + } +} + +tasks.withType(Javadoc) { + dependsOn("compileScala") + source = [sourceSets.main.allJava, "$buildDir/generated/java"] +} +~~~ + ### Translation of Scaladoc comments Comments found within the Scala sources are transferred to the corresponding Java sources including some modifications. These are necessary since Scaladoc supports different mark-up elements than Javadoc. The modifications are: