-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathbuild.gradle
200 lines (172 loc) · 5.29 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
import com.github.spotbugs.SpotBugsTask
buildscript {
repositories {
mavenCentral()
mavenLocal()
jcenter()
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath "gradle.plugin.com.github.spotbugs:spotbugs-gradle-plugin:1.6.6"
//Check for the latest version here: http://plugins.gradle.org/plugin/com.jfrog.artifactory
classpath(group: 'org.jfrog.buildinfo', name: 'build-info-extractor-gradle', version: '4.+')
}
}
apply plugin: 'idea'
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'jacoco'
apply plugin: 'maven'
apply plugin: 'com.github.spotbugs'
apply plugin: 'com.jfrog.artifactory'
apply plugin: 'maven-publish'
sourceCompatibility = javaVersion
targetCompatibility = javaVersion
group = 'com.codingrodent.microprocessor'
task setVersion {
if (System.env.BUILD_NUMBER) {
version = projectVersionMajor + '.' + projectVersionMinor + '.' + System.env.BUILD_NUMBER
} else {
version = projectVersionMajor + '.' + projectVersionMinor + '.' + projectVersionBuild
}
}
jar {
baseName = projectName
manifest
{
attributes 'Implementation-Title': projectName,
'Implementation-Version': version
}
}
task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.allSource
}
javadoc {
options.addBooleanOption('html5', true)
}
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}
task createPom {
doLast {
pom
{
project {
artifactId 'Z80Processor'
groupId 'com.codingrodent.microprocessor'
name 'com.codingrodent.microprocessor.Z80Processor'
description 'A Z80 Microprocessor core in Java'
url 'https://github.com/codesqueak/Z80Processor'
scm {
url 'https://github.com/codesqueak/Z80Processor'
connection 'scm:git:git://github.com/codesqueak/Z80Processor.git'
developerConnection 'scm:git:ssh://github.com:codesqueak/Z80Processor.git'
}
licenses {
license {
name 'The Apache Software License, Version 2.0'
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
distribution 'repo'
}
}
developers {
developer {
id 'codesqueak'
name 'codesqueak'
email '[email protected]'
organizationUrl 'http://www.codesqueak.com'
// organization 'codesqueak'
}
}
}
}.writeTo("$buildDir/libs/" + projectName + "-" + version + ".pom")
}
}
artifacts {
archives sourcesJar
archives javadocJar
}
repositories {
mavenCentral()
}
jacoco {
toolVersion = "0.8.2"
reportsDir = file("$buildDir/customJacocoReportDir")
}
test
{
maxParallelForks = 1
filter
{
includeTestsMatching "com.codingrodent.microprocessor.*"
}
jacoco {
append = false
destinationFile = file("$buildDir/jacoco/jacocoTest.exec")
classDumpDir = file("$buildDir/jacoco/classpathdumps")
}
}
jacocoTestReport {
reports {
xml.setEnabled(true)
csv.setEnabled(false)
html.setDestination(file("${buildDir}/jacocoHtml"))
}
}
spotbugs {
sourceSets = [sourceSets.main]
effort = "max"
reportLevel = "high"
ignoreFailures = true
}
tasks.withType(SpotBugsTask) {
reports {
xml.enabled = true
html.enabled = false
}
}
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
}
}
}
artifactory {
contextUrl = "${artifactory_contextUrl}" //The base Artifactory URL if not overridden by the publisher/resolver
publish {
repository {
repoKey = 'gradle-dev-local'
username = "${artifactory_user}"
password = "${artifactory_password}"
maven = true
}
defaults {
// Reference to Gradle publications defined in the build script.
// This is how we tell the Artifactory Plugin which artifacts should be
// published to Artifactory.
publications('mavenJava')
publishArtifacts = true
// Properties to be attached to the published artifacts.
properties = ['qa.level': 'basic', 'dev.team': 'core']
// Publish generated POM files to Artifactory (true by default)
publishPom = true
}
}
}
check.dependsOn jacocoTestReport
test.dependsOn javadoc
jar.dependsOn createPom
jar.dependsOn setVersion
dependencies {
testCompile group: 'junit', name: 'junit', version: '4.12'
testCompile group: 'org.mockito', name: 'mockito-core', version: '2.10.0'
testCompile group: 'org.hamcrest', name: 'hamcrest-all', version: '1.3'
}
wrapper {
gradleVersion = '5.0'
}