This project is a Gradle plugin that provides useful tasks for implement a Continuous Integration process for SalesForce projects.
Here you can find the enought required information to have running a Gradle project with Enforce.
1.Create build.gradle file on your source code project, below you have an example:
buildscript {
repositories {
mavenCentral()
jcenter()
}
dependencies {
classpath 'org.fundacionjala.gradle.plugins.enforce:enforce-gradle-plugin:1.1.4'
}
}
apply plugin: 'enforce'
enforce {
srcPath = 'src'
}
2.Register a Salesforce credential to be used
$ gradle addCredential -Pid=default
-Pusername=<USER NAME>
-Ppassword=<PASSWORD>
-Ptoken=<SECURITY TOKEN>
In this step is recomendable put credential id as default value, to run the EnForce tasks without using credentialId parameter.
Executing a task without credentialId parameter:
$ gradle <TASK NAME>
It uses the default credential.
Executing a task with credentialId parameter:
$ gradle <TASK NAME> -PcredentialId=<CREDENTIAL ID>
This credential will be saved in credentials.dat file located in user HOME directory.
3.Start executing available commands, for example, deploy all classes from your local repository to your organization.
$ gradle deploy
Now you can start using all the Enforce features.
- These reports are generated on
{PROJECT_FOLDER}/build/report/
after executegradle runTest
command. - They are able to be integration with Jenkins enviroments
Configuration
- Select your job.
- Go to
Configure
->Add post-build action
- Select
Publish JUnit test result report
option
Preview
- Summary, contains charts with the coverage and test results.
- Unit Test, contains unit test execution results and also it has options to filter its results.
- Coverage, contains a list of all classes categorized by coverage status(Danger, Risk, Acceptable, Safe) and also it is possible to review the covered and uncovered lines by file(click on file name).
Configuration
- Select your job.
- Go to
Configure
->Add post-build action
- Select
Publish HTML reports
option
- Java JDK or JRE, version 7 or higher.
- Gradle version 2.0 or higher.
- Internet access (configure Gradle if you are using a Proxy).
If you are using gradle version higher than 2.4 use:
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.2'
If you are using gradle version less than 2.4 use:
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.1'
To gradle 2.0 version
dependencies {
compile 'org.codehaus.groovy:groovy-all:2.3.2'
testCompile 'org.spockframework:spock-core:0.7-groovy-2.0'
}
or
dependencies {
compile 'org.codehaus.groovy:groovy-all:2.3.4'
testCompile 'org.spockframework:spock-core:0.7-groovy-2.0'
}
To gradle 2.1 and 2.2 versions
dependencies {
compile 'org.codehaus.groovy:groovy-all:2.3.6'
testCompile 'org.spockframework:spock-core:1.0-groovy-2.3'
}
To gradle 2.3 version
dependencies {
compile 'org.codehaus.groovy:groovy-all:2.3.9'
testCompile 'org.spockframework:spock-core:1.0-groovy-2.3'
}
To gradle 2.4 version
dependencies {
compile 'org.codehaus.groovy:groovy-all:2.3.9'
testCompile 'org.spockframework:spock-core:1.0-groovy-2.3'
}
or
dependencies {
compile 'org.codehaus.groovy:groovy-all:2.3.10'
testCompile 'org.spockframework:spock-core:1.0-groovy-2.3'
}
To gradle 2.5 and 2.6 versions
dependencies {
compile 'org.codehaus.groovy:groovy-all:2.4.4'
testCompile 'org.spockframework:spock-core:1.0-groovy-2.4'
}
For more information about spock and groovy versions click here
It is desired a basic knowledge about Gradle and its plugin mechanism, as starting point you can review:
$ gradle build
$ gradle test