1 /* 2 * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. 8 * 9 * This code is distributed in the hope that it will be useful, but WITHOUT 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 * version 2 for more details (a copy is included in the LICENSE file that 13 * accompanied this code). 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 */ 23 24 plugins { 25 id 'org.openjdk.skara.gradle.proxy' 26 id 'org.openjdk.skara.gradle.version' 27 id 'org.openjdk.skara.gradle.reproduce' 28 } 29 30 configure(subprojects.findAll() { it.name != 'bots' }) { 31 apply plugin: 'java-library' 32 apply plugin: 'maven-publish' 33 apply plugin: 'org.openjdk.skara.gradle.module' 34 apply plugin: 'org.openjdk.skara.gradle.version' 35 36 group = 'org.openjdk.skara' 37 38 repositories { 39 mavenLocal() 40 maven { 41 url System.getProperty('maven.url', 'https://repo.maven.apache.org/maven2/') 42 } 43 } 44 45 dependencies { 46 testImplementation 'org.junit.jupiter:junit-jupiter-api:5.5.2' 47 testImplementation 'org.junit.jupiter:junit-jupiter-params:5.5.2' 48 testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.5.2' 49 // Force Gradle to load the JUnit Platform Launcher from the module-path, as 50 // configured in buildSrc/.../ModulePlugin.java -- see SKARA-69 for details. 51 testRuntimeOnly 'org.junit.platform:junit-platform-launcher:1.5.2' 52 } 53 54 compileJava.options.encoding = 'UTF-8' 55 compileTestJava.options.encoding = 'UTF-8' 56 57 test { 58 useJUnitPlatform() 59 60 if (findProperty('credentials')) { 61 systemProperty "credentials", findProperty('credentials') 62 } 63 64 testLogging { 65 events "passed", "skipped", "failed" 66 exceptionFormat "full" 67 } 68 } 69 70 publishing { 71 repositories { 72 maven { 73 url = findProperty('mavenRepositoryUrl') 74 credentials { 75 username = findProperty('mavenRepositoryUser') 76 password = findProperty('mavenRepositoryPassword') 77 } 78 } 79 } 80 } 81 82 gradle.taskGraph.whenReady { graph -> 83 if (graph.hasTask(publish) && !findProperty('mavenRepositoryUrl')) { 84 throw new GradleException("To publish artifacts, set the maven repository url -PmavenRepositoryUrl=<url>") 85 } 86 if (graph.hasTask(publish) && !findProperty('mavenRepositoryUser')) { 87 throw new GradleException("To publish artifacts, set the maven repository user name -PmavenRepositoryUser=<user>") 88 } 89 if (graph.hasTask(publish) && !findProperty('mavenRepositoryPassword')) { 90 throw new GradleException("To publish artifacts, set the maven repository password -PmavenRepositoryPassword=<password>") 91 } 92 } 93 } 94 95 task test { 96 subprojects.findAll() { !it.getTasksByName('test', false).isEmpty() }.each { dependsOn "${it.path}:test" } 97 } 98 99 task clean { 100 subprojects.findAll() { !it.getTasksByName('clean', false).isEmpty() }.each { dependsOn "${it.path}:clean" } 101 } 102 103 reproduce { 104 dockerfile = 'test.dockerfile' 105 } 106 107 task local(type: Copy) { 108 doFirst { 109 delete project.buildDir 110 } 111 def os = System.getProperty('os.name').toLowerCase() 112 def osName = os.startsWith('win') ? 'Windows' : 113 os.startsWith('mac') ? 'Macos' : 'Linux' 114 115 dependsOn ':cli:image' + osName 116 from zipTree(file(project.rootDir.toString() + 117 '/cli/build/distributions/cli' + 118 '-' + project.version + '-' + 119 osName.toLowerCase() + '.zip')) 120 into project.buildDir 121 } 122 123 defaultTasks 'local'