annotate build.gradle @ 8397:3bcb55ac0869

Automated merge with http://hg.openjdk.java.net/openjfx/8u/rt
author kcr
date Mon, 03 Nov 2014 13:18:35 -0800
parents 11bb1d4546fd ee5b9dda302a
children f7cf8271d635
rev   line source
richard@3002 1 /*
kcr@6534 2 * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
richard@3002 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
richard@3002 4 *
richard@3002 5 * This code is free software; you can redistribute it and/or modify it
richard@3002 6 * under the terms of the GNU General Public License version 2 only, as
richard@3002 7 * published by the Free Software Foundation. Oracle designates this
richard@3002 8 * particular file as subject to the "Classpath" exception as provided
richard@3002 9 * by Oracle in the LICENSE file that accompanied this code.
richard@3002 10 *
richard@3002 11 * This code is distributed in the hope that it will be useful, but WITHOUT
richard@3002 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
richard@3002 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
richard@3002 14 * version 2 for more details (a copy is included in the LICENSE file that
richard@3002 15 * accompanied this code).
richard@3002 16 *
richard@3002 17 * You should have received a copy of the GNU General Public License version
richard@3002 18 * 2 along with this work; if not, write to the Free Software Foundation,
richard@3002 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
richard@3002 20 *
richard@3002 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
richard@3002 22 * or visit www.oracle.com if you need additional information or have any
richard@3002 23 * questions.
richard@3002 24 */
richard@3002 25
richard@2472 26 /**
rbair@2559 27 * The main build script for JavaFX.
richard@2472 28 *
richard@3002 29 * MUST FIX tasks to complete:
richard@3002 30 * - build check -- making sure the final artifact has the right bits
richard@3069 31 * - some things worth automatically sanity checking:
richard@3069 32 * - are there images in the javadocs?
richard@3069 33 * - are all of the expected dylibs etc there?
richard@3069 34 * - is jfxrt.jar there?
richard@3069 35 * - does jfxrt.jar contain stuff it shouldn't (doc-files, iml, etc)
richard@3069 36 * - does jfxrt.jar contain stuff it should (bss files, etc)
richard@3021 37 * - Perform sanity checking to make sure a JDK exists with javac, javah, etc
richard@3021 38 * - Support building with no known JDK location, as long as javac, javah, etc are on the path
richard@3021 39 * - Check all of the native flags. We're adding weight to some libs that don't need it, and so forth.
richard@3002 40 *
richard@3002 41 * Additional projects to work on as we go:
richard@3156 42 * - Add "developer debug". This is where the natives do not have debug symbols, but the Java code does
richard@3013 43 * - The genVSproperties.bat doesn't find the directory where RC.exe lives. So it is hard coded. Might be a problem.
richard@2472 44 * - special tasks for common needs, such as:
richard@2472 45 * - updating copyright headers
richard@2472 46 * - stripping trailing whitespace (?)
richard@2472 47 * - checkstyle
richard@2472 48 * - findbugs
richard@2472 49 * - re needs?
rbair@2828 50 * - sqe testing
richard@2472 51 * - API change check
richard@2472 52 * - Pushing results to a repo?
richard@2476 53 * - ServiceWithSecurityManagerTest fails to complete when run from gradle.
rbair@2707 54 * - Integrate Parfait reports for C code
rbair@2828 55 * - FXML Project tests are not running
rbair@2749 56 */
kcr@3624 57 defaultTasks = ["sdk"]
rbair@2749 58
kcr@3415 59 import java.util.concurrent.CountDownLatch
kcr@3415 60 import java.util.concurrent.ExecutorService
kcr@3415 61 import java.util.concurrent.Executors
kcr@3415 62 import java.util.concurrent.Future
kcr@3415 63
rbair@2749 64 /******************************************************************************
richard@2983 65 * Utility methods *
rbair@2749 66 *****************************************************************************/
rbair@2749 67
richard@3008 68 /**
richard@3008 69 * If the given named property is not defined, then this method will define
richard@3008 70 * it with the given defaultValue. Any properties defined by this method can
richard@3008 71 * be substituted on the command line by using -P, or by specifying a
richard@3008 72 * gradle.properties file in the user home dir
richard@3008 73 *
richard@3008 74 * @param name The name of the property to define
richard@3008 75 * @param defaultValue The default value to assign the property
richard@3008 76 */
richard@2983 77 void defineProperty(String name, String defaultValue) {
richard@2983 78 if (!project.hasProperty(name)) {
richard@2983 79 project.ext.set(name, defaultValue);
richard@2983 80 }
rbair@2749 81 }
rbair@2749 82
richard@2983 83 /**
richard@2983 84 * If the given named property is not defined, then this method will attempt to
richard@2983 85 * look up the property in the props map, and use the defaultValue if it cannot be found.
richard@2983 86 *
richard@2983 87 * @param name The name of the property to look up and/or define
richard@2983 88 * @param props The properties to look for the named property in, if it has not already been defined
richard@2983 89 * @param defaultValue The default value if the property has not been defined and the
richard@2983 90 * props map does not contain the named property
richard@2983 91 */
richard@2983 92 void defineProperty(String name, Properties props, String defaultValue) {
richard@2983 93 if (!project.hasProperty(name)) {
richard@2983 94 project.ext.set(name, props.getProperty(name, defaultValue));
richard@2983 95 }
rbair@2825 96 }
rbair@2825 97
richard@3156 98 /**
rbair@3458 99 * Converts cygwin style paths to windows style paths, but with a forward slash.
rbair@3458 100 * This method is safe to call from any platform, and will only do work if
rbair@3458 101 * called on Windows (in all other cases it simply returns the supplied path.
rbair@3458 102 * In the future I would like to modify this so that it only does work if
rbair@3458 103 * cygwin is installed, as I hope one day to remove the requirement to build
rbair@3458 104 * with cygwin, but at present (due to GStreamer / Webkit) cygwin is needed
rbair@3458 105 * anyway.
shemnon@8032 106 *
rbair@3458 107 * @param path the path to convert
rbair@3458 108 * @return the path converted to windows style, if on windows, otherwise it
rbair@3458 109 * is the supplied path.
rbair@3458 110 */
rbair@3328 111 String cygpath(String path) {
rbair@3328 112 if (!IS_WINDOWS) return path;
anthony@5699 113 if (path == null || "".equals(path)) return path;
rbair@3328 114 ByteArrayOutputStream out = new ByteArrayOutputStream();
richard@3479 115 logger.info("Converting path '$path' via cygpath")
rbair@3328 116 exec {
rbair@3328 117 standardOutput = out
rbair@3328 118 commandLine "cmd", "/c", "cygpath", "-m", path
rbair@3328 119 }
rbair@3328 120 return out.toString().trim();
rbair@3328 121 }
rbair@3328 122
kcr@4498 123 void loadProperties(String sourceFileName) {
kcr@4498 124 def config = new Properties()
kcr@4498 125 def propFile = new File(sourceFileName)
kcr@4498 126 if (propFile.canRead()) {
kcr@4498 127 config.load(new FileInputStream(propFile))
kcr@4498 128 for (Map.Entry property in config) {
kcr@4498 129 def keySplit = property.key.split("\\.");
kcr@4498 130 def key = keySplit[0];
kcr@4498 131 for (int i = 1; i < keySplit.length; i++) {
kcr@4498 132 key = key + keySplit[i].capitalize();
kcr@4498 133 }
kcr@4498 134 ext[key] = property.value;
kcr@4498 135 }
kcr@4498 136 }
kcr@4498 137 }
kcr@4498 138
rbair@3458 139 /**
rbair@3458 140 * Struct used to contain some information passed to the closure
rbair@3458 141 * passed to compileTargets.
rbair@3458 142 */
rbair@3458 143 class CompileTarget {
rbair@3458 144 String name;
rbair@3458 145 String upper;
rbair@3458 146 String capital;
rbair@3458 147 }
rbair@3458 148
rbair@3458 149 /**
rbair@3458 150 * Iterates over each of the compile targets, passing the given closure
rbair@3458 151 * a CompileTarget instance.
shemnon@8032 152 *
rbair@3458 153 * @param c The closure to call
rbair@3458 154 */
rbair@3458 155 void compileTargets(Closure c) {
Tomas@4265 156 if (COMPILE_TARGETS == "") {
Tomas@4265 157 return
Tomas@4265 158 }
rbair@3458 159 COMPILE_TARGETS.split(",").each { target ->
rbair@3458 160 CompileTarget ct = new CompileTarget();
rbair@3458 161 ct.name = target;
leifs@4851 162 ct.upper = target.trim().toUpperCase(Locale.ROOT)
richard@3487 163 ct.capital = target.trim().capitalize()
rbair@3458 164 c(ct)
rbair@3458 165 }
rbair@3458 166 }
rbair@3458 167
rbair@3458 168 /**
rbair@3458 169 * Manages the execution of some closure which is responsible for producing
rbair@3458 170 * content for a properties file built at build time and stored in the
rbair@3458 171 * root project's $buildDir, and then loading that properties file and
rbair@3458 172 * passing it to the processor closure.
shemnon@8032 173 *
rbair@3458 174 * This is used on windows to produce a properties file containing all the
rbair@3458 175 * windows visual studio paths and environment variables, and on Linux
rbair@3458 176 * for storing the results of pkg-config calls.
shemnon@8032 177 *
rbair@3458 178 * @param name the name of the file to produce
rbair@3458 179 * @param loader a closure which is invoked, given the properties file. This
rbair@3458 180 * closure is invoked only if the properties file needs to be created
rbair@3458 181 * and is responsible for populating the properties file.
rbair@3458 182 * @param processor a closure which is invoked every time this method is
rbair@3458 183 * called and which will be given a Properties object, fully populated.
rbair@3458 184 * The processor is then responsible for doing whatever it is that it
rbair@3458 185 * must do with those properties (such as setting up environment
rbair@3458 186 * variables used in subsequent native builds, or whatnot).
rbair@3458 187 */
rbair@3458 188 void setupTools(String name, Closure loader, Closure processor) {
rbair@3458 189 // Check to see whether $buildDir/$name.properties file exists. If not,
rbair@3458 190 // then generate it. Once generated, we need to read the properties file to
rbair@3458 191 // help us define the defaults for this block of properties
rbair@3458 192 File propFile = file("$buildDir/${name}.properties");
rbair@3458 193 if (!propFile.exists()) {
rbair@3458 194 // Create the properties file
rbair@3458 195 propFile.getParentFile().mkdirs();
rbair@3458 196 propFile.createNewFile();
rbair@3458 197 loader(propFile);
rbair@3458 198 }
rbair@3458 199
rbair@3458 200 // Try reading the properties in order to define the properties. If the property file cannot
rbair@3458 201 // be located, then we will throw an exception because we cannot guess these values
rbair@3458 202 InputStream propStream = null;
rbair@3458 203 try {
rbair@3458 204 Properties properties = new Properties();
rbair@3458 205 propStream = new FileInputStream(propFile);
rbair@3458 206 properties.load(propStream);
rbair@3458 207 processor(properties);
rbair@3458 208 } finally {
rbair@3458 209 try { propStream.close() } catch (Exception e) { }
rbair@3458 210 }
rbair@3458 211 }
rbair@3458 212
kcr@4094 213 /**
kcr@4094 214 * Fails the build with the specified error message
kcr@4094 215 *
kcr@4094 216 * @param msg the reason for the failure
kcr@4094 217 */
kcr@4094 218 void fail(String msg) {
kcr@4094 219 throw new GradleException("FAIL: " + msg);
kcr@4094 220 }
kcr@4094 221
richard@2983 222 /******************************************************************************
richard@2983 223 * *
richard@2983 224 * Definition of project properties *
richard@2983 225 * *
richard@2983 226 * All properties defined using ext. are immediately available throughout *
richard@2983 227 * the script as variables that can be used. These variables are attached *
richard@2983 228 * to the root project (whereas if they were defined as def variables then *
richard@2983 229 * they would only be available within the root project scope). *
richard@2983 230 * *
richard@2983 231 * All properties defined using the "defineProperty" method can be replaced *
richard@2983 232 * on the command line by using the -P flag. For example, to override the *
richard@3016 233 * location of the binary plug, you would specify -PBINARY_PLUG=some/where *
richard@2983 234 * *
richard@2983 235 *****************************************************************************/
rbair@2749 236
kcr@4078 237 // If the ../rt-closed directory exists, then we are doing a closed build.
kcr@4078 238 // In this case, build and property files will be read from
kcr@3624 239 // ../rt-closed/closed-build.gradle and ../rt-closed/closed-properties.gradle
kcr@3624 240 // respectively
kcr@3624 241
kcr@4078 242 def closedDir = file("../rt-closed")
kcr@4078 243 def buildClosed = closedDir.isDirectory()
kcr@3784 244 ext.BUILD_CLOSED = buildClosed
kcr@3624 245
rbair@3458 246 // These variables indicate what platform is running the build. Is
richard@3008 247 // this build running on a Mac, Windows, or Linux machine? 32 or 64 bit?
rbair@3458 248 ext.OS_NAME = System.getProperty("os.name").toLowerCase()
rbair@3458 249 ext.OS_ARCH = System.getProperty("os.arch")
rbair@3458 250 ext.IS_64 = OS_ARCH.toLowerCase().contains("64")
rbair@3458 251 ext.IS_MAC = OS_NAME.contains("mac") || OS_NAME.contains("darwin")
rbair@3458 252 ext.IS_WINDOWS = OS_NAME.contains("windows")
rbair@3458 253 ext.IS_LINUX = OS_NAME.contains("linux")
richard@2983 254
richard@2983 255 // Get the JDK_HOME automatically based on the version of Java used to execute gradle. Or, if specified,
kcr@5886 256 // use a user supplied JDK_HOME, STUB_RUNTIME, JAVAC, and/or JAVAH, all of which may be specified
richard@3212 257 // independently (or we'll try to get the right one based on other supplied info). Sometimes the
richard@3212 258 // JRE might be the thing that is being used instead of the JRE embedded in the JDK, such as:
richard@3016 259 // c:\Program Files (x86)\Java\jdk1.8.0\jre
richard@3016 260 // c:\Program Files (x86)\Java\jre8\
richard@3016 261 // Because of this, you may sometimes get the jdk's JRE (in which case the logic we used to have here
richard@3016 262 // was correct and consistent with all other platforms), or it might be the standalone JRE (for the love!).
anthony@5699 263 def envJavaHome = cygpath(System.getenv("JDK_HOME"))
anthony@5699 264 if (envJavaHome == null || envJavaHome.equals("")) envJavaHome = cygpath(System.getenv("JAVA_HOME"))
kcr@5051 265 def javaHome = envJavaHome == null || envJavaHome.equals("") ? System.getProperty("java.home") : envJavaHome
kcr@5051 266 def javaHomeFile = file(javaHome)
richard@3016 267 defineProperty("JDK_HOME",
richard@3016 268 javaHomeFile.name == "jre" ?
richard@3016 269 javaHomeFile.getParent().toString() :
richard@3016 270 javaHomeFile.name.startsWith("jre") ?
richard@3016 271 new File(javaHomeFile.getParent(), "jdk1.${javaHomeFile.name.substring(3)}.0").toString() :
kcr@5051 272 javaHome) // we have to bail and set it to something and this is as good as any!
kcr@5051 273 ext.JAVA_HOME = JDK_HOME
rbair@3458 274 defineProperty("JAVA", cygpath("$JDK_HOME/bin/java${IS_WINDOWS ? '.exe' : ''}"))
rbair@3458 275 defineProperty("JAVAC", cygpath("$JDK_HOME/bin/javac${IS_WINDOWS ? '.exe' : ''}"))
rbair@3458 276 defineProperty("JAVAH", cygpath("$JDK_HOME/bin/javah${IS_WINDOWS ? '.exe' : ''}"))
rbair@3458 277 defineProperty("JAVADOC", cygpath("$JDK_HOME/bin/javadoc${IS_WINDOWS ? '.exe' : ''}"))
kcr@6534 278 defineProperty("JDK_DOCS", "http://docs.oracle.com/javase/8/docs/api/")
David@4103 279
kcr@4498 280 defineProperty("javaRuntimeVersion", System.getProperty("java.runtime.version"))
kcr@6464 281 defineProperty("javaVersion", javaRuntimeVersion.split("-")[0])
kcr@4498 282 defineProperty("javaBuildNumber", javaRuntimeVersion.substring(javaRuntimeVersion.lastIndexOf("-b") + 2))
kcr@4498 283
kcr@4498 284 loadProperties("$projectDir/build.properties")
kcr@4498 285
David@4103 286 def String closedCacheStubRuntime = cygpath("$projectDir") + "/../caches/sdk/rt"
David@4103 287 defineProperty("STUB_RUNTIME", BUILD_CLOSED ? closedCacheStubRuntime : cygpath("$JDK_HOME/jre"))
David@4103 288 defineProperty("LIBRARY_STUB", IS_MAC ? "$STUB_RUNTIME/lib" :
David@4103 289 IS_WINDOWS ? "$STUB_RUNTIME/bin" :
David@4103 290 "$STUB_RUNTIME/lib/$OS_ARCH")
David@4103 291 defineProperty("UPDATE_STUB_CACHE", (STUB_RUNTIME.equals(closedCacheStubRuntime) ? 'true' : 'false'))
richard@2983 292
kcr@4083 293 def supplementalPreBuildFile = file("$closedDir/closed-pre-build.gradle");
richard@4045 294 def supplementalBuildFile = file("$closedDir/closed-build.gradle");
richard@4045 295
richard@4045 296 if (BUILD_CLOSED) {
kcr@4083 297 apply from: supplementalPreBuildFile
richard@4045 298 }
richard@4045 299
kcr@6537 300 // GRADLE_VERSION_CHECK specifies whether to fail the build if the
kcr@6537 301 // gradle version check fails
kcr@6537 302 defineProperty("GRADLE_VERSION_CHECK", "true")
kcr@6537 303 ext.IS_GRADLE_VERSION_CHECK = Boolean.parseBoolean(GRADLE_VERSION_CHECK)
kcr@6537 304
kcr@5525 305 // COMPILE_WEBKIT specifies whether to build all of webkit.
richard@3156 306 defineProperty("COMPILE_WEBKIT", "false")
kcr@5525 307 ext.IS_COMPILE_WEBKIT = Boolean.parseBoolean(COMPILE_WEBKIT)
kcr@5525 308
kcr@5525 309 // COMPILE_MEDIA specifies whether to build all of media.
kirill@5407 310 defineProperty("COMPILE_MEDIA", "false")
kcr@5525 311 ext.IS_COMPILE_MEDIA = Boolean.parseBoolean(COMPILE_MEDIA)
richard@3156 312
kcr@5526 313 // COMPILE_PANGO specifies whether to build javafx_font_pango.
kcr@5545 314 defineProperty("COMPILE_PANGO", "${IS_LINUX}")
kcr@5525 315 ext.IS_COMPILE_PANGO = Boolean.parseBoolean(COMPILE_PANGO)
felipe@4255 316
daniel@6175 317 // COMPILE_HARFBUZZ specifies whether to use Harfbuzz.
daniel@6175 318 defineProperty("COMPILE_HARFBUZZ", "false")
daniel@6175 319 ext.IS_COMPILE_HARFBUZZ = Boolean.parseBoolean(COMPILE_HARFBUZZ)
daniel@6175 320
felipe@4973 321 // COMPILE_PARFAIT specifies whether to build parfait
felipe@4973 322 defineProperty("COMPILE_PARFAIT", "false")
kcr@5525 323 ext.IS_COMPILE_PARFAIT = Boolean.parseBoolean(COMPILE_PARFAIT)
felipe@4973 324
martin@6981 325 // COMPILE_JFR specifies whether to build code that logs to JRockit Flight Recorder
martin@6981 326 defineProperty("COMPILE_JFR", Boolean.toString(file("$JDK_HOME/jre/lib/jfr.jar").exists()))
martin@6981 327 ext.IS_COMPILE_JFR = Boolean.parseBoolean(COMPILE_JFR)
martin@6981 328
shemnon@6330 329 // RETAIN_PACKAGER_TESTS specifies whether the tests in fxpackager should
shemnon@6330 330 // keep generated files instead of attempting to automatically delete them
shemnon@6330 331 defineProperty("RETAIN_PACKAGER_TESTS", "false")
shemnon@6330 332 ext.IS_RETAIN_PACKAGER_TESTS = Boolean.parseBoolean(RETAIN_PACKAGER_TESTS)
felipe@4255 333
shemnon@8024 334 // TEST_PACKAGER_DMG whether tests that create DMG files via hdiutil
shemnon@8024 335 // should be run. On OSX 10.7 this tends to hang automated builds
shemnon@8024 336 defineProperty("TEST_PACKAGER_DMG", "false")
shemnon@8024 337 ext.IS_TEST_PACKAGER_DMG = Boolean.parseBoolean(TEST_PACKAGER_DMG)
shemnon@8024 338
richard@2983 339 // Define the SWT.jar that we are going to have to download during the build process based
rbair@3458 340 // on what platform we are compiling from (not based on our target).
richard@3325 341 ext.SWT_FILE_NAME = IS_MAC ? "org.eclipse.swt.cocoa.macosx.x86_64_3.7.2.v3740f" :
richard@3325 342 IS_WINDOWS && IS_64 ? "org.eclipse.swt.win32.win32.x86_64_3.7.2.v3740f" :
richard@3325 343 IS_WINDOWS && !IS_64 ? "org.eclipse.swt.win32.win32.x86_3.7.2.v3740f" :
richard@3325 344 IS_LINUX && IS_64 ? "org.eclipse.swt.gtk.linux.x86_64_3.7.2.v3740f" :
rbair@3458 345 IS_LINUX && !IS_64 ? "org.eclipse.swt.gtk.linux.x86_3.7.2.v3740f" : ""
richard@2983 346
kcr@4079 347 // Build javadocs only if BUILD_JAVADOC=true
kcr@5525 348 defineProperty("BUILD_JAVADOC", "false")
kcr@5525 349 ext.IS_BUILD_JAVADOC = Boolean.parseBoolean(BUILD_JAVADOC)
kcr@3950 350
kcr@5299 351 // Specifies whether to build the javafx-src bundle
kcr@5299 352 defineProperty("BUILD_SRC_ZIP", "false")
kcr@5299 353 ext.IS_BUILD_SRC_ZIP = Boolean.parseBoolean(BUILD_SRC_ZIP)
kcr@5299 354
kcr@5006 355 // Specifies whether to run full tests (true) or smoke tests (false)
kcr@5525 356 defineProperty("FULL_TEST", "false")
kcr@5525 357 ext.IS_FULL_TEST = Boolean.parseBoolean(FULL_TEST);
kcr@5006 358
kcr@5548 359 // Specifies whether to run robot-based visual tests (only used when FULL_TEST is also enabled)
kcr@6509 360 defineProperty("USE_ROBOT", "false")
kcr@5548 361 ext.IS_USE_ROBOT = Boolean.parseBoolean(USE_ROBOT);
kcr@5548 362
daniel@6168 363 // Specified whether to run tests in headless mode
daniel@6168 364 defineProperty("HEADLESS_TEST", "false")
daniel@6168 365 ext.IS_HEADLESS_TEST = Boolean.parseBoolean(HEADLESS_TEST);
daniel@6168 366
kcr@5629 367 // Specifies whether to run system tests that depend on AWT (only used when FULL_TEST is also enabled)
kcr@5629 368 defineProperty("AWT_TEST", "true")
kcr@5629 369 ext.IS_AWT_TEST = Boolean.parseBoolean(AWT_TEST);
kcr@5629 370
kcr@5292 371 // Specify the build configuration (Release, Debug, or DebugNative)
kcr@5292 372 defineProperty("CONF", "Debug")
kcr@5292 373 ext.IS_DEBUG_JAVA = CONF == "Debug" || CONF == "DebugNative"
kcr@5292 374 ext.IS_DEBUG_NATIVE = CONF == "DebugNative"
richard@3156 375
richard@3156 376 // Defines the compiler warning levels to use. If empty, then no warnings are generated. If
richard@3156 377 // not empty, then the expected syntax is as a space or comma separated list of names, such
richard@3156 378 // as defined in the javac documentation.
rbair@3458 379 defineProperty("LINT", "none")
rbair@3458 380 ext.IS_LINT = LINT != "none"
richard@3156 381
rbair@3458 382 defineProperty("DOC_LINT", "none")
rbair@3458 383 ext.IS_DOC_LINT = DOC_LINT != "none"
richard@3156 384
richard@3156 385 // Specifies whether to use the "useDepend" option when compiling Java sources
kcr@4079 386 defineProperty("USE_DEPEND", "true")
kcr@5141 387 ext.IS_USE_DEPEND = Boolean.parseBoolean(USE_DEPEND)
richard@3156 388
kcr@4368 389 // Specifies whether to generate code coverage statistics when running tests
kcr@4368 390 defineProperty("JCOV", "false")
kcr@4368 391 ext.DO_JCOV = Boolean.parseBoolean(JCOV)
kcr@4368 392
richard@2983 393 // Define the number of threads to use when compiling (specifically for native compilation)
kcr@6578 394 // On Mac we limit it to 1 by default due to problems running gcc in parallel
kcr@6578 395 if (IS_MAC) {
kcr@6578 396 defineProperty("NUM_COMPILE_THREADS", "1")
kcr@6578 397 } else {
kcr@6578 398 defineProperty("NUM_COMPILE_THREADS", "${Runtime.runtime.availableProcessors()}")
kcr@6578 399 }
rbair@3458 400
kcr@3624 401 //
kcr@5877 402 // The next three sections of properties are used to generate the
kcr@5877 403 // VersionInfo class, and the Windows DLL manifest.
kcr@5877 404 //
kcr@5877 405
kcr@5877 406 // The following properties should be left alone by developers and set only from Hudson.
rbair@3458 407 defineProperty("HUDSON_JOB_NAME", "not_hudson")
rbair@3458 408 defineProperty("HUDSON_BUILD_NUMBER","0000")
rbair@3458 409 defineProperty("PROMOTED_BUILD_NUMBER", "00")
kcr@5877 410
kcr@5877 411 // The following properties define the product name for Oracle JDK and OpenJDK
kcr@5877 412 // for VersionInfo and the DLL manifest.
felipe@5790 413 if (BUILD_CLOSED) {
felipe@5790 414 defineProperty("PRODUCT_NAME", "Java(TM)")
felipe@5790 415 defineProperty("COMPANY_NAME", "Oracle Corporation")
felipe@5790 416 defineProperty("PLATFORM_NAME", "Platform SE")
felipe@5790 417 } else {
felipe@5790 418 defineProperty("PRODUCT_NAME", "OpenJFX")
felipe@5790 419 defineProperty("COMPANY_NAME", "N/A")
felipe@5790 420 defineProperty("PLATFORM_NAME", "Platform")
felipe@5790 421 }
kcr@5877 422
kcr@5877 423 // The following properties are set based on properties defined in
kcr@5877 424 // build.properties. The release number or milestone number should be updated
kcr@5877 425 // in that file.
kcr@5877 426 def jfxReleaseVersion = "${jfxReleaseMajorVersion}.${jfxReleaseMinorVersion}.${jfxReleaseMicroVersion}"
kcr@5877 427 defineProperty("RAW_VERSION", jfxReleaseVersion)
kcr@5877 428 defineProperty("RELEASE_NAME", jfxReleaseName)
kcr@5877 429 defineProperty("RELEASE_MILESTONE", jfxReleaseMilestone)
rbair@3458 430
rbair@3458 431 // Check whether the COMPILE_TARGETS property has been specified (if so, it was done by
rbair@3458 432 // the user and not by this script). If it has not been defined then default
rbair@3458 433 // to building the normal desktop build for this machine
David@3655 434 project.ext.set("defaultHostTarget", IS_MAC ? "mac" : IS_WINDOWS ? "win" : IS_LINUX ? "linux" : "");
David@3655 435 defineProperty("COMPILE_TARGETS", "$defaultHostTarget")
richard@2983 436
kcr@5525 437 // Flag indicating whether to import cross compile tools
David@3902 438 def importCrossTools = BUILD_CLOSED ? true : false;
David@3902 439 if (!importCrossTools && hasProperty("IMPORT_CROSS_TOOLS")) {
kcr@5525 440 importCrossTools = Boolean.parseBoolean(IMPORT_CROSS_TOOLS);
David@3902 441 }
kcr@5525 442 ext.IS_IMPORT_CROSS_TOOLS = importCrossTools
David@3902 443
kcr@5525 444 // Location of the cross compile tools
shemnon@8032 445 def crossToolsDir = "../crosslibs"
David@3902 446 if (hasProperty("CROSS_TOOLS_DIR")) {
David@3902 447 crossToolsDir = CROSS_TOOLS_DIR
David@3902 448 }
David@3902 449 ext.CROSS_TOOLS_DIR = file(crossToolsDir)
David@3902 450
dmitry@7780 451 // Specifies whether to run tests with the present jfxrt.jar instead of compiling the new one
dmitry@7780 452 defineProperty("BUILD_SDK_FOR_TEST", "true")
dmitry@7780 453 ext.DO_BUILD_SDK_FOR_TEST = Boolean.parseBoolean(BUILD_SDK_FOR_TEST)
dmitry@7780 454
dmitry@7780 455 // Specifies the location to point at SDK build when DO_BUILD_SDK_FOR_TEST set to false
dmitry@7780 456 // Used to get location of jfxrt.jar, ant-javafx.jar and javafx-mx.jar
dmitry@7780 457 defineProperty("TEST_SDK", JDK_HOME)
dmitry@7780 458 ext.TEST_SDK_DIR = file(TEST_SDK)
dmitry@7780 459
dmitry@7780 460 def rtDir = new File(TEST_SDK_DIR, "rt")
dmitry@7780 461 if (!rtDir.directory) {
dmitry@7780 462 rtDir = new File(TEST_SDK_DIR, "jre")
dmitry@7780 463 }
dmitry@7780 464 ext.jfxrtJarFromSdk = new File(rtDir, "lib/ext/jfxrt.jar").absolutePath
dmitry@7780 465 if (!DO_BUILD_SDK_FOR_TEST && !file(jfxrtJarFromSdk).exists()) {
dmitry@7780 466 fail ("BUILD_SDK_FOR_TEST is set to false, but there\'s no jfxrt.jar at the expected paths in TEST_SDK($TEST_SDK_DIR)\n"
dmitry@7780 467 + "TEST_SDK should point at either JavaFX SDK location or JDK location\n"
dmitry@7780 468 + "Please, set the correct TEST_SDK")
dmitry@7780 469 }
dmitry@7780 470
dmitry@7780 471 // These tasks would be disabled when running with DO_BUILD_SDK_FOR_TEST=false as they're unneeded for running tests
dmitry@7780 472 def disabledTasks = DO_BUILD_SDK_FOR_TEST ? [] : ["compileJava", "processResources", "classes", // all projects
dmitry@7780 473 "generateDecoraShaders", "generatePrismShaders",
dmitry@7780 474 "compilePrismCompilers", "compilePrismJavaShaders", "compileDecoraCompilers", // :graphics
dmitry@7780 475 "processDecoraShaders", "processPrismShaders"]
dmitry@7780 476
David@3902 477 /**
David@3902 478 * Fetch/Check that external tools are present for the build. This method
richard@4018 479 * will conditionally download the packages from project defined ivy repositories
David@3902 480 * and unpack them into the specified destdir
David@3902 481 *
richard@4018 482 * @param configName A unique name to distinguish the configuration (ie "ARMSFV6")
richard@4018 483 * @param packages A list of required packages (with extensions .tgz, .zip)
David@3902 484 * @param destdir where the packages should be unpacked
David@3902 485 * @param doFetch if true, the named packages will be download
David@3902 486 */
David@3902 487 void fetchExternalTools(String configName, List packages, File destdir, boolean doFetch) {
David@3902 488 if (doFetch) {
richard@4018 489 // create a unique configuration for this fetch
richard@4018 490 def String fetchToolsConfig = "fetchTools$configName"
richard@4018 491 rootProject.configurations.create(fetchToolsConfig)
David@3902 492
David@3902 493 def List<String> fetchedPackages = []
David@3902 494 def int fetchCount = 0
David@3902 495
David@3902 496 packages.each { pkgname->
David@3902 497 def int dotdex = pkgname.lastIndexOf('.')
David@3902 498 def int dashdex = pkgname.lastIndexOf('-')
David@3902 499 def String basename = pkgname.substring(0,dashdex)
David@3902 500 def String ver = pkgname.substring(dashdex+1,dotdex)
David@3902 501 def String ext = pkgname.substring(dotdex+1)
David@3902 502 def File pkgdir = file("$destdir/$basename-$ver")
David@3902 503
David@3902 504 if (!pkgdir.isDirectory()) {
richard@4018 505 rootProject.dependencies.add(fetchToolsConfig, "javafx:$basename:$ver", {
David@3902 506 artifact {
David@3902 507 name = basename
David@3902 508 version = ver
David@3902 509 type = ext
David@3902 510 }
David@3902 511 })
David@3902 512 println "adding $pkgname as a downloadable item did not find $pkgdir"
David@3902 513 fetchedPackages.add(pkgname)
David@3902 514 fetchCount++
David@3902 515 }
David@3902 516 }
David@3902 517
David@3902 518 //fetch all the missing packages
David@3902 519 if (fetchedPackages.size > 0) {
David@3902 520 destdir.mkdirs()
David@3902 521
David@3902 522 logger.quiet "fetching missing packages $fetchedPackages"
David@3902 523 copy {
richard@4018 524 from rootProject.configurations[fetchToolsConfig]
David@3902 525 into destdir
David@3902 526 }
David@3902 527
David@3902 528 // unpack the fetched packages
David@3902 529 fetchedPackages.each { pkgname->
David@3902 530 logger.quiet "expanding the package $pkgname"
David@3902 531 def srcball = file("${destdir}/${pkgname}")
David@3902 532
David@3902 533 if (!srcball.exists()) {
David@3902 534 throw new GradleException("Failed to fetch $pkgname");
David@3902 535 }
David@3902 536
David@3902 537 def String basename = pkgname.substring(0,pkgname.lastIndexOf("."))
David@3902 538 def File pkgdir = file("$destdir/$basename")
David@3902 539
David@3902 540 if (pkgname.endsWith(".tgz")) {
David@3902 541 if (IS_LINUX || IS_MAC) {
David@3902 542 // use native tar to support symlinks
David@3902 543 pkgdir.mkdirs()
David@3902 544 exec {
David@3902 545 workingDir pkgdir
David@3902 546 commandLine "tar", "zxf", "${srcball}"
David@3902 547 }
richard@4018 548 } else {
richard@4018 549 copy {
richard@4018 550 from tarTree(resources.gzip("${srcball}"))
richard@4018 551 into pkgdir
richard@4018 552 }
richard@4018 553 }
David@3902 554 } else if (pkgname.endsWith(".zip")) {
David@3902 555 copy {
David@3902 556 from zipTree("${srcball}")
David@3902 557 into pkgdir
David@3902 558 }
David@3902 559 } else {
David@3902 560 throw new GradleException("Unhandled pacakge type for compile package ${pkgname}")
David@3902 561 }
David@3902 562 srcball.deleteOnExit();
David@3902 563 }
David@3902 564 } else {
David@3902 565 logger.quiet "all tool packages are present $packages"
David@3902 566 }
David@3902 567 } else { // !doFetch - so just check they are present
David@3902 568 // check that all the dirs are really there
David@3902 569 def List<String> errors = []
David@3902 570 packages.each { pkgname->
daniel@4250 571 def String basename = pkgname.substring(0,pkgname.lastIndexOf("."))
David@3902 572 def File pkgdir = file("$destdir/$basename")
David@3902 573
David@3902 574 if (!pkgdir.isDirectory()) {
David@3902 575 errors.add(pkgname)
David@3902 576 }
David@3902 577 }
David@3902 578 if (errors.size > 0) {
David@3902 579 throw new GradleException("Error: missing tool packages: $errors")
David@3902 580 } else {
David@3902 581 logger.quiet "all tool packages are present $packages"
David@3902 582 }
David@3902 583 }
David@3902 584 }
David@3902 585
richard@2983 586 // Now we need to define the native compilation tasks. The set of parameters to
richard@4018 587 // native compilation depends on the target platform (and also to some extent what platform
richard@2983 588 // you are compiling on). These settings are contained in various gradle files
richard@2983 589 // such as mac.gradle and linux.gradle and armhf.gradle. Additionally, the developer
richard@2983 590 // can specify COMPILE_FLAGS_FILE to be a URL or path to a different gradle file
richard@2983 591 // that will contain the appropriate flags.
rbair@3458 592 defineProperty("COMPILE_FLAGS_FILES", COMPILE_TARGETS.split(",").collect {"buildSrc/${it.trim()}.gradle"}.join(","))
rbair@3458 593 if (COMPILE_TARGETS == "all") {
rbair@3458 594 def tmp = []
rbair@3458 595 File buildSrcDir = file("buildSrc")
rbair@3458 596 buildSrcDir.listFiles().each { File f ->
rbair@3458 597 if (f.isFile() && f.name.endsWith(".gradle") && !f.name.equals("build.gradle")) {
leifs@4851 598 def target = f.name.substring(0, f.name.lastIndexOf('.gradle')).toUpperCase(Locale.ROOT)
rbair@3458 599 apply from: f
richard@3487 600 if (project.ext["${target}"].canBuild) {
rbair@3458 601 tmp.add(target)
rbair@3458 602 }
rbair@3458 603 }
rbair@3458 604 }
rbair@3458 605 COMPILE_FLAGS_FILES = tmp.collect { "buildSrc/${it}.gradle"}.join(",")
rbair@3458 606 COMPILE_TARGETS = tmp.collect { "${it.toLowerCase()}"}.join(",")
rbair@3458 607 } else {
rbair@3458 608 COMPILE_FLAGS_FILES.split(",").each {
rbair@3458 609 logger.info("Applying COMPILE_FLAGS_FILE '$it'")
rbair@3458 610 apply from: it
rbair@3458 611 }
rbair@3458 612 }
richard@2983 613
Tomas@4265 614 if (COMPILE_TARGETS != "") {
Tomas@4265 615 def tmp = []
Tomas@4265 616 COMPILE_TARGETS.split(",").each {target ->
leifs@4851 617 if (project.ext["${target.toUpperCase(Locale.ROOT)}"].canBuild) {
Tomas@4265 618 tmp.add(target)
Tomas@4265 619 }
Tomas@4265 620 }
Tomas@4265 621 COMPILE_TARGETS = tmp.collect { "${it.toLowerCase()}"}.join(",")
Tomas@4265 622 }
Tomas@4265 623
richard@3487 624 // Sanity check the expected properties all exist
richard@3487 625 compileTargets { t ->
richard@3487 626 // Every platform must define these variables
richard@3487 627 if (!project.hasProperty(t.upper)) throw new Exception("ERROR: Incorrectly configured compile flags file, missing ${t.name} property")
richard@3487 628 def props = project.ext[t.upper];
ddhill@7065 629 ["compileSwing", "compileSWT", "compileFXPackager", "compileDesignTime", "libDest"].each { prop ->
richard@3487 630 if (!props.containsKey(prop)) throw new Exception("ERROR: Incorrectly configured compile flags file, missing ${prop} property on ${t.name}")
richard@3487 631 }
richard@3487 632 }
richard@3487 633
rbair@3458 634 // Various build flags may be set by the different target files, such as
rbair@3458 635 // whether to build Swing, SWT, FXPackager, etc. We iterate over all
rbair@3458 636 // compile targets and look for these settings in our properties. Note that
rbair@3458 637 // these properties cannot be set from the command line, but are set by
rbair@3458 638 // the target build files such as armv6hf.gradle or mac.gradle.
rbair@3458 639 ext.COMPILE_SWING = false;
rbair@3458 640 ext.COMPILE_SWT = false;
rbair@3458 641 ext.COMPILE_FXPACKAGER = false;
rbair@3458 642 ext.COMPILE_DESIGN_TIME = false;
rbair@3458 643 compileTargets { t ->
ddhill@7062 644 def targetProperties = project.rootProject.ext[t.upper]
ddhill@6318 645
ddhill@7062 646 if (targetProperties.compileSwing) COMPILE_SWING = true
ddhill@7062 647 if (targetProperties.compileSWT) COMPILE_SWT = true
ddhill@7062 648 if (targetProperties.compileFXPackager) COMPILE_FXPACKAGER = true
ddhill@7062 649 if (targetProperties.compileDesignTime) COMPILE_DESIGN_TIME = true
ddhill@7062 650
ddhill@7062 651 if (!targetProperties.containsKey('compileWebnodeNative')) {
ddhill@7062 652 // unless specified otherwise, we will compile native Webnode if IS_COMPILE_WEBKIT
ddhill@7062 653 targetProperties.compileWebnodeNative = true
ddhill@7062 654 }
ddhill@7062 655
ddhill@7062 656 if (!targetProperties.containsKey('compileMediaNative')) {
ddhill@7062 657 // unless specified otherwise, we will compile native Media if IS_COMPILE_MEDIA
ddhill@7062 658 targetProperties.compileMediaNative = true
ddhill@7062 659 }
ddhill@7062 660
ddhill@7065 661 if (!targetProperties.containsKey('includeSWT')) targetProperties.includeSWT = true
ddhill@7065 662 if (!targetProperties.containsKey('includeSwing')) targetProperties.includeSwing = true
ddhill@7065 663 if (!targetProperties.containsKey('includeNull3d')) targetProperties.includeNull3d = true
ddhill@7065 664 if (!targetProperties.containsKey('includeLens')) targetProperties.includeLens = false
ddhill@7379 665 if (!targetProperties.containsKey('includeMonocle')) targetProperties.includeMonocle = false
ddhill@7065 666 if (!targetProperties.containsKey('includeEGL')) targetProperties.includeEGL = false
ddhill@7065 667
ddhill@7065 668 if (!targetProperties.containsKey('includeGTK')) targetProperties.includeGTK = IS_LINUX
ddhill@7065 669
ddhill@7062 670 // This value is used to under ./build/${sdkDirName} to allow for
ddhill@7062 671 // a common name for the hosted build (for use when building apps)
ddhill@7062 672 // and a unique name for cross builds.
shemnon@8032 673 if (rootProject.defaultHostTarget.equals(t.name)) {
ddhill@6318 674 // use a simple common default for the "host" build
ddhill@7062 675 targetProperties.sdkDirName="sdk"
ddhill@6318 676 } else {
ddhill@6318 677 // and a more complex one for cross builds
ddhill@7062 678 targetProperties.sdkDirName="${t.name}-sdk"
ddhill@6318 679 }
rbair@3458 680 }
richard@2983 681
richard@3156 682 /******************************************************************************
richard@3156 683 * *
rbair@3458 684 * Build Setup Sanity Checks *
richard@3156 685 * *
richard@3156 686 * Here we do a variety of checks so that if the version of Java you are *
richard@3156 687 * building with is misconfigured, or you are using the wrong version of *
richard@3156 688 * gradle, etc you will get some kind of helpful error / warning message *
richard@3156 689 * *
richard@3156 690 *****************************************************************************/
richard@3156 691
rbair@3458 692 // Verify that the architecture & OS are supported configurations. Note that
rbair@3458 693 // at present building on PI is not supported, but we would only need to make
rbair@3458 694 // some changes on assumptions on what should be built (like SWT / Swing) and
rbair@3458 695 // such and we could probably make it work.
richard@3156 696 if (!IS_MAC && !IS_WINDOWS && !IS_LINUX) logger.error("Unsupported build OS ${OS_NAME}")
rbair@3458 697 if (IS_WINDOWS && OS_ARCH != "x86" && OS_ARCH != "amd64") {
rbair@3458 698 throw new Exception("Unknown and unsupported build architecture: $OS_ARCH")
rbair@3458 699 } else if (IS_MAC && OS_ARCH != "x86_64") {
rbair@3458 700 throw new Exception("Unknown and unsupported build architecture: $OS_ARCH")
rbair@3458 701 } else if (IS_LINUX && OS_ARCH != "i386" && OS_ARCH != "amd64") {
richard@3156 702 throw new Exception("Unknown and unsupported build architecture: $OS_ARCH")
richard@3156 703 }
richard@3156 704
rbair@3458 705 // Sanity check that we actually have a list of compile targets to execute
rbair@3458 706 if (COMPILE_TARGETS == null || COMPILE_TARGETS == "") {
rbair@3458 707 throw new Exception("Unable to determine compilation platform, must specify valid COMPILE_TARGETS!")
rbair@3458 708 }
richard@3156 709
anthony@5699 710 // Make sure JDK_HOME/bin/java exists
rbair@3328 711 if (!file(JAVA).exists()) throw new Exception("Missing or incorrect path to 'java': '$JAVA'. Perhaps bad JDK_HOME? $JDK_HOME")
rbair@3328 712 if (!file(JAVAC).exists()) throw new Exception("Missing or incorrect path to 'javac': '$JAVAC'. Perhaps bad JDK_HOME? $JDK_HOME")
rbair@3328 713 if (!file(JAVAH).exists()) throw new Exception("Missing or incorrect path to 'javah': '$JAVAH'. Perhaps bad JDK_HOME? $JDK_HOME")
rbair@3328 714 if (!file(JAVADOC).exists()) throw new Exception("Missing or incorrect path to 'javadoc': '$JAVADOC'. Perhaps bad JDK_HOME? $JDK_HOME")
richard@3156 715
anthony@5699 716
anthony@5699 717 // Determine the verion of Java in JDK_HOME. It looks like this:
anthony@5699 718 //
anthony@5699 719 // $ java -version
anthony@5699 720 // java version "1.7.0_45"
anthony@5699 721 // Java(TM) SE Runtime Environment (build 1.7.0_45-b18)
anthony@5699 722 // Java HotSpot(TM) 64-Bit Server VM (build 24.45-b08, mixed mode)
anthony@5699 723 //
anthony@5699 724 // We need to parse the second line
anthony@5699 725 def inStream = new java.io.BufferedReader(new java.io.InputStreamReader(new java.lang.ProcessBuilder(JAVA, "-version").start().getErrorStream()));
anthony@5699 726 try {
anthony@5699 727 if (inStream.readLine() != null) {
anthony@5699 728 String v = inStream.readLine();
anthony@5699 729 if (v != null) {
anthony@5699 730 int ib = v.indexOf(" (build ");
anthony@5699 731 if (ib != -1) {
anthony@5699 732 String ver = v.substring(ib + 8, v.size() - 1);
anthony@5699 733
anthony@5699 734 defineProperty("jdkRuntimeVersion", ver)
kcr@6464 735 defineProperty("jdkVersion", jdkRuntimeVersion.split("-")[0])
anthony@5699 736 defineProperty("jdkBuildNumber", jdkRuntimeVersion.substring(jdkRuntimeVersion.lastIndexOf("-b") + 2))
anthony@5699 737 }
anthony@5699 738 }
anthony@5699 739 }
anthony@5699 740 } finally {
anthony@5699 741 inStream.close();
anthony@5699 742 }
anthony@5699 743 if (!project.hasProperty("jdkRuntimeVersion")) throw new Exception("Unable to determine the version of Java in JDK_HOME at $JDK_HOME");
anthony@5699 744
anthony@5699 745
anthony@5699 746
richard@3156 747 // Verify that CONF is something useful
kcr@7801 748 if (CONF != "Release" && CONF != "Debug" && CONF != "DebugNative") {
kcr@7801 749 logger.warn("Unknown configuration CONF='$CONF'. Treating as 'Release'")
kcr@7801 750 }
richard@3156 751
richard@3156 752 // If the number of compile threads is less than 1 then we have a problem!
richard@3156 753 if (Integer.parseInt(NUM_COMPILE_THREADS.toString()) < 1) {
richard@3156 754 logger.warn("NUM_COMPILE_THREADS was specified as '$NUM_COMPILE_THREADS' which is less than the minimum value of 1. " +
richard@3156 755 "Building with a value of 1 instead.")
rbair@3458 756 NUM_COMPILE_THREADS = 1
richard@3156 757 }
richard@3156 758
kcr@5783 759 // Check that Gradle 1.8 is in use.
kcr@5783 760 if (gradle.gradleVersion != "1.8") {
kcr@6537 761 def ver = gradle.gradleVersion.split("[\\.]");
kcr@6537 762 def gradleMajor = Integer.parseInt(ver[0]);
kcr@6537 763 def gradleMinor = Integer.parseInt(ver[1]);
kcr@6537 764 def err = "";
kcr@6537 765 if (gradleMajor != 1) {
kcr@6538 766 err = "Gradle major version is incompatible: ${gradle.gradleVersion}; supported version is 1.8";
kcr@6537 767 } else {
kcr@6537 768 if (gradleMinor < 8) {
kcr@6537 769 err = "Gradle version too old: ${gradle.gradleVersion}; must be at least 1.8"
kcr@6537 770 }
kcr@6537 771
kcr@6537 772 // Blacklisted versions of gradle
kcr@6537 773 if (gradleMinor == 11) {
kcr@6538 774 err = "JavaFX fails to build with Gradle ${gradle.gradleVersion}; supported version is 1.8"
kcr@6537 775 }
kcr@6537 776 }
kcr@6537 777
kcr@6537 778 if (IS_GRADLE_VERSION_CHECK && err != "") {
kcr@6537 779 fail(err);
kcr@6537 780 }
kcr@6537 781
kcr@6537 782 logger.warn("*****************************************************************");
kcr@6537 783 logger.warn("Unsupported gradle version $gradle.gradleVersion in use.");
kcr@6537 784 logger.warn("Only version 1.8 is supported. Use this version at your own risk");
kcr@6537 785 if ( err != "") logger.warn(err);
kcr@6537 786 logger.warn("*****************************************************************");
richard@3156 787 }
richard@3156 788
richard@3156 789 /******************************************************************************
richard@3156 790 * *
richard@3156 791 * Logging of Properties and Settings *
richard@3156 792 * *
richard@3156 793 * Log some of the settings we've determined. We could log more here, it *
richard@3156 794 * doesn't really hurt. *
richard@3156 795 * *
richard@3156 796 *****************************************************************************/
richard@3156 797
rbair@3458 798 logger.quiet("OS_NAME: $OS_NAME")
rbair@3458 799 logger.quiet("OS_ARCH: $OS_ARCH")
rbair@3458 800 logger.quiet("JAVA_HOME: $JAVA_HOME")
rbair@3458 801 logger.quiet("JDK_HOME: $JDK_HOME")
kcr@4498 802 logger.quiet("java.runtime.version: ${javaRuntimeVersion}")
kcr@4498 803 logger.quiet("java version: ${javaVersion}")
kcr@4498 804 logger.quiet("java build number: ${javaBuildNumber}")
anthony@5699 805 logger.quiet("jdk.runtime.version: ${jdkRuntimeVersion}")
anthony@5699 806 logger.quiet("jdk version: ${jdkVersion}")
anthony@5699 807 logger.quiet("jdk build number: ${jdkBuildNumber}")
kcr@4498 808 logger.quiet("minimum java build number: ${jfxBuildJdkBuildnumMin}")
kcr@7801 809 logger.quiet("CONF: $CONF")
kcr@6578 810 logger.quiet("NUM_COMPILE_THREADS: $NUM_COMPILE_THREADS")
rbair@3458 811 logger.quiet("COMPILE_TARGETS: $COMPILE_TARGETS")
rbair@3458 812 logger.quiet("COMPILE_FLAGS_FILES: $COMPILE_FLAGS_FILES")
rbair@3458 813 logger.quiet("HUDSON_JOB_NAME: $HUDSON_JOB_NAME")
rbair@3458 814 logger.quiet("HUDSON_BUILD_NUMBER: $HUDSON_BUILD_NUMBER")
rbair@3458 815 logger.quiet("PROMOTED_BUILD_NUMBER: $PROMOTED_BUILD_NUMBER")
rbair@3458 816 logger.quiet("PRODUCT_NAME: $PRODUCT_NAME")
rbair@3458 817 logger.quiet("RAW_VERSION: $RAW_VERSION")
rbair@3458 818 logger.quiet("RELEASE_NAME: $RELEASE_NAME")
rbair@3458 819 logger.quiet("RELEASE_MILESTONE: $RELEASE_MILESTONE")
richard@2983 820
David@4103 821 if (UPDATE_STUB_CACHE) {
David@4103 822 logger.quiet("UPDATE_STUB_CACHE: $UPDATE_STUB_CACHE")
David@4103 823 }
David@4103 824
richard@2983 825 /******************************************************************************
richard@2983 826 * *
richard@2983 827 * Definition of Native Code Compilation Tasks *
richard@2983 828 * *
richard@2983 829 * - JavaHeaderTask is used to run javah. The JAVAH property will point at *
richard@2983 830 * the version of javah to be used (i.e.: a path to javah) *
richard@2983 831 * - CCTask compiles native code. Specifically it will compile .m, .c, *
richard@2983 832 * .cpp, or .cc files. It uses the headers provided by the *
richard@2983 833 * JavaHeaderTask plus additional platform specific headers. It will *
richard@4018 834 * compile into .obj files. *
richard@2983 835 * - LinkTask will perform native linking and create the .dll / .so / *
richard@4018 836 * .dylib as necessary. *
richard@2983 837 * *
richard@2983 838 *****************************************************************************/
richard@2983 839
richard@3219 840 // Save a reference to the buildSrc.jar file because we need it for actually
richard@3219 841 // compiling things, not just for the sake of this build script
richard@3219 842 // (such as generating the builders, JSL files, etc)
rbair@3458 843 ext.BUILD_SRC = rootProject.files("buildSrc/build/libs/buildSrc.jar")
richard@2920 844
richard@2983 845 /**
rbair@3458 846 * Convenience method for creating javah, cc, link, and "native" tasks in the given project. These
rbair@3458 847 * tasks are parameterized by name, so that we can produce, for example, javahGlass, ccGlass, etc
rbair@3458 848 * named tasks.
shemnon@8032 849 *
rbair@3458 850 * @param project The project to add tasks to
rbair@3458 851 * @param name The name of the project, such as "prism-common". This name is used
rbair@3458 852 * in the name of the generated task, such as ccPrismCommon, and also
rbair@3458 853 * in the name of the final library, such as libprism-common.dylib.
rbair@3458 854 */
kcr@5526 855 void addNative(Project project, String name) {
rbair@3458 856 // TODO if we want to handle 32/64 bit windows in the same build,
rbair@3458 857 // Then we will need to modify the win compile target to be win32 or win64
rbair@3458 858 def capitalName = name.split("-").collect{it.capitalize()}.join()
rbair@3458 859 def nativeTask = project.task("native$capitalName", group: "Build") {
rbair@3458 860 description = "Generates JNI headers, compiles, and builds native dynamic library for $name for all compile targets"
richard@2920 861 }
felipe@4729 862 def cleanTask = project.task("cleanNative$capitalName", type: Delete, group: "Build") {
felipe@4729 863 description = "Clean native objects for $name"
felipe@4729 864 }
felipe@4736 865 if (project.hasProperty("nativeAllTask")) project.nativeAllTask.dependsOn nativeTask
kcr@5526 866 project.assemble.dependsOn(nativeTask)
felipe@4736 867 if (project.hasProperty("cleanNativeAllTask")) project.cleanNativeAllTask.dependsOn cleanTask
shemnon@8032 868
rbair@3458 869 // Each of the different compile targets will be placed in a sub directory
rbair@3458 870 // of these root dirs, with the name of the dir being the name of the target
rbair@3458 871 def headerRootDir = project.file("$project.buildDir/generated-src/headers/$name")
rbair@3458 872 def nativeRootDir = project.file("$project.buildDir/native/$name")
rbair@3458 873 def libRootDir = project.file("$project.buildDir/libs/$name")
rbair@3458 874 // For each compile target, create a javah / cc / link triplet
rbair@3458 875 compileTargets { t ->
richard@3487 876 def targetProperties = project.rootProject.ext[t.upper]
rbair@4165 877 def library = targetProperties.library
richard@3487 878 def properties = targetProperties.get(name)
rbair@3458 879 def nativeDir = file("$nativeRootDir/${t.name}")
rbair@3458 880 def headerDir = file("$headerRootDir/${t.name}")
ddhill@7063 881
ddhill@7063 882 // If there is not a library clause in the properties, assume it is not wanted
ddhill@7063 883 if (!targetProperties.containsKey(name)) {
ddhill@7063 884 println("Ignoring native library ${name}. Not defined in ${t.name} project properties");
ddhill@7063 885 return
ddhill@7063 886 }
ddhill@7063 887
ddhill@7063 888 // check for the property disable${name} = true
ddhill@7063 889 def String disableKey = "disable${name}"
ddhill@7063 890 def boolean disabled = targetProperties.containsKey(disableKey) ? targetProperties.get(disableKey) : false
ddhill@7063 891 if (disabled) {
ddhill@7063 892 println("Native library ${name} disabled in ${t.name} project properties");
ddhill@7063 893 return
ddhill@7063 894 }
shemnon@8032 895
rbair@3458 896 def javahTask = project.task("javah${t.capital}${capitalName}", type: JavaHeaderTask, dependsOn: project.classes, group: "Build") {
rbair@3458 897 description = "Generates JNI Headers for ${name} for ${t.name}"
Tomas@4163 898 if (properties.javahSource == null) {
Tomas@4163 899 source(project.sourceSets.main.output.classesDir)
Tomas@4163 900 } else {
Tomas@4163 901 source(properties.javahSource)
Tomas@4163 902 }
Tomas@4163 903 if (properties.javahClasspath == null) {
Tomas@4163 904 classpath = project.files(project.sourceSets.main.output.classesDir)
felipe@6505 905 classpath += project.sourceSets.main.compileClasspath
Tomas@4163 906 } else {
Tomas@4163 907 classpath = project.files(properties.javahClasspath)
Tomas@4163 908 }
rbair@3458 909 output = headerDir
richard@3487 910 include(properties.javahInclude)
felipe@6021 911 cleanTask.delete headerDir
richard@3021 912 }
richard@3487 913
rbair@3491 914 def variants = properties.containsKey("variants") ? properties.variants : [""];
rbair@3458 915 variants.each { variant ->
richard@3487 916 def variantProperties = variant == "" ? properties : properties.get(variant)
rbair@3458 917 def capitalVariant = variant.capitalize()
felipe@4729 918 def ccOutput = variant == "" ? nativeDir : file("$nativeDir/$variant")
rbair@3458 919 def ccTask = project.task("cc${t.capital}$capitalName$capitalVariant", type: CCTask, dependsOn: javahTask, group: "Build") {
rbair@3458 920 description = "Compiles native sources for ${name} for ${t.name}${capitalVariant != '' ? ' for variant ' + capitalVariant : ''}"
rbair@3458 921 matches = ".*\\.c|.*\\.cpp|.*\\.m|.*\\.cc"
rbair@3458 922 headers = headerDir
felipe@4729 923 output(ccOutput)
richard@3487 924 params.addAll(variantProperties.ccFlags)
richard@3487 925 compiler = variantProperties.compiler
richard@3487 926 source(variantProperties.nativeSource)
felipe@4729 927 cleanTask.delete ccOutput
rbair@3458 928 }
rbair@3458 929 def linkTask = project.task("link${t.capital}$capitalName$capitalVariant", type: LinkTask, dependsOn: ccTask, group: "Build") {
rbair@3458 930 description = "Creates native dynamic library for $name for ${t.name}${capitalVariant != '' ? ' for variant ' + capitalVariant : ''}"
felipe@4729 931 objectDir = ccOutput
richard@3487 932 linkParams.addAll(variantProperties.linkFlags)
rbair@3572 933 lib = file("$libRootDir/${t.name}/${variant == '' ? library(properties.lib) : library(variantProperties.lib)}")
richard@3487 934 linker = variantProperties.linker
felipe@4734 935 cleanTask.delete "$libRootDir/${t.name}"
rbair@3458 936 }
rbair@3458 937 nativeTask.dependsOn(linkTask)
rbair@3458 938 if (IS_WINDOWS && t.name == "win") {
rbair@3458 939 def rcTask = project.task("rc$capitalName$capitalVariant", type: CompileResourceTask, dependsOn: javahTask, group: "Build") {
rbair@3458 940 description = "Compiles native sources for $name"
anthony@5155 941 matches = ".*\\.rc"
felipe@5790 942 compiler = variantProperties.rcCompiler
felipe@5790 943 source(variantProperties.rcSource)
felipe@5790 944 if (variantProperties.rcFlags) {
felipe@5790 945 rcParams.addAll(variantProperties.rcFlags)
felipe@5790 946 }
felipe@5790 947 output(ccOutput)
rbair@3458 948 }
rbair@3458 949 linkTask.dependsOn rcTask;
rbair@3458 950 }
rbair@3458 951 }
david@4201 952
david@4201 953 def useLipo = targetProperties.containsKey('useLipo') ? targetProperties.useLipo : false
david@4201 954 if (useLipo) {
david@4201 955 def lipoTask = project.task("lipo${t.capital}$capitalName", type: LipoTask, dependsOn: javahTask, group: "Build") {
david@4201 956 description = "Creates native fat library for $name for ${t.name}"
david@4201 957 libDir = file("$libRootDir/${t.name}")
david@4201 958 lib = file("$libRootDir/${t.name}/${library(properties.lib)}")
david@4201 959 }
david@4201 960 nativeTask.dependsOn(lipoTask)
david@4201 961 }
richard@3021 962 }
richard@2920 963 }
richard@2920 964
rbair@3546 965 void addJSL(Project project, String name, String pkg, Closure compile) {
richard@3212 966 def lowerName = name.toLowerCase()
richard@3219 967
richard@3212 968 def compileCompilers = project.task("compile${name}Compilers", type: JavaCompile, dependsOn: project.compileJava) {
richard@3212 969 description = "Compile the $name JSL Compilers"
richard@3219 970 classpath = project.files(project.sourceSets.main.output.classesDir) +
richard@3219 971 rootProject.BUILD_SRC +
richard@3219 972 project.configurations.antlr3
richard@3212 973 source = [project.file("src/main/jsl-$lowerName")]
richard@3212 974 destinationDir = project.file("$project.buildDir/classes/jsl-compilers/$lowerName")
richard@3212 975 }
richard@3212 976
richard@3212 977 def generateShaders = project.task("generate${name}Shaders", dependsOn: compileCompilers) {
richard@3212 978 description = "Generate $name shaders from JSL"
richard@3212 979 def sourceDir = project.file("src/main/jsl-$lowerName")
richard@3212 980 def destinationDir = project.file("$project.buildDir/generated-src/jsl-$lowerName")
richard@3212 981 inputs.dir sourceDir
richard@3212 982 outputs.dir destinationDir
richard@3212 983 doLast {
richard@3212 984 compile(sourceDir, destinationDir)
richard@3212 985 }
richard@3212 986 }
richard@3212 987
richard@3212 988 project.task("compile${name}JavaShaders", type: JavaCompile, dependsOn: generateShaders) {
richard@3212 989 description = "Compile the Java $name JSL shaders"
richard@3219 990 classpath = project.files(project.sourceSets.main.output.classesDir) + rootProject.BUILD_SRC
richard@3212 991 source = [project.file("$project.buildDir/generated-src/jsl-$lowerName")]
richard@3212 992 destinationDir = project.file("$project.buildDir/classes/jsl-$lowerName")
richard@3212 993 }
richard@3212 994
richard@3212 995 def compileHLSLShaders = project.task("compile${name}HLSLShaders", dependsOn: generateShaders, type: CompileHLSLTask) {
richard@3212 996 enabled = IS_WINDOWS
richard@3212 997 description = "Compile $name HLSL files into .obj files"
richard@3212 998 matches = ".*\\.hlsl"
rbair@3546 999 output project.file("$project.buildDir/hlsl/$name/$pkg")
rbair@3546 1000 source project.file("$project.buildDir/generated-src/jsl-$lowerName/$pkg")
richard@3212 1001 }
richard@3212 1002
richard@3212 1003 project.task("process${name}Shaders", dependsOn: [generateShaders, compileHLSLShaders], type: Copy, description: "Copy hlsl / frag shaders to build/resources/jsl-$lowerName") {
rbair@3516 1004 from("$project.buildDir/hlsl/$name") {
richard@3212 1005 include "**/*.obj"
richard@3212 1006 }
richard@3212 1007 from("$project.buildDir/generated-src/jsl-$lowerName") {
richard@3212 1008 include("**/*.frag")
richard@3212 1009 }
richard@3212 1010 into "$project.buildDir/resources/jsl-$lowerName"
richard@3212 1011 }
richard@3212 1012 }
richard@3212 1013
kcr@6464 1014 /**
kcr@6464 1015 * Parses a JDK version string. The string must be in one of the following
kcr@6464 1016 * two formats:
kcr@6464 1017 *
kcr@6464 1018 * major.minor.subminor
kcr@6464 1019 * or
kcr@6464 1020 * major.minor.subminor_update
kcr@6464 1021 *
kcr@6464 1022 * In both cases a list of 4 integers is returned, with element 3 set to
kcr@6464 1023 * 0 in the former case.
kcr@6464 1024 */
kcr@6464 1025 List parseJdkVersion(String version) {
kcr@6464 1026 def arr = version.split("[_\\.]");
kcr@6464 1027 def intArr = [];
kcr@6464 1028 arr.each { s -> intArr += Integer.parseInt(s); }
kcr@6464 1029 if (intArr.size() < 4) intArr += 0;
kcr@6464 1030 return intArr;
kcr@6464 1031 }
kcr@6464 1032
kcr@6464 1033 /**
kcr@6464 1034 * Returns -1, 0, or 1 depending on whether JDK version "a" is less than,
kcr@6464 1035 * equal to, or grater than version "b".
kcr@6464 1036 */
kcr@6464 1037 int compareJdkVersion(String a, String b) {
kcr@6464 1038 def aIntArr = parseJdkVersion(a);
kcr@6464 1039 def bIntArr = parseJdkVersion(b);
kcr@6464 1040
kcr@6464 1041 for (int i = 0; i < 4; i++) {
kcr@6464 1042 if (aIntArr[i] < bIntArr[i]) return -1;
kcr@6464 1043 if (aIntArr[i] > bIntArr[i]) return 1;
kcr@6464 1044 }
kcr@6464 1045 return 0;
kcr@6464 1046 }
kcr@6464 1047
kcr@4498 1048 // Task to verify the minimum level of Java needed to build JavaFX
kcr@4498 1049 task verifyJava() {
kcr@4498 1050 doLast {
kcr@6464 1051 def status = compareJdkVersion(jdkVersion, jfxBuildJdkVersion);
kcr@6464 1052 if (status < 0) {
kcr@6464 1053 fail("java version mismatch: JDK version (${jdkVersion}) < minimum version (${jfxBuildJdkVersion})")
kcr@6464 1054 } else if (status == 0) {
kcr@6464 1055 def buildNum = Integer.parseInt(jdkBuildNumber)
kcr@6464 1056 def minBuildNum = Integer.parseInt(jfxBuildJdkBuildnumMin)
kcr@6464 1057 if (buildNum < minBuildNum) {
kcr@6464 1058 fail("JDK build number ($buildNum) < minimum build number ($minBuildNum)")
kcr@6464 1059 }
kcr@4498 1060 }
kcr@4498 1061 }
kcr@4498 1062 }
kcr@4498 1063
kcr@4552 1064 // Task to check whether jfxrt.jar is present in the JDK
kcr@4552 1065 task checkJfxrtJar {
kcr@4552 1066 doLast {
anthony@5699 1067 def jfxrtFile = new File("$JDK_HOME/jre/lib/ext/jfxrt.jar");
kcr@4552 1068 if (jfxrtFile.exists()) {
kcr@8375 1069 fail("$jfxrtFile must be removed before building sdk")
kcr@4552 1070 }
kcr@4552 1071 }
kcr@4552 1072 }
kcr@4552 1073
David@4103 1074 task updateCacheIfNeeded() {
David@4103 1075 // an empty task we can add to as needed for UPDATE_STUB_CACHE
David@4103 1076 }
David@4103 1077
richard@3156 1078 /*****************************************************************************
richard@2983 1079 * Project definitions (dependencies, etc) *
richard@2983 1080 *****************************************************************************/
richard@2472 1081
rbair@4232 1082 void addJCov(p, test) {
rbair@4232 1083 test.doFirst {
rbair@4232 1084 def jcovJVMArgument =
rbair@4232 1085 "include=javafx," +
rbair@4232 1086 "include=com.sun.javafx," +
rbair@4232 1087 "include=com.sun.glass," +
rbair@4232 1088 "include=com.sun.openpisces," +
rbair@4232 1089 "include=com.sun.pisces," +
rbair@4232 1090 "include=com.sun.prism," +
rbair@4232 1091 "include=com.sun.scenario," +
rbair@4232 1092 "include=com.sun.webkit," +
rbair@4232 1093 "exclude=com," +
rbair@4232 1094 "exclude=java," +
rbair@4232 1095 "exclude=javax," +
rbair@4232 1096 "exclude=\"**.test\"," +
rbair@4232 1097 "exclude=\"**.*Test\"," +
rbair@4232 1098 "file=build/reports/jcov/report.xml," +
rbair@4232 1099 "merge=merge";
rbair@4232 1100 test.jvmArgs("-javaagent:${p.configurations.testCompile.files.find { it.name.startsWith('jcov') }}=$jcovJVMArgument");
rbair@4232 1101 p.mkdir p.file("build/reports/jcov")
rbair@4232 1102 }
rbair@4232 1103 test.doLast {
rbair@4232 1104 def reportFile = p.file("build/reports/jcov/report.xml")
rbair@4232 1105 if (reportFile.exists()) {
rbair@4232 1106 p.javaexec {
rbair@4232 1107 workingDir = p.file("build/reports/jcov")
rbair@4232 1108 classpath = p.files(p.configurations.testCompile.files.find { it.name.startsWith('jcov') })
rbair@4232 1109 main = "com.sun.tdk.jcov.Helper"
rbair@4232 1110 args = [
rbair@4232 1111 "RepGen",
rbair@4232 1112 "-exclude", "\"**.test\"",
rbair@4232 1113 "-exclude", "\"**.*Test\"",
rbair@4232 1114 "-output", ".",
rbair@4232 1115 "-source", p.sourceSets.main.java.srcDirs.collect{p.file(it)}.join(":"),
rbair@4232 1116 "report.xml"
rbair@4232 1117 ]
rbair@4232 1118 }
rbair@4232 1119 }
rbair@4232 1120 }
rbair@4232 1121 }
rbair@4232 1122
rbair@2744 1123 allprojects {
rbair@2744 1124 // We want to configure all projects as java projects and use the same compile settings
peterz@4174 1125 // etc, except for the root project which we just want to ignore (and for now media)
ddhill@5832 1126 if (project == rootProject) {
ddhill@5832 1127 return
ddhill@5832 1128 }
ddhill@5832 1129 if (project.path.startsWith(":apps")) {
ddhill@5832 1130 // Lets handle the apps tree differently, as it is a collection of ant builds,
ddhill@5832 1131 // and the ant importer collides with the 'apply plugin:java'
ddhill@5832 1132 return
ddhill@5832 1133 }
rbair@2559 1134 // All of our projects are java projects
richard@2472 1135 apply plugin: "java"
kcr@3514 1136 sourceCompatibility = 1.8
richard@3156 1137
rbair@2559 1138 // Setup the repositories that we'll download libraries from. Maven Central is
richard@2983 1139 // just easy for most things. The custom "ivy" repo is for downloading SWT. The way it
richard@2983 1140 // works is to setup the download URL such that it will resolve to the actual jar file
richard@2983 1141 // to download. See SWT_FILE_NAME for the name of the jar that will be used as the
richard@3325 1142 // "artifact" in the pattern below. Note that the closed builds use different repositories
richard@3325 1143 // so if you are debugging a closed-build artifact related build issue, check out the
richard@3325 1144 // closed gradle file instead.
kcr@4078 1145 if (!BUILD_CLOSED) {
kcr@3962 1146 repositories {
kcr@3962 1147 mavenCentral()
kcr@3962 1148 ivy {
kcr@3962 1149 url "http://download.eclipse.org/eclipse/updates/3.7/R-3.7.2-201202080800/plugins/"
kcr@3962 1150 layout "pattern", {
kcr@3962 1151 artifact "[artifact].[ext]"
kcr@3962 1152 }
richard@2472 1153 }
rbair@3343 1154 }
richard@2472 1155 }
rbair@2726 1156
richard@2983 1157 // By default all of our projects require junit for testing so we can just
richard@2983 1158 // setup this dependency here.
rbair@2757 1159 dependencies {
rbair@4232 1160 testCompile group: "junit", name: "junit", version: "4.8.2"
kcr@4368 1161 if (BUILD_CLOSED && DO_JCOV) {
kcr@4368 1162 testCompile name: "jcov"
kcr@4368 1163 }
rbair@2757 1164 }
rbair@2757 1165
kcr@5886 1166 // Compile and run tests against the jfxrt.jar in the built sdk of the host machine
ddhill@6318 1167 def sdkDir = "${rootProject.buildDir}/sdk"
kcr@5886 1168 def jfxrtJar = "$sdkDir/rt/lib/ext/jfxrt.jar"
dmitry@7780 1169 def testJfxrtJar = DO_BUILD_SDK_FOR_TEST ? jfxrtJar : jfxrtJarFromSdk
kcr@5886 1170
rbair@2757 1171 // At the moment the ASM library shipped with Gradle that is used to
rbair@2757 1172 // discover the different test classes fails on Java 8, so in order
rbair@2757 1173 // to have sourceCompatibility set to 1.8 I have to also turn scanForClasses off
richard@2983 1174 // and manually specify the includes / excludes. At the moment we use
richard@2983 1175 // Java 7 but when we switch to 8 this will be needed, and probably again when
richard@2983 1176 // we start building with Java 9.
rbair@2757 1177 test {
richard@2983 1178 jvmArgs("-Djava.ext.dirs=");
richard@3008 1179 executable = JAVA;
richard@2983 1180 enableAssertions = true;
richard@2983 1181 testLogging.exceptionFormat = "full";
richard@2983 1182 scanForTestClasses = false;
richard@3008 1183 include("**/*Test.*");
kcr@4368 1184 if (BUILD_CLOSED && DO_JCOV) {
rbair@4232 1185 addJCov(project, test)
rbair@4232 1186 }
dmitry@7780 1187 classpath = files(testJfxrtJar) + classpath
daniel@6168 1188 if (IS_HEADLESS_TEST) {
daniel@6168 1189 systemProperty 'glass.platform', 'Monocle'
daniel@6168 1190 systemProperty 'monocle.platform', 'Headless'
daniel@6168 1191 systemProperty 'prism.order', 'sw'
elina@6925 1192 systemProperty 'com.sun.javafx.gestures.zoom', 'true'
elina@6925 1193 systemProperty 'com.sun.javafx.gestures.rotate', 'true'
elina@6925 1194 systemProperty 'com.sun.javafx.gestures.scroll', 'true'
daniel@6168 1195 }
kcr@5886 1196 }
kcr@5886 1197
kcr@5886 1198 compileTestJava {
dmitry@7780 1199 classpath = files(testJfxrtJar) + classpath
rbair@2757 1200 }
rbair@2757 1201
richard@3156 1202 // Exclude any non-public-API classes from having javadoc generated. This block is used
richard@3156 1203 // when generating JavaDocs for a specific project. When generating the JavaDocs for the
richard@3156 1204 // entire SDK, a different javadoc command is used (see the javadoc task on the top level)
richard@2997 1205 javadoc {
kcr@5525 1206 enabled = IS_BUILD_JAVADOC
felipe@6505 1207 exclude("com/**/*", "javafx/scene/ParentDesignInfo*", "Compile*", "javafx/builder/**/*", "javafx/scene/accessibility/**/*");
richard@3069 1208 executable = JAVADOC;
richard@2997 1209 options.windowTitle("JavaFX Project ${project.name} ${RELEASE_NAME}")
kcr@6534 1210 if (BUILD_CLOSED) {
kcr@6534 1211 options.linksOffline(JDK_DOCS, JDK_DOCS_CLOSED);
kcr@6534 1212 } else {
kcr@6534 1213 options.links(JDK_DOCS);
kcr@6534 1214 }
richard@2997 1215 options.addBooleanOption("XDignore.symbol.file").setValue(true);
richard@2997 1216 options.addBooleanOption("Xdoclint:none").setValue(!IS_DOC_LINT);
rbair@3009 1217 options.addBooleanOption("javafx").setValue(true);
kcr@7246 1218 options.addBooleanOption("use").setValue(true);
richard@3156 1219 // All doc-files are located in src/main/docs because Gradle's javadoc doesn't copy
richard@3156 1220 // over the doc-files if they are embedded with the sources. I find this arrangement
richard@3156 1221 // somewhat cleaner anyway (never was a fan of mixing javadoc files with the sources)
richard@3069 1222 doLast {
richard@3069 1223 copy {
richard@3069 1224 from "src/main/docs"
richard@3069 1225 into "$buildDir/docs/javadoc"
richard@3069 1226 }
richard@3069 1227 }
richard@2997 1228 }
richard@2472 1229 }
richard@2472 1230
rbair@2707 1231 // The "base" project is our first module and the most basic one required for
rbair@2707 1232 // all other modules. It is useful even for non-GUI applications.
richard@2472 1233 project(":base") {
richard@2472 1234 dependencies {
richard@3219 1235 compile BUILD_SRC
richard@2472 1236 }
richard@2472 1237
rbair@2707 1238 // We need to take the VersionInfo.java file and replace the various
rbair@2707 1239 // properties within it
richard@3212 1240 def replacements = [
richard@3212 1241 "BUILD_TIMESTAMP": new java.util.Date(),
richard@2983 1242 "HUDSON_JOB_NAME": HUDSON_JOB_NAME,
richard@2983 1243 "HUDSON_BUILD_NUMBER": HUDSON_BUILD_NUMBER,
richard@2983 1244 "PROMOTED_BUILD_NUMBER": PROMOTED_BUILD_NUMBER,
richard@2983 1245 "PRODUCT_NAME": PRODUCT_NAME,
richard@2983 1246 "RAW_VERSION": RAW_VERSION,
richard@2983 1247 "RELEASE_NAME": RELEASE_NAME,
richard@2983 1248 "RELEASE_MILESTONE": RELEASE_MILESTONE];
richard@3156 1249 task processVersionInfo(type: Copy, description: "Replace params in VersionInfo and copy file to destination") {
richard@3156 1250 doFirst { mkdir "$buildDir/generated-src/version-info" }
richard@2472 1251 from "src/main/version-info"
richard@2920 1252 into "$buildDir/generated-src/version-info/com/sun/javafx/runtime"
richard@2472 1253 filter {line->
richard@2472 1254 replacements.each() {k, v ->
rbair@2749 1255 line = line.replace("@$k@", v.toString());
richard@2472 1256 }
richard@2472 1257 line
richard@2472 1258 }
richard@2472 1259 }
richard@2472 1260
David@4103 1261 compileJava.dependsOn updateCacheIfNeeded
kcr@4498 1262 compileJava.dependsOn verifyJava
David@4103 1263
richard@2920 1264 // Make sure to include $buildDir/generated-src/version-info that we previously created.
rbair@2707 1265 // We DO NOT want to include src/main/version-info
martin@6918 1266 if (System.getProperty("jfx.build.jdk.defenders", "true").equals("true")) {
martin@6918 1267 sourceSets.main.java.srcDirs += "src/main/java8"
martin@6918 1268 } else {
martin@6918 1269 sourceSets.main.java.srcDirs += "src/main/java7"
martin@6918 1270 }
martin@6918 1271
martin@6981 1272 if (IS_COMPILE_JFR) {
martin@6918 1273 sourceSets.main.java.srcDirs += "src/main/java-jfr"
martin@6918 1274 }
martin@6918 1275
martin@6918 1276 sourceSets.main.java.srcDirs += "$buildDir/generated-src/version-info"
martin@6918 1277
richard@3156 1278 compileJava.dependsOn processVersionInfo
richard@2472 1279 }
richard@2472 1280
rbair@2707 1281 // The graphics module is needed for any graphical JavaFX application. It requires
rbair@2707 1282 // the base module and includes the scene graph, layout, css, prism, windowing, etc.
rbair@2707 1283 // This is a fairly complicated module. There are many different types of native components
rbair@2707 1284 // that all need to be compiled.
richard@2472 1285 project(":graphics") {
richard@3219 1286 // Workaround for lack of Antlr 3 support in Gradle. By defining a configuration,
richard@3219 1287 // we can then give it a class path and use that classpath to execute a java command
danno@6605 1288 getConfigurations().create("antlr3");
richard@3219 1289
rbair@2757 1290 sourceSets {
richard@3156 1291 main
rbair@2828 1292 test
richard@3134 1293 stub
rbair@2757 1294 }
richard@2472 1295
richard@2472 1296 dependencies {
rbair@3343 1297 compile project(":base"), BUILD_SRC
richard@3325 1298 compile name: SWT_FILE_NAME
richard@3325 1299 stubCompile group: "junit", name: "junit", version: "4.8.2",
richard@4031 1300 project(":base").sourceSets.test.output, sourceSets.main.output
richard@3325 1301 antlr3 group: "org.antlr", name: "antlr", version: "3.1.3"
richard@4043 1302 antlr3 group: "org.antlr", name: "antlr-runtime", version: "3.1.3"
richard@4043 1303 antlr3 group: "org.antlr", name: "stringtemplate", version: "3.2"
richard@2472 1304 }
kirill@5407 1305
felipe@4734 1306 // Create a single "native" task which will depend on all the individual native tasks for graphics
felipe@4734 1307 project.ext.nativeAllTask = task("native", group: "Build", description: "Compiles and Builds all native libraries for Graphics");
felipe@4734 1308 project.ext.cleanNativeAllTask = task("cleanNative", group: "Build", description: "Clean all native libraries and objects for Graphics");
rbair@2757 1309
rbair@3458 1310 // Add tasks for native compilation
rbair@3458 1311 addNative(project, "glass");
richard@3487 1312 addNative(project, "prism")
richard@3487 1313 addNative(project, "prismSW")
kcr@4019 1314 addNative(project, "font")
rbair@3458 1315 addNative(project, "iio")
richard@3487 1316 addNative(project, "prismES2")
kcr@3415 1317
kcr@5526 1318 if (IS_COMPILE_PANGO) {
ddhill@7063 1319 addNative(project, "fontFreetype")
ddhill@7063 1320 addNative(project, "fontPango")
felipe@4255 1321 }
felipe@4255 1322
kcr@3415 1323 if (IS_WINDOWS) {
richard@3487 1324 addNative(project, "prismD3D")
kcr@3415 1325 // TODO need to hook this up to be executed only if PassThroughVS.h is missing or PassThroughVS.hlsl is changed
kcr@3415 1326 task generateD3DHeaders(group: "Build") {
kcr@3415 1327 enabled = IS_WINDOWS
kcr@3513 1328 dependsOn javahWinPrismD3D
felipe@5857 1329 inputs.file "src/main/native-prism-d3d/hlsl/Mtl1PS.hlsl"
felipe@5857 1330 inputs.file "src/main/native-prism-d3d/hlsl/Mtl1VS.hlsl"
felipe@5857 1331 inputs.file "src/main/native-prism-d3d/PassThroughVS.hlsl"
felipe@5857 1332 outputs.dir "$buildDir/headers/PrismD3D/"
felipe@5857 1333 outputs.dir "$buildDir/headers/PrismD3D/hlsl/"
kcr@3415 1334 description = "Generate headers by compiling hlsl files"
kcr@3415 1335 doLast {
kcr@3415 1336 mkdir file("$buildDir/headers/PrismD3D/hlsl")
rbair@3477 1337 def PS_3D_SRC = file("src/main/native-prism-d3d/hlsl/Mtl1PS.hlsl")
rbair@3477 1338 def VS_3D_SRC = file("src/main/native-prism-d3d/hlsl/Mtl1VS.hlsl")
rbair@3477 1339 def PASSTHROUGH_VS_SRC = file("src/main/native-prism-d3d/PassThroughVS.hlsl")
kcr@3415 1340 def jobs = [
rbair@3477 1341 ["$FXC", "/nologo", "/T", "vs_3_0", "/Fh", "$buildDir/headers/PrismD3D/PassThroughVS.h", "/E", "passThrough", "$PASSTHROUGH_VS_SRC"],
kcr@3415 1342 ["$FXC", "/nologo", "/T", "ps_2_0", "/Fh", "$buildDir/headers/PrismD3D/hlsl/Mtl1PS.h", "/DSpec=0", "/DSType=0", "$PS_3D_SRC"],
kcr@3415 1343 ["$FXC", "/nologo", "/T", "ps_2_0", "/Fh", "$buildDir/headers/PrismD3D/hlsl/Mtl1PS_i.h", "/DSpec=0", "/DSType=0", "/DIllumMap=1", "$PS_3D_SRC"],
kcr@3415 1344 ["$FXC", "/nologo", "/T", "ps_2_0", "/Fh", "$buildDir/headers/PrismD3D/hlsl/Mtl1PS_s1n.h", "/DSpec=1", "/DSType=0", "$PS_3D_SRC"],
kcr@3415 1345 ["$FXC", "/nologo", "/T", "ps_2_0", "/Fh", "$buildDir/headers/PrismD3D/hlsl/Mtl1PS_s2n.h", "/DSpec=2", "/DSType=0", "$PS_3D_SRC"],
kcr@3415 1346 ["$FXC", "/nologo", "/T", "ps_2_0", "/Fh", "$buildDir/headers/PrismD3D/hlsl/Mtl1PS_s3n.h", "/DSpec=3", "/DSType=0", "$PS_3D_SRC"],
vadim@5842 1347 ["$FXC", "/nologo", "/T", "ps_2_0", "/Fh", "$buildDir/headers/PrismD3D/hlsl/Mtl1PS_s1t.h", "/DSpec=1", "/DSType=1", "$PS_3D_SRC"],
vadim@5842 1348 ["$FXC", "/nologo", "/T", "ps_2_0", "/Fh", "$buildDir/headers/PrismD3D/hlsl/Mtl1PS_s2t.h", "/DSpec=2", "/DSType=1", "$PS_3D_SRC"],
vadim@5842 1349 ["$FXC", "/nologo", "/T", "ps_2_0", "/Fh", "$buildDir/headers/PrismD3D/hlsl/Mtl1PS_s3t.h", "/DSpec=3", "/DSType=1", "$PS_3D_SRC"],
vadim@5842 1350 ["$FXC", "/nologo", "/T", "ps_2_0", "/Fh", "$buildDir/headers/PrismD3D/hlsl/Mtl1PS_s1c.h", "/DSpec=1", "/DSType=2", "$PS_3D_SRC"],
vadim@5842 1351 ["$FXC", "/nologo", "/T", "ps_2_0", "/Fh", "$buildDir/headers/PrismD3D/hlsl/Mtl1PS_s2c.h", "/DSpec=2", "/DSType=2", "$PS_3D_SRC"],
vadim@5842 1352 ["$FXC", "/nologo", "/T", "ps_2_0", "/Fh", "$buildDir/headers/PrismD3D/hlsl/Mtl1PS_s3c.h", "/DSpec=3", "/DSType=2", "$PS_3D_SRC"],
vadim@5842 1353 ["$FXC", "/nologo", "/T", "ps_2_0", "/Fh", "$buildDir/headers/PrismD3D/hlsl/Mtl1PS_s1m.h", "/DSpec=1", "/DSType=3", "$PS_3D_SRC"],
vadim@5842 1354 ["$FXC", "/nologo", "/T", "ps_2_0", "/Fh", "$buildDir/headers/PrismD3D/hlsl/Mtl1PS_s2m.h", "/DSpec=2", "/DSType=3", "$PS_3D_SRC"],
vadim@5842 1355 ["$FXC", "/nologo", "/T", "ps_2_0", "/Fh", "$buildDir/headers/PrismD3D/hlsl/Mtl1PS_s3m.h", "/DSpec=3", "/DSType=3", "$PS_3D_SRC"],
kcr@3415 1356 ["$FXC", "/nologo", "/T", "ps_2_0", "/Fh", "$buildDir/headers/PrismD3D/hlsl/Mtl1PS_b1n.h", "/DSpec=1", "/DSType=0", "/DBump=1", "$PS_3D_SRC"],
kcr@3415 1357 ["$FXC", "/nologo", "/T", "ps_2_0", "/Fh", "$buildDir/headers/PrismD3D/hlsl/Mtl1PS_b2n.h", "/DSpec=2", "/DSType=0", "/DBump=1", "$PS_3D_SRC"],
kcr@3415 1358 ["$FXC", "/nologo", "/T", "ps_2_0", "/Fh", "$buildDir/headers/PrismD3D/hlsl/Mtl1PS_b3n.h", "/DSpec=3", "/DSType=0", "/DBump=1", "$PS_3D_SRC"],
vadim@5842 1359 ["$FXC", "/nologo", "/T", "ps_2_0", "/Fh", "$buildDir/headers/PrismD3D/hlsl/Mtl1PS_b1t.h", "/DSpec=1", "/DSType=1", "/DBump=1", "$PS_3D_SRC"],
vadim@5842 1360 ["$FXC", "/nologo", "/T", "ps_2_0", "/Fh", "$buildDir/headers/PrismD3D/hlsl/Mtl1PS_b2t.h", "/DSpec=2", "/DSType=1", "/DBump=1", "$PS_3D_SRC"],
vadim@5842 1361 ["$FXC", "/nologo", "/T", "ps_2_0", "/Fh", "$buildDir/headers/PrismD3D/hlsl/Mtl1PS_b3t.h", "/DSpec=3", "/DSType=1", "/DBump=1", "$PS_3D_SRC"],
vadim@5842 1362 ["$FXC", "/nologo", "/T", "ps_2_0", "/Fh", "$buildDir/headers/PrismD3D/hlsl/Mtl1PS_b1c.h", "/DSpec=1", "/DSType=2", "/DBump=1", "$PS_3D_SRC"],
vadim@5842 1363 ["$FXC", "/nologo", "/T", "ps_2_0", "/Fh", "$buildDir/headers/PrismD3D/hlsl/Mtl1PS_b2c.h", "/DSpec=2", "/DSType=2", "/DBump=1", "$PS_3D_SRC"],
vadim@5842 1364 ["$FXC", "/nologo", "/T", "ps_2_0", "/Fh", "$buildDir/headers/PrismD3D/hlsl/Mtl1PS_b3c.h", "/DSpec=3", "/DSType=2", "/DBump=1", "$PS_3D_SRC"],
vadim@5842 1365 ["$FXC", "/nologo", "/T", "ps_2_0", "/Fh", "$buildDir/headers/PrismD3D/hlsl/Mtl1PS_b1m.h", "/DSpec=1", "/DSType=3", "/DBump=1", "$PS_3D_SRC"],
vadim@5842 1366 ["$FXC", "/nologo", "/T", "ps_2_0", "/Fh", "$buildDir/headers/PrismD3D/hlsl/Mtl1PS_b2m.h", "/DSpec=2", "/DSType=3", "/DBump=1", "$PS_3D_SRC"],
vadim@5842 1367 ["$FXC", "/nologo", "/T", "ps_2_0", "/Fh", "$buildDir/headers/PrismD3D/hlsl/Mtl1PS_b3m.h", "/DSpec=3", "/DSType=3", "/DBump=1", "$PS_3D_SRC"],
kcr@3415 1368 ["$FXC", "/nologo", "/T", "ps_2_0", "/Fh", "$buildDir/headers/PrismD3D/hlsl/Mtl1PS_s1ni.h", "/DSpec=1", "/DSType=0", "/DIllumMap=1", "$PS_3D_SRC"],
kcr@3415 1369 ["$FXC", "/nologo", "/T", "ps_2_0", "/Fh", "$buildDir/headers/PrismD3D/hlsl/Mtl1PS_s2ni.h", "/DSpec=2", "/DSType=0", "/DIllumMap=1", "$PS_3D_SRC"],
kcr@3415 1370 ["$FXC", "/nologo", "/T", "ps_2_0", "/Fh", "$buildDir/headers/PrismD3D/hlsl/Mtl1PS_s3ni.h", "/DSpec=3", "/DSType=0", "/DIllumMap=1", "$PS_3D_SRC"],
vadim@5842 1371 ["$FXC", "/nologo", "/T", "ps_2_0", "/Fh", "$buildDir/headers/PrismD3D/hlsl/Mtl1PS_s1ti.h", "/DSpec=1", "/DSType=1", "/DIllumMap=1", "$PS_3D_SRC"],
vadim@5842 1372 ["$FXC", "/nologo", "/T", "ps_2_0", "/Fh", "$buildDir/headers/PrismD3D/hlsl/Mtl1PS_s2ti.h", "/DSpec=2", "/DSType=1", "/DIllumMap=1", "$PS_3D_SRC"],
vadim@5842 1373 ["$FXC", "/nologo", "/T", "ps_2_0", "/Fh", "$buildDir/headers/PrismD3D/hlsl/Mtl1PS_s3ti.h", "/DSpec=3", "/DSType=1", "/DIllumMap=1", "$PS_3D_SRC"],
vadim@5842 1374 ["$FXC", "/nologo", "/T", "ps_2_0", "/Fh", "$buildDir/headers/PrismD3D/hlsl/Mtl1PS_s1ci.h", "/DSpec=1", "/DSType=2", "/DIllumMap=1", "$PS_3D_SRC"],
vadim@5842 1375 ["$FXC", "/nologo", "/T", "ps_2_0", "/Fh", "$buildDir/headers/PrismD3D/hlsl/Mtl1PS_s2ci.h", "/DSpec=2", "/DSType=2", "/DIllumMap=1", "$PS_3D_SRC"],
vadim@5842 1376 ["$FXC", "/nologo", "/T", "ps_2_0", "/Fh", "$buildDir/headers/PrismD3D/hlsl/Mtl1PS_s3ci.h", "/DSpec=3", "/DSType=2", "/DIllumMap=1", "$PS_3D_SRC"],
vadim@5842 1377 ["$FXC", "/nologo", "/T", "ps_2_0", "/Fh", "$buildDir/headers/PrismD3D/hlsl/Mtl1PS_s1mi.h", "/DSpec=1", "/DSType=3", "/DIllumMap=1", "$PS_3D_SRC"],
vadim@5842 1378 ["$FXC", "/nologo", "/T", "ps_2_0", "/Fh", "$buildDir/headers/PrismD3D/hlsl/Mtl1PS_s2mi.h", "/DSpec=2", "/DSType=3", "/DIllumMap=1", "$PS_3D_SRC"],
vadim@5842 1379 ["$FXC", "/nologo", "/T", "ps_2_0", "/Fh", "$buildDir/headers/PrismD3D/hlsl/Mtl1PS_s3mi.h", "/DSpec=3", "/DSType=3", "/DIllumMap=1", "$PS_3D_SRC"],
kcr@3415 1380 ["$FXC", "/nologo", "/T", "ps_2_0", "/Fh", "$buildDir/headers/PrismD3D/hlsl/Mtl1PS_b1ni.h", "/DSpec=1", "/DSType=0", "/DBump=1", "/DIllumMap=1", "$PS_3D_SRC"],
kcr@3415 1381 ["$FXC", "/nologo", "/T", "ps_2_0", "/Fh", "$buildDir/headers/PrismD3D/hlsl/Mtl1PS_b2ni.h", "/DSpec=2", "/DSType=0", "/DBump=1", "/DIllumMap=1", "$PS_3D_SRC"],
kcr@3415 1382 ["$FXC", "/nologo", "/T", "ps_2_0", "/Fh", "$buildDir/headers/PrismD3D/hlsl/Mtl1PS_b3ni.h", "/DSpec=3", "/DSType=0", "/DBump=1", "/DIllumMap=1", "$PS_3D_SRC"],
vadim@5842 1383 ["$FXC", "/nologo", "/T", "ps_2_0", "/Fh", "$buildDir/headers/PrismD3D/hlsl/Mtl1PS_b1ti.h", "/DSpec=1", "/DSType=1", "/DBump=1", "/DIllumMap=1", "$PS_3D_SRC"],
vadim@5842 1384 ["$FXC", "/nologo", "/T", "ps_2_0", "/Fh", "$buildDir/headers/PrismD3D/hlsl/Mtl1PS_b2ti.h", "/DSpec=2", "/DSType=1", "/DBump=1", "/DIllumMap=1", "$PS_3D_SRC"],
vadim@5842 1385 ["$FXC", "/nologo", "/T", "ps_2_0", "/Fh", "$buildDir/headers/PrismD3D/hlsl/Mtl1PS_b3ti.h", "/DSpec=3", "/DSType=1", "/DBump=1", "/DIllumMap=1", "$PS_3D_SRC"],
vadim@5842 1386 ["$FXC", "/nologo", "/T", "ps_2_0", "/Fh", "$buildDir/headers/PrismD3D/hlsl/Mtl1PS_b1ci.h", "/DSpec=1", "/DSType=2", "/DBump=1", "/DIllumMap=1", "$PS_3D_SRC"],
vadim@5842 1387 ["$FXC", "/nologo", "/T", "ps_2_0", "/Fh", "$buildDir/headers/PrismD3D/hlsl/Mtl1PS_b2ci.h", "/DSpec=2", "/DSType=2", "/DBump=1", "/DIllumMap=1", "$PS_3D_SRC"],
vadim@5842 1388 ["$FXC", "/nologo", "/T", "ps_2_0", "/Fh", "$buildDir/headers/PrismD3D/hlsl/Mtl1PS_b3ci.h", "/DSpec=3", "/DSType=2", "/DBump=1", "/DIllumMap=1", "$PS_3D_SRC"],
vadim@5842 1389 ["$FXC", "/nologo", "/T", "ps_2_0", "/Fh", "$buildDir/headers/PrismD3D/hlsl/Mtl1PS_b1mi.h", "/DSpec=1", "/DSType=3", "/DBump=1", "/DIllumMap=1", "$PS_3D_SRC"],
vadim@5842 1390 ["$FXC", "/nologo", "/T", "ps_2_0", "/Fh", "$buildDir/headers/PrismD3D/hlsl/Mtl1PS_b2mi.h", "/DSpec=2", "/DSType=3", "/DBump=1", "/DIllumMap=1", "$PS_3D_SRC"],
vadim@5842 1391 ["$FXC", "/nologo", "/T", "ps_2_0", "/Fh", "$buildDir/headers/PrismD3D/hlsl/Mtl1PS_b3mi.h", "/DSpec=3", "/DSType=3", "/DBump=1", "/DIllumMap=1", "$PS_3D_SRC"],
kcr@3415 1392 ["$FXC", "/nologo", "/T", "vs_2_0", "/Fh", "$buildDir/headers/PrismD3D/hlsl/Mtl1VS_Obj.h", "/DVertexType=ObjVertex", "$VS_3D_SRC"]
kcr@3415 1393 ]
kcr@3415 1394 final ExecutorService executor = Executors.newFixedThreadPool(Integer.parseInt(project.NUM_COMPILE_THREADS.toString()));
kcr@3415 1395 final CountDownLatch latch = new CountDownLatch(jobs.size());
kcr@3415 1396 List futures = new ArrayList<Future>();
kcr@3415 1397 jobs.each { cmd ->
kcr@3415 1398 futures.add(executor.submit(new Runnable() {
kcr@3415 1399 @Override public void run() {
kcr@3415 1400 try {
kcr@3415 1401 exec {
kcr@3415 1402 commandLine cmd
kcr@3415 1403 }
kcr@3415 1404 } finally {
kcr@3415 1405 latch.countDown();
kcr@3415 1406 }
kcr@3415 1407 }
kcr@3415 1408 }));
kcr@3415 1409 }
kcr@3415 1410 latch.await();
kcr@3415 1411 // Looking for whether an exception occurred while executing any of the futures.
kcr@3415 1412 // By calling "get()" on each future an exception will be thrown if one had occurred
kcr@3415 1413 // on the background thread.
kcr@3415 1414 futures.each {it.get();}
kcr@3415 1415 }
kcr@3415 1416 }
kcr@3415 1417
kcr@3513 1418 ccWinPrismD3D.dependsOn generateD3DHeaders
kcr@3415 1419 }
kcr@3415 1420
richard@3212 1421 // The Decora and Prism JSL files have to be generated in a very specific set of steps.
richard@3212 1422 // 1) Compile the *Compile.java classes. These live in src/main/jsl-* and will be
richard@3212 1423 // output to $buildDir/classes/jsl-compilers/* (where * == decora or prism).
richard@3212 1424 // 2) Generate source files from the JSL files contained in src/main/jsl-*. These
richard@3212 1425 // will be output to $buildDir/generated-src/jsl-*
richard@3212 1426 // 3) Compile the JSL Java sources in $buildDir/generated-src/jsl-* and put the output
richard@3212 1427 // into classes/jsl-*
richard@3212 1428 // 4) Compile the native JSL sources in $buildDir/generated-src/jsl-* and put the obj
richard@3212 1429 // files into native/jsl-* and the resulting library into libs/jsl-*.dll|so|dylib
richard@3212 1430 // 5) Modify the jar step to include classes/jsl-*
richard@3212 1431 // The native library must be copied over during SDK creation time in the "sdk" task. In
richard@3212 1432 // addition to these steps, the clean task is created. Note that I didn't bother to create
richard@3212 1433 // a new task for each of the decora files, preferring instead just to create a rule?? Also
richard@3212 1434 // need "clean" tasks for each compile task.
richard@3212 1435
rbair@3546 1436 addJSL(project, "Decora", "com/sun/scenario/effect/impl/hw/d3d/hlsl") { sourceDir, destinationDir ->
richard@3212 1437 [[fileName: "ColorAdjust", generator: "CompileJSL", outputs: "-all"],
richard@3212 1438 [fileName: "Brightpass", generator: "CompileJSL", outputs: "-all"],
richard@3212 1439 [fileName: "SepiaTone", generator: "CompileJSL", outputs: "-all"],
richard@3212 1440 [fileName: "PerspectiveTransform", generator: "CompileJSL", outputs: "-all"],
richard@3212 1441 [fileName: "DisplacementMap", generator: "CompileJSL", outputs: "-all"],
richard@3212 1442 [fileName: "InvertMask", generator: "CompileJSL", outputs: "-all"],
richard@3212 1443 [fileName: "Blend", generator: "CompileBlend", outputs: "-all"],
richard@3212 1444 [fileName: "PhongLighting", generator: "CompilePhong", outputs: "-all"],
richard@3212 1445 [fileName: "LinearConvolve", generator: "CompileLinearConvolve", outputs: "-hw"],
richard@3212 1446 [fileName: "LinearConvolveShadow", generator: "CompileLinearConvolve", outputs: "-hw"]].each { settings ->
richard@3212 1447 javaexec {
rbair@3335 1448 executable = JAVA
richard@3212 1449 workingDir = "modules/graphics"
richard@3212 1450 main = settings.generator
richard@3219 1451 classpath = configurations.compile + configurations.antlr3
richard@3333 1452 classpath += files("$buildDir/classes/main")
richard@3212 1453 classpath += files("$buildDir/classes/jsl-compilers/decora")
richard@3212 1454 args = ["-i", sourceDir, "-o", destinationDir, "-t", "-pkg", "com/sun/scenario/effect", "$settings.outputs", "$settings.fileName"]
rbair@3335 1455 jvmArgs "-Djava.ext.dirs="
richard@3212 1456 }
richard@3212 1457 }
richard@3212 1458 }
richard@3212 1459
richard@3212 1460 task generateDecoraNativeHeaders(type: JavaHeaderTask, dependsOn: compileDecoraJavaShaders) {
richard@3212 1461 description = "Generates JNI Headers for Decora SSE Natives"
richard@3212 1462 source file("$buildDir/classes/jsl-decora")
richard@3212 1463 source file("$buildDir/classes/main")
richard@3212 1464 include("com/sun/scenario/effect/impl/sw/sse/*");
richard@3212 1465 classpath = files("$buildDir/classes/main", "$buildDir/classes/jsl-decora")
richard@3212 1466 output = file("$buildDir/generated-src/headers/jsl-decora")
richard@3212 1467 }
richard@3212 1468
felipe@4734 1469 task nativeDecora(dependsOn: compileDecoraHLSLShaders, group: "Build") {
felipe@4734 1470 description = "Generates JNI headers, compiles, and builds native dynamic library for Decora"
felipe@4734 1471 }
felipe@4734 1472 task cleanNativeDecora(type: Delete, group: "Build") {
felipe@4734 1473 description = "Clean native objects for Decora"
felipe@4734 1474 }
rbair@3458 1475
rbair@3458 1476 def headerDir = file("$buildDir/generated-src/headers/jsl-decora")
rbair@3458 1477 def nativeRootDir = project.file("$project.buildDir/native/jsl-decora")
rbair@3458 1478 def libRootDir = project.file("$project.buildDir/libs/jsl-decora")
rbair@3458 1479 // For each compile target, create cc and link tasks
rbair@3458 1480 compileTargets { t ->
rbair@3458 1481 def target = t.name
rbair@3458 1482 def upperTarget = t.upper
rbair@3458 1483 def capitalTarget = t.capital
richard@3487 1484 def properties = rootProject.ext[upperTarget];
rbair@4165 1485 def library = properties.library
felipe@5790 1486 def ccOutput = file("$nativeRootDir/$target");
rbair@3458 1487
rbair@3458 1488 def ccTask = task("compileDecoraNativeShaders$capitalTarget", type: CCTask, dependsOn: generateDecoraNativeHeaders) {
rbair@3458 1489 description = "Compiles Decora SSE natives"
rbair@3458 1490 matches = ".*\\.cc"
rbair@3458 1491 source file("$buildDir/generated-src/jsl-decora")
rbair@3458 1492 source file("modules/graphics/src/main/native-decora")
rbair@3458 1493 headers = headerDir
richard@3487 1494 params.addAll(properties.decora.ccFlags)
felipe@5790 1495 output(ccOutput)
richard@3487 1496 compiler = properties.decora.compiler
felipe@5790 1497 cleanNativeDecora.delete ccOutput
rbair@3458 1498 }
rbair@3458 1499
rbair@3458 1500 def linkTask = task("linkDecoraNativeShaders$capitalTarget", type: LinkTask, dependsOn: ccTask) {
rbair@3458 1501 description = "Creates native dynamic library for Decora SSE"
rbair@3458 1502 objectDir = file("$nativeRootDir/$target")
richard@3487 1503 linkParams.addAll(properties.decora.linkFlags)
richard@3502 1504 lib = file("$libRootDir/$t.name/${library(properties.decora.lib)}")
richard@3487 1505 linker = properties.decora.linker
felipe@4734 1506 cleanNativeDecora.delete "$libRootDir/$t.name/"
rbair@3458 1507 }
rbair@3458 1508
felipe@5790 1509 if (IS_WINDOWS && target == "win") {
felipe@5790 1510 def rcTask = project.task("rcDecoraNativeShaders$capitalTarget", type: CompileResourceTask, dependsOn: generateDecoraNativeHeaders) {
felipe@5790 1511 description = "Compiles native sources for Decora SSE"
felipe@5790 1512 matches = ".*\\.rc"
felipe@5790 1513 compiler = properties.decora.rcCompiler
felipe@5790 1514 source(properties.decora.rcSource)
felipe@5790 1515 if (properties.decora.rcFlags) {
felipe@5790 1516 rcParams.addAll(properties.decora.rcFlags)
felipe@5790 1517 }
felipe@5790 1518 output(ccOutput)
felipe@5790 1519 }
felipe@5790 1520 linkTask.dependsOn rcTask;
felipe@5790 1521 }
felipe@5790 1522
rbair@3458 1523 nativeDecora.dependsOn(linkTask)
richard@3212 1524 }
richard@3212 1525
richard@3212 1526 // Prism JSL
rbair@3546 1527 addJSL(project, "Prism", "com/sun/prism/d3d/hlsl") { sourceDir, destinationDir ->
richard@3212 1528 def inputFiles = fileTree(dir: sourceDir)
richard@3212 1529 inputFiles.include "**/*.jsl"
richard@3212 1530 inputFiles.each { file ->
richard@3212 1531 javaexec {
rbair@3335 1532 executable = JAVA
richard@3212 1533 workingDir = "modules/graphics"
richard@3212 1534 main = "CompileJSL"
richard@3219 1535 classpath = configurations.compile + configurations.antlr3
richard@3212 1536 classpath += files("$buildDir/classes/jsl-compilers/prism", "modules/graphics/src/main/jsl-prism") // for the .stg
richard@3212 1537 args = ["-i", sourceDir, "-o", destinationDir, "-t", "-pkg", "com/sun/prism", "-d3d", "-es2", "-name", "$file"]
rbair@3335 1538 jvmArgs "-Djava.ext.dirs="
richard@3212 1539 }
richard@3212 1540 }
richard@3212 1541 }
richard@3212 1542
richard@3212 1543 classes.dependsOn compilePrismJavaShaders;
richard@3487 1544 nativePrism.dependsOn compilePrismHLSLShaders;
richard@3212 1545
felipe@4734 1546 project.nativeAllTask.dependsOn nativeDecora
felipe@4734 1547 project.cleanNativeAllTask.dependsOn cleanNativeDecora
richard@3212 1548 assemble.dependsOn nativeDecora
richard@3212 1549 processResources.dependsOn processDecoraShaders, processPrismShaders
richard@3212 1550
richard@3014 1551 test {
richard@2920 1552 jvmArgs "-Djava.ext.dirs=", "-Djavafx.toolkit=com.sun.javafx.pgstub.StubToolkit", "-DCSS_META_DATA_TEST_DIR=${file('$buildDir/classes/main/javafx')}"
pavel@4656 1553 enableAssertions = true
pavel@4656 1554 testLogging.exceptionFormat = "full"
pavel@4656 1555 scanForTestClasses = false
pavel@4656 1556 include "**/*Test.*"
kcr@4368 1557 if (BUILD_CLOSED && DO_JCOV) {
rbair@4232 1558 addJCov(project, test)
rbair@4232 1559 }
rbair@2757 1560 }
rbair@2903 1561
richard@4031 1562 // To enable the IDEs to all be happy (no red squiggles) we need to have the libraries
richard@4031 1563 // available in some known location. Maybe in the future the Gradle plugins to each
richard@4031 1564 // of the IDEs will be good enough that we won't need this hack anymore.
richard@4031 1565 classes << {
snorthov@4178 1566 // Copy all of the download libraries to the libs directory for the sake of the IDEs
snorthov@4178 1567 File libsDir = rootProject.file("build/libs");
snorthov@6996 1568
snorthov@6996 1569 // In some IDEs (Eclipse for example), touching these libraries cauese a full build
snorthov@6996 1570 // within the IDE. When gradle is used outside of the IDE, for example to build the
snorthov@6996 1571 // native code, a full rebuild is caused within the IDE. The fix is to check for the
snorthov@6996 1572 // lib directory and not copy the files
snorthov@6996 1573 //
snorthov@6996 1574 // This means that in order to update the dependent libraries for the IDE's, a clean
snorthov@6996 1575 // build is required
snorthov@6996 1576 //
snorthov@6996 1577 if (libsDir.exists()) return;
snorthov@4178 1578 libsDir.mkdirs();
snorthov@4178 1579 for (File f : [configurations.compile.files, configurations.antlr3.files].flatten()) {
snorthov@4178 1580 copy {
snorthov@4178 1581 into libsDir
snorthov@4178 1582 from f.getParentFile()
snorthov@4178 1583 include "**/antlr-3.1.3.jar"
snorthov@4178 1584 include "**/stringtemplate-3.2.jar"
snorthov@4178 1585 include "**/antlr-runtime-3.1.3.jar"
snorthov@4178 1586 includeEmptyDirs = false
snorthov@4178 1587 }
snorthov@4178 1588 // Have to rename the swt jar because it is some platform specific name but
snorthov@4178 1589 // for the sake of the IDEs we need to have a single stable name that works
snorthov@4178 1590 // on every platform
snorthov@4178 1591 copy {
snorthov@4178 1592 into libsDir
snorthov@4178 1593 from f.getParentFile()
snorthov@4178 1594 include "**/*swt*.jar"
snorthov@4178 1595 includeEmptyDirs = false
snorthov@4178 1596 rename ".*swt.*jar", "swt-debug\\.jar"
richard@4031 1597 }
richard@4031 1598 }
richard@4031 1599 }
richard@2472 1600 }
richard@2472 1601
richard@2472 1602 project(":controls") {
richard@2472 1603 dependencies {
richard@3219 1604 compile BUILD_SRC, project(":base"), project(":graphics"), project(":designTime")
rbair@3335 1605 // TODO not sure how to specify this? processResources project(":base"), project(":graphics")
pavel@4663 1606 testCompile project(":graphics").sourceSets.test.output
rbair@4341 1607 testCompile project(":base").sourceSets.test.output
rbair@2757 1608 }
rbair@2757 1609
rbair@2757 1610 test {
rbair@2757 1611 jvmArgs "-Djavafx.toolkit=com.sun.javafx.pgstub.StubToolkit"
richard@2472 1612 }
richard@3069 1613
richard@3219 1614 // TODO Css2Bin really should be moved out and put into buildSrc if it can be
richard@3156 1615 // TODO could change script to dynamically locate all .css files and create bss for them, probably better
richard@3156 1616 // TODO also not sure there is any benefit to having css files in the jfxrt.jar at all
richard@3069 1617 processResources << {
richard@3069 1618 ["$buildDir/resources/main/com/sun/javafx/scene/control/skin/caspian/caspian.css",
jgiles@6105 1619 "$buildDir/resources/main/com/sun/javafx/scene/control/skin/caspian/caspian-no-transparency.css",
richard@3069 1620 "$buildDir/resources/main/com/sun/javafx/scene/control/skin/caspian/embedded-qvga.css",
richard@3069 1621 "$buildDir/resources/main/com/sun/javafx/scene/control/skin/caspian/embedded.css",
richard@3069 1622 "$buildDir/resources/main/com/sun/javafx/scene/control/skin/caspian/fxvk.css",
richard@3069 1623 "$buildDir/resources/main/com/sun/javafx/scene/control/skin/caspian/highcontrast.css",
richard@3069 1624 "$buildDir/resources/main/com/sun/javafx/scene/control/skin/modena/modena.css",
jgiles@6105 1625 "$buildDir/resources/main/com/sun/javafx/scene/control/skin/modena/modena-no-transparency.css",
richard@3069 1626 "$buildDir/resources/main/com/sun/javafx/scene/control/skin/modena/touch.css"].each { css ->
richard@3069 1627 javaexec {
rbair@3335 1628 executable = JAVA
rbair@3335 1629 workingDir = "modules/controls"
richard@3333 1630 classpath files("$buildDir/classes/main",
richard@3333 1631 project(":graphics").sourceSets.main.output,
richard@3333 1632 project(":base").sourceSets.main.output)
richard@3069 1633 main = "com.sun.javafx.css.parser.Css2Bin"
richard@3069 1634 args css
rbair@3335 1635 jvmArgs "-Djava.ext.dirs="
richard@3069 1636 }
richard@3069 1637 }
richard@3069 1638 }
richard@2472 1639 }
richard@2472 1640
oldrich@5689 1641 project(":extensions") {
oldrich@5689 1642 dependencies {
oldrich@5689 1643 compile BUILD_SRC, project(":base"), project(":graphics")
oldrich@5689 1644 }
oldrich@5689 1645 }
oldrich@5689 1646
richard@2472 1647 project(":swing") {
David@3903 1648 /* should not be built, but needed in builders and JMX
rbair@3458 1649 tasks.all {
rbair@3458 1650 if (!COMPILE_SWING) it.enabled = false
richard@3156 1651 }
David@3903 1652 */
richard@2472 1653 dependencies {
richard@3219 1654 compile BUILD_SRC, project(":base"), project(":graphics")
richard@2472 1655 }
richard@2472 1656 }
richard@2472 1657
richard@2472 1658 project(":swt") {
rbair@3458 1659 tasks.all {
rbair@3458 1660 if (!COMPILE_SWT) it.enabled = false
richard@3156 1661 }
richard@2472 1662 dependencies {
richard@3219 1663 compile BUILD_SRC, project(":base"), project(":graphics")
richard@3325 1664 compile name: SWT_FILE_NAME
richard@2472 1665 }
richard@2472 1666 }
richard@2472 1667
rbair@2723 1668 project(":fxml") {
rbair@2723 1669 dependencies {
richard@3219 1670 compile BUILD_SRC, project(":base"), project(":graphics"),
richard@3156 1671 project(":controls"), project(":swt"), project(":swing")
pavel@4663 1672 testCompile project(":graphics").sourceSets.test.output
richard@3008 1673 }
richard@3008 1674 test {
richard@3008 1675 // StubToolkit is not *really* needed here, but because some code inadvertently invokes performance
richard@3156 1676 // tracker and this attempts to fire up the toolkit and this looks for native libraries and fails,
richard@3008 1677 // we have to use the stub toolkit for now.
richard@3008 1678 jvmArgs "-Djavafx.toolkit=com.sun.javafx.pgstub.StubToolkit"
anthony@5699 1679 classpath += files("$JDK_HOME/jre/lib/ext/nashorn.jar")
rbair@2723 1680 }
rbair@2723 1681 }
rbair@2707 1682
kcr@3784 1683 project(":builders") {
kcr@3784 1684 sourceCompatibility = 1.7
kcr@3784 1685
kirill@5407 1686 if (!COMPILE_SWING) sourceSets.main.java.exclude ("**/swing/**")
kirill@5407 1687 if (!COMPILE_SWT) sourceSets.main.java.exclude ("**/swt/**")
David@3903 1688
kcr@3784 1689 dependencies {
kcr@3784 1690 compile BUILD_SRC, project(":base"), project(":graphics"),
kirill@5407 1691 project(":controls"), project(":swt"), project(":swing"), project(":media"), project(":web")
pavel@4663 1692 testCompile project(":graphics").sourceSets.test.output
kcr@3784 1693 }
kcr@3784 1694 test {
kcr@3784 1695 // StubToolkit is not *really* needed here, but because some code inadvertently invokes performance
kcr@3784 1696 // tracker and this attempts to fire up the toolkit and this looks for native libraries and fails,
kcr@3784 1697 // we have to use the stub toolkit for now.
kcr@3784 1698 jvmArgs "-Djavafx.toolkit=com.sun.javafx.pgstub.StubToolkit"
kcr@3784 1699 }
kcr@3784 1700 }
kcr@3784 1701
rbair@2707 1702 project(":designTime") {
rbair@3458 1703 tasks.all {
rbair@3458 1704 if (!COMPILE_DESIGN_TIME) it.enabled = false
rbair@3458 1705 }
rbair@2707 1706 dependencies {
richard@3008 1707 compile project(":graphics")
rbair@2707 1708 }
dmitry@7780 1709 // impossible to run tests on designTime when not compiling SDK and designTime subproject
dmitry@7780 1710 // need to disable test and compileTestJava tasks and remove their dependencies
dmitry@7780 1711 if (!DO_BUILD_SDK_FOR_TEST) {
dmitry@7780 1712 [test, compileTestJava].each {
dmitry@7780 1713 it.dependsOn = []
dmitry@7780 1714 it.enabled = false
dmitry@7780 1715 }
dmitry@7780 1716 }
rbair@2707 1717 }
rbair@2707 1718
kcr@5584 1719 project(":jmx") {
kcr@5584 1720 dependencies {
kcr@5584 1721 compile project(":base")
kcr@5584 1722 compile project(":graphics")
kcr@5584 1723 compile project(":swing")
kcr@5584 1724 compile project(":media")
kcr@5584 1725 }
kcr@5584 1726
kcr@5584 1727 // Tests are disabled until RT-33926 can be fixed
kcr@5584 1728 test.enabled = false
dmitry@7780 1729
dmitry@7780 1730 if (!DO_BUILD_SDK_FOR_TEST) {
dmitry@7780 1731 def javafxMxJar = new File(TEST_SDK_DIR, "lib/javafx-mx.jar")
dmitry@7780 1732 [test, compileTestJava].each {
dmitry@7780 1733 it.classpath = files(javafxMxJar) + it.classpath
dmitry@7780 1734 }
dmitry@7780 1735 }
kcr@5584 1736 }
kcr@5584 1737
kcr@5006 1738 // This project is for system tests that need to run with a full SDK.
kcr@5006 1739 // Most of them display a stage or do other things that preclude running
kcr@5006 1740 // them in a shared JVM or as part of the "smoke test" run (which must
kcr@5006 1741 // not pop up any windows or use audio). As such, they are only enabled
kcr@5006 1742 // when FULL_TEST is specified, and each test runs in its own JVM
kcr@5006 1743 project(":systemTests") {
kcr@5006 1744 test {
kcr@5006 1745 enabled = IS_FULL_TEST
kcr@5548 1746 if (!IS_USE_ROBOT) {
kcr@5548 1747 // Disable all robot-based visual tests
kcr@5548 1748 exclude("**/helloworld/*.*");
kcr@5548 1749 exclude("**/javafx/embed/swing/*.*");
kcr@5548 1750 exclude("**/javafx/scene/layout/*.*");
kcr@5548 1751 exclude("**/test3d/*.*");
kcr@5819 1752 exclude("**/painttest/*.*");
kcr@8351 1753 exclude("**/renderlock/*.*");
kcr@5548 1754 }
kcr@5629 1755 if (!IS_AWT_TEST) {
kcr@5629 1756 // Disable all AWT-based tests
kcr@5629 1757 exclude("**/javafx/embed/swing/*.*");
kcr@5629 1758 exclude("**/com/sun/javafx/application/Swing*.*");
kcr@5629 1759 }
jgiles@8312 1760
kcr@5006 1761 forkEvery = 1
kcr@5006 1762 }
kcr@5006 1763 }
kcr@5006 1764
richard@3116 1765 project(":fxpackager") {
rbair@3458 1766 tasks.all {
rbair@3458 1767 if (!COMPILE_FXPACKAGER) it.enabled = false
rbair@3458 1768 }
richard@3116 1769 // fxpackager has a dependency on ant in order to build the ant jar,
richard@3116 1770 // and as such needs to point to the apache binary repository
kcr@4078 1771 if (!BUILD_CLOSED) {
kcr@3962 1772 repositories {
kcr@3962 1773 maven {
kcr@3962 1774 url "https://repository.apache.org"
kcr@3962 1775 }
richard@3116 1776 }
richard@3116 1777 }
richard@3116 1778
richard@3116 1779 dependencies {
richard@3325 1780 compile group: "org.apache.ant", name: "ant", version: "1.8.2"
richard@3116 1781 }
richard@3116 1782
richard@3116 1783 // When producing the jar, we need to relocate a few class files
richard@3116 1784 // from their normal location to a resources/classes or resources/web-files
richard@3116 1785 // location
richard@3116 1786 jar {
richard@3116 1787 includeEmptyDirs = false
richard@3116 1788 archiveName = "ant-javafx.jar"
richard@3116 1789 eachFile { FileCopyDetails details ->
richard@3116 1790 if (details.path.startsWith("com/javafx/main")) {
richard@3116 1791 details.path = "resources/classes/$details.path"
richard@3116 1792 }
richard@3116 1793 }
richard@3116 1794 }
richard@3116 1795
richard@3116 1796 // The "man" task will create a $buildDir/man containing the man
richard@3116 1797 // files for the system being built
richard@3116 1798 task man(type: Copy) {
richard@3116 1799 includeEmptyDirs = false
rbair@3458 1800 enabled = (IS_LINUX || IS_MAC) && COMPILE_FXPACKAGER
richard@3116 1801 from "src/main/man"
richard@3116 1802 into "$buildDir/man"
richard@3116 1803 exclude "**/*.html"
richard@3116 1804 if (IS_MAC) exclude "**/ja_JP.UTF-8/**"
richard@3116 1805 }
richard@3116 1806 processResources.dependsOn man
richard@3116 1807
shemnon@8032 1808 // Compile the native launchers. These are included in ant-javafx.jar.
rbair@3458 1809 if (IS_WINDOWS && COMPILE_FXPACKAGER) {
shemnon@8032 1810 task buildWinLauncher(type: CCTask, group: "Build") {
rbair@3162 1811 description = "Compiles native sources for the application co-bundle launcher";
rbair@3162 1812 matches = "WinLauncher\\.cpp";
richard@3487 1813 params.addAll(WIN.launcher.ccFlags);
rbair@3163 1814 output(file("$buildDir/native/WinLauncher"));
rbair@3162 1815 source(file("src/main/native/launcher/win"));
richard@3487 1816 compiler = WIN.launcher.compiler
rbair@3162 1817 exe = true;
richard@3487 1818 linkerOptions.addAll(WIN.launcher.linkFlags);
rbair@3163 1819 doLast {
rbair@3163 1820 copy {
rbair@3163 1821 from "$buildDir/native/WinLauncher/WinLauncher.exe"
shemnon@8032 1822 from "$MSVCR"
shemnon@8032 1823 from "$MSVCP"
danno@6951 1824 into "$buildDir/classes/main/com/oracle/tools/packager/windows"
rbair@3163 1825 }
rbair@3163 1826 }
richard@3116 1827 }
shemnon@8032 1828 task compileWinLibrary(type: CCTask, group: "Build") {
shemnon@8032 1829 description = "Compiles native sources for the application co-bundle launcher library";
shemnon@8032 1830 matches = ".*\\.cpp"
shemnon@8032 1831 source(file("src/main/native/library/common"));
shemnon@8032 1832 params.addAll(WIN.launcherlibrary.ccFlags)
shemnon@8032 1833 output(file("$buildDir/native/WinLauncher/obj"));
shemnon@8032 1834 compiler = WIN.launcherlibrary.compiler
shemnon@8032 1835 }
shemnon@8032 1836 task linkWinLibrary(type: LinkTask, group: "Build", dependsOn: compileWinLibrary) {
shemnon@8032 1837 description = "Links native sources for the application co-bundle launcher library";
shemnon@8032 1838 objectDir = file("$buildDir/native/WinLauncher/obj")
shemnon@8032 1839 linkParams.addAll(WIN.launcherlibrary.linkFlags);
shemnon@8032 1840 lib = file("$buildDir/native/WinLauncher/packager.dll")
shemnon@8032 1841 linker = WIN.launcherlibrary.linker
shemnon@8032 1842 doLast {
shemnon@8032 1843 copy {
shemnon@8032 1844 from "$buildDir/native/WinLauncher/packager.dll"
shemnon@8032 1845 into "$buildDir/classes/main/com/oracle/tools/packager/windows"
shemnon@8032 1846 }
shemnon@8032 1847 }
shemnon@8032 1848 }
shemnon@8032 1849 task buildWinLauncherSvc(type: CCTask, group: "Build") {
shemnon@6622 1850 description = "Compiles native sources for the application co-bundle launcher";
shemnon@6622 1851 matches = "WinLauncherSvc\\.cpp";
shemnon@6622 1852 params.addAll(WIN.launcher.ccFlags);
shemnon@6622 1853 output(file("$buildDir/native/WinLauncherSvc"));
shemnon@8032 1854 source(file("src/main/native/service/win"));
shemnon@6622 1855 compiler = WIN.launcher.compiler
shemnon@6622 1856 exe = true;
shemnon@6622 1857 linkerOptions.addAll(WIN.launcher.linkFlags);
shemnon@6622 1858 doLast {
shemnon@6622 1859 copy {
shemnon@6622 1860 from "$buildDir/native/WinLauncherSvc/WinLauncherSvc.exe"
danno@6951 1861 into "$buildDir/classes/main/com/oracle/tools/packager/windows"
shemnon@6622 1862 }
shemnon@6622 1863 }
shemnon@6622 1864 }
shemnon@8032 1865 task buildIconSwap(type: CCTask, group: "Build") {
richard@3116 1866 description = "Compiles native sources for the application co-bundle launcher"
rbair@3163 1867 matches = "IconSwap\\.cpp"
richard@3487 1868 params.addAll(WIN.iconLauncher.ccFlags)
rbair@3163 1869 output(file("$buildDir/native/IconSwap"))
shemnon@8032 1870 source file("src/main/native/tools/win")
richard@3487 1871 compiler = WIN.launcher.compiler
richard@3116 1872 exe = true
richard@3494 1873 linkerOptions.addAll(WIN.iconLauncher.linkFlags)
rbair@3163 1874 doLast {
rbair@3163 1875 copy {
rbair@3163 1876 from "$buildDir/native/IconSwap/IconSwap.exe"
danno@6951 1877 into "$buildDir/classes/main/com/oracle/tools/packager/windows"
rbair@3163 1878 }
rbair@3163 1879 }
richard@3116 1880 }
shemnon@8032 1881 task compileLauncher(dependsOn: [buildWinLauncher, linkWinLibrary, buildWinLauncherSvc, buildIconSwap])
rbair@3458 1882 jar.dependsOn compileLauncher;
shemnon@8032 1883 } else if (IS_MAC && COMPILE_FXPACKAGER) {
shemnon@8032 1884 task buildMacLauncher(type: CCTask, group: "Build") {
shemnon@8032 1885 description = "Compiles native sources for the application co-bundle launcher"
shemnon@8032 1886 matches = ".*\\.m"
shemnon@8032 1887 source file("src/main/native/launcher/mac")
shemnon@8032 1888 params.addAll(MAC.launcher.ccFlags)
shemnon@8032 1889 compiler = MAC.launcher.compiler
shemnon@8032 1890 output(file("$buildDir/classes/main/com/oracle/tools/packager/mac"))
shemnon@8032 1891 eachOutputFile = { f ->
shemnon@8032 1892 return new File(f.getParent(), "JavaAppLauncher")
rbair@4026 1893 }
richard@3116 1894 }
shemnon@8032 1895 task compileMacLibrary(type: CCTask, group: "Build") {
shemnon@8032 1896 description = "Compiles native sources for the application co-bundle launcher library"
shemnon@8032 1897 matches = ".*\\.cpp|.*\\.mm"
shemnon@8032 1898 source file("src/main/native/library/common");
shemnon@8032 1899 params.addAll(MAC.launcherlibrary.ccFlags)
shemnon@8032 1900 compiler = MAC.launcherlibrary.compiler
shemnon@8032 1901 output(file("$buildDir/native/maclauncher/obj"))
shemnon@8032 1902 }
shemnon@8032 1903 task linkMacLibrary(type: LinkTask, group: "Build", dependsOn: compileMacLibrary) {
shemnon@8032 1904 description = "Links native sources for the application co-bundle launcher library"
shemnon@8032 1905 objectDir = file("$buildDir/native/maclauncher/obj")
shemnon@8032 1906 linkParams.addAll(MAC.launcherlibrary.linkFlags)
shemnon@8032 1907 linker = MAC.launcherlibrary.linker
shemnon@8032 1908 lib = file("$buildDir/classes/main/com/oracle/tools/packager/mac/libpackager.dylib")
shemnon@8032 1909 }
shemnon@8032 1910 task compileLauncher(dependsOn: [buildMacLauncher, linkMacLibrary])
shemnon@8032 1911 jar.dependsOn compileLauncher;
shemnon@8032 1912 } else if (IS_LINUX && COMPILE_FXPACKAGER) {
shemnon@8032 1913 task compileLinuxLauncher(type: CCTask, group: "Build") {
shemnon@8032 1914 description = "Compiles native sources for the application co-bundle launcher"
shemnon@8032 1915 matches = ".*\\.cpp"
shemnon@8032 1916 source file("src/main/native/launcher/linux")
shemnon@8032 1917 params.addAll(LINUX.launcher.ccFlags)
shemnon@8032 1918 compiler = LINUX.launcher.compiler
shemnon@8032 1919 output(file("$buildDir/native/linuxlauncher/launcherobj"))
shemnon@8032 1920 }
shemnon@8032 1921 task linkLinuxLauncher(type: LinkTask, dependsOn: compileLinuxLauncher, group: "Build") {
shemnon@8032 1922 description = "Links native dynamic library for the application co-bundle launcher"
shemnon@8032 1923 objectDir = file("$buildDir/native/linuxlauncher/launcherobj")
shemnon@8032 1924 linkParams.addAll(LINUX.launcher.linkFlags)
shemnon@8032 1925 linker = LINUX.launcher.linker
shemnon@8032 1926 lib = file("$buildDir/classes/main/com/oracle/tools/packager/linux/JavaAppLauncher")
shemnon@8032 1927 }
shemnon@8032 1928 task compileLinuxLibrary(type: CCTask, group: "Build") {
shemnon@8032 1929 description = "Compiles native sources for the application co-bundle launcher library"
shemnon@8032 1930 matches = ".*\\.cpp"
shemnon@8032 1931 source file("src/main/native/library/common")
shemnon@8032 1932 params.addAll(LINUX.launcherlibrary.ccFlags)
shemnon@8032 1933 compiler = LINUX.launcherlibrary.compiler
shemnon@8032 1934 output(file("$buildDir/native/linuxlauncher/obj"))
shemnon@8032 1935 }
shemnon@8032 1936 task linkLinuxLibrary(type: LinkTask, dependsOn: compileLinuxLibrary, group: "Build") {
shemnon@8032 1937 description = "Links native dynamic library for the application co-bundle launcher library"
shemnon@8032 1938 objectDir = file("$buildDir/native/linuxlauncher/obj")
shemnon@8032 1939 linkParams.addAll(LINUX.launcherlibrary.linkFlags)
shemnon@8032 1940 linker = LINUX.launcherlibrary.linker
shemnon@8032 1941 lib = file("$buildDir/classes/main/com/oracle/tools/packager/linux/libpackager.so")
shemnon@8032 1942 }
shemnon@8032 1943 task compileLauncher(dependsOn: [linkLinuxLauncher, linkLinuxLibrary])
shemnon@8032 1944 jar.dependsOn compileLauncher;
richard@3116 1945 }
richard@3116 1946
danno@6953 1947 // Builds the javapackager executable. For everything other than windows,
richard@3116 1948 // this is simply moving the existing shell script and ensuring it has proper
richard@3116 1949 // permissions. For Windows, this includes compiling the native executable
rbair@3458 1950 if (IS_WINDOWS && COMPILE_FXPACKAGER){
danno@6953 1951 task buildJavaPackager(type: CCTask, group: "Build") {
danno@6953 1952 description = "Compiles native sources for javapackager.exe"
danno@6953 1953 matches = "javapackager\\.cpp"
richard@3487 1954 params.addAll(WIN.fxpackager.ccFlags)
richard@3487 1955 compiler = WIN.fxpackager.compiler
danno@6953 1956 output(file("$buildDir/native/javapackager"))
richard@3487 1957 source WIN.fxpackager.nativeSource
mhowe@5009 1958 doFirst {
mhowe@5009 1959 copy {
mhowe@5009 1960 mkdir "$buildDir/native"
danno@6953 1961 mkdir "$buildDir/native/javapackager"
danno@6953 1962 from file("src/main/native/javapackager/win/javapackager.manifest")
danno@6953 1963 into file("$buildDir/native/javapackager")
mhowe@5009 1964 filter { line->
mhowe@5009 1965 line = line.replace("FXVERSION", "${RAW_VERSION}.${HUDSON_BUILD_NUMBER}");
mhowe@5009 1966 }
mhowe@5009 1967 }
mhowe@5009 1968 }
richard@3116 1969 doLast {
richard@3116 1970 mkdir "$buildDir/native"
richard@3116 1971 exec({
mv157916@6126 1972 commandLine("$RC", "/nologo", "/l", "0x409", "/r", "/dJFX_DVERSION=9", "/dJFX_VERSION=9",
danno@6953 1973 "/fo$buildDir/native/javapackager/javapackager.res",
danno@6953 1974 "src/main/native/javapackager/win/javapackager.rc");
richard@3116 1975 environment(WINDOWS_NATIVE_COMPILE_ENVIRONMENT);
richard@3116 1976 });
richard@3116 1977 }
richard@3116 1978 doLast {
danno@6953 1979 mkdir "$buildDir/javapackager"
richard@3116 1980 exec({
richard@3487 1981 commandLine("$WIN.fxpackager.linker", "/nologo", "/opt:REF", "/incremental:no", "/manifest", "kernel32.lib", "advapi32.lib",
danno@6953 1982 "/out:$buildDir/native/javapackager/javapackager.exe",
danno@6953 1983 "$buildDir/native/javapackager/javapackager.obj",
danno@6953 1984 "$buildDir/native/javapackager/javapackager.res")
richard@3116 1985 environment(WINDOWS_NATIVE_COMPILE_ENVIRONMENT)
richard@3116 1986 })
richard@3116 1987 }
richard@3116 1988 doLast {
mhowe@5009 1989 exec({
mhowe@5009 1990 commandLine("$MC", "-manifest",
danno@6953 1991 "$buildDir/native/javapackager/javapackager.manifest",
danno@6953 1992 "-outputresource:$buildDir/native/javapackager/javapackager.exe")
mhowe@5009 1993 environment(WINDOWS_NATIVE_COMPILE_ENVIRONMENT)
mhowe@5009 1994 })
richard@3116 1995 copy {
danno@6953 1996 from file("$buildDir/native/javapackager/javapackager.exe")
danno@6953 1997 into file("$buildDir/javapackager")
danno@6953 1998 }
danno@6953 1999 copy {
danno@6953 2000 from file("$buildDir/native/javapackager/javapackager.exe")
danno@6953 2001 into file("$buildDir/javapackager")
danno@6953 2002 rename ('javapackager', 'javafxpackager')
richard@3116 2003 }
richard@3116 2004 }
richard@3116 2005 }
richard@3116 2006 } else {
danno@6953 2007 task buildJavaPackager(group: "Build") {
rbair@3458 2008 enabled = COMPILE_FXPACKAGER
mhowe@5692 2009 doLast {
kcr@7245 2010 copy {
kcr@7245 2011 from "src/main/native/javapackager/shell"
kcr@7245 2012 into "$buildDir/javapackager"
kcr@7245 2013 fileMode = 0755
danno@6953 2014 }
kcr@7245 2015 copy {
kcr@7245 2016 from "src/main/native/javapackager/shell"
kcr@7245 2017 into "$buildDir/javapackager"
danno@6953 2018 rename ('javapackager', 'javafxpackager')
kcr@7245 2019 fileMode = 0755
mhowe@5692 2020 }
richard@3116 2021 }
richard@3116 2022 }
richard@3116 2023 }
richard@3116 2024
shemnon@8032 2025 task packagerJar(type: Jar) {
shemnon@8032 2026 group = "Basic"
shemnon@8032 2027 description = "Creates the packager.jar"
shemnon@8032 2028 archiveName = "packager.jar";
shemnon@8032 2029 includeEmptyDirs = false
shemnon@8032 2030 from("$buildDir/classes/main");
shemnon@8032 2031 from("$buildDir/resources/main");
shemnon@8032 2032 include('jdk/packager/**')
shemnon@8032 2033
shemnon@8032 2034 dependsOn(buildJavaPackager);
shemnon@8032 2035 }
shemnon@8032 2036
danno@6953 2037 jar.dependsOn buildJavaPackager
shemnon@8032 2038 jar.dependsOn packagerJar
richard@4034 2039
richard@4034 2040 classes << {
snorthov@4178 2041 // Copy all of the download libraries to libs directory for the sake of the IDEs
snorthov@4178 2042 File libsDir = rootProject.file("build/libs");
richard@4034 2043 File antLib = new File(libsDir, "ant-1.8.2.jar")
snorthov@4178 2044 libsDir.mkdirs();
snorthov@4178 2045 for (File f : configurations.compile.files) {
snorthov@4178 2046 copy {
snorthov@4178 2047 into libsDir
snorthov@4178 2048 from f.getParentFile()
snorthov@4178 2049 include "**/ant-1.8.2.jar"
snorthov@4178 2050 includeEmptyDirs = false
richard@4034 2051 }
richard@4034 2052 }
richard@4034 2053 }
shemnon@6291 2054
shemnon@6291 2055 task packagerFakeJar(type: Jar) {
shemnon@6291 2056 dependsOn compileTestJava
shemnon@6291 2057 from compileTestJava.destinationDir
shemnon@6291 2058 include "hello/**"
shemnon@6291 2059
shemnon@6291 2060 destinationDir project.file("build/tmp/tests/appResources")
shemnon@6291 2061 archiveName "mainApp.jar"
dmitry@7780 2062
shemnon@6291 2063 manifest {
shemnon@6291 2064 attributes(
shemnon@8032 2065 "Main-Class": "hello.HelloRectangle",
shemnon@6291 2066 "Custom-Attribute": " Is it stripped?"
shemnon@6291 2067 )
shemnon@6291 2068 }
shemnon@6622 2069
shemnon@6622 2070 doFirst {
shemnon@6622 2071 copy {
shemnon@7059 2072 from "$projectDir/src/main/resources/com/oracle/tools/packager/linux/javalogo_white_48.png"
shemnon@7059 2073 from "$projectDir/src/main/resources/com/oracle/tools/packager/mac/GenericAppHiDPI.icns"
shemnon@7059 2074 from "$projectDir/src/main/resources/com/oracle/tools/packager/windows/javalogo_white_48.ico"
shemnon@6726 2075 from "$projectDir/src/test/resources/hello/java-logo2.gif"
shemnon@8032 2076 from "$projectDir/src/test/resources/hello/small.ico"
shemnon@8032 2077 from "$projectDir/src/test/resources/hello/test.icns"
shemnon@6622 2078 from "$projectDir/../../LICENSE"
shemnon@8032 2079 from "$projectDir/build/libs/packager.jar"
shemnon@6622 2080 into project.file("$projectDir/build/tmp/tests/appResources")
shemnon@6622 2081 }
shemnon@6622 2082 copy {
shemnon@6622 2083 from "$projectDir/../../LICENSE"
shemnon@6622 2084 into project.file("$projectDir/build/tmp/tests/appResources")
shemnon@6622 2085 rename '(.*)LICENSE', '$1LICENSE2'
shemnon@6622 2086 }
shemnon@6622 2087 }
shemnon@6291 2088 }
dmitry@7780 2089
shemnon@7868 2090 task packagerFXPackagedJar(type: Jar) {
shemnon@7868 2091 dependsOn packagerFakeJar
shemnon@7868 2092 from compileTestJava.destinationDir
shemnon@7868 2093 include "hello/**"
shemnon@7868 2094
shemnon@7868 2095 destinationDir project.file("build/tmp/tests/appResources")
shemnon@7868 2096 archiveName "packagedMainApp.jar"
shemnon@7868 2097
shemnon@7868 2098 manifest {
shemnon@7868 2099 attributes(
shemnon@7868 2100 "JavaFX-Application-Class": "hello.TestPackager",
shemnon@7868 2101 )
shemnon@7868 2102 }
shemnon@7868 2103 }
shemnon@7868 2104
dmitry@7780 2105 if (!DO_BUILD_SDK_FOR_TEST) {
dmitry@7780 2106 def antJavafxJar = new File(TEST_SDK_DIR, "lib/ant-javafx.jar")
dmitry@7780 2107 [compileTestJava, test].each {
dmitry@7780 2108 it.classpath = files(antJavafxJar) + it.classpath
dmitry@7780 2109 }
dmitry@7780 2110 }
dmitry@7780 2111
shemnon@6291 2112 test {
shemnon@7868 2113 dependsOn packagerFXPackagedJar
shemnon@6330 2114 systemProperty "RETAIN_PACKAGER_TESTS", RETAIN_PACKAGER_TESTS
shemnon@8024 2115 systemProperty "TEST_PACKAGER_DMG", TEST_PACKAGER_DMG
shemnon@6672 2116 systemProperty "FULL_TEST", FULL_TEST
shemnon@6291 2117 }
shemnon@8032 2118
shemnon@8180 2119 def packagerDevOpts = []
shemnon@8180 2120 try {
shemnon@8180 2121 packagerDevOpts.addAll(PACKAGER_DEV_OPTS.split(' '))
shemnon@8180 2122 } catch (MissingPropertyException ignore) {
shemnon@8180 2123 packagerDevOpts.addAll("image")
shemnon@8180 2124 }
shemnon@8180 2125
shemnon@8032 2126 task packagerDev(dependsOn: [jar, packagerFakeJar], type:JavaExec) {
shemnon@8032 2127 workingDir = project.file("build/tmp/tests/appResources/")
shemnon@8032 2128 classpath = project.files("build/libs/ant-javafx.jar", "build/classes/test", "build/resources/test")
shemnon@8032 2129 main = "hello.SimpleBundle"
shemnon@8032 2130 args = [
shemnon@8032 2131 "-o", "$projectDir/build/dev",
shemnon@8032 2132 "-all",
shemnon@8180 2133 packagerDevOpts
shemnon@8180 2134 ].flatten()
shemnon@8032 2135 }
richard@3116 2136 }
richard@3116 2137
kirill@5407 2138 project(":media") {
kirill@5407 2139 configurations {
kirill@5407 2140 media
kirill@5407 2141 }
kirill@5407 2142
kirill@5407 2143 dependencies {
kirill@5407 2144 compile BUILD_SRC, project(":base"), project(":graphics")
kirill@5407 2145 }
kirill@5407 2146
kirill@5407 2147 sourceSets {
kirill@5407 2148 tools {
kirill@5407 2149 java.srcDir "src/tools/java"
kirill@5407 2150 }
kirill@5407 2151 }
kirill@5407 2152
kirill@5407 2153 compileToolsJava {
kcr@5525 2154 enabled = IS_COMPILE_MEDIA
kirill@5407 2155 classpath = sourceSets.main.output;
kirill@5407 2156 }
kirill@5407 2157
kirill@5407 2158 project.ext.makeJobsFlag = IS_WINDOWS && IS_DEBUG_NATIVE ? "-j1" : "-j5";
kirill@5407 2159 project.ext.buildType = IS_DEBUG_NATIVE ? "Debug" : "Release";
kirill@5407 2160
kirill@5407 2161 def nativeSrcDir = file("${projectDir}/src/main/native")
kirill@5407 2162 def generatedHeadersDir = file("${buildDir}/generated-src/headers")
kirill@5407 2163
kirill@5407 2164 task generateHeaders(dependsOn: compileJava) {
kcr@5525 2165 enabled = IS_COMPILE_MEDIA
kirill@5407 2166 doLast {
kirill@5407 2167 def classpath = sourceSets.main.output;
kirill@5407 2168 mkdir generatedHeadersDir;
kirill@5407 2169
kirill@5407 2170 def classesList = ["com.sun.media.jfxmedia.logging.Logger",
kirill@5407 2171 "com.sun.media.jfxmedia.track.AudioTrack",
kirill@5407 2172 "com.sun.media.jfxmedia.control.VideoDataBuffer",
kirill@5407 2173 "com.sun.media.jfxmedia.control.VideoFormat\$FormatTypes",
kirill@5407 2174 "com.sun.media.jfxmediaimpl.NativeAudioClip",
kirill@5407 2175 "com.sun.media.jfxmediaimpl.NativeMediaPlayer",
kirill@5407 2176 "com.sun.media.jfxmediaimpl.NativeVideoBuffer",
kirill@5407 2177 "com.sun.media.jfxmediaimpl.platform.gstreamer.GSTPlatform",
kirill@5407 2178 "com.sun.media.jfxmediaimpl.platform.gstreamer.GSTMedia",
kirill@5407 2179 "com.sun.media.jfxmediaimpl.platform.gstreamer.GSTMediaPlayer",
ddehaven@8148 2180 "com.sun.media.jfxmediaimpl.NativeAudioEqualizer",
ddehaven@8148 2181 "com.sun.media.jfxmediaimpl.NativeEqualizerBand",
ddehaven@8148 2182 "com.sun.media.jfxmediaimpl.NativeAudioSpectrum"]
kirill@5407 2183 if (IS_MAC) {
kirill@5407 2184 classesList.addAll( ["com.sun.media.jfxmediaimpl.platform.osx.OSXPlatform",
kirill@5407 2185 "com.sun.media.jfxmediaimpl.platform.osx.OSXMedia",
kirill@5407 2186 "com.sun.media.jfxmediaimpl.platform.osx.OSXMediaPlayer"] );
kirill@5407 2187 }
kirill@5407 2188 exec {
kirill@5407 2189 commandLine ("${JAVAH}", "-J-Djava.ext.dirs=", "-d", "${generatedHeadersDir}", "-classpath", "${classpath.asPath}");
kirill@5407 2190 args classesList;
kirill@5407 2191 }
kirill@5407 2192 }
kirill@5407 2193 }
kirill@5407 2194
kirill@5407 2195 task generateMediaErrorHeader(dependsOn: [compileToolsJava, compileJava]) {
kcr@5525 2196 enabled = IS_COMPILE_MEDIA
kirill@5407 2197 doLast {
kirill@5407 2198 def classpath = files(sourceSets.main.output, sourceSets.tools.output);
kirill@5407 2199 def sourcepath = sourceSets.main.java.srcDirs;
kirill@5407 2200 def headerpath = file("$generatedHeadersDir/jfxmedia_errors.h");
kirill@5407 2201 def srcRoot = (sourcepath.toArray())[0];
kirill@5407 2202
kirill@5407 2203 mkdir generatedHeadersDir;
kirill@5407 2204
kirill@5407 2205 exec {
kirill@5407 2206 commandLine("$JAVA", "-Djava.ext.dirs=", "-classpath", "${classpath.asPath}");
kirill@5407 2207 args("headergen.HeaderGen", "$headerpath", "$srcRoot");
kirill@5407 2208 }
kirill@5407 2209 }
kirill@5407 2210 }
kirill@5407 2211
kirill@5407 2212 task buildNativeTargets {
kcr@5525 2213 enabled = IS_COMPILE_MEDIA
kirill@5407 2214 }
kirill@5407 2215
kirill@5407 2216 compileTargets { t->
ddhill@7062 2217 def targetProperties = project.rootProject.ext[t.upper]
kirill@5407 2218 def nativeOutputDir = file("${buildDir}/native/${t.name}")
kirill@5407 2219 def projectDir = t.name.startsWith("arm") ? "linux" : t.name
ddhill@7062 2220 def mediaProperties = targetProperties.media
ddehaven@8390 2221 // Makefile for OSX needs to know if we're building for parfait
ddehaven@8390 2222 def compileParfait = IS_COMPILE_PARFAIT ? "true" : "false"
kirill@5407 2223
kirill@5407 2224 def buildNative = task("build${t.capital}Native", dependsOn: [generateHeaders, generateMediaErrorHeader]) {
ddhill@7062 2225 enabled = targetProperties.compileMediaNative
ddhill@7062 2226 if (!targetProperties.compileMediaNative) {
ddhill@7062 2227 println("Not compiling native Media for ${t.name} per configuration request");
ddhill@7062 2228 }
ddhill@7062 2229
kirill@5407 2230 doLast {
kirill@5407 2231 exec {
kirill@5407 2232 commandLine ("make", "${makeJobsFlag}", "-C", "${nativeSrcDir}/jfxmedia/projects/${projectDir}")
anthony@5699 2233 args("JAVA_HOME=${JDK_HOME}", "GENERATED_HEADERS_DIR=${generatedHeadersDir}",
ddehaven@8390 2234 "OUTPUT_DIR=${nativeOutputDir}", "BUILD_TYPE=${buildType}", "BASE_NAME=jfxmedia",
ddehaven@8390 2235 "COMPILE_PARFAIT=${compileParfait}")
kirill@5407 2236
kirill@5407 2237 if (t.name == "win") {
kirill@5407 2238 environment(WINDOWS_NATIVE_COMPILE_ENVIRONMENT)
kirill@5859 2239 args(IS_64 ? "ARCH=x64" : "ARCH=x32", "RESOURCE=${nativeOutputDir}/${buildType}/${WIN.media.jfxmediaRcFile}")
kirill@5407 2240 } else {
kirill@5407 2241 args ("CC=${mediaProperties.compiler}", "LINK=${mediaProperties.linker}", "LIB=${mediaProperties.lib}")
kirill@5407 2242
kcr@7799 2243 if (t.name.startsWith("arm")) {
kirill@5407 2244 args("EXTRA_CFLAGS=${mediaProperties.extra_cflags}", "EXTRA_LDFLAGS=${mediaProperties.extra_ldflags}")
kcr@7799 2245 } else {
kirill@5407 2246 args("HOST_COMPILE=1")
kcr@7799 2247 }
kirill@5407 2248 }
kirill@5407 2249 }
kirill@5407 2250 }
kirill@5407 2251 }
kirill@5407 2252
ddhill@7063 2253 // check for the property disable${name} = true
ddhill@7063 2254 def boolean disabled = targetProperties.containsKey('disableMedia') ? targetProperties.get('disableMedia') : false
ddhill@7063 2255 if (!disabled) {
kirill@5407 2256 // Building GStreamer
kirill@5407 2257 def buildGStreamer = task("build${t.capital}GStreamer") {
kcr@5525 2258 enabled = IS_COMPILE_MEDIA
kirill@5407 2259 doLast {
kirill@5407 2260 exec {
kirill@5407 2261 commandLine ("make", "${makeJobsFlag}", "-C", "${nativeSrcDir}/gstreamer/projects/${projectDir}/gstreamer-lite")
kirill@5407 2262 args("OUTPUT_DIR=${nativeOutputDir}", "BUILD_TYPE=${buildType}", "BASE_NAME=gstreamer-lite")
kirill@5407 2263
kirill@5407 2264 if (t.name == "win") {
kirill@5407 2265 environment(WINDOWS_NATIVE_COMPILE_ENVIRONMENT)
kirill@5859 2266 args(IS_64 ? "ARCH=x64" : "ARCH=x32", "RESOURCE=${nativeOutputDir}/${buildType}/${WIN.media.gstreamerRcFile}")
kirill@5407 2267 } else
kirill@5407 2268 args ("CC=${mediaProperties.compiler}", "LINK=${mediaProperties.linker}", "LIB=${mediaProperties.lib}")
kirill@5407 2269 }
kirill@5407 2270 }
kirill@5407 2271 }
kirill@5407 2272
kirill@5407 2273 def buildPlugins = task("build${t.capital}Plugins", dependsOn: buildGStreamer) {
kcr@5525 2274 enabled = IS_COMPILE_MEDIA
kirill@5407 2275
kcr@7799 2276 if (!project.ext.properties.containsKey("ON2_SRCDIR")) {
kirill@5407 2277 project.ext.ON2_SRCDIR = "";
kcr@7799 2278 }
kirill@5407 2279
kcr@7799 2280 if (!project.ext.properties.containsKey("ON2_LIB")) {
kirill@5407 2281 project.ext.ON2_LIB = "";
kcr@7799 2282 }
kirill@5407 2283
kirill@5407 2284 doLast {
kirill@5407 2285 exec {
kirill@5407 2286 commandLine ("make", "${makeJobsFlag}", "-C", "${nativeSrcDir}/gstreamer/projects/${projectDir}/fxplugins")
kirill@5407 2287 args("OUTPUT_DIR=${nativeOutputDir}", "BUILD_TYPE=${buildType}", "BASE_NAME=fxplugins",
kirill@5407 2288 "ON2_SRCDIR=${project.ext.ON2_SRCDIR}", "ON2_LIB=${project.ext.ON2_LIB}")
kirill@5407 2289
kirill@5407 2290 if (t.name == "win") {
kirill@5407 2291 Map winEnv = new HashMap(WINDOWS_NATIVE_COMPILE_ENVIRONMENT)
kirill@5407 2292
kirill@5407 2293 String sdkDir = System.getenv("BASECLASSES_SDK_DIR");
kcr@7799 2294 if (sdkDir == null) {
kirill@5407 2295 sdkDir = "C:/Program Files/Microsoft SDKs/Windows/v7.1" // Default value
kirill@5407 2296 winEnv["BASECLASSES_SDK_DIR"] = sdkDir
kirill@5407 2297 }
kirill@5407 2298 environment(winEnv)
kirill@5407 2299
kirill@5859 2300 args(IS_64 ? "ARCH=x64" : "ARCH=x32", "RESOURCE=${nativeOutputDir}/${buildType}/${WIN.media.fxpluginsRcFile}")
kirill@5407 2301 } else
kirill@5407 2302 args ("CC=${mediaProperties.compiler}", "LINK=${mediaProperties.linker}", "LIB=${mediaProperties.lib}")
kirill@5407 2303 }
kirill@5407 2304 }
kirill@5407 2305 }
kirill@5407 2306
kirill@5407 2307 buildNative.dependsOn buildPlugins
kirill@5407 2308
kirill@5407 2309 if (t.name == "linux") {
kirill@5407 2310 def buildAVPlugin = task( "buildAVPlugin", dependsOn: [buildPlugins]) {
kcr@5525 2311 enabled = IS_COMPILE_MEDIA
kirill@5407 2312
kirill@5407 2313 doLast {
stayer@7645 2314 if (project.ext.properties.containsKey("libav")) {
stayer@7645 2315 project.ext.libav.versions.each { version ->
stayer@7645 2316 def libavDir = "${project.ext.libav.basedir}-${version}"
stayer@7645 2317 File dir = file(libavDir)
stayer@7645 2318 if (dir.exists()) {
stayer@7645 2319 exec {
stayer@7645 2320 commandLine ("make", "${makeJobsFlag}", "-C", "${nativeSrcDir}/gstreamer/projects/linux/avplugin")
stayer@7645 2321 args("CC=${mediaProperties.compiler}", "OUTPUT_DIR=${nativeOutputDir}", "BUILD_TYPE=${buildType}",
stayer@7645 2322 "BASE_NAME=avplugin", "VERSION=${version}", "LIBAV_DIR=${libavDir}")
stayer@7645 2323 }
stayer@7645 2324 }
stayer@7645 2325 }
stayer@7645 2326 } else {
stayer@7645 2327 // Building fxavcodec plugin (libav plugin)
stayer@7645 2328 exec {
stayer@7645 2329 commandLine ("make", "${makeJobsFlag}", "-C", "${nativeSrcDir}/gstreamer/projects/linux/avplugin")
stayer@7645 2330 args("CC=${mediaProperties.compiler}", "OUTPUT_DIR=${nativeOutputDir}", "BUILD_TYPE=${buildType}",
stayer@7645 2331 "BASE_NAME=avplugin")
stayer@7645 2332 }
kirill@5407 2333 }
kirill@5407 2334 }
kirill@5407 2335 }
kirill@5407 2336 buildNative.dependsOn buildAVPlugin
kirill@5407 2337 }
kirill@5407 2338
kirill@5859 2339 if (t.name == "win") {
kirill@5859 2340 def buildResources = task("buildResources") << {
kirill@5859 2341 def rcOutputDir = "${nativeOutputDir}/${buildType}"
kirill@5859 2342 mkdir rcOutputDir
kirill@5859 2343 exec {
kirill@5859 2344 environment(WINDOWS_NATIVE_COMPILE_ENVIRONMENT)
kirill@5859 2345 commandLine (WIN.media.rcCompiler)
kirill@5859 2346 args(WIN.media.glibRcFlags)
kirill@5859 2347 args("/Fo${rcOutputDir}/${WIN.media.glibRcFile}", WIN.media.rcSource)
kirill@5859 2348 }
kirill@5859 2349
kirill@5859 2350 exec {
kirill@5859 2351 environment(WINDOWS_NATIVE_COMPILE_ENVIRONMENT)
kirill@5859 2352 commandLine (WIN.media.rcCompiler)
kirill@5859 2353 args(WIN.media.gstreamerRcFlags)
kirill@5859 2354 args("/Fo${rcOutputDir}/${WIN.media.gstreamerRcFile}", WIN.media.rcSource)
kirill@5859 2355 }
kirill@5859 2356
kirill@5859 2357 exec {
kirill@5859 2358 environment(WINDOWS_NATIVE_COMPILE_ENVIRONMENT)
kirill@5859 2359 commandLine (WIN.media.rcCompiler)
kirill@5859 2360 args(WIN.media.fxpluginsRcFlags)
kirill@5859 2361 args("/Fo${rcOutputDir}/${WIN.media.fxpluginsRcFile}", WIN.media.rcSource)
kirill@5859 2362 }
kirill@5859 2363
kirill@5859 2364 exec {
kirill@5859 2365 environment(WINDOWS_NATIVE_COMPILE_ENVIRONMENT)
kirill@5859 2366 commandLine (WIN.media.rcCompiler)
kirill@5859 2367 args(WIN.media.jfxmediaRcFlags)
kirill@5859 2368 args("/Fo${rcOutputDir}/${WIN.media.jfxmediaRcFile}", WIN.media.rcSource)
kirill@5859 2369 }
kirill@5859 2370 }
kirill@5859 2371
kirill@5859 2372 def buildGlib = task("build${t.capital}Glib", dependsOn: [buildResources]) {
kirill@5859 2373 enabled = IS_COMPILE_MEDIA
kirill@5859 2374 doLast {
kirill@5859 2375 exec {
kirill@5859 2376 environment(WINDOWS_NATIVE_COMPILE_ENVIRONMENT)
kirill@5859 2377 commandLine ("make", "${makeJobsFlag}", "-C", "${nativeSrcDir}/gstreamer/projects/${projectDir}/glib-lite")
kirill@5859 2378 args("OUTPUT_DIR=${nativeOutputDir}", "BUILD_TYPE=${buildType}", "BASE_NAME=glib-lite",
kirill@5859 2379 IS_64 ? "ARCH=x64" : "ARCH=x32", "RESOURCE=${nativeOutputDir}/${buildType}/${WIN.media.glibRcFile}")
kirill@5859 2380 }
kirill@5859 2381 }
kirill@5859 2382 }
kirill@5859 2383 buildGStreamer.dependsOn buildGlib
kirill@5859 2384
kirill@5859 2385 } else if (t.name == "mac") {
kirill@5407 2386 def buildGlib = task("build${t.capital}Glib") {
kcr@5525 2387 enabled = IS_COMPILE_MEDIA
kirill@5407 2388 doLast {
kirill@5407 2389 exec {
kirill@5407 2390 commandLine ("make", "${makeJobsFlag}", "-C", "${nativeSrcDir}/gstreamer/projects/${projectDir}/glib-lite")
kirill@5407 2391 args("OUTPUT_DIR=${nativeOutputDir}", "BUILD_TYPE=${buildType}", "BASE_NAME=glib-lite")
kirill@5859 2392 args ("CC=${mediaProperties.compiler}", "LINK=${mediaProperties.linker}", "LIB=${mediaProperties.lib}")
kirill@5407 2393 }
kirill@5407 2394 }
kirill@5407 2395 }
kirill@5407 2396 buildGStreamer.dependsOn buildGlib
kirill@5407 2397 }
kirill@5407 2398 }
kirill@5407 2399
kirill@5407 2400 buildNativeTargets.dependsOn buildNative
kirill@5407 2401 }
kirill@5407 2402
kirill@5407 2403 jar {
kirill@5407 2404 exclude("headergen/**")
kirill@5407 2405
kirill@5407 2406 dependsOn compileJava
kcr@7799 2407 if (IS_COMPILE_MEDIA) {
kirill@5407 2408 dependsOn buildNativeTargets
kcr@7799 2409 }
kirill@5407 2410 }
kirill@5407 2411 }
kirill@5407 2412
peterz@5540 2413 project(":web") {
peterz@5540 2414 configurations {
peterz@5540 2415 webkit
peterz@5540 2416 }
peterz@5540 2417 dependencies {
peterz@5540 2418 compile project(":base"), project(":graphics"), project(":controls"), project(":media")
peterz@5540 2419 }
peterz@5540 2420
peterz@5765 2421 compileJava {
peterz@5765 2422 if (IS_COMPILE_WEBKIT) {
peterz@5765 2423 // These classes will be generated by native build
peterz@5765 2424 sourceSets.main.java.exclude("com/sun/webkit/dom/**")
peterz@5765 2425 }
peterz@5765 2426 }
peterz@5540 2427
peterz@5540 2428 task generateHeaders(dependsOn: compileJava) {
peterz@5540 2429 doLast {
peterz@5540 2430 def classpath = files("$buildDir/classes/main",
peterz@5540 2431 project(":graphics").sourceSets.main.output.classesDir)
peterz@5540 2432 def dest = file("$buildDir/generated-src/headers");
peterz@5540 2433 mkdir dest;
peterz@5540 2434 exec {
peterz@5540 2435 commandLine("$JAVAH", "-J-Djava.ext.dirs=", "-d", "$dest",
peterz@5540 2436 "-classpath", "${classpath.asPath}");
peterz@5540 2437 args("java.lang.Character",
peterz@5540 2438 "java.net.IDN",
peterz@5540 2439 "com.sun.webkit.ContextMenu",
peterz@5540 2440 "com.sun.webkit.ContextMenuItem",
peterz@5540 2441 "com.sun.webkit.CursorManager",
peterz@5540 2442 "com.sun.webkit.PageCache",
peterz@5540 2443 "com.sun.webkit.PopupMenu",
peterz@5540 2444 "com.sun.webkit.SharedBuffer",
peterz@5540 2445 "com.sun.webkit.WatchdogTimer",
peterz@5540 2446 "com.sun.webkit.WebPage",
peterz@5540 2447 "com.sun.webkit.LoadListenerClient",
peterz@5540 2448 "com.sun.webkit.event.WCFocusEvent",
peterz@5540 2449 "com.sun.webkit.event.WCKeyEvent",
peterz@5540 2450 "com.sun.webkit.event.WCMouseEvent",
peterz@5540 2451 "com.sun.webkit.event.WCMouseWheelEvent",
peterz@5540 2452 "com.sun.webkit.graphics.GraphicsDecoder",
peterz@5540 2453 "com.sun.webkit.graphics.RenderMediaControls",
peterz@5540 2454 "com.sun.webkit.graphics.RenderTheme",
peterz@5540 2455 "com.sun.webkit.graphics.ScrollBarTheme",
peterz@5540 2456 "com.sun.webkit.graphics.WCMediaPlayer",
peterz@5540 2457 "com.sun.webkit.graphics.WCGraphicsManager",
peterz@5540 2458 "com.sun.webkit.graphics.WCRenderQueue",
peterz@5540 2459 "com.sun.webkit.graphics.WCPath",
peterz@5540 2460 "com.sun.webkit.graphics.WCPathIterator",
peterz@5540 2461 "com.sun.webkit.Timer",
peterz@5540 2462 "com.sun.webkit.WCFrameView",
peterz@5540 2463 "com.sun.webkit.WCPasteboard",
peterz@5540 2464 "com.sun.webkit.WCPluginWidget",
peterz@5540 2465 "com.sun.webkit.dom.JSObject",
peterz@5540 2466 "com.sun.webkit.network.SocketStreamHandle",
peterz@5540 2467 "com.sun.webkit.network.URLLoader",
peterz@5540 2468 "com.sun.webkit.text.TextBreakIterator",
peterz@5540 2469 "com.sun.webkit.text.TextNormalizer");
peterz@5540 2470 }
peterz@5540 2471 }
peterz@5540 2472 }
peterz@5540 2473
peterz@5540 2474 task compileGenerated()
peterz@5540 2475
peterz@5540 2476 compileTargets { t ->
ddhill@7062 2477 def targetProperties = project.rootProject.ext[t.upper]
peterz@5540 2478 def classifier = (t.name != "linux" && t.name != "win") ? t.name :
peterz@5540 2479 IS_64 ? "${t.name}-amd64" : "${t.name}-i586"
peterz@5540 2480 dependencies {
peterz@5540 2481 webkit group: "com.sun.webkit", name: "webview-deps",
peterz@5540 2482 version: "1.2", classifier: "$classifier", ext: "zip"
peterz@5540 2483 }
peterz@5540 2484
peterz@5540 2485 def webkitOutputDir = "$buildDir/${t.name}"
peterz@5540 2486 def webkitConfig = IS_DEBUG_NATIVE ? "Debug" : "Release"
peterz@5540 2487
peterz@5540 2488 def compileNativeTask = task("compileNative${t.capital}", dependsOn: generateHeaders) << {
peterz@5540 2489 println "Building Webkit configuration /$webkitConfig/ into $webkitOutputDir"
peterz@5540 2490
peterz@5540 2491 def dependencyFile = configurations.webkit.filter(
peterz@5540 2492 { File f -> f.getName().contains(classifier) }
peterz@5540 2493 ).getSingleFile()
peterz@5540 2494 ant.unzip(src: dependencyFile,
peterz@5540 2495 dest: webkitOutputDir)
peterz@5540 2496
peterz@5540 2497 exec {
peterz@5540 2498 workingDir("$projectDir/src/main/native")
peterz@5540 2499 commandLine("perl", "Tools/Scripts/set-webkit-configuration", "--$webkitConfig")
peterz@5540 2500 environment(["WEBKITOUTPUTDIR" : webkitOutputDir])
peterz@5540 2501 }
peterz@5540 2502
peterz@5540 2503 exec {
peterz@5540 2504 workingDir("$projectDir/src/main/native")
peterz@5540 2505 if (t.name == "win") {
peterz@5540 2506 String qtDir = cygpath(System.getenv().get("QTSDK_DIR"))
peterz@5540 2507 String parfaitPath = IS_COMPILE_PARFAIT ? System.getenv().get("PARFAIT_PATH") + ";" : "";
peterz@5540 2508 Map environmentSettings = new HashMap(WINDOWS_NATIVE_COMPILE_ENVIRONMENT)
peterz@5540 2509 environmentSettings["PATH"] = parfaitPath + "$WINDOWS_VS_PATH;$qtDir/bin;$qtDir/qt/bin"
peterz@5540 2510 environmentSettings["QMAKESPEC"] = "win32-msvc2008"
peterz@5540 2511 environment(environmentSettings)
peterz@5540 2512 /* To build with ICU:
peterz@5540 2513 1. Download http://javaweb.us.oracle.com/jcg/fx-webrevs/RT-17164/WebKitLibrariesICU.zip
peterz@5540 2514 and unzip it to WebKitLibraries folder.
peterz@5540 2515 2. Copy DLLs from
peterz@5540 2516 WebKitLibrariesICU.zip\WebKitLibraries\import\runtime
peterz@5540 2517 to %windir%\system32
peterz@5540 2518 3. Uncomment the line below
peterz@5540 2519 */
peterz@5540 2520 // args("--icu-unicode")
peterz@5540 2521 } else if (t.name == "mac") {
peterz@5540 2522 environment([
peterz@5540 2523 "QMAKESPEC" : "macx-g++",
peterz@5540 2524 "QMAKE_CFLAGS" : "-m64",
peterz@5540 2525 "QMAKE_LFLAGS" : "-m64",
peterz@5540 2526 ])
peterz@5540 2527 } else if (t.name.startsWith("arm")) {
peterz@5540 2528 // ARM cross build
peterz@5540 2529 def webkitProperties = project.rootProject.ext[t.upper].webkit
peterz@5540 2530 def qmakeSpecDir = "$webkitOutputDir/qws/linux-cross-${t.name}-g++"
peterz@5540 2531 mkdir qmakeSpecDir
peterz@5540 2532 File qmakeSpec = new File("$qmakeSpecDir/qmake.conf")
peterz@5540 2533 qmakeSpec.append(
peterz@5540 2534 """TARGET_PLATFORM = unix
peterz@5540 2535 include(/usr/share/qt4/mkspecs/common/linux.conf)
peterz@5540 2536 include(/usr/share/qt4/mkspecs/common/g++.conf)
peterz@5540 2537 include(/usr/share/qt4/mkspecs/common/qws.conf)
peterz@5540 2538 QMAKE_CC = $webkitProperties.compiler
peterz@5540 2539 QMAKE_CXX = $webkitProperties.linker
peterz@5540 2540 QMAKE_LINK = $webkitProperties.linker
peterz@5540 2541 QMAKE_LINK_SHLIB = $webkitProperties.linker
peterz@5540 2542 QMAKE_AR = $webkitProperties.ar cqs
peterz@5540 2543 QMAKE_OBJCOPY = $webkitProperties.objcopy
peterz@5540 2544 QMAKE_STRIP = $webkitProperties.strip
peterz@5540 2545 QMAKE_CXXFLAGS = $webkitProperties.ccFlags
peterz@5540 2546 QMAKE_LFLAGS = $webkitProperties.linkFlags
peterz@5540 2547 load(qt_config)""")
peterz@5540 2548 environment([
peterz@5540 2549 "QMAKESPEC" : file(qmakeSpecDir).getAbsolutePath(),
peterz@5540 2550 "PATH" : "$System.env.PATH:$webkitProperties.binDir",
peterz@5540 2551 ])
peterz@5540 2552 args("--nocache")
peterz@5540 2553 }
peterz@5540 2554 environment([
anthony@5699 2555 "JAVA_HOME" : JDK_HOME,
peterz@5540 2556 "WEBKITOUTPUTDIR" : webkitOutputDir,
peterz@5540 2557 ])
peterz@5540 2558
peterz@5540 2559 if (IS_COMPILE_PARFAIT) {
peterz@5540 2560 environment([
peterz@5540 2561 "CC" : "parfait-gcc",
peterz@5540 2562 "QMAKE_CC" : "parfait-gcc",
peterz@5540 2563 "CXX" : "parfait-g++",
peterz@5540 2564 "QMAKE_CXX" : "parfait-g++",
peterz@5540 2565 "CPP" : "parfait-g++",
peterz@5540 2566 "cc" : "parfait-gcc",
peterz@5540 2567 "LINK" : "parfait-g++",
peterz@5540 2568 "QMAKE_LINK": "parfait-g++",
peterz@5540 2569 ])
peterz@5540 2570 }
peterz@5540 2571 commandLine("perl", "Tools/Scripts/build-webkit", "--java", "--imageio")
peterz@5540 2572 }
peterz@5540 2573
peterz@5540 2574 def library = rootProject.ext[t.upper].library
peterz@5540 2575 copy {
peterz@5540 2576 from "$webkitOutputDir/$webkitConfig/lib/${library('jfxwebkit')}"
peterz@5540 2577 into "$buildDir/libs/${t.name}"
peterz@5540 2578 }
peterz@5540 2579 copy {
peterz@5540 2580 from "$webkitOutputDir/$webkitConfig/lib/${library('DumpRenderTreeJava')}"
peterz@5540 2581 into "$buildDir/test/${t.name}"
peterz@5540 2582 }
peterz@5540 2583 }
peterz@5540 2584
lepopov@5863 2585 if (IS_WINDOWS && t.name == "win") {
lepopov@5863 2586 def webkitProperties = project.rootProject.ext[t.upper].webkit
lepopov@5863 2587 def rcTask = project.task("rc${t.capital}", type: CompileResourceTask) {
lepopov@5863 2588 compiler = webkitProperties.rcCompiler
lepopov@5863 2589 source(webkitProperties.rcSource)
lepopov@5863 2590 if (webkitProperties.rcFlags) {
lepopov@5863 2591 rcParams.addAll(webkitProperties.rcFlags)
lepopov@5863 2592 }
lepopov@5863 2593 output(file("$webkitOutputDir/$webkitConfig/WebCore/obj"))
lepopov@5863 2594 }
lepopov@5863 2595 compileNativeTask.dependsOn rcTask
lepopov@5863 2596 }
lepopov@5863 2597
peterz@5540 2598 def compileGeneratedTask = task("compileGenerated${t.capital}", type: JavaCompile, dependsOn: compileNativeTask) {
peterz@5540 2599 def gensrcDir = "$webkitOutputDir/$webkitConfig/WebCore/generated/java"
peterz@5540 2600 doFirst {
peterz@5540 2601 copy {
peterz@5765 2602 from "$projectDir/src/main/java/com/sun/webkit/dom/EventListenerImpl.java"
peterz@5540 2603 into "$gensrcDir/com/sun/webkit/dom"
peterz@5540 2604 }
peterz@5540 2605 }
peterz@5540 2606 classpath = files(project(":graphics").sourceSets.main.output) // for JSObject
peterz@5540 2607 source gensrcDir
peterz@5540 2608 destinationDir = file("$buildDir/classes/main")
peterz@5540 2609 }
peterz@5540 2610
peterz@5540 2611 compileGenerated.dependsOn compileGeneratedTask
ddhill@7062 2612
ddhill@7062 2613 if (!targetProperties.compileWebnodeNative) {
ddhill@7062 2614 println("Not compiling native Webkit for ${t.name} per configuration request");
ddhill@7062 2615 compileNativeTask.enabled = false
ddhill@7062 2616 }
peterz@5540 2617 }
peterz@5540 2618
peterz@5540 2619 def drtClasses = "com/sun/javafx/webkit/drt/**"
peterz@5540 2620 jar.exclude(drtClasses)
peterz@5540 2621 task drtJar(type: Jar, dependsOn: compileJava) {
peterz@5540 2622 archiveName = "drt.jar"
peterz@5540 2623 destinationDir = file("$buildDir/test")
peterz@5540 2624 from "$buildDir/classes/main"
peterz@5540 2625 include drtClasses
peterz@5540 2626 }
peterz@5540 2627
peterz@5540 2628 if (IS_COMPILE_WEBKIT) {
peterz@5540 2629 jar.dependsOn compileGenerated, drtJar
peterz@5540 2630 }
peterz@5540 2631 }
peterz@5540 2632
richard@3212 2633 allprojects {
richard@3212 2634 // The following block is a workaround for the fact that presently Gradle
richard@3212 2635 // can't set the -XDignore.symbol.file flag, because it appears that the
richard@3212 2636 // javac API is lacking support for it. So what we'll do is find any Compile
richard@3212 2637 // task and manually provide the options necessary to fire up the
richard@3212 2638 // compiler with the right settings.
richard@3212 2639 //
richard@3212 2640 // Also, we need to remove jfxrt.jar from the ext classpath (if it is there)
richard@3212 2641 tasks.withType(Compile) { compile ->
richard@3212 2642 // It looks like we have to use ant to compile instead of the built-in gradle
richard@3212 2643 // compiler stuff because otherwise it won't compile on CYGWIN
richard@3212 2644 // TODO need to file issue with Gradle
richard@3212 2645 compile.options.useAnt = true
richard@3212 2646 compile.options.debug = true // we always generate debugging info in the class files
kcr@5292 2647 compile.options.debugOptions.debugLevel = IS_DEBUG_JAVA ? "source,lines,vars" : "source,lines"
richard@3212 2648 compile.options.fork = true
richard@3212 2649 compile.options.forkOptions.executable = JAVAC
richard@3212 2650 compile.options.warnings = IS_LINT
kcr@5141 2651 compile.options.useDepend = IS_USE_DEPEND
richard@3212 2652 compile.options.compilerArgs = ["-Djava.ext.dirs=", "-XDignore.symbol.file", "-encoding", "UTF-8"]
dmitry@7780 2653 if (!DO_BUILD_SDK_FOR_TEST) {
dmitry@7780 2654 compile.classpath = files(jfxrtJarFromSdk) + compile.classpath
dmitry@7780 2655 }
richard@3212 2656
richard@3212 2657 // Add in the -Xlint options
richard@3212 2658 if (IS_LINT) {
richard@3212 2659 LINT.split("[, ]").each { s ->
richard@3212 2660 compile.options.compilerArgs += "-Xlint:$s"
richard@3212 2661 }
richard@3212 2662 }
richard@3212 2663 }
dmitry@7780 2664
dmitry@7780 2665 // Some tasks should be disabled not to compile SDK, when running only the tests
dmitry@7780 2666 disabledTasks.each {
dmitry@7780 2667 project.getTasksByName(it, false)*.enabled = false
dmitry@7780 2668 }
richard@3212 2669 }
richard@3212 2670
richard@3014 2671 /******************************************************************************
richard@3014 2672 * *
richard@3014 2673 * Top Level Tasks *
richard@3014 2674 * *
richard@3014 2675 * These are the tasks which are defined only for the top level project and *
richard@3014 2676 * not for any sub projects. These are generally the entry point that is *
richard@3014 2677 * used by Hudson and by the continuous build system. *
richard@3014 2678 * *
richard@3014 2679 *****************************************************************************/
richard@3014 2680
richard@2997 2681 task clean() {
richard@3014 2682 group = "Basic"
richard@3014 2683 description = "Deletes the build directory and the build directory of all sub projects"
richard@2997 2684 getSubprojects().each { subProject ->
richard@2997 2685 dependsOn(subProject.getTasksByName("clean", true));
richard@2997 2686 }
richard@2997 2687 doLast {
richard@2997 2688 delete(buildDir);
richard@2997 2689 }
richard@2997 2690 }
richard@2997 2691
kcr@5006 2692
richard@3069 2693 task javadoc(type: Javadoc) {
kcr@5525 2694 enabled = IS_BUILD_JAVADOC
richard@3069 2695 group = "Basic"
richard@3069 2696 description = "Generates the JavaDoc for all the public API"
richard@3116 2697 executable = JAVADOC
richard@3116 2698 def projectsToDocument = [
kcr@5552 2699 project(":base"), project(":graphics"), project(":controls"), project(":media"),
peterz@4174 2700 project(":swing"), project(":swt"), project(":fxml"), project(":web")]
kcr@4836 2701 source(projectsToDocument.collect({
richard@3212 2702 [it.sourceSets.main.java, "$it.buildDir/generated-src/builders"]
kcr@4836 2703 }));
richard@3069 2704 setDestinationDir(new File(buildDir, 'javadoc'));
richard@3069 2705 // Might need a classpath
richard@3116 2706 classpath = files(projectsToDocument.collect { project ->
richard@3069 2707 project.sourceSets.main.compileClasspath
richard@3069 2708 });
richard@3333 2709 classpath += files(projectsToDocument.collect { project ->
richard@3333 2710 project.sourceSets.main.output
richard@3333 2711 });
felipe@6505 2712 exclude("com/**/*", "javafx/scene/ParentDesignInfo*", "Compile*", "javafx/builder/**/*", "javafx/scene/accessibility/**/*");
kcr@5602 2713 options.windowTitle("${javadocTitle}")
kcr@5602 2714 options.header("${javadocHeader}")
kcr@5602 2715 options.bottom("${javadocBottom}")
kcr@6534 2716 if (BUILD_CLOSED) {
kcr@6534 2717 options.linksOffline(JDK_DOCS, JDK_DOCS_CLOSED);
kcr@6534 2718 } else {
kcr@6534 2719 options.links(JDK_DOCS);
kcr@6534 2720 }
richard@3069 2721 options.addBooleanOption("XDignore.symbol.file").setValue(true);
richard@3069 2722 options.addBooleanOption("Xdoclint:none").setValue(!IS_DOC_LINT);
richard@3069 2723 options.addBooleanOption("javafx").setValue(true);
kcr@7246 2724 options.addBooleanOption("use").setValue(true);
richard@3069 2725 doLast {
richard@3069 2726 projectsToDocument.each { p ->
richard@3069 2727 copy {
richard@3069 2728 from "$p.projectDir/src/main/docs"
richard@3069 2729 into "$buildDir/javadoc"
richard@3069 2730 }
richard@3069 2731 }
richard@3069 2732 }
richard@3069 2733
richard@3116 2734 dependsOn(projectsToDocument.collect { project -> project.getTasksByName("classes", true)});
richard@3069 2735 }
richard@3069 2736
kcr@5006 2737 task jfxrt() {
dmitry@7780 2738 if (DO_BUILD_SDK_FOR_TEST) {
dmitry@7780 2739 rootProject.getTasksByName("compileTestJava", true).each { t ->
dmitry@7780 2740 if (t.enabled) t.dependsOn(jfxrt)
dmitry@7780 2741 }
kcr@5886 2742 }
kcr@5006 2743 }
kcr@3624 2744
kcr@4552 2745 task sdk() {
kcr@4552 2746 dependsOn(checkJfxrtJar)
kcr@5886 2747
dmitry@7780 2748 if (DO_BUILD_SDK_FOR_TEST) {
dmitry@7780 2749 rootProject.getTasksByName("test", true).each { t ->
dmitry@7780 2750 if (t.enabled) t.dependsOn(sdk)
dmitry@7780 2751 }
kcr@5886 2752 }
kcr@4552 2753 }
rbair@3458 2754
ddhill@5832 2755 task appsjar() {
ddhill@5832 2756 dependsOn(sdk)
ddhill@5866 2757 // Note: the jar dependencies get added elsewhere see project(":apps")
ddhill@5832 2758 }
ddhill@5832 2759
ddhill@5832 2760 // these are empty tasks, allowing us to depend on the task, which may have other
ddhill@5832 2761 // real work items added later.
ddhill@5832 2762 task copyAppsArtifacts() {
ddhill@5832 2763 dependsOn(appsjar)
ddhill@5832 2764 }
David@4051 2765
kcr@3624 2766 task apps() {
kcr@3624 2767 dependsOn(sdk)
ddhill@5832 2768 dependsOn(appsjar)
David@4051 2769 dependsOn(copyAppsArtifacts)
kcr@3624 2770 }
kcr@3624 2771
kcr@3624 2772 task findbugs() {
kcr@3624 2773 dependsOn(sdk)
kcr@3624 2774
kcr@3624 2775 doLast {
kcr@3784 2776 if (!BUILD_CLOSED) {
chien@8095 2777 println "findbugs task is only run for a closed build"
kcr@3624 2778 }
kcr@3624 2779 }
kcr@3624 2780 }
kcr@3624 2781
kcr@3624 2782 // The following tasks are for the closed build only. They are a no-op for the open build
kcr@3624 2783
David@4103 2784 task checkCache() {
David@4103 2785 dependsOn(updateCacheIfNeeded)
David@4103 2786 }
David@4103 2787
kcr@3624 2788 // TODO: consider moving the "public-sdk" portion of this task here
kcr@3624 2789 task publicExports() {
kcr@4094 2790 doFirst {
kcr@5525 2791 if (!IS_BUILD_JAVADOC) {
kcr@4094 2792 fail("publicExports task requires: -PBUILD_JAVADOC=true")
kcr@4094 2793 }
kcr@4094 2794 }
kcr@3624 2795 dependsOn(sdk)
kcr@3624 2796 doLast {
kcr@3784 2797 if (!BUILD_CLOSED) {
kcr@3624 2798 println "publicExports task is only run for a closed build"
kcr@3624 2799 }
kcr@3624 2800 }
kcr@3624 2801 }
kcr@3624 2802
kcr@3624 2803 task perf() {
kcr@3624 2804 dependsOn(sdk,apps)
kcr@3624 2805 doLast {
kcr@3784 2806 if (!BUILD_CLOSED) {
kcr@3624 2807 println "perf task is only run for a closed build"
kcr@3624 2808 }
kcr@3624 2809 }
kcr@3624 2810 }
kcr@3624 2811
kcr@3624 2812 task zips() {
kcr@4094 2813 doFirst {
kcr@5525 2814 if (!IS_BUILD_JAVADOC) {
kcr@4094 2815 fail("zips task requires: -PBUILD_JAVADOC=true")
kcr@4094 2816 }
kcr@4094 2817 }
kcr@3624 2818 dependsOn(sdk,publicExports,apps,perf)
kcr@3625 2819 doLast {
kcr@3784 2820 if (!BUILD_CLOSED) {
kcr@3624 2821 println "zips task is only run for a closed build"
kcr@3624 2822 }
kcr@3625 2823 }
kcr@3624 2824 }
kcr@3624 2825
kcr@5299 2826 task copySources(type: Copy) {
kcr@5299 2827 enabled = IS_BUILD_SRC_ZIP
kcr@5299 2828 def projectsToCopy = [
kcr@5299 2829 project(":base"), project(":graphics"), project(":controls"),
kcr@5299 2830 project(":swing"), project(":swt"), project(":fxml"),
kcr@7463 2831 project(":builders"), project(":media"), project(":web")]
kcr@7463 2832 from(projectsToCopy.collect({ proj ->
kcr@7463 2833 files(proj.sourceSets.main.java.srcDirs)
kcr@5299 2834 }))
kcr@5299 2835 include "**/*.java"
kcr@5299 2836 into "${buildDir}/javafx-src"
kcr@5299 2837 }
kcr@5299 2838
kcr@5299 2839 task zipSources(type: Zip) {
kcr@5299 2840 enabled = IS_BUILD_SRC_ZIP
kcr@5299 2841 dependsOn(copySources)
kcr@5299 2842 archiveName = "javafx-src.zip"
kcr@5299 2843 destinationDir = file("$buildDir")
kcr@5299 2844 includeEmptyDirs = false
kcr@5299 2845 from "${buildDir}/javafx-src"
kcr@5299 2846 }
kcr@5299 2847
kcr@5299 2848 task src {
kcr@5299 2849 enabled = IS_BUILD_SRC_ZIP
kcr@5299 2850 description = "Created the javafx-src.zip bundle"
kcr@5299 2851 dependsOn(zipSources)
kcr@5299 2852 }
kcr@5299 2853
kcr@3624 2854 task all() {
kcr@3624 2855 dependsOn(sdk,publicExports,apps,perf,zips)
kcr@3624 2856 }
kcr@3624 2857
rbair@3458 2858 compileTargets { t ->
richard@3487 2859 def targetProperties = project.ext[t.upper]
ddhill@6318 2860 def sdkDirName = targetProperties.sdkDirName
rbair@4165 2861 def library = targetProperties.library
rbair@3458 2862 // The jfxrt task is responsible for creating the jfxrt.jar. A developer may
rbair@3458 2863 // have multiple SDK's on their system at any one time, depending on which
rbair@3458 2864 // cross compiles they have done. For example, I might have:
rbair@3458 2865 // build/ios-sdk/rt/lib/ext/jfxrt.jar
rbair@3458 2866 // build/armhf-sdk/rt/lib/ext/jfxrt.jar
ddhill@6318 2867 // and so forth. The default host build will always install into 'sdk'
ddhill@6318 2868 // allowing for uses where a known sdk path is needed (like IDEs)
ddhill@6318 2869 // build/sdk/rt/lib/ext/jfxrt.jar
ddhill@6318 2870 // This arrangement allows for multiple independent SDKs to
rbair@3458 2871 // exist on a developer's system.
rbair@3458 2872 def jfxrtTask = task("jfxrt$t.capital", type: Jar) {
rbair@3458 2873 group = "Basic"
rbair@3458 2874 description = "Creates the jfxrt.jar for the $t.name target"
ddhill@6318 2875 archiveName = "build/${sdkDirName}/rt/lib/ext/jfxrt.jar";
rbair@3458 2876 includeEmptyDirs = false
rbair@3458 2877 from("modules/base/build/classes/main",
rbair@3458 2878 "modules/base/build/resources/main",
kcr@3784 2879 "modules/builders/build/classes/main",
rbair@3458 2880 "modules/graphics/build/classes/main",
rbair@3458 2881 "modules/graphics/build/resources/main",
rbair@3458 2882 "modules/controls/build/classes/main",
rbair@3458 2883 "modules/controls/build/resources/main",
rbair@3458 2884 "modules/fxml/build/classes/main",
rbair@3458 2885 "modules/fxml/build/resources/main",
rbair@3458 2886 "modules/graphics/build/classes/jsl-decora",
rbair@3458 2887 "modules/graphics/build/resources/jsl-decora",
rbair@3458 2888 "modules/graphics/build/classes/jsl-prism",
kirill@5407 2889 "modules/graphics/build/resources/jsl-prism",
kirill@5407 2890 "modules/media/build/classes/main",
kirill@5407 2891 "modules/media/build/resources/main")
richard@3502 2892 if (COMPILE_SWING) from ("modules/swing/build/classes/main", "modules/swing/build/resources/main")
kirill@5407 2893
ddhill@7065 2894 if (!IS_MAC) {
ddhill@7065 2895 exclude ("modules/media/build/classes/main/com/sun/media/jfxmediaimpl/platform/osx/**",
ddhill@7065 2896 "com/sun/prism/es2/MacGL*",
ddhill@7065 2897 "com/sun/glass/events/mac",
ddhill@7065 2898 "com/sun/glass/ui/mac",
ddhill@7065 2899 "com/sun/prism/es2/gl/mac"
ddhill@7065 2900 )
ddhill@7065 2901 }
ddhill@7065 2902 if (!IS_WINDOWS) {
ddhill@7065 2903 exclude ("**/*.hlsl",
ddhill@7065 2904 "com/sun/glass/ui/win",
ddhill@7065 2905 "com/sun/prism/d3d",
ddhill@7065 2906 "com/sun/prism/es2/gl/win",
ddhill@7065 2907 "com/sun/prism/es2/WinGL*",
ddhill@7065 2908 "com/sun/scenario/effect/impl/hw/d3d"
ddhill@7065 2909 )
ddhill@7065 2910 }
ddhill@7065 2911 if (!targetProperties.includeGTK) { //usually IS_LINUX
ddhill@7065 2912 exclude (
ddhill@7065 2913 "com/sun/glass/ui/gtk",
ddhill@7065 2914 "com/sun/prism/es2/EGL*",
ddhill@7065 2915 "com/sun/prism/es2/gl/eglfb",
ddhill@7065 2916 "com/sun/prism/es2/gl/eglx11",
ddhill@7065 2917 "com/sun/prism/es2/gl/x11",
ddhill@7065 2918 "com/sun/prism/es2/X11GL*"
ddhill@7065 2919 )
ddhill@7065 2920 }
ddhill@7065 2921 if (!targetProperties.includeEGL) {
ddhill@7065 2922 exclude ("com/sun/prism/es2/EGL*")
ddhill@7065 2923 }
ddhill@7065 2924 if (!targetProperties.includeLens) {
ddhill@7065 2925 exclude ("com/sun/glass/ui/lens")
ddhill@7065 2926 }
ddhill@7379 2927 /* Note: Monocle is used in the test harness, and so should
ddhill@7379 2928 * not be excluded until the deploy phase
ddhill@7379 2929 if (!targetProperties.includeMonocle) {
ddhill@7379 2930 exclude ("com/sun/glass/ui/monocle")
ddhill@7379 2931 }
ddhill@7379 2932 */
ddhill@7065 2933 if (!targetProperties.includeNull3d) {
ddhill@7065 2934 // "com/sun/prism/null3d", // TODO This is used in dev builds but not the final sdk
ddhill@7065 2935 exclude ("com/sun/prism/null3d")
ddhill@7065 2936 }
ddhill@7065 2937 if (t.name != 'ios') {
ddhill@7065 2938 exclude ("modules/media/build/classes/main/com/sun/media/jfxmediaimpl/platform/ios/**",
ddhill@7065 2939 "com/sun/glass/ui/ios",
ddhill@7065 2940 "com/sun/prism/es2/IOS*"
ddhill@7065 2941 )
ddhill@7065 2942 }
kcr@7248 2943 if (t.name != 'android' && t.name != 'dalvik') {
ddhill@7065 2944 exclude ("com/sun/glass/ui/android/*")
ddhill@7065 2945 }
kirill@5407 2946
david@4201 2947 if (t.name == 'android') {
Tomas@4643 2948 from ("modules/web/build/classes/android",
Tomas@4643 2949 "modules/web/build/resources/android",
Tomas@4643 2950 "modules/controls/build/classes/android",
Tomas@4643 2951 "modules/controls/build/resources/android")
david@4201 2952 } else if (t.name == 'ios') {
oldrich@5689 2953 from ("modules/web/build/classes/ios",
oldrich@5689 2954 "modules/web/build/resources/ios",
oldrich@5689 2955 "modules/extensions/build/classes/ios")
david@4201 2956 } else {
peterz@4174 2957 from ("modules/web/build/classes/main", "modules/web/build/resources/main")
peterz@4174 2958 }
ddhill@7065 2959
kcr@5474 2960 exclude("**/javafx/embed/swt/**")
ddhill@7065 2961
ddhill@7065 2962 if (!targetProperties.includeSWT) {
ddhill@7065 2963 exclude("com/sun/glass/ui/swt")
ddhill@7065 2964 }
ddhill@7065 2965
ddhill@7065 2966 if (!targetProperties.includeSwing) {
ddhill@7065 2967 exclude("javafx/embed/swing")
ddhill@7065 2968 }
rbair@3458 2969 exclude("js/**/*", // er...
rbair@3458 2970 "PrismLoaderBackend*", // More decora stuff
rbair@3458 2971 "**/*.stg", // any glue files for decora must be excluded
rbair@3458 2972 "**/*.java"); // Builder java files are in build/classes and should be excluded
rbair@3458 2973
rbair@3458 2974 // Filter out platform specific Java sources (glass) when compiling for other targets
ddhill@7065 2975 if (targetProperties.containsKey('jfxrtJarExcludes')) {
ddhill@7065 2976 exclude(targetProperties.jfxrtJarExcludes)
ddhill@7065 2977 }
rbair@3458 2978
rbair@3458 2979 dependsOn(subprojects.collect { project -> project.getTasksByName("assemble", true)});
rbair@3458 2980 }
ddhill@4798 2981 def jfxrtIndexTask = task("jfxrtIndex$t.capital") {
ddhill@4798 2982 //the following is a workaround for the lack of indexing in gradle 1.4 through 1.7
ddhill@4798 2983 dependsOn(jfxrtTask)
ddhill@4798 2984
ddhill@4798 2985 doLast() {
ddhill@4798 2986 ant.jar (update: true, index: true, destfile: jfxrtTask.archiveName)
ddhill@4798 2987 }
ddhill@4798 2988 }
ddhill@4798 2989 jfxrt.dependsOn(jfxrtIndexTask)
rbair@3458 2990
kcr@5474 2991 def jfxswtTask = task("jfxswt$t.capital", type: Jar) {
kcr@5474 2992 enabled = COMPILE_SWT
kcr@5474 2993 group = "Basic"
kcr@5474 2994 description = "Creates the jfxswt.jar for the $t.name target"
ddhill@6318 2995 archiveName = "build/${sdkDirName}/rt/lib/jfxswt.jar";
kcr@5474 2996 includeEmptyDirs = false
kcr@5474 2997 from("modules/swt/build/classes/main");
kcr@5474 2998 from("modules/builders/build/classes/main");
kcr@5474 2999 include("**/javafx/embed/swt/**")
kcr@5474 3000 exclude("**/*.java"); // Builder java files are in build/classes and should be excluded
kcr@5474 3001
kcr@5474 3002 dependsOn(subprojects.collect { project -> project.getTasksByName("assemble", true)});
kcr@5474 3003 }
kcr@5474 3004 def jfxswtIndexTask = task("jfxswtIndex$t.capital") {
kcr@5474 3005 //the following is a workaround for the lack of indexing in gradle 1.4 through 1.7
kcr@5474 3006 dependsOn(jfxswtTask)
kcr@5474 3007
kcr@5474 3008 doLast() {
kcr@5474 3009 ant.jar (update: true, index: true, destfile: jfxswtTask.archiveName)
kcr@5474 3010 }
kcr@5474 3011 }
kcr@5474 3012 jfxrt.dependsOn(jfxswtIndexTask)
kcr@5474 3013
kcr@5584 3014 def jmxTask = task ("jmx${t.capital}", type: Jar) {
kcr@5584 3015 group = "Basic"
kcr@5584 3016 description = "Creates the javafx-mx.jar"
ddhill@6318 3017 archiveName = "build/${sdkDirName}/lib/javafx-mx.jar";
kcr@5584 3018 includeEmptyDirs = false
kcr@5584 3019 from "modules/jmx/build/classes/main"
kcr@5584 3020 from "modules/jmx/build/resources/main"
kcr@5584 3021 dependsOn project(":jmx").assemble
kcr@5584 3022 }
kcr@5584 3023
rbair@3458 3024 // The 'sdk' task will build the rest of the SDK, and depends on the 'jfxrtTask' task. After
rbair@3458 3025 // executing this task the sdk bundle for the current COMPILE_TARGETS will be fully created.
rbair@3458 3026 def sdkTask = task("sdk$t.capital") {
rbair@3458 3027 group = "Basic"
rbair@3458 3028 description = "Creates the SDK for $t.name"
rbair@3458 3029 doLast {
rbair@3458 3030 // TODO instead of using copy everywhere, I probably want to use "sync" instead?
rbair@3458 3031 // Copy all of the .dll / .so / .dylib native libraries into build/sdk/rt/lib/
rbair@3458 3032 copy {
david@4201 3033 def useLipo = targetProperties.containsKey('useLipo') ? targetProperties.useLipo : false
rbair@4165 3034 from("modules/graphics/build/libs/jsl-decora/${t.name}/${library(targetProperties.decora.lib)}")
felipe@4255 3035 def libs = ['font', 'prism', 'prismSW', 'prismES2', 'glass', 'iio']
kcr@5525 3036 if (IS_COMPILE_PANGO) {
ddhill@7063 3037 libs += ['fontFreetype', 'fontPango'];
felipe@4255 3038 }
felipe@4255 3039 libs.each { lib ->
david@4201 3040 def variants = targetProperties[lib].containsKey('variants') && !useLipo ? targetProperties[lib].variants : [null]
rbair@4165 3041 variants.each { variant ->
rbair@4165 3042 def variantProperties = variant ? targetProperties[lib][variant] : targetProperties[lib]
rbair@4165 3043 println "modules/graphics/build/libs/$lib/$t.name/${library(variantProperties.lib)}"
rbair@4165 3044 from ("modules/graphics/build/libs/$lib/$t.name/${library(variantProperties.lib)}")
rbair@4165 3045 }
richard@3502 3046 }
rbair@3546 3047 if (IS_WINDOWS) {
richard@3502 3048 from ("modules/graphics/build/libs/prismD3D/${t.name}/${library(targetProperties.prismD3D.lib)}");
peterz@4174 3049 }
kcr@5525 3050 if (IS_COMPILE_WEBKIT) {
peterz@4657 3051 from ("modules/web/build/libs/${t.name}/${library('jfxwebkit')}")
peterz@4174 3052 } else {
peterz@4876 3053 if (t.name != "android" && t.name != "ios") {
peterz@4876 3054 from ("$LIBRARY_STUB/${library('jfxwebkit')}")
Tomas@4488 3055 }
rbair@3458 3056 }
kirill@5407 3057
kirill@5463 3058 def mediaBuildType = project(":media").ext.buildType
kcr@5525 3059 if (IS_COMPILE_MEDIA) {
kirill@5407 3060 [ "fxplugins", "gstreamer-lite", "jfxmedia" ].each { name ->
kirill@5463 3061 from ("modules/media/build/native/${t.name}/${mediaBuildType}/${library(name)}") }
ddehaven@7679 3062
ddehaven@7679 3063 if (t.name == "mac") {
ddehaven@7679 3064 // OSX media natives
ddehaven@8148 3065 [ "jfxmedia_qtkit", "jfxmedia_avf", "glib-lite" ].each { name ->
ddehaven@7679 3066 from ("modules/media/build/native/${t.name}/${mediaBuildType}/${library(name)}") }
ddehaven@7679 3067 } else if (t.name == "linux") {
stayer@7645 3068 from("modules/media/build/native/${t.name}/${mediaBuildType}") { include "libavplugin*.so" }
ddehaven@7679 3069 } else from ("modules/media/build/native/${t.name}/${mediaBuildType}/${library("glib-lite")}")
kirill@5407 3070 } else {
kirill@5407 3071 [ "fxplugins", "gstreamer-lite", "jfxmedia" ].each { name ->
kirill@5463 3072 from ("$LIBRARY_STUB/${library(name)}") }
kirill@5407 3073
ddehaven@8148 3074 if (t.name == "mac") {
ddehaven@8148 3075 // copy libjfxmedia_{avf,qtkit}.dylib if they exist
ddehaven@8148 3076 [ "jfxmedia_qtkit", "jfxmedia_avf", "glib-lite" ].each { name ->
ddehaven@8148 3077 from ("$LIBRARY_STUB/${library(name)}") }
ddehaven@8148 3078 } else if (t.name == "linux") {
stayer@7645 3079 from(LIBRARY_STUB) { include "libavplugin*.so" }
stayer@7645 3080 }
kirill@5407 3081 else from ("$LIBRARY_STUB/${library("glib-lite")}")
kirill@5407 3082 }
kirill@5407 3083
richard@3487 3084 def libDest = targetProperties.libDest
ddhill@6318 3085 into ("build/${sdkDirName}/rt/$libDest")
kcr@3415 3086 }
rbair@3458 3087
rbair@3458 3088 // Create the javafx.properties file
ddhill@6318 3089 final File javafxProperties = file("build/${sdkDirName}/rt/lib/javafx.properties")
richard@3502 3090 javafxProperties.delete()
rbair@3458 3091 javafxProperties << "javafx.runtime.version=$RAW_VERSION";
ddhill@7379 3092 javafxProperties << "\n"
rbair@3458 3093 // Include any properties that have been defined (most likely in
rbair@3458 3094 // one of the various platform gradle files)
rbair@3572 3095 if (targetProperties.containsKey("javafxProperties")) {
ddhill@7379 3096 javafxProperties << targetProperties.javafxProperties
richard@3502 3097 javafxProperties << "\n"
richard@2997 3098 }
rbair@3458 3099
rbair@3458 3100 // Embedded builds define this file as well
rbair@3572 3101 if (targetProperties.containsKey("javafxPlatformProperties")) {
ddhill@6318 3102 final File javafxPlatformProperties = file("build/${sdkDirName}/rt/lib/javafx.platform.properties")
richard@3502 3103 javafxPlatformProperties.delete()
richard@3487 3104 javafxPlatformProperties << targetProperties.javafxPlatformProperties
ddhill@7379 3105 javafxPlatformProperties << "\n"
rbair@3458 3106 }
rbair@3458 3107
rbair@3458 3108 // Copy over the javadocs that were generated. This is done rather than just generating
rbair@3458 3109 // the docs into the "right place" because for a cross-compile you only need one set of
rbair@3458 3110 // docs but need to have a copy in each created sdk
kcr@5525 3111 if (IS_BUILD_JAVADOC) {
kcr@3950 3112 copy {
kcr@3950 3113 from "build/javadoc"
ddhill@6318 3114 into "build/${sdkDirName}/docs/api"
kcr@3950 3115 }
rbair@3458 3116 }
rbair@3458 3117
kcr@5299 3118 // Copy over the javafx-src bundle
kcr@5299 3119 if (IS_BUILD_SRC_ZIP) {
kcr@5299 3120 copy {
kcr@5299 3121 from "build/javafx-src.zip"
ddhill@6318 3122 into "build/${sdkDirName}"
kcr@5299 3123 }
kcr@5299 3124 }
kcr@5299 3125
rbair@3458 3126 // Copy over the fxpackager and rename as ant-javafx.jar
rbair@3458 3127 copy {
rbair@3458 3128 from "modules/fxpackager/build/libs"
ddhill@6318 3129 into "build/${sdkDirName}/lib"
rbair@3458 3130 }
rbair@3458 3131
rbair@3458 3132 // Copy over the FXPackager man files
rbair@3458 3133 copy {
rbair@3458 3134 from "modules/fxpackager/build/man"
ddhill@6318 3135 into "build/${sdkDirName}/man"
rbair@3458 3136 }
rbair@3458 3137
danno@6953 3138 // Copy over the javapackager executable
rbair@3572 3139 if (t.name == "win" || t.name == "linux" || t.name == "mac") {
rbair@3572 3140 copy {
danno@6953 3141 from "modules/fxpackager/build/javapackager"
ddhill@6318 3142 into "build/${sdkDirName}/bin"
rbair@3572 3143 }
richard@2997 3144 }
richard@2997 3145 }
kcr@5584 3146 dependsOn(jmxTask);
kcr@5676 3147 dependsOn(jfxrtIndexTask)
kcr@5676 3148 dependsOn(jfxswtIndexTask)
rbair@3458 3149 dependsOn(javadoc)
kcr@5299 3150 dependsOn(src)
richard@2997 3151 }
david@4201 3152
david@4201 3153 def generateSymbols = targetProperties.containsKey('generateSymbols') ? targetProperties.generateSymbols : false
david@4201 3154 if (generateSymbols) {
david@4201 3155 def exportedSymbolsTask = project.task("exportedSymbols${t.capital}", type: ExportedSymbolsTask, dependsOn: sdkTask, group: "Build") {