forked from cflint/CFLint
-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle
209 lines (184 loc) · 6.41 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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
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"
// classpath "net.thebugmc.gradle:sonatype-central-portal-publisher:1.2.3"
}
}
plugins {
id 'java'
id 'com.github.johnrengelman.shadow' version '7.1.1'
id 'eclipse'
id 'signing'
// id 'net.thebugmc.gradle.sonatype-central-portal-publisher' version '1.2.3'
}
java {
toolchain {
languageVersion = JavaLanguageVersion.of(11)
vendor = JvmVendorSpec.ADOPTIUM
}
withJavadocJar()
withSourcesJar()
}
// 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-publish'
apply from: 'cobertura.gradle'
//apply from: 'deploy.gradle'
apply plugin: 'se.bjurr.gitchangelog.git-changelog-gradle-plugin'
// apply plugin: "net.thebugmc.gradle.sonatype-central-portal-publisher"
sourceCompatibility = 1.11
targetCompatibility = 1.11
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: 'ant', name: 'ant', version: '1.7.0'
implementation 'jakarta.xml.bind:jakarta.xml.bind-api:2.3.3'
implementation group: 'com.sun.xml.bind', name: 'jaxb-impl', version: '2.1.8'
implementation group: 'com.fasterxml.jackson.core', name: 'jackson-core', version: '2.10.3'
implementation group: 'com.fasterxml.jackson.module', name: 'jackson-module-jaxb-annotations', version: '2.10.3'
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.5'
runtimeOnly 'com.sun.xml.bind:jaxb-impl:2.3.3'
runtimeOnly 'com.sun.xml.bind:jaxb-core:2.3.0.1'
testImplementation 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,
'Bundle-Name': 'cflint',
'Bundle-SymbolicName': 'io.cfmleditor.cflint',
'Bundle-Description': 'cflint',
'Bundle-ManifestVersion': 2,
'Bundle-Version': version
)
}
}
task fatJar(type: Jar) {
manifest.from jar.manifest
archiveClassifier.set('all')
from {
configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) }
} {
exclude "META-INF/*.SF"
exclude "META-INF/*.DSA"
exclude "META-INF/*.RSA"
}
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
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
}
}
tasks.register('stuffZip', Zip) {
archiveBaseName = 'stuff'
from 'src/stuff'
}
// signing {
// sign stuffZip
// }
// centralPortal {
// pom {
// name = 'cfmleditor-cflint'
// description = 'cflint'
// url = "https://github.com/cfmleditor/CFLint/"
// licenses {
// license {
// name = "bsd-3-clause"
// url = "https://opensource.org/license/bsd-3-clause"
// }
// }
// developers {
// developer {
// name = "Gareth Edwards"
// email = "ghedwards@gmail.com"
// organization = "cfmleditor"
// organizationUrl = "https://github.com/cfmleditor/"
// }
// }
// scm {
// url = "https://github.com/cfmleditor/CFLint/"
// }
// }
// publishingType = USER_MANAGED
// }