forked from cflint/CFLint
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
149 lines (128 loc) · 4.28 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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
buildscript {
repositories {
mavenLocal()
jcenter {
url "http://jcenter.bintray.com/"
}
maven {
url "http://oss.sonatype.org/content/repositories/snapshots/"
}
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath 'com.bmuschko:gradle-nexus-plugin:2.3'
classpath "io.codearte.gradle.nexus:gradle-nexus-staging-plugin:0.5.3"
classpath "gradle.plugin.se.bjurr.gitchangelog:git-changelog-gradle-plugin:1.50"
}
}
plugins {
id 'java'
id 'com.github.johnrengelman.shadow' version '1.2.4'
id 'eclipse'
}
// Helper functions and constants
def getLatestTag = { ->
try {
def stdout = new ByteArrayOutputStream()
String osName = System.getProperty('os.name').toLowerCase();
if (osName.contains('win')) {
//exec {
// commandLine 'cmd', '/c', 'hg.exe', 'parent', '--template', '{rev}'
// standardOutput = stdout
//}
} else if (osName.contains('mac')) {
exec {
commandLine "src/main/resources/scripts/getLatestTag.sh"
standardOutput = stdout
}
}
return stdout.toString()
}
catch (ignored) {
print("fail")
println(ignored.toString())
throw new GradleException('Git command to find latest tag failed')
}
}
apply plugin: "base"
apply plugin: "signing"
apply plugin: "com.bmuschko.nexus"
apply plugin: 'java'
apply plugin: 'maven'
apply from: 'cobertura.gradle'
apply from: 'deploy.gradle'
apply plugin: "se.bjurr.gitchangelog.git-changelog-gradle-plugin"
sourceCompatibility = 1.8
targetCompatibility = 1.8
repositories {
maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
maven { url "http://repo.maven.apache.org/maven2" }
maven { url "https://oss.sonatype.org/content/repositories/releases" }
maven { url "http://cfmlprojects.org/artifacts" }
}
dependencies {
compile group: 'com.github.cfparser', name: 'cfml.parsing', version: '2.6.0'
compile group: 'commons-cli', name: 'commons-cli', version: '1.2'
compile group: 'ro.fortsoft.pf4j', name: 'pf4j', version: '0.6'
compile group: 'ant', name: 'ant', version: '1.7.0'
compile group: 'com.sun.xml.bind', name: 'jaxb-impl', version: '2.1.8'
compile group: 'com.fasterxml.jackson.core', name: 'jackson-core', version: '2.8.6'
compile group: 'com.fasterxml.jackson.module', name: 'jackson-module-jaxb-annotations', version: '2.8.6'
compile(group: 'net.java.dev.stax-utils', name: 'stax-utils', version: '20070216') {
exclude module: 'jsr173-ri'
exclude module: 'jsr173'
}
// https://mvnrepository.com/artifact/commons-io/commons-io
compile group: 'commons-io', name: 'commons-io', version: '2.5'
testCompile group: 'junit', name: 'junit', version: '4.12'
}
test {
testLogging {
exceptionFormat = 'full'
showExceptions true
events "skipped", "failed", "standardError"
showStandardStreams = true
}
}
jar {
manifest {
attributes(
'Main-Class': 'com.cflint.cli.CFLintCLI',
'Implementation-Version': version,
)
}
}
task fatJar(type: Jar) {
manifest.from jar.manifest
classifier = 'all'
from {
configurations.runtime.collect { it.isDirectory() ? it : zipTree(it) }
} {
exclude "META-INF/*.SF"
exclude "META-INF/*.DSA"
exclude "META-INF/*.RSA"
}
with jar
}
artifacts {
archives fatJar
}
task gitChangelog(type: se.bjurr.gitchangelog.plugin.gradle.GitChangelogTask) {
group "documentation"
file = new File("CHANGELOG.md");
templateContent = file('src/main/resources/changelog.mustache').getText('UTF-8');
}
task githubChangelogGenerator {
group "documentation"
doLast {
def latestTag = getLatestTag()
def props = new Properties()
props.load(new FileInputStream("user.properties"))
def changelogBinary = props.getProperty("user.githubChanglogGeneratorBinary")
def githubToken = props.getProperty("user.githubToken")
def p = ['src/main/resources/scripts/writeChangelog.sh', changelogBinary, githubToken, latestTag].execute()
println p.text
}
}