Methods to handle gradle project.
def gradle = new Gradle(this) def info = gradle.getPackageInfo() // show current package version echo info['version'] // we need a GitHub instance to bump version def github = new org.zowe.jenkins_shared_library.scm.GitHub(this) // bump patch version on master branch gradle.version( github : github, branch : 'master', version : 'patch' )
Modifiers | Name | Description |
---|---|---|
static java.lang.String |
GRADLE_PROPERTIES |
Default file name of gradle.properties . |
Type | Name and description |
---|---|
java.util.Map |
_packageInfo Package information extracted from gradle settings. |
java.lang.Object |
steps Reference to the groovy pipeline variable. |
java.lang.String |
versionDefinitionFile File name which defined package version. |
Constructor and description |
---|
Gradle
(java.lang.Object steps) Constructs the class. |
Type Params | Return Type | Name and description |
---|---|---|
|
java.lang.Boolean |
_isVersionDefinedInGradleProperties() This checks if version entry is defined in versionDefinitionFile. |
|
void |
_updateVersion(java.lang.String version) Update version in versionDefinitionFile. |
|
void |
bootstrap() Bootstrap gradle. |
|
void |
clearPackageInfoCache() Reset package info cache |
|
java.util.Map |
getPackageInfo() Get current package information from gradle settings. |
|
void |
init(java.util.Map args = [:]) Initialize gradle project properties. |
|
void |
version(java.util.Map args = [:]) Declare a new version of gradle project. |
|
void |
version(org.zowe.jenkins_shared_library.scm.GitHub github, java.lang.String branch, java.lang.String version = 'PATCH') Declare a new version of gradle project |
Methods inherited from class | Name |
---|---|
class java.lang.Object |
java.lang.Object#wait(long, int), java.lang.Object#wait(long), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll() |
Default file name of gradle.properties
.
Package information extracted from gradle settings.
Reference to the groovy pipeline variable.
File name which defined package version.
Constructs the class.
When invoking from a Jenkins pipeline script, the Pipeline must be passed the current environment of the Jenkinsfile to have access to the steps.
def gradle = new Gradle(this)
steps
- The workflow steps object provided by the Jenkins pipelineThis checks if version entry is defined in versionDefinitionFile.
Update version in versionDefinitionFile.
version
- new semantic version string. For example, "1.2.3"
.Bootstrap gradle.
Usually the bootstrap is for downloading gradle/wrapper/gradle-wrapper.jar
to
local, so we don't need to upload the gradle-wrapper.jar
into GitHub repository.
Reset package info cache
Get current package information from gradle settings.
Expected keys in the result Map:
name
- name of the package. For example, "explorer-jobs"
.version
- version of the package. For example, "1.2.3"
.versionTrunks
- Map version trunks returned from Utils.parseSemanticVersion.group
- group name of the package if defined. For example, "org.zowe.explorer.jobs"
.description
- description of the package if defined. For example, "An API to handle z/OS jobs."
.scripts
- List of tasks of the package defined. For example, ["build", "buildDir", "class", "assemble", "release", ...]
.Initialize gradle project properties.
args
Map.versionDefinitionFile
- file where defines version
of the project.Declare a new version of gradle project.
def github = new org.zowe.jenkins_shared_library.scm.GitHub(this) // bump patch version on master branch gradle.version( github : github, branch : 'master', version : 'patch' ) // After this, you should be able to see your repository master branch has a commit of // version bump.
github
- GitHub instance must have been initialized with repository, credential, etcbranch
- which branch to perform the releaseversion
- what kind of version bump we should makeDeclare a new version of gradle project
Groovy Documentation