forked from crnk-project/crnk-framework
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
190 lines (155 loc) · 4.55 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
import java.text.SimpleDateFormat
// tag::versions[]
buildscript {
dependencies {
apply from: "versions.gradle"
def depMgmtVersion = versions['dependency.management.plugin.version']
classpath "io.spring.gradle:dependency-management-plugin:${depMgmtVersion}"
classpath 'org.asciidoctor:asciidoctor-gradle-plugin:1.5.3'
classpath 'org.asciidoctor:asciidoctorj-pdf:1.5.0-alpha.11'
classpath 'com.moowork.gradle:gradle-node-plugin:1.1.1'
classpath 'org.ajoberstar:gradle-git-publish:0.2.1'
classpath 'org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:2.5-rc1'
}
}
wrapper {
gradleVersion = '3.5'
}
// note that a production build creates javadoc, sources jars and signatures undesired during development
// for performance reasons
def isProductionBuild = System.env.NEXUS_DEPLOY_USER != null
ext {
timestampedVersion = isProductionBuild
}
SimpleDateFormat format = new SimpleDateFormat("yyyyMMddHHmmss")
if (ext.timestampedVersion) {
version = BUILD_VERSION_PREFIX + "." + format.format(new Date())
}
else {
version = '0.0.0-SNAPSHOT'
}
group = GROUP_ID
if (JavaVersion.current().isJava8Compatible()) {
allprojects {
tasks.withType(Javadoc) {
options.addStringOption('Xdoclint:none', '-quiet')
}
}
}
gradle.beforeProject { Project project ->
project.with {
apply plugin: 'maven'
def docs = project.name == 'crnk-documentation'
def ui = project.name == 'crnk-ui'
def test = project.name == 'crnk-test'
def examples = project.name.contains('example')
if (!docs) {
apply plugin: 'java'
sourceCompatibility = 1.7
targetCompatibility = 1.7
dependencies {
testCompile group: 'junit', name: 'junit', version: '4.12'
testCompile group: 'org.mockito', name: 'mockito-core', version: '1.10.19'
testCompile group: 'org.assertj', name: 'assertj-core', version: '2.2.0'
}
}
if (!docs && !examples && !test) {
// https://about.sonarqube.com/get-started/
apply plugin: "org.sonarqube"
apply plugin: "jacoco"
jacoco {
toolVersion = "0.7.6.201602180812"
}
sonarqube {
properties {
property 'sonar.coverage.exclusions', "**/legacy/**"
}
}
}
apply plugin: 'maven-publish'
if (!docs && !examples) {
if (isProductionBuild) {
apply plugin: 'signing'
task sourcesJar(type: Jar) {
from sourceSets.main.allSource
classifier = 'sources'
}
task javadocJar(type: Jar, dependsOn: 'javadoc') {
from javadoc.destinationDir
classifier = 'javadoc'
}
artifacts {
archives jar
archives javadocJar
archives sourcesJar
}
signing {
required {
gradle.taskGraph.hasTask("uploadArchives")
}
sign configurations.archives
}
uploadArchives {
repositories {
mavenDeployer {
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
// if(!System.env.NEXUS_DEPLOY_PASS){
// throw new IllegalStateException("NEXUS_DEPLOY_PASS not specified in environment")
// }
repository(url: NEXUS_DEPLOY_URL) {
authentication(
userName: System.env.NEXUS_DEPLOY_USER,
password: System.env.NEXUS_DEPLOY_PASS
)
// that plugin does not make use of global proxy settings :-(
def proxyHost = System.getProperty("https.proxyHost")
def proxyPort = System.getProperty("https.proxyPort")
if (proxyHost && proxyPort) {
proxy(host: proxyHost, port: Integer.parseInt(proxyPort), type: 'http')
}
}
pom.project {
name project.name
description 'JSON API framework for Java'
url 'http://www.crnk.io'
scm {
url 'https://github.com/crnk-project/crnk-framework'
connection 'scm:git:git://github.com/crnk-project/crnk-framework.git'
developerConnection 'scm:git:[email protected]:crnk-project/crnk-framework.git'
}
licenses {
license {
name 'The Apache Software License, Version 2.0'
url 'http://www.apache.org/licenses/LICENSE-2.0.html'
distribution 'repo'
}
}
issueManagement {
system 'GitHub'
url 'https://github.com/crnk-project/crml-framework/issues'
}
developers {
developer {
id 'crnk.io'
name 'crnk.io'
email '[email protected]'
}
}
}
}
}
}
tasks.publish.dependsOn(tasks.uploadArchives)
}else{
apply plugin: 'maven-publish'
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
}
}
}
}
}
}
}