-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.gradle
executable file
·79 lines (64 loc) · 1.96 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
apply plugin: 'java'
apply plugin: 'idea'
ext {
versionRegex = '(\\d+)(\\.\\d+)*'
}
sourceCompatibility = 1.8
targetCompatibility = 1.8
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}
// artifact group
group 'com.blackducksoftware.integration'
// plugin version, note the version must match versionRegex.
version = '2.0.3'
if (project.hasProperty('devBuild')) {
// Gradle has been run with option -PdevBuild - auto increment plugin version
def time = System.currentTimeMillis().intdiv(1000)
def hours = time.intdiv(3600)
def secs = time % 3600
version = "$version.$hours.$secs"
}
println "Building version $version"
repositories {
// repository with fortify artifacts
ivy {
name 'blackduck'
url = [projectDir, "fortifyRepository"].join(File.separator)
}
mavenCentral()
}
configurations {
compileExport
compile.extendsFrom compileExport
}
dependencies {
// plugin specific dependencies
compileExport 'com.univocity:univocity-parsers:1.3.2'
compileExport 'commons-codec:commons-codec:1.6'
// dependencies provided by plugin runtime
compile 'com.fortify.plugin:plugin-api:1.0'
compile 'org.slf4j:slf4j-api:1.7.21'
testCompile 'junit:junit:4.12'
testRuntime 'org.slf4j:slf4j-simple:1.7.21'
}
jar {
doFirst {
// check if version matches requirements
if (!version.matches(versionRegex)) {
throw new InvalidUserDataException("Plugin version '$version' does not match '$versionRegex'")
}
}
// replace version placeholders in plugin.xml
filesMatching('plugin.xml') {
filter {
it.replaceAll('<!--VERSION-->.*?<!--/VERSION-->', version)
}
}
// include files from compileExport dependencies
from { configurations.compileExport.collect { it.isDirectory() ? it : zipTree(it).matching { exclude 'META-INF/*' } } }
}
// Define Gradle version for wrapper.
task wrapper(type: Wrapper) {
gradleVersion = '3.1'
}