Gradle Object Instance

From NovaOrdis Knowledge Base
Jump to navigation Jump to search

External

Internal

DEPLETE TO

Org.gradle.api.invocation.Gradle

Overview

TaskExecutionGraph

StartParameter

https://docs.gradle.org/current/javadoc/org/gradle/StartParameter.html

The StartParameter instance provides access to parsed command line arguments:

println "contains someTask? " + gradle.startParameter.taskNames.contains('someTask')

Gradle Version

The version of the Gradle runtime executing the build can be obtained from the Gradle object:

gradle.gradleVersion

Example:

jar {
  // ...
  manifest {
    attributes (
      // ...
      'Built-With': "Gradle " + gradle.gradleVersion,
      // ..
    }
  }
}