-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle
More file actions
144 lines (122 loc) · 4.39 KB
/
build.gradle
File metadata and controls
144 lines (122 loc) · 4.39 KB
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
plugins {
id 'org.ajoberstar.grgit' version '5.3.2'
id 'io.github.gradle-nexus.publish-plugin' version '2.0.0'
id 'nebula.lint' version '20.6.2'
}
description = 'Coherent API mocker'
def groupName = 'hu.webarticum.miniconnect.phantomapi'
def scmUrl = 'https://github.com/miniconnect/phantomapi.git'
def websiteUrl = scmUrl.replaceAll(/\.git$/, "");
def automaticVersion = '0.1.0-SNAPSHOT'
def versionMatcher = grgit.describe() =~ /^v?(\d+\.\d+\.)(\d+)(.*)$/
if (versionMatcher.size() > 0) {
def versionMatch = versionMatcher[0]
def isVersionDirty = !versionMatch[3].isEmpty()
def versionPrefix = versionMatch[1]
def versionPatch = isVersionDirty ? (Integer.parseInt(versionMatch[2]) + 1) + "" : versionMatch[2];
def versionSuffix = isVersionDirty ? "-SNAPSHOT" : ""
automaticVersion = versionPrefix + versionPatch + versionSuffix
}
defaultTasks 'build'
nexusPublishing {
repositories {
sonatype {
nexusUrl.set(uri(providers.gradleProperty('sonatypeUrl').orNull))
}
}
}
tasks.register('printVersion') {
inputs.property('projectVersion', project.version)
doLast {
println inputs.properties['projectVersion']
}
}
allprojects {
group = groupName
version = automaticVersion
ext.miniConnectApiVersion = '0.5.1-SNAPSHOT'
ext.holodbVersion = '0.8.1-SNAPSHOT'
repositories {
mavenCentral()
mavenLocal()
}
}
subprojects { subproject ->
subproject.plugins.withId('java') {
subproject.plugins.apply('maven-publish')
subproject.plugins.apply('signing')
subproject.java {
withJavadocJar()
withSourcesJar()
}
subproject.sourceSets.matching { it.name == 'lab' }.all { labSourceSet ->
subproject.tasks.register('execLab', JavaExec) {
group = 'Execution'
description = 'Run lab demo main class'
classpath = labSourceSet.runtimeClasspath
mainClass = System.getProperty('lab.exec.main.class')
standardInput = System.in
}
}
subproject.tasks.withType(JavaCompile).configureEach {
options.encoding = 'UTF-8'
options.compilerArgs += ['-Xlint:-options']
}
subproject.tasks.withType(Javadoc).configureEach { javadocTask ->
javadocTask.options.addStringOption('Xdoclint:none', '-quiet')
}
def moduleName = groupName + '.' + subproject.name.replaceAll(/\W/, ".")
subproject.tasks.named('jar', Jar).configure {
manifest.attributes('Automatic-Module-Name': moduleName)
}
subproject.tasks.withType(Test).configureEach { testTask ->
testTask.useJUnitPlatform()
testTask.testLogging {
events('failed')
showExceptions = true
exceptionFormat = 'full'
showCauses = true
showStackTraces = true
showStandardStreams = false
}
}
subproject.publishing {
publications {
mavenJava(MavenPublication) {
from subproject.components.java
suppressAllPomMetadataWarnings()
}
}
}
subproject.publishing.publications.withType(MavenPublication).configureEach { mavenPublication ->
mavenPublication.pom {
name = subproject.name
description = subproject.provider { subproject.description }
url = websiteUrl
licenses {
license {
name = 'The Apache Software License, Version 2.0'
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
distribution = 'repo'
}
}
scm {
connection = 'scm:git:' + scmUrl
developerConnection = 'scm:git:' + scmUrl
url = scmUrl
}
developers {
developer {
id = 'davidsusu'
name = 'Dávid Horváth'
email = 'horvath@webarticum.hu'
}
}
}
}
subproject.signing {
required = true
sign subproject.publishing.publications
}
}
}