-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathbuild.gradle
210 lines (179 loc) · 6.34 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
/**
* This is a gradle multi project build that works with GitHub Actions to publish
* release branch commits to mavenCentral.
*
* You can browse published artifacts here: https://repo1.maven.org/maven2/io/inversion/inversion-api/
*
* The following examples/articles were super helpful in figuring all fo this out
* - https://docs.gradle.org/current/userguide/signing_plugin.html
* - https://github.com/gradle-nexus/publish-plugin/
* - https://central.sonatype.org/publish/publish-guide/
*
*/
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.netflix.nebula:gradle-aggregate-javadocs-plugin:3.0.1'
}
}
plugins {
id "java-library"
id "maven-publish"
id "signing"
//-- publishes to OSSRH and on to mavenCentral
id("io.github.gradle-nexus.publish-plugin") version "1.1.0"
//-- provides the "dependencyUpdates" task that reports available updates for your dependencies
id "com.github.ben-manes.versions" version "${dependencyUpdatesVersion}"
}
apply plugin: 'nebula-aggregate-javadocs'
/**
* The gradle-aggregate-javadocs-plugin generates a combined
* javadoc for all subprojects but as of this writing, the
* plugin did not seem to offer the ability to change the output
* directory. Running 'allJavadocs' instead of 'aggregateJavadocs'
* will generate the combined docs and put them into /docs/javadoc
* where they can be checked into github and served up from
* github pages.
*/
task allJavadocs {
dependsOn 'aggregateJavadocs'
doLast {
ant.delete(dir: 'docs/javadoc/')
//ant.move(file: 'build/docs/javadoc/', tofile: 'docs/javadoc/')
}
}
tasks.withType(Javadoc) {
failOnError false
title = "Inversion Cloud API Engine - " + project.version
}
//regenerate javadocs after a build
build.finalizedBy(allJavadocs)
allprojects {
group = 'io.inversion'
def isSnapshot = Boolean.valueOf(System.getProperty("snapshot"))
project.version = project.version + (isSnapshot ? "-SNAPSHOT" : "")
//required for generating comprehensive javadocs with
//gradle-aggregate-javadocs-plugin and not failing on error
tasks.withType(Javadoc) {
failOnError false
options.bottom = "Copyright © ${java.time.Year.now()} <a href=\"http://rocketpartners.io\">Rocket Partners, LLC</a>. All rights reserved."
}
}
nexusPublishing {
repositories {
sonatype()
}
}
subprojects {
apply plugin: 'java-library'
apply plugin: 'maven-publish'
apply plugin: 'signing'
//./gradlew printSubDependencies --configuration runtimeClasspath
task printSubDependencies(type: DependencyReportTask) {}
java {
toolchain {
languageVersion = JavaLanguageVersion.of(17)
}
}
/*
test {
exclude '**'
}
*/
repositories {
mavenCentral()
}
signing {
def signingKeyId = findProperty("signingKeyId")
def signingKey = findProperty("signingKey")
def signingPassword = findProperty("signingPassword")
useInMemoryPgpKeys(signingKeyId, signingKey, signingPassword)
sign publishing.publications
}
dependencies {
testImplementation "org.junit.jupiter:junit-jupiter-engine:${junitVersion}"
}
javadoc.failOnError = false
task javadocJar(type: Jar) {
classifier = 'javadoc'
from javadoc
}
task sourcesJar(type: Jar) {
classifier = 'sources'
from sourceSets.main.allSource
}
artifacts {
archives javadocJar, sourcesJar
}
//keeps integration test that require access to external systems
//from running as part of the standard CICD pipeline build
//run intergration tests via: ./gradlew test -Dtest.profile=integration
test {
useJUnitPlatform()
if (System.properties['test.profile'] != 'integration') {
exclude '**/*IntegTest*'
}
testLogging {
outputs.upToDateWhen { false }
showStandardStreams = true
}
}
//causes a new ${subpoject}/pom.xml file to be generated after each build
gradle.buildFinished { buildResult ->
if (Boolean.valueOf(System.getProperty("release"))) {
tasks.generatePomFileForMavenJavaPublication.doGenerate()
}
}
project.getGradle().getTaskGraph().whenReady {
tasks.withType(GenerateMavenPom.class) {
destination = file("$buildDir/../pom.xml")
}
}
publishing {
publications {
mavenJava(MavenPublication) {
artifactId = project.name
from components.java
artifact sourcesJar
artifact javadocJar
//-- the following will generate poms with resolved dependencies
//-- instead of potentially dynamic dependencies declared in the gradle build
//-- https://docs.gradle.org/current/userguide/publishing_maven.html
versionMapping {
usage('java-api') {
fromResolutionOf('runtimeClasspath')
}
usage('java-runtime') {
fromResolutionResult()
}
}
pom {
name = project.name
description = 'Inversion Cloud API Engine'
url = 'https://inversion.io'
licenses {
license {
name = 'The Apache License, Version 2.0'
url = 'https://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
developers {
developer {
name = 'Wells Burke'
email = 'wells@inversion.io'
organization = 'inversion.io'
organizationUrl = 'https://inversion.io'
}
}
scm {
connection = 'scm:git:git://github.com/inversion-api/inversion-engine.git'
developerConnection = 'scm:git:ssh://github.com:inversion-api/inversion-engine.git'
url = 'https://github.com/inversion-api/inversion-engine/'
}
}
}
}
}
}