forked from btraceio/btrace
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcommon.gradle
111 lines (92 loc) · 2.75 KB
/
common.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
//
// This file is to be applied to every subproject.
//
apply plugin: 'java'
apply plugin: 'maven'
apply plugin: 'idea'
project.group = 'org.openjdk.btrace'
project.version = '2.3.0-SNAPSHOT'
sourceCompatibility = '8'
targetCompatibility = '8'
if (!project.hasProperty("JAVA_8_HOME")) {
project.ext.setProperty("JAVA_8_HOME", System.getenv("JAVA_8_HOME"));
}
if (!project.hasProperty("JAVA_9_HOME")) {
project.ext.setProperty("JAVA_9_HOME", System.getenv("JAVA_9_HOME"));
}
if (!project.hasProperty("JAVA_11_HOME")) {
project.ext.setProperty("JAVA_11_HOME", System.getenv("JAVA_11_HOME"));
}
if (!project.hasProperty("JAVA_16_HOME")) {
project.ext.setProperty("JAVA_16_HOME", System.getenv("JAVA_16_HOME"));
}
buildscript {
repositories {
mavenCentral()
jcenter()
}
}
googleJavaFormat {
exclude '**/resources/**/*.java'
exclude '**/test/btrace/**.java'
}
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
compileJava {
options.fork = true
options.forkOptions.executable = "${project.property("JAVA_8_HOME")}/bin/javac"
}
repositories {
mavenCentral()
// You may define additional repositories, or even remove "mavenCentral()".
// Read more about repositories here:
// http://www.gradle.org/docs/current/userguide/dependency_management.html#sec:repositories
jcenter()
}
dependencies {
// Adding dependencies here will add the dependencies to each subproject.
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.7.1'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.7.1'
}
String mavenArtifactId = name
javadoc {
options.addStringOption('Xdoclint:all,-missing', '-quiet')
executable = "${JAVA_8_HOME}/bin/javadoc"
failOnError true
}
task sourcesJar(type: Jar, dependsOn: classes, description: 'Creates a jar from the source files.') {
classifier = 'sources'
from sourceSets.main.allSource
}
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}
artifacts {
archives jar
archives sourcesJar
archives javadocJar
}
configure(install.repositories.mavenInstaller) {
pom.project {
groupId = group ?: "org.openjdk.btrace"
artifactId = mavenArtifactId
version = version ?: "0"
}
}
task createFolders(description: 'Creates the source folders if they do not exist.') doLast {
sourceSets*.allSource*.srcDirs*.each { File srcDir ->
if (!srcDir.isDirectory()) {
println "Creating source folder: ${srcDir}"
srcDir.mkdirs()
}
}
}
test {
useJUnitPlatform()
// Always run tests, even when nothing changed.
dependsOn 'cleanTest'
// Show test results.
testLogging {
events "passed", "skipped", "failed"
}
}