From 41ebda2ab779d76aa2f506d0ead1594207f1cffe Mon Sep 17 00:00:00 2001 From: Dennis Fricke Date: Sat, 26 Aug 2023 17:13:27 +0200 Subject: [PATCH] added language switch to code blocks --- documentation/build.gradle | 8 ++ documentation/src/docs/asciidoc/_aspectj.adoc | 73 +++++++++---- .../src/docs/asciidoc/_compress.adoc | 70 ++++++++---- .../src/docs/asciidoc/_embedded-sass.adoc | 17 ++- documentation/src/docs/asciidoc/_github.adoc | 8 +- documentation/src/docs/asciidoc/_jacoco.adoc | 11 +- documentation/src/docs/asciidoc/_lombok.adoc | 20 +++- documentation/src/docs/asciidoc/_maven.adoc | 103 ++++++++++++++++-- documentation/src/docs/asciidoc/_mjml.adoc | 9 +- documentation/src/docs/asciidoc/_okhttp.adoc | 33 ++++-- .../src/docs/asciidoc/_plantuml.adoc | 24 +++- examples/mjml/build.gradle.kts | 2 +- 12 files changed, 291 insertions(+), 87 deletions(-) diff --git a/documentation/build.gradle b/documentation/build.gradle index 58785645..4a49cf7e 100644 --- a/documentation/build.gradle +++ b/documentation/build.gradle @@ -4,11 +4,17 @@ plugins { id 'io.freefair.javadoc-links' } +configurations { + asciidoctorExt +} + asciidoctor { baseDirFollowsSourceDir() attributes gradle_version: gradle.gradleVersion + configurations 'asciidoctorExt' + inputs.dir("src/docs/asciidoc") } @@ -22,6 +28,8 @@ dependencies { javadocClasspath "org.jacoco:org.jacoco.ant:${org.gradle.testing.jacoco.plugins.JacocoPlugin.DEFAULT_JACOCO_VERSION}" javadocClasspath "org.apache.maven.plugins:maven-plugin-plugin:3.9.0" javadocClasspath 'net.sourceforge.plantuml:plantuml:1.2023.10' + + asciidoctorExt "io.spring.asciidoctor:spring-asciidoctor-extensions-block-switch:0.6.2" } tasks.register("docsZip", Zip) { diff --git a/documentation/src/docs/asciidoc/_aspectj.adoc b/documentation/src/docs/asciidoc/_aspectj.adoc index 3676b45b..064348c1 100644 --- a/documentation/src/docs/asciidoc/_aspectj.adoc +++ b/documentation/src/docs/asciidoc/_aspectj.adoc @@ -33,59 +33,67 @@ This plugin adds AspectJ support to the project, by adding a `aspectj` directory Source contained in the `src/main/aspectj` directory will be compiled with `ajc` by the `compileAspectj` task. -[source,groovy] +==== +[source, groovy, role="primary"] +.Groovy ---- dependencies { implementation "org.aspectj:aspectjrt:1.9.8.RC3" } ---- - -[source,kotlin] +[source, kotlin, role="secondary"] +.Kotlin ---- dependencies { implementation("org.aspectj:aspectjrt:1.9.8.RC3") } ---- +==== TIP: This is follows the same principles as the `groovy` and `scala` plugins. Additional advices (the `-aspectpath`) can be declared as dependencies of the `aspect` configuration: -[source,groovy] +==== +[source, groovy, role="primary"] +.Groovy ---- dependencies { aspect project(":my-aspect") testAspect "com.example.foo:bar-aspect:1.0.0" } ---- - -[source,kotlin] +[source, kotlin, role="secondary"] +.Kotlin ---- dependencies { aspect(project(":my-aspect")) testAspect("com.example.foo:bar-aspect:1.0.0") } ---- - +==== Additional jars/classes which should be woven and added to the output as well (the `-inpath`) can be declared as dependencies fo the `inpath` configuration: -[source,groovy] +==== +[source, groovy, role="primary"] +.Groovy ---- dependencies { inpath project(":my-lib") testInpath "com.example.foo:bar-lib:1.0.0" } ---- - -[source,kotlin] +[source, kotlin, role="secondary"] +.Kotlin ---- dependencies { inpath(project(":my-lib")) testInpath("com.example.foo:bar-lib:1.0.0") } ---- +==== === `io.freefair.aspectj.post-compile-weaving` @@ -94,54 +102,65 @@ with an additional `ajc` action in order to perform post-compile-weaving. The output of the compilation (`javac`, etc.) becomes the `-inpath` for `ajc`. -[source,groovy] +==== +[source, groovy, role="primary"] +.Groovy ---- dependencies { implementation "org.aspectj:aspectjrt:1.9.8.RC3" } ---- -[source,kotlin] +[source, kotlin, role="secondary"] +.Kotlin ---- dependencies { implementation("org.aspectj:aspectjrt:1.9.8.RC3") } ---- +==== Additional advices (the `-aspectpath`) can be declared as dependencies of the `aspect` configuration: -[source,groovy] +==== +[source, groovy, role="primary"] +.Groovy ---- dependencies { aspect project(":my-aspect") testAspect "com.example.foo:bar-aspect:1.0.0" } ---- -[source,kotlin] +[source, kotlin, role="secondary"] +.Kotlin ---- dependencies { aspect(project(":my-aspect")) testAspect("com.example.foo:bar-aspect:1.0.0") } ---- +==== Additional jars/classes which should be woven and added to the output as well (the `-inpath`) can be declared as dependencies fo the `inpath` configuration: -[source,groovy] +==== +[source, groovy, role="primary"] +.Groovy ---- dependencies { inpath project(":my-lib") testInpath "com.example.foo:bar-lib:1.0.0" } ---- - -[source,kotlin] +[source, kotlin, role="secondary"] +.Kotlin ---- dependencies { inpath(project(":my-lib")) testInpath("com.example.foo:bar-lib:1.0.0") } ---- +==== The `-classpath`, `-source` and `-target` arguments of `ajc` are set automatically to the corresponding values taken from the compile task. @@ -149,7 +168,9 @@ Additional `ajc` arguments can be configured using the `ajc.options.compilerArgs The following things are configurable: -[source,groovy] +==== +[source, groovy, role="primary"] +.Groovy ---- compileJava { ajc { @@ -172,8 +193,8 @@ compileTestJava { } } ---- - -[source,kotlin] +[source, kotlin, role="secondary"] +.Kotlin ---- tasks.compileJava { configure { @@ -196,6 +217,7 @@ tasks.compileTestJava { } } ---- +==== <1> Specifies if ajc should run at all. Defaults to `true` <2> The classpath containing ajc itself (`aspectjtools.jar`). Inferred from the compile/runtime classpaths by default. <3> The classpath containing additional advices to weave. This directly maps to the `-aspectpath` argument of ajc. @@ -212,7 +234,9 @@ https://docs.gradle.org/{gradle_version}/javadoc/org/gradle/api/tasks/compile/Ab task can be used to run https://www.eclipse.org/aspectj/doc/released/devguide/ajc-ref.html[`ajc`]. -[source,groovy] +==== +[source, groovy, role="primary"] +.Groovy ---- task myAjcTask(type: io.freefair.gradle.plugins.aspectj.AspectjCompile) { aspectjClasspath.setFrom configurations.aspectj @@ -222,8 +246,8 @@ task myAjcTask(type: io.freefair.gradle.plugins.aspectj.AspectjCompile) { } } ---- - -[source,kotlin] +[source, kotlin, role="secondary"] +.Kotlin ---- tasks.register("myAjcTask") { aspectjClasspath.setFrom(configurations.aspectj) @@ -232,4 +256,5 @@ tasks.register("myAjcTask") { aspectpath = files() } } ----- \ No newline at end of file +---- +==== \ No newline at end of file diff --git a/documentation/src/docs/asciidoc/_compress.adoc b/documentation/src/docs/asciidoc/_compress.adoc index 85d16107..3ff38c15 100644 --- a/documentation/src/docs/asciidoc/_compress.adoc +++ b/documentation/src/docs/asciidoc/_compress.adoc @@ -44,18 +44,22 @@ https://docs.gradle.org/current/dsl/org.gradle.api.Project.html#org.gradle.api.P methods which are described https://docs.gradle.org/current/userguide/working_with_files.html#sec:unpacking_archives_example[here] .Example -[source,groovy] +==== +[source, groovy, role="primary"] +.Groovy ---- task example(type: Sync) { from commonsCompress.arTree(file("foo.ar")) } ---- -[source,kotlin] +[source, kotlin, role="secondary"] +.Kotlin ---- tasks.register("example") { from(commonsCompress.arTree(file("foo.ar"))) } ---- +==== === `io.freefair.compress.ar` @@ -78,7 +82,9 @@ This https://docs.gradle.org/current/dsl/org.gradle.api.tasks.bundling.AbstractArchiveTask.html[`AbstractArchiveTask`] implementation can be used to create `ar` archives. -[source, groovy] +==== +[source, groovy, role="primary"] +.Groovy ---- task packageArArchive(type: io.freefair.gradle.plugins.compress.tasks.Ar) { archiveFileName = "my-distribution.ar" @@ -89,7 +95,8 @@ task packageArArchive(type: io.freefair.gradle.plugins.compress.tasks.Ar) { longFileMode = org.apache.commons.compress.archivers.ar.ArArchiveOutputStream.LONGFILE_ERROR } ---- -[source, kotlin] +[source, kotlin, role="secondary"] +.Kotlin ---- tasks.register("packageArArchive") { archiveFileName = "my-distribution.ar" @@ -100,13 +107,16 @@ tasks.register("packageArArchive") longFileMode = org.apache.commons.compress.archivers.ar.ArArchiveOutputStream.LONGFILE_ERROR } ---- +==== [#BZip2] === `BZip2` This task can be used to compress individual files using BZip2. -[source, groovy] +==== +[source, groovy, role="primary"] +.Groovy ---- task compressBZip2(type: io.freefair.gradle.plugins.compress.tasks.BZip2) { source "src/main/resources" @@ -114,7 +124,8 @@ task compressBZip2(type: io.freefair.gradle.plugins.compress.tasks.BZip2) { fileExtension = "bz2" } ---- -[source, kotlin] +[source, kotlin, role="secondary"] +.Kotlin ---- tasks.register("compressBZip2") { source("src/main/resources") @@ -122,6 +133,7 @@ tasks.register("compressBZip2") fileExtension = "bz2" } ---- +==== [#Cpio] @@ -131,7 +143,9 @@ This https://docs.gradle.org/current/dsl/org.gradle.api.tasks.bundling.AbstractArchiveTask.html[`AbstractArchiveTask`] implementation can be used to create `cpio` archives. -[source, groovy] +==== +[source, groovy, role="primary"] +.Groovy ---- task packageCpioArchive(type: io.freefair.gradle.plugins.compress.tasks.Cpio) { archiveFileName = "my-distribution.cpio" @@ -145,7 +159,8 @@ task packageCpioArchive(type: io.freefair.gradle.plugins.compress.tasks.Cpio) { } ---- -[source, kotlin] +[source, kotlin, role="secondary"] +.Kotlin ---- tasks.register("packageCpioArchive") { archiveFileName = "my-distribution.cpio" @@ -158,13 +173,16 @@ tasks.register("packageCpioArchi encoding = "US-ASCII" } ---- +==== [#Deflate] === `Deflate` This task can be used to compress individual files using the zlib deflate algorithm. -[source, groovy] +==== +[source, groovy, role="primary"] +.Groovy ---- task compressDeflate(type: io.freefair.gradle.plugins.compress.tasks.Deflate) { source "src/main/resources" @@ -175,8 +193,8 @@ task compressDeflate(type: io.freefair.gradle.plugins.compress.tasks.Deflate) { withZlibHeader = false } ---- - -[source, kotlin] +[source, kotlin, role="secondary"] +.Kotlin ---- tasks.register("compressDeflate") { source("src/main/resources") @@ -187,13 +205,16 @@ tasks.register("compressDefla withZlibHeader = false } ---- +==== [#GZip] === `GZip` This task can be used to compress individual files using BZip2. -[source, groovy] +==== +[source, groovy, role="primary"] +.Groovy ---- task compressGZip(type: io.freefair.gradle.plugins.compress.tasks.GZip) { source "src/main/resources" @@ -205,8 +226,8 @@ task compressGZip(type: io.freefair.gradle.plugins.compress.tasks.GZip) { addFilename = false } ---- - -[source, kotlin] +[source, kotlin, role="secondary"] +.Kotlin ---- tasks.register("compressGZip") { source("src/main/resources") @@ -218,13 +239,16 @@ tasks.register("compressGZip") { addFilename = false } ---- +==== [#LZMA] === `LZMA` This task can be used to compress individual files using LZMA. -[source, groovy] +==== +[source, groovy, role="primary"] +.Groovy ---- task compressLZMA(type: io.freefair.gradle.plugins.compress.tasks.LZMA) { source "src/main/resources" @@ -232,8 +256,8 @@ task compressLZMA(type: io.freefair.gradle.plugins.compress.tasks.LZMA) { fileExtension = "lzma" } ---- - -[source, kotlin] +[source, kotlin, role="secondary"] +.Kotlin ---- tasks.register("compressLZMA") { source("src/main/resources") @@ -241,6 +265,7 @@ tasks.register("compressLZMA") { fileExtension = "lzma" } ---- +==== [#SevenZip] === `SevenZip` @@ -249,7 +274,9 @@ This https://docs.gradle.org/current/dsl/org.gradle.api.tasks.bundling.AbstractArchiveTask.html[`AbstractArchiveTask`] implementation can be used to create `7z` archives. -[source, groovy] +==== +[source, groovy, role="primary"] +.Groovy ---- task packageSevenZipArchive(type: io.freefair.gradle.plugins.compress.tasks.SevenZip) { archiveFileName = "my-distribution.7z" @@ -260,8 +287,8 @@ task packageSevenZipArchive(type: io.freefair.gradle.plugins.compress.tasks.Seve contentCompression = org.apache.commons.compress.archivers.sevenz.SevenZMethod.LZMA2 } ---- - -[source, kotlin] +[source, kotlin, role="secondary"] +.Kotlin ---- tasks.register("packageSevenZipArchive") { archiveFileName = "my-distribution.7z" @@ -271,4 +298,5 @@ tasks.register("packageSeven contentCompression = org.apache.commons.compress.archivers.sevenz.SevenZMethod.LZMA2 } ----- \ No newline at end of file +---- +==== \ No newline at end of file diff --git a/documentation/src/docs/asciidoc/_embedded-sass.adoc b/documentation/src/docs/asciidoc/_embedded-sass.adoc index 0c13aaac..12736054 100644 --- a/documentation/src/docs/asciidoc/_embedded-sass.adoc +++ b/documentation/src/docs/asciidoc/_embedded-sass.adoc @@ -12,7 +12,9 @@ This chapter describes all the plugins contained in the `embedded-sass-plugin` m This plugin adds the `sass` extension to the project and applies it to all `SassCompile` tasks. -[source,groovy] +==== +[source, groovy, role="primary"] +.Groovy ---- sass { omitSourceMapUrl = false @@ -22,7 +24,8 @@ sass { sourceMapEnabled = true } ---- -[source,kotlin] +[source, kotlin, role="secondary"] +.Kotlin ---- sass { omitSourceMapUrl = false @@ -32,24 +35,28 @@ sass { sourceMapEnabled = true } ---- +==== === `io.freefair.sass-webjars` This plugin adds webjars support to the sass compilation: -[source,groovy] +==== +[source, groovy, role="primary"] +.Groovy ---- dependencies { implementation 'org.webjars:bootstrap:5.1.3' } ---- - -[source,kotlin] +[source, kotlin, role="secondary"] +.Kotlin ---- dependencies { implementation("org.webjars:bootstrap:5.1.3") } ---- +==== [source,scss] ---- diff --git a/documentation/src/docs/asciidoc/_github.adoc b/documentation/src/docs/asciidoc/_github.adoc index df964da6..5950d220 100644 --- a/documentation/src/docs/asciidoc/_github.adoc +++ b/documentation/src/docs/asciidoc/_github.adoc @@ -10,7 +10,9 @@ Common base plugin which is applied by the other plugins in this module. It adds the `github` extension to the project: .Configuration options of the `github` extension -[source, groovy] +==== +[source, groovy, role="primary"] +.Groovy ---- github { slug = "freefair" //<1> @@ -20,7 +22,8 @@ github { travis = true //<5> } ---- -[source, kotlin] +[source, kotlin, role="secondary"] +.Kotlin ---- github { slug = "freefair" //<1> @@ -30,6 +33,7 @@ github { travis = true //<5> } ---- +==== <1> The `owner/name` identifier of the GitHub repository. This is auto-detected using the configured git remotes. <2> The username which should be used when accessing the GitHub API. diff --git a/documentation/src/docs/asciidoc/_jacoco.adoc b/documentation/src/docs/asciidoc/_jacoco.adoc index bc654f91..388218f8 100644 --- a/documentation/src/docs/asciidoc/_jacoco.adoc +++ b/documentation/src/docs/asciidoc/_jacoco.adoc @@ -24,7 +24,9 @@ link:../api/io/freefair/gradle/plugins/jacoco/tasks/JacocoDump.html[`io.freefair task is the Gradle equivalent of the https://www.jacoco.org/jacoco/trunk/doc/ant.html#dump[`dump` Ant-Task] .JacocoDump Example -[source, groovy] +==== +[source, groovy, role="primary"] +.Groovy ---- task dump(type: io.freefair.gradle.plugins.jacoco.tasks.JacocoDump) { address = "localhost" @@ -36,8 +38,8 @@ task dump(type: io.freefair.gradle.plugins.jacoco.tasks.JacocoDump) { append = true } ---- - -[source, kotlin] +[source, kotlin, role="secondary"] +.Kotlin ---- tasks.register("dump") { address = "localhost" @@ -48,4 +50,5 @@ tasks.register("dump") { destfile = file("build/dump.exec") append = true } ----- \ No newline at end of file +---- +==== \ No newline at end of file diff --git a/documentation/src/docs/asciidoc/_lombok.adoc b/documentation/src/docs/asciidoc/_lombok.adoc index 623171c0..8e78fdf3 100644 --- a/documentation/src/docs/asciidoc/_lombok.adoc +++ b/documentation/src/docs/asciidoc/_lombok.adoc @@ -16,12 +16,22 @@ It also configures all Lombok related tasks to use the `lombok` configuration. The used Lombok version can be customized using the `lombok` extension: .Setting a custom Lombok version -[source,groovy] +==== +[source, groovy, role="primary"] +.Groovy ---- lombok { version = "1.18.28" } ---- +[source, groovy, role="secondary"] +.Kotlin +---- +lombok { + version = "1.18.28" +} +---- +==== === `io.freefair.lombok` @@ -38,14 +48,16 @@ This plugin simplifies the use of https://projectlombok.org/[Lombok] in Gradle b Only the default `javadoc` https://docs.gradle.org/{gradle_version}/dsl/org.gradle.api.tasks.javadoc.Javadoc.html[Javadoc] task will be modified to work on the delombok-ed sources. If you create your own custom https://docs.gradle.org/{gradle_version}/dsl/org.gradle.api.tasks.javadoc.Javadoc.html[Javadoc] tasks, it's up to you to assign the correct `source`. The `delombok` task created by this plugin can be used as source for the javadoc task: -[source,groovy] + +[source, groovy, role="primary"] +.Groovy ---- task myJavadocs(type: Javadoc) { source = delombok } ---- - -[source,kotlin] +[source, kotlin, role="secondary"] +.Kotlin ---- tasks.register("myJavadocs") { source = tasks.named("delombok") diff --git a/documentation/src/docs/asciidoc/_maven.adoc b/documentation/src/docs/asciidoc/_maven.adoc index 96b6f01f..d29ca83f 100644 --- a/documentation/src/docs/asciidoc/_maven.adoc +++ b/documentation/src/docs/asciidoc/_maven.adoc @@ -23,7 +23,9 @@ to Gradle. The overlays can be configured using the `overlays` property, which is added to every `War` task. -[source,groovy] +==== +[source, groovy, role="primary"] +.Groovy ---- war { overlays { @@ -44,6 +46,28 @@ war { } } ---- +[source, groovy, role="secondary"] +.Kotlin +---- +tasks.withType { + val extension: NamedDomainObjectContainer = extensions["overlays"] as NamedDomainObjectContainer + extension.create("foo") { + from("com.example:some-war:1.2.3@war") //<1> + enabled = true //<2> + into("sub-path/foo") //<3> + enableCompilation = true //<4> + provided(false) //<5> + } + extension.create("bar") { + from(project(":some-other-war")) //<1> + skip = false //<2> + targetPath = "sub-path/bar" //<3> + include("*.html") + includes = ["*.html", "**/*.xml"] + } +} +---- +==== <1> The source of the overlay. This can be another project, a File instance or a dependency notation. <2> Whether the overlay is enabled or should be skipped. <3> The target relative path in the webapp structure. By default, the content of the overlay is added in the root structure of the webapp. @@ -64,13 +88,27 @@ feature of the https://maven.apache.org/plugins/maven-war-plugin/index.html[Maven War Plugin] to Gradle. -[source,groovy] +==== +[source, groovy, role="primary"] +.Groovy ---- war { attachClasses.set(true) //<1> classesClassifier.set('classes') //<2> } ---- +[source, kotlin, role="secondary"] +.Kotlin +---- +war { + val attachClasses = extensions["attachClasses"] as Property + val classesClassifier = extensions["classesClassifier"] as Property + attachClasses.set(true) //<1> + classesClassifier.set("classes") //<2> +} +---- + +==== <1> Whether classes (that is the content of the WEB-INF/classes directory) should be attached to the project as an additional artifact. <2> The classifier to use for the attached classes artifact. @@ -82,12 +120,23 @@ feature of the https://maven.apache.org/plugins/maven-war-plugin/index.html[Maven War Plugin] to Gradle. -[source,groovy] +==== +[source, groovy, role="primary"] +.Groovy ---- war { archiveClasses.set(true) //<1> } ---- +[source, kotlin, role="secondary"] +.Kotlin +---- +war { + val archiveClasses = extensions["archiveClasses"] as Property + archiveClasses.set(true) //<1> +} +---- +==== <1> Whether a JAR file will be created for the classes in the webapp. Using this optional configuration parameter will make the compiled classes to be archived into a JAR file and the classes directory will then be excluded from the webapp. === `io.freefair.aggregate-javadoc` @@ -99,7 +148,9 @@ This plugin is designed to be used in multi-module Gradle builds. It can either The projects which sources should be included into the aggregated javadocs have to be added as dependencies to the `javadoc` configuration: -[source,groovy] +==== +[source, groovy, role="primary"] +.Groovy ---- dependencies { // Option 1: List projects explicitly @@ -114,6 +165,23 @@ dependencies { } } ---- +[source, kotlin, role="secondary"] +.Kotlin +---- +dependencies { + // Option 1: List projects explicitly + javadoc(project(":moduleA")) + javadoc(project(":moduleB")) + + //Option 2: Add all java projects automatically + rootProject.subprojects.forEach { subproject -> + subproject.plugins.withId("java") { + javadoc(subproject) + } + } +} +---- +==== === `io.freefair.aggregate-javadoc-legacy` @@ -157,12 +225,22 @@ This plugin applies the `maven-publish` and `war` plugins and configures a `mave This plugin adds a Maven-like `optional` configuration to the project. -[source,groovy] +==== +[source, groovy, role="primary"] +.Groovy ---- dependencies { optional "com.example:foo-bar:1.0.0" } ---- +[source, kotlin, role="secondary"] +.Kotlin +---- +dependencies { + optional("com.example:foo-bar:1.0.0") +} +---- +==== === `io.freefair.maven-central.validate-poms` @@ -177,12 +255,21 @@ task. This task validates, that a given pom file contains all the information required by maven central. -[source,groovy] +==== +[source, groovy, role="primary"] +.Groovy ---- task validateMyPom(type: io.freefair.gradle.plugins.maven.central.ValidateMavenPom) { pomFile = file("path/to/my/pom.xml") ignoreFailures = false } ---- - - +[source, kotlin, role="secondary"] +.Kotlin +---- +tasks.register("validateMyPom") { + pomFile = file("path/to/my/pom.xml") + ignoreFailures = false +} +---- +==== diff --git a/documentation/src/docs/asciidoc/_mjml.adoc b/documentation/src/docs/asciidoc/_mjml.adoc index fe60b8e0..429c8789 100644 --- a/documentation/src/docs/asciidoc/_mjml.adoc +++ b/documentation/src/docs/asciidoc/_mjml.adoc @@ -12,7 +12,9 @@ This chapter describes all the plugins contained in the `mjml-plugin` module. This plugin adds the `mjml` extension to the project and create some basic tasks to install mjml via npm. -[source,groovy] +==== +[source, groovy, role="primary"] +.Groovy ---- mjml { validationMode = ValidationMode.strict @@ -23,8 +25,8 @@ mjml { juicePreserveTags = "{\"myTag\": { \"start\": \"<#\", \"end\": \"("myDownload") { url = "https://example.com/foo.txt" outputFile = file("build/foo.txt") } ---- +==== NOTE: See also <> === `UploadFile` -[source,groovy] +==== +[source, groovy, role="primary"] +.Groovy ---- tasks.register("myUpload", io.freefair.gradle.plugins.okhttp.tasks.UploadFile) { url = "https://example.com/foo.txt" @@ -79,7 +92,8 @@ tasks.register("myUpload", io.freefair.gradle.plugins.okhttp.tasks.UploadFile) { contentType = "text/plain" } ---- -[source,kotlin] +[source, kotlin, role="secondary"] +.Kotlin ---- tasks.register("myUpload") { url = "https://example.com/foo.txt" @@ -87,5 +101,6 @@ tasks.register("myUpload") { contentType = "text/plain" } ---- +==== NOTE: See also <> diff --git a/documentation/src/docs/asciidoc/_plantuml.adoc b/documentation/src/docs/asciidoc/_plantuml.adoc index a2477f61..15d7fce4 100644 --- a/documentation/src/docs/asciidoc/_plantuml.adoc +++ b/documentation/src/docs/asciidoc/_plantuml.adoc @@ -4,18 +4,22 @@ This plugin generates images from plantuml files. == Basic usage -[source,groovy] +==== +[source, groovy, role="primary"] +.Groovy ---- plugins { id "io.freefair.plantuml" } ---- -[source,kotlin] +[source, kotlin, role="secondary"] +.Kotlin ---- plugins { id("io.freefair.plantuml") } ---- +==== This adds a PlantUML task to gradle as well as a new source set. The images will be saved to the build directory. == Configuration options @@ -37,24 +41,30 @@ This adds a PlantUML task to gradle as well as a new source set. The images will |=== === Configure -[source,groovy] +==== +[source, groovy, role="primary"] +.Groovy ---- plantUml { fileFormat = "PNG" outputDirectory = layout.buildDirectory.dir("dist") } ---- -[source,kotlin] +[source, kotlin, role="secondary"] +.Kotlin ---- tasks.plantUml { fileFormat = "PNG" outputDirectory = layout.buildDirectory.dir("dist") } ---- +==== == Custom Task -[source,groovy] +==== +[source, groovy, role="primary"] +.Groovy ---- tasks.register("plantUml2", PlantumlTask) { source("src/plantuml2") @@ -63,7 +73,8 @@ tasks.register("plantUml2", PlantumlTask) { outputDirectory = layout.buildDirectory.dir("dist2") } ---- -[source,kotlin] +[source, kotlin, role="secondary"] +.Kotlin ---- tasks.register("plantUml2") { source("src/plantuml2") @@ -72,3 +83,4 @@ tasks.register("plantUml2") { outputDirectory = layout.buildDirectory.dir("dist2") } ---- +==== \ No newline at end of file diff --git a/examples/mjml/build.gradle.kts b/examples/mjml/build.gradle.kts index 11e411aa..dea2da5c 100644 --- a/examples/mjml/build.gradle.kts +++ b/examples/mjml/build.gradle.kts @@ -12,4 +12,4 @@ mjml { minifyOptions = "{\"minifyCSS\": true, \"removeEmptyAttributes\": false}" juiceOptions = "{\"preserveImportant\": true}" juicePreserveTags = "{\"myTag\": { \"start\": \"<#\", \"end\": \"