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
  • Force rewrite: false
  • Track progress history: false
  • Progress history file: gherkin-progress-history.ndjson (project directory)
  • Update progress history: same as track progress history

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, snippetDir, and progressHistoryFile (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, snippetDir, and progressHistoryFile are the exceptions that never inherit from the root project: each project always defaults to a location under its own directory, regardless of what the root project configures, so that every project's report/history lands in its own location rather than colliding with another project's. Set these explicitly on a specific project to relocate that project's report/history file.

Overriding indexing/forceRewrite/updateProgressHistory from the command line

The -PgherkinToAsciidoc.indexing=&lt;value&gt;, -PgherkinToAsciidoc.forceRewrite=&lt;true|false&gt;, and -PgherkinToAsciidoc.updateProgressHistory=&lt;true|false&gt; project properties each override their respective DSL property for every project in the build, regardless of what any project's own gherkinToAsciidoc { } block configures - indexing typically set to ci in a CI pipeline so generateFeatureDocs never mutates source .feature files there, and updateProgressHistory typically set to true only for the branch(es) whose CI pipeline should advance the committed progress history file, without having to change the build script itself for either.

  • 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>