Gradle Object Instance: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
(Created page with "=Internal= * Gradle Concepts =Overview= =TaskExecutionGraph= =StartParameter=")
 
 
(6 intermediate revisions by the same user not shown)
Line 1: Line 1:
=External=
* https://docs.gradle.org/current/dsl/org.gradle.api.invocation.Gradle.html
=Internal=
=Internal=


* [[Gradle_Concepts#The_Gradle_Object_Instance|Gradle Concepts]]
* [[Gradle_Concepts#The_Gradle_Object_Instance|Gradle Concepts]]
=DEPLETE TO=
{{Internal|Org.gradle.api.invocation.Gradle|Org.gradle.api.invocation.Gradle}}


=Overview=
=Overview=
Line 8: Line 14:


=StartParameter=
=StartParameter=
{{External|https://docs.gradle.org/current/javadoc/org/gradle/StartParameter.html}}
The StartParameter instance provides access to parsed command line arguments:
<syntaxhighlight lang='groovy'>
println "contains someTask? " + gradle.startParameter.taskNames.contains('someTask')
</syntaxhighlight>
=Gradle Version=
The version of the Gradle runtime executing the build can be obtained from the Gradle object:
<syntaxhighlight lang='groovy'>
gradle.gradleVersion
</syntaxhighlight>
Example:
<syntaxhighlight lang='groovy'>
jar {
  // ...
  manifest {
    attributes (
      // ...
      'Built-With': "Gradle " + gradle.gradleVersion,
      // ..
    }
  }
}
</syntaxhighlight>

Latest revision as of 21:59, 11 October 2020

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,
      // ..
    }
  }
}