view buildSrc/build.gradle @ 8148:6b242a49e749

RT-34893: [Media] Use of QuickTime prevents Mac AppStore Submission Summary: Added new media platform module which uses AVFoundation instead of QTKit Reviewed-by: almatvee, stayer, kcr, flar
author ddehaven
date Mon, 06 Oct 2014 09:32:41 -0700
parents c1c6f4066627
children 32b4f835090b
line wrap: on
line source
/*
 * Copyright (c) 2013, 2014, 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.  Oracle designates this
 * particular file as subject to the "Classpath" exception as provided
 * by Oracle in the LICENSE file that accompanied this code.
 *
 * 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.
 */

/**
 * Build file for buildSrc project. The buildSrc project contains the annotation
 * processor that is used to generate the builders, the decora compiler used for effects,
 * and various annotations we use for FXML, etc. It also contains build script logic such
 * as for compiling native code. Nothing in buildSrc should *ever* be shipped with the runtime.
 */

/**
 * If the given named property is not defined, then this method will define
 * it with the given defaultValue. Any properties defined by this method can
 * be substituted on the command line by using -P, or by specifying a
 * gradle.properties file in the user home dir
 *
 * @param name The name of the property to define
 * @param defaultValue The default value to assign the property
 */
void defineProperty(String name, String defaultValue) {
    if (!project.hasProperty(name)) {
        project.ext.set(name, defaultValue);
    }
}

def closedDir = file("../../rt-closed")
def buildClosed = closedDir.isDirectory()

if (buildClosed) {
    File supplementalBuildFile = new File("../../rt-closed/closed-properties.gradle");
    apply from: supplementalBuildFile
}

apply plugin: "java"


repositories {
    if (buildClosed) {
        ivy {
            url jfxRepositoryURL
            layout "pattern", {
                artifact "[artifact]-[revision].[ext]"
                artifact "[artifact].[ext]"
            }
        }
    } else {
        mavenCentral()
    }
}

// Include the to-be-generated antlr source files in the source set. We will generate
// the antlr sources first before compilation.
sourceSets {
    main.java.srcDirs = ["src/main/java", "$buildDir/generated-src/antlr"]
}

// Workaround for lack of Antlr 3 support in Gradle. By defining a configuration,
// we can then give it a class path and use that classpath to execute a java command
getConfigurations().create("antlr3");

dependencies {
    compile     group: "org.antlr", name: "antlr",          version: "3.1.3"
    testCompile group: "junit",     name: "junit",          version: "4.8.2"
    antlr3      group: "org.antlr", name: "antlr-runtime",  version: "3.1.3"
    antlr3      group: "org.antlr", name: "stringtemplate", version: "3.2"
    antlr3      group: "org.antlr", name: "antlr",          version: "3.1.3"
}

// At the moment the ASM library shipped with Gradle that is used to
// discover the different test classes fails on Java 8, so in order
// to have sourceCompatibility set to 1.8 I have to also turn scanForClasses off
// and manually specify the includes / excludes. At the moment we use
// Java 7 but when we switch to 8 this will be needed, and probably again when
// we start building with Java 9.
test {
    jvmArgs("-Djava.ext.dirs=");
    enableAssertions = true;
    testLogging.exceptionFormat = "full";
    scanForTestClasses = false;
    include("**/*Test.*");
    exclude("**/DepthTest.*");
    exclude("**/*Abstract*.*");
}

// This is the task that will call antlr to generate the sources
task generateGrammarSource(type: JavaExec) {
    description = "Generate JSL parser from Antlr3 grammars"
    String dest = "$buildDir/generated-src/antlr/com/sun/scenario/effect/compiler"
    String src = "src/main/antlr"
    inputs.dir file(src)
    outputs.dir file(dest)
    def grammars = fileTree(src).include("**/*.g")
    main = "org.antlr.Tool"
    classpath = configurations.antlr3
    args = ["-o", dest, grammars.files].flatten()
    // See RT-30955. This should be removed when JDK-8015656 is fixed
    ignoreExitValue = true
}

// Configure the compileJava task so that it relies on the task for generating
// the grammar source (gotta have it prior to compilation)
compileJava {
    dependsOn(generateGrammarSource);
}