This repository has been archived by the owner on Nov 26, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
build.gradle
210 lines (169 loc) · 4.58 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
210
/**
* Copyright (C) 2017 Ardika Rommy Sanjaya
*/
buildscript {
apply from: "${rootDir}/gradle/configure.gradle"
repositories {
jcenter()
maven {
url "https://plugins.gradle.org/m2/"
}
}
}
plugins {
id "c"
id "java"
id "signing"
id "maven"
id "jacoco"
id "checkstyle"
id "pmd"
id "org.springframework.boot" version "2.0.4.RELEASE" apply false
id "com.jfrog.bintray" version "1.7.3" apply false
id "com.github.spotbugs" version "1.6.2" apply false
id "com.github.kt3k.coveralls" version "2.8.2" apply false
id "com.ardikars.gjnp" version "1.0.0.Final" apply false
id "co.riiid.gradle" version "0.4.2" apply false
id "org.owasp.dependencycheck" version "3.3.4" apply false
id "org.sonarqube" version "2.7"
}
allprojects {
if (!project.name.equals("jxnet-native") && !project.name.equals("jxnet")) {
apply plugin: 'java'
apply plugin: 'io.spring.dependency-management'
apply plugin: 'jacoco'
apply plugin: 'com.github.kt3k.coveralls'
group = "${GROUP}"
version = "${VERSION}"
sourceCompatibility = "${JAVA_VERSION}"
targetCompatibility = "${JAVA_VERSION}"
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
repositories {
jcenter()
maven {
url "https://dl.bintray.com/ardikars/maven"
}
}
dependencyManagement {
imports { mavenBom("com.ardikars.common:common:${COMMON_VERSION}") }
}
dependencies {
compileOnly ("com.github.spotbugs:spotbugs-annotations:${SPOTBUGS_VERSION}")
}
configurations.archives.artifacts.with { archives ->
def jarArtifact
archives.each {
if (it.file =~ 'jar' && project.name == "${rootProject.name}") {
jarArtifact = it
}
}
remove(jarArtifact)
}
evaluationDependsOn(project.path)
jar {
manifest {
attributes 'Implementation-Title': 'Jxnet',
'Implementation-Version': version
}
}
javadoc {
def currentYear = Calendar.getInstance().get Calendar.YEAR
options.with {
locale 'en_US'
encoding 'UTF-8'
charSet 'UTF-8'
author true
windowTitle "${NAME} ${project.version}"
header "${NAME} ${project.version}"
docTitle "${NAME} ${project.version} API Documentation"
footer 'https://github.com/jxnet/Jxnet'
bottom "Copyright © 2015 - ${currentYear} ardikars.com. All rights reserved."
showFromProtected()
addStringOption 'Xdoclint:all,-reference', '-quiet'
}
}
task javadocJar(type: Jar) {
classifier = 'javadoc'
from javadoc
}
task sourcesJar(type: Jar) {
classifier = 'sources'
from sourceSets.main.allSource
}
tasks.withType(JavaCompile) {
//options.compilerArgs << "-Xlint:unchecked" << "-Werror"
}
/**
* Code coverage (Jacoco + coveralls)
*/
jacoco {
toolVersion = "${JACOCO_VERSION}"
}
jacocoTestReport {
reports {
csv.enabled false
xml.enabled true
html.enabled = true
}
if (project.name.equals("jxnet-core")) {
enabled = true
} else {
enabled = false
}
}
/**
* Upload converage report
*/
tasks.coveralls {
if (project.name.equals("jxnet-core")) {
dependsOn 'check'
}
}
coveralls {
if (project.name.equals("jxnet-core")) {
jacocoReportPath "build/reports/jacoco/test/jacocoTestReport.xml"
}
}
} else if (project.name.equals("jxnet")) {
apply plugin: 'java'
group = "${GROUP}"
version = "${VERSION}"
} else {
apply plugin: 'c'
}
}
description = "${DESCRIPTION}"
if (gradle.startParameter.taskNames.contains('github') ||
gradle.startParameter.taskNames.contains('githubRelease')) {
apply from: 'gradle/githubRelease.gradle'
}
if (gradle.startParameter.taskNames.contains("install")) {
apply from: 'gradle/artifactInstall.gradle'
}
if (gradle.startParameter.taskNames.contains("dist")) {
apply from: 'gradle/artifactDistribute.gradle'
}
if (gradle.startParameter.taskNames.contains("build")) {
apply from: 'gradle/codeAnalysis.gradle'
}
if (gradle.startParameter.taskNames.contains("bintrayUpload") ||
gradle.startParameter.taskNames.contains("uploadArchives")) {
apply from: 'gradle/artifactRelease.gradle'
}
if (gradle.startParameter.taskNames.contains('dependencyCheckAnalyze')) {
apply from: 'gradle/dependencyAnalysis.gradle'
}
if (gradle.startParameter.taskNames.contains('generateDockerfile')) {
apply from: 'gradle/generateDockerfile.gradle'
}
sonarqube {
properties {
property "sonar.projectName", "Jxnet"
property "sonar.organization", "jxnet"
property "sonar.projectKey", "jxnet_Jxnet"
property "sonar.host.url", "https://sonarcloud.io"
}
}
task wrapper(type: Wrapper) {
distributionUrl = "https://services.gradle.org/distributions/gradle-${GRADLE_VERSION}-all.zip"
}