forked from openjdk/skara
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
122 lines (105 loc) · 4.21 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
/*
* Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
plugins {
id 'org.openjdk.skara.gradle.proxy'
id 'org.openjdk.skara.gradle.version'
id 'org.openjdk.skara.gradle.reproduce'
}
configure(subprojects.findAll() { it.name != 'bots' }) {
apply plugin: 'java-library'
apply plugin: 'maven-publish'
apply plugin: 'org.openjdk.skara.gradle.module'
apply plugin: 'org.openjdk.skara.gradle.version'
group = 'org.openjdk.skara'
repositories {
mavenLocal()
maven {
url System.getProperty('maven.url', 'https://repo.maven.apache.org/maven2/')
}
}
dependencies {
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.5.2'
testImplementation 'org.junit.jupiter:junit-jupiter-params:5.5.2'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.5.2'
// Force Gradle to load the JUnit Platform Launcher from the module-path, as
// configured in buildSrc/.../ModulePlugin.java -- see SKARA-69 for details.
testRuntimeOnly 'org.junit.platform:junit-platform-launcher:1.5.2'
}
compileJava.options.encoding = 'UTF-8'
compileTestJava.options.encoding = 'UTF-8'
test {
useJUnitPlatform()
if (findProperty('credentials')) {
systemProperty "credentials", findProperty('credentials')
}
testLogging {
events "passed", "skipped", "failed"
}
}
publishing {
repositories {
maven {
url = findProperty('mavenRepositoryUrl')
credentials {
username = findProperty('mavenRepositoryUser')
password = findProperty('mavenRepositoryPassword')
}
}
}
}
gradle.taskGraph.whenReady { graph ->
if (graph.hasTask(publish) && !findProperty('mavenRepositoryUrl')) {
throw new GradleException("To publish artifacts, set the maven repository url -PmavenRepositoryUrl=<url>")
}
if (graph.hasTask(publish) && !findProperty('mavenRepositoryUser')) {
throw new GradleException("To publish artifacts, set the maven repository user name -PmavenRepositoryUser=<user>")
}
if (graph.hasTask(publish) && !findProperty('mavenRepositoryPassword')) {
throw new GradleException("To publish artifacts, set the maven repository password -PmavenRepositoryPassword=<password>")
}
}
}
task test {
subprojects.findAll() { !it.getTasksByName('test', false).isEmpty() }.each { dependsOn "${it.path}:test" }
}
task clean {
subprojects.findAll() { !it.getTasksByName('clean', false).isEmpty() }.each { dependsOn "${it.path}:clean" }
}
reproduce {
dockerfile = 'test.dockerfile'
}
task local(type: Copy) {
doFirst {
delete project.buildDir
}
def os = System.getProperty('os.name').toLowerCase()
def osName = os.startsWith('win') ? 'Windows' :
os.startsWith('mac') ? 'Macos' : 'Linux'
dependsOn ':cli:image' + osName
from zipTree(file(project.rootDir.toString() +
'/cli/build/distributions/cli' +
'-' + project.version + '-' +
osName.toLowerCase() + '.zip'))
into project.buildDir
}
defaultTasks 'local'