Class GherkinToAsciidocPlugin

java.lang.Object
com.arc_e_tect.gradle.gherkin.GherkinToAsciidocPlugin
All Implemented Interfaces:
org.gradle.api.Plugin<org.gradle.api.Project>

public class GherkinToAsciidocPlugin extends Object implements org.gradle.api.Plugin<org.gradle.api.Project>
Gradle plugin that registers the generateFeatureDocs task and wires the gherkinToAsciidoc DSL extension into the project.

Usage

 plugins {
     id 'com.arc-e-tect.gherkin-to-asciidoc'
 }

 gherkinToAsciidoc {
     sourceDirs.from(layout.projectDirectory.dir('src/test/resources/features'))
 }
 

Defaults

  • Source directory: src/test/resources/features
  • Include sub-directories: true
  • Group scenarios by feature: true
  • Output directory: build/generated-docs
  • Output file name: features.adoc
  • Indexing: off

Multi-project builds

When applied to more than one project in the same build (typically via allprojects { apply plugin: ... } ), every project gets its own generateFeatureDocs task and its own generated report. Every DSL property defaults to the value configured on the root project's own gherkinToAsciidoc extension; a sub-project that configures a property itself overrides that inherited default for that property only - except for outputDir and snippetDir (see below).

sourceDirs, sourceFile, and glueCodeDirs cascade too, but not verbatim: when a sub-project configures neither its own sourceDirs nor sourceFile, any of the root project's directories/file that live inside the root project's own directory are re-resolved against the sub-project's directory instead - so a standard layout (e.g. every module keeping its features under src/test/resources/features) only needs to be declared once, at the root, following "convention over configuration". A root-configured path that points outside the root project's own directory (e.g. a directory shared by every module) is used as-is, unchanged, by every sub-project that inherits it.

outputDir and snippetDir are the one exception that never inherits from the root project: each project always defaults to a location under its own build directory, regardless of what the root project configures, so that every project's report lands in its own build output rather than colliding with another project's. Set these explicitly on a specific project to relocate that project's report.

Overriding indexing from the command line

The -PgherkinToAsciidoc.indexing=&lt;value&gt; project property overrides indexing for every project in the build, regardless of what any project's own gherkinToAsciidoc { } block configures - typically set to ci in a CI pipeline so generateFeatureDocs never mutates source .feature files there, without having to change the build script itself.

  • Field Details

  • Constructor Details

    • GherkinToAsciidocPlugin

      public GherkinToAsciidocPlugin()
      Creates a new plugin instance. Instantiated by Gradle infrastructure.
  • Method Details

    • apply

      public void apply(org.gradle.api.Project project)
      Specified by:
      apply in interface org.gradle.api.Plugin<org.gradle.api.Project>