forked from cflint/CFLint
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
156 lines (136 loc) · 4.81 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
149
150
151
152
153
154
155
156
buildscript {
repositories {
mavenLocal()
jcenter {
url "https://jcenter.bintray.com/"
}
maven {
url "https://oss.sonatype.org/content/repositories/snapshots/"
}
maven {
url "https://plugins.gradle.org/m2/"
}
maven {
url "https://cfmlprojects.org/artifacts"
}
}
dependencies {
classpath 'com.bmuschko:gradle-nexus-plugin:2.3.1'
classpath "io.codearte.gradle.nexus:gradle-nexus-staging-plugin:0.22.0"
classpath "gradle.plugin.se.bjurr.gitchangelog:git-changelog-gradle-plugin:1.64"
}
}
plugins {
id 'java'
id 'com.github.johnrengelman.shadow' version '5.2.0'
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 "https://repo.maven.apache.org/maven2" }
maven { url "https://oss.sonatype.org/content/repositories/releases" }
maven { url "https://cfmlprojects.org/artifacts" }
}
dependencies {
implementation group: 'com.github.cfparser', name: 'cfml.parsing', version: '2.11.0'
implementation group: 'commons-cli', name: 'commons-cli', version: '1.2'
implementation group: 'ro.fortsoft.pf4j', name: 'pf4j', version: '0.6'
implementation group: 'org.apache.ant', name: 'ant', version: '1.10.14'
implementation group: 'com.sun.xml.bind', name: 'jaxb-impl', version: '2.1.17'
implementation group: 'com.fasterxml.jackson.core', name: 'jackson-core', version: '2.12.7'
implementation group: 'com.fasterxml.jackson.module', name: 'jackson-module-jaxb-annotations', version: '2.12.7'
implementation(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
implementation group: 'commons-io', name: 'commons-io', version: '2.15.1'
testImplementation group: 'junit', name: 'junit', version: '4.13.2'
}
test {
testLogging {
exceptionFormat = 'full'
showExceptions true
events "skipped", "failed", "standardError"
showStandardStreams = true
}
}
jar {
manifest {
attributes(
'Main-Class': 'com.cflint.cli.CFLintCLI',
'Implementation-Version': version,
'Bundle-Name': 'CFLint',
'Bundle-SymbolicName': 'com.cflint.CFLint',
'Bundle-Description': 'CFLint',
'Bundle-ManifestVersion': 2,
'Bundle-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
}
}