1 /*
   2  * Copyright (c) 2013, 2018, 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.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 /**
  27  * Build file for buildSrc project. The buildSrc project contains the annotation
  28  * processor that is used to generate the decora compiler used for effects,
  29  * and various annotations we use for FXML, etc. It also contains build script logic such
  30  * as for compiling native code. Nothing in buildSrc should *ever* be shipped with the runtime.
  31  */
  32 
  33 /**
  34  * If the given named property is not defined, then this method will define
  35  * it with the given defaultValue. Any properties defined by this method can
  36  * be substituted on the command line by using -P, or by specifying a
  37  * gradle.properties file in the user home dir
  38  *
  39  * @param name The name of the property to define
  40  * @param defaultValue The default value to assign the property
  41  */
  42 void defineProperty(String name, String defaultValue) {
  43     if (!project.hasProperty(name)) {
  44         project.ext.set(name, defaultValue);
  45     }
  46 }
  47 
  48 def closedDir = file("../../rt-closed")
  49 def buildClosed = closedDir.isDirectory()
  50 
  51 if (buildClosed) {
  52     File supplementalBuildFile = new File("../../rt-closed/closed-properties.gradle");
  53     apply from: supplementalBuildFile
  54 }
  55 
  56 apply plugin: "java"
  57 
  58 
  59 repositories {
  60     if (buildClosed) {
  61         ivy {
  62             url jfxRepositoryURL
  63             layout "pattern", {
  64                 artifact "[artifact]-[revision].[ext]"
  65                 artifact "[artifact].[ext]"
  66             }
  67         }
  68     } else {
  69         mavenCentral()
  70     }
  71 }
  72 
  73 dependencies {
  74     testCompile group: "junit",     name: "junit",          version: "4.8.2"
  75 }
  76 
  77 // At the moment the ASM library shipped with Gradle that is used to
  78 // discover the different test classes fails on Java 8, so in order
  79 // to have sourceCompatibility set to 1.8 I have to also turn scanForClasses off
  80 // and manually specify the includes / excludes. At the moment we use
  81 // Java 7 but when we switch to 8 this will be needed, and probably again when
  82 // we start building with Java 9.
  83 test {
  84     enableAssertions = true;
  85     testLogging.exceptionFormat = "full";
  86     scanForTestClasses = false;
  87     include("**/*Test.*");
  88     exclude("**/DepthTest.*");
  89     exclude("**/*Abstract*.*");
  90 }