-
Notifications
You must be signed in to change notification settings - Fork 8
/
build.gradle
118 lines (101 loc) · 3.76 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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
buildscript {
repositories {
maven { url 'https://plugins.gradle.org/m2/'}
maven { url 'http://dl.bintray.com/content/aalmiray/kordamp' }
}
dependencies {
classpath 'gradle.plugin.com.github.jk1:gradle-license-report:1.2',
'org.kordamp:markdown-gradle-plugin:1.1.0',
'gradle.plugin.org.gradle.crypto:checksum:1.1.0'
}
}
apply plugin: 'java'
apply plugin: 'com.github.jk1.dependency-license-report'
apply plugin: 'org.kordamp.markdown.convert'
apply plugin: 'org.gradle.crypto.checksum'
import org.gradle.crypto.checksum.Checksum
defaultTasks 'clean', 'build'
ext.rundeckPluginVersion='1.2'
ext.rundeckPluginArchive='true'
//Set this to a comma-separated list of full classnames of your implemented Rundeck plugins.
ext.rundeckPluginClassnames='com.github.theque5t.DIYWebhookNotificationPlugin.DIYWebhookNotificationPlugin'
ext.rundeckPluginAuthor='Trevor Highfill'
ext.rundeckPluginURL='https://github.com/theque5t/rundeck-diy-webhook-notification'
ext.rundeckPluginDate=new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
ext.rundeckPluginFileVersion = hasProperty('projectVersion') && projectVersion != "" ? projectVersion.replaceAll(/v(\d+\.\d+\.\d+)/,'$1') : 'SNAPSHOT-'+new Date().format("yyyyMMddHHmmss")
project.version=ext.rundeckPluginFileVersion
configurations{
//declare custom pluginLibs configuration to include only libs for this plugin
pluginLibs
//declare compile to extend from pluginLibs so it inherits the dependencies
compile{
extendsFrom pluginLibs
}
}
repositories {
mavenCentral()
}
dependencies {
compile group: 'org.rundeck', name: 'rundeck-core', version: '2.6.9'
pluginLibs(
'nl.big-o:liqp:0.7.5'
)
}
task copyIndexHtml(type: Copy){
into "$buildDir/output/dependency-license"
from "$buildDir/reports/dependency-license/index.html"
}
htmlToMarkdown {
sourceDir = file("$buildDir/output/dependency-license")
outputDir = file("$buildDir/output/dependency-license")
}
task copyToOutput(type: Copy) {
into "$buildDir/output"
from("$buildDir/reports"){
include "dependency-license/**"
}
from "LICENSE"
}
task deleteIndexHtml(type: Delete){
delete "$buildDir/output/dependency-license/index.html"
delete "$buildDir/reports/dependency-license/index.html"
}
task copyIndexMarkdown(type: Copy){
into "$buildDir/reports/dependency-license"
from "$buildDir/output/dependency-license/index.md"
}
// task to copy plugin libs to output/lib dir
task copyToLib(type: Copy) {
into "$buildDir/output/lib"
from configurations.pluginLibs
}
jar {
//include contents of output dir
from "$buildDir/output"
manifest {
def libList = configurations.pluginLibs.collect{'lib/'+it.name}.join(' ')
attributes 'Rundeck-Plugin-Version': rundeckPluginVersion
attributes 'Rundeck-Plugin-Archive': rundeckPluginArchive
attributes 'Rundeck-Plugin-Classnames': rundeckPluginClassnames
attributes 'Rundeck-Plugin-Libs': "${libList}"
attributes 'Rundeck-Plugin-Author': rundeckPluginAuthor
attributes 'Rundeck-Plugin-URL': rundeckPluginURL
attributes 'Rundeck-Plugin-Date': rundeckPluginDate
attributes 'Rundeck-Plugin-File-Version': rundeckPluginFileVersion
}
}
task createChecksum(type: Checksum) {
files = jar.outputs.files
outputDir = new File("${project.buildDir}/libs")
algorithm = Checksum.Algorithm.SHA256
}
//set task dependencies
copyIndexHtml.dependsOn(generateLicenseReport)
htmlToMarkdown.dependsOn(copyIndexHtml)
copyToOutput.dependsOn(htmlToMarkdown)
deleteIndexHtml.dependsOn(copyToOutput)
copyIndexMarkdown.dependsOn(deleteIndexHtml)
copyToLib.dependsOn(copyIndexMarkdown)
jar.dependsOn(copyToLib)
createChecksum.dependsOn(jar)
build.dependsOn(createChecksum)