-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathbuild.gradle
113 lines (98 loc) · 3.11 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
/*
* SPDX-License-Identifier: CC0-1.0
*
* Copyright 2018-2020 Will Sargent.
*
* Licensed under the CC0 Public Domain Dedication;
* You may obtain a copy of the License at
*
* http://creativecommons.org/publicdomain/zero/1.0/
*/
plugins {
id 'java'
id "com.github.hierynomus.license" version "0.15.0"
id "com.diffplug.spotless" version "6.11.0"
id 'ru.vyarus.use-python' version '3.0.0'
id 'ru.vyarus.mkdocs' version '2.4.0'
id "io.github.gradle-nexus.publish-plugin" version "1.1.0"
id "org.shipkit.shipkit-auto-version" version "1.1.19"
//id 'org.inferred.processors' version '2.3.0'
}
apply from: "gradle/release.gradle"
mkdocs {
sourcesDir = projectDir
strict = true
}
python {
minPythonVersion = '3.7'
// mkdocs requires 3.7.x
scope = VIRTUALENV
}
spotless {
freshmark {
target 'README.md'
propertiesFile('gradle.properties')
propertiesFile('version.properties')
}
java {
googleJavaFormat()
}
}
allprojects {
repositories {
mavenCentral()
}
}
// Root project shouldn't publish
tasks.withType(PublishToMavenRepository).configureEach { it.enabled = false }
subprojects { subproj ->
apply plugin: 'java'
apply plugin: 'com.diffplug.spotless'
spotless {
java {
googleJavaFormat()
}
}
java {
toolchain {
languageVersion = JavaLanguageVersion.of(8)
}
}
dependencies {
testImplementation 'org.apiguardian:apiguardian-api:1.1.0'
testImplementation 'org.assertj:assertj-core:3.13.2'
testImplementation "junit:junit:$junitVersion"
testImplementation "org.junit.jupiter:junit-jupiter-api:$junitJupiterVersion"
testImplementation "org.junit.jupiter:junit-jupiter-engine:$junitJupiterVersion"
testImplementation "org.junit.vintage:junit-vintage-engine:$junitVintageVersion"
//testImplementation group: 'org.junit.platform', name: 'junit-platform-runner', version: '1.5.0'
}
test {
useJUnitPlatform()
}
}
// Go through all the artifacts and find javadoc for it...
static List<String> javadocFromDependencies(Configuration config) {
List<String> javadocs = []
config.dependencies.each { dep ->
javadocs.add(artifactToJavadoc(dep.group, dep.name, dep.version))
}
javadocs
}
static String jvmToJavadoc(JavaVersion jvmVersion) {
if (jvmVersion.java8) {
'https://docs.oracle.com/javase/8/docs/api/'
} else if (jvmVersion.java9) {
'https://docs.oracle.com/javase/9/docs/api/'
}else if (jvmVersion.java10) {
'https://docs.oracle.com/javase/10/docs/api/'
}else if (jvmVersion.java11) {
'https://docs.oracle.com/en/java/javase/11/docs/api/'
} else {
'https://docs.oracle.com/javase/8/docs/api/'
}
}
static String artifactToJavadoc(String organization, String name, String apiVersion) {
String slashedOrg = organization.replace('.', '/')
"https://oss.sonatype.org/service/local/repositories/releases/archive/$slashedOrg/$name/$apiVersion/$name-$apiVersion-javadoc.jar/!/"
}