forked from jenkinsci/synopsys-coverity-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
103 lines (86 loc) · 4.43 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
import com.synopsys.integration.jenkins.coverity.GenerateHtml
import com.synopsys.integration.jenkins.coverity.GenerateJelly
buildscript {
repositories {
jcenter()
mavenCentral()
maven { url 'https://plugins.gradle.org/m2/' }
}
dependencies { classpath 'com.blackducksoftware.integration:common-gradle-plugin:0.0.+' }
}
plugins {
id 'org.jenkins-ci.jpi' version '0.31.0'
}
group = 'org.jenkins-ci.plugins'
version = '2.2.0-SNAPSHOT'
description = 'Allows users to run Coverity commands in their builds'
apply plugin: 'com.blackducksoftware.integration.solution'
def jcenterRepo = project.repositories.findByName('BintrayJCenter')
project.repositories.remove(jcenterRepo)
def mavenRepo = project.repositories.findByName('maven')
project.repositories.remove(mavenRepo)
project.afterEvaluate {
// MavenLocal is added by the gradle-jpi-plugin and the common-gradle-plugin so we have to remove it after the plugins are evaluated
List<String> repoNames = new ArrayList()
repoNames.addAll(project.repositories.getNames())
for (String repoName : repoNames) {
if (repoName.contains('MavenLocal')) {
def repoToRemove = project.repositories.findByName(repoName)
project.repositories.remove(repoToRemove)
}
}
}
repositories {
maven { url 'https://sig-repo.synopsys.com/bds-integrations-release' }
}
jenkinsPlugin {
coreVersion = '2.60.1'
displayName = 'Synopsys Coverity Plugin'
url = 'https://wiki.jenkins.io/display/JENKINS/Synopsys+Coverity+Plugin'
gitHubUrl = 'https://github.com/jenkinsci/synopsys-coverity-plugin'
compatibleSinceVersion = '2.0.0'
pluginFirstClassLoader = false
}
dependencies {
jenkinsPlugins 'org.jenkins-ci.plugins:credentials:2.1.10'
implementation 'com.synopsys.integration:coverity-common:0.4.2'
optionalJenkinsPlugins 'org.jenkins-ci.plugins:job-dsl:1.67'
optionalJenkinsPlugins 'org.jenkins-ci.plugins.workflow:workflow-job:2.9'
optionalJenkinsPlugins 'org.jenkins-ci.plugins.workflow:workflow-cps:2.23'
optionalJenkinsPlugins 'org.jenkins-ci.plugins.workflow:workflow-step-api:2.10'
}
task renameFile {
doLast {
if (project.version.toString().contains("SNAPSHOT")) {
File libsDirectory = new File(project.buildDir, "libs")
File originalFile = new File(libsDirectory, "${project.getName()}.hpi")
File newFile = new File(libsDirectory, "${project.getName()}-${project.version}.hpi")
originalFile.renameTo newFile
}
}
}
task generateJelly(type: GenerateJelly) {
pathToExtensionResourcesPackage = 'src/main/resources/com/synopsys/integration/jenkins/coverity/extensions/'
pathToJellyJson = 'src/main/resources/templates/coverity/jelly/'
outputPathToJson = ['buildstep/CoverityBuildStep' : 'buildStep.json',
'buildstep/SimpleCoverityRunConfiguration' : 'simpleRunConfiguration.json',
'buildstep/AdvancedCoverityRunConfiguration': 'advancedRunConfiguration.json',
'global/CoverityGlobalConfig' : 'globalConfig.json',
'pipeline/CheckForIssuesStep' : 'checkForIssuesStep.json',
'wrap/CoverityEnvironmentWrapper' : 'environmentWrapper.json',]
}
task generateHelp(type: GenerateHtml) {
pathToExtensionResourcesPackage = 'src/main/resources/com/synopsys/integration/jenkins/coverity/extensions/'
pathToHelpJson = 'src/main/resources/templates/coverity/help/'
outputPathToJson = ['buildstep/CoverityBuildStep' : 'buildStep.json',
'buildstep/SimpleCoverityRunConfiguration': 'simpleRunConfiguration.json',
'buildstep/CommandArguments' : 'commandArguments.json',
'CheckForIssuesInView' : 'checkForIssuesInView.json',
'ConfigureChangeSetPatterns' : 'configureChangeSetPatterns.json',
'global/CoverityConnectInstance' : 'coverityConnectInstance.json',
'buildstep/RepeatableCommand' : 'repeatableCommand.json',
'pipeline/CheckForIssuesStep' : 'checkForIssuesStep.json',
'wrap/CoverityEnvironmentWrapper' : 'environmentWrapper.json']
}
compileJava.dependsOn generateHelp, generateJelly
jpi.finalizedBy renameFile