changeset 1968:5820f2afe811

Updated jib-profiles file to submit RBT jobs
author thartmann
date Thu, 12 Jan 2017 11:57:38 +0100
parents 52bd1d878467
children 27d374a0ad48
files common/conf/jib-profiles.js
diffstat 1 files changed, 645 insertions(+), 132 deletions(-) [+]
line wrap: on
line diff
--- a/common/conf/jib-profiles.js	Wed Apr 27 14:49:22 2016 +0200
+++ b/common/conf/jib-profiles.js	Thu Jan 12 11:57:38 2017 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -55,6 +55,7 @@
  * be provided:
  *
  * input.profile
+ * input.build_id
  * input.target_os
  * input.target_cpu
  * input.build_os
@@ -181,11 +182,14 @@
 
     var data = {};
 
-    // Identifies the version of this format to the tool reading it
-    data.format_version = "1.0";
+    // Identifies the version of this format to the tool reading it.
+    // 1.1 signifies that the publish, publish-src and get-src features are usable.
+    data.format_version = "1.1";
 
-    // Organization is used when uploading/publishing build results
-    data.organization = "com.oracle.jpg.jdk";
+    // Organization, product and version are used when uploading/publishing build results
+    data.organization = "";
+    data.product = "jdk";
+    data.version = getVersion();
 
     // The base directory for the build output. JIB will assume that the
     // actual build directory will be <output_basedir>/<configuration>
@@ -195,12 +199,18 @@
     // The make argument to use to specify the name of the configuration
     data.configuration_make_arg = "CONF_NAME=";
 
+    // Exclude list to use when Jib creates a source bundle
+    data.src_bundle_excludes = "./build webrev .hg */.hg */*/.hg */*/*/.hg";
+    // Include list to use when creating a minimal jib source bundle which
+    // contains just the jib configuration files.
+    data.conf_bundle_includes = "*/conf/jib-profiles.* common/autoconf/version-numbers"
+
     // Define some common values
-    var common = getJibProfilesCommon(input);
+    var common = getJibProfilesCommon(input, data);
     // Generate the profiles part of the configuration
-    data.profiles = getJibProfilesProfiles(input, common);
+    data.profiles = getJibProfilesProfiles(input, common, data);
     // Generate the dependencies part of the configuration
-    data.dependencies = getJibProfilesDependencies(input, common);
+    data.dependencies = getJibProfilesDependencies(input, common, data);
 
     return data;
 };
@@ -211,14 +221,186 @@
  * @param input External data to use for generating the configuration
  * @returns Common values
  */
-var getJibProfilesCommon = function (input) {
-    var common = {
+var getJibProfilesCommon = function (input, data) {
+    var common = {};
+
+    common.organization = "jpg.infra.builddeps";
+    common.build_id = getBuildId(input);
+    common.build_number = input.build_number != null ? input.build_number : "0";
+
+    // List of the main profile names used for iteration
+    common.main_profile_names = [
+        "linux-x64", "linux-x86", "macosx-x64", "solaris-x64",
+        "solaris-sparcv9", "windows-x64", "windows-x86"
+    ];
+
+    // These are the base setttings for all the main build profiles.
+    common.main_profile_base = {
         dependencies: ["boot_jdk", "gnumake", "jtreg"],
-        configure_args: ["--with-default-make-target=all"],
-        configure_args_32bit: ["--with-target-bits=32", "--with-jvm-variants=client,server"],
-        configure_args_debug: ["--enable-debug"],
-        organization: "jpg.infra.builddeps"
+        default_make_targets: ["product-bundles", "test-bundles"],
+        configure_args: [
+            "--with-version-opt=" + common.build_id,
+            "--enable-jtreg-failure-handler",
+            "--with-version-build=" + common.build_number
+        ]
     };
+    // Extra settings for debug profiles
+    common.debug_suffix = "-debug";
+    common.debug_profile_base = {
+        configure_args: ["--enable-debug"],
+        labels: "debug"
+    };
+    // Extra settings for slowdebug profiles
+    common.slowdebug_suffix = "-slowdebug";
+    common.slowdebug_profile_base = {
+        configure_args: ["--with-debug-level=slowdebug"],
+        labels: "slowdebug"
+    };
+    // Extra settings for openjdk only profiles
+    common.open_suffix = "-open";
+    common.open_profile_base = {
+        configure_args: ["--enable-openjdk-only"],
+        labels: "open"
+    };
+
+    common.configure_args_64bit = ["--with-target-bits=64"];
+    common.configure_args_32bit = ["--with-target-bits=32"];
+
+    /**
+     * Define common artifacts template for all main profiles
+     * @param pf - Name of platform in bundle names
+     * @param demo_ext - Type of extension for demo bundle
+     */
+    common.main_profile_artifacts = function (pf, demo_ext) {
+        return {
+            artifacts: {
+                jdk: {
+                    local: "bundles/\\(jdk.*bin.tar.gz\\)",
+                    remote: [
+                        "bundles/" + pf + "/jdk-" + data.version + "_" + pf + "_bin.tar.gz",
+                        "bundles/" + pf + "/\\1"
+                    ],
+                    subdir: "jdk-" + data.version,
+                    exploded: "images/jdk"
+                },
+                jre: {
+                    local: "bundles/\\(jre.*bin.tar.gz\\)",
+                    remote: [
+                        "bundles/" + pf + "/jre-" + data.version + "_" + pf + "_bin.tar.gz",
+                        "bundles/" + pf + "/\\1"
+                    ],
+                    subdir: "jre-" + data.version,
+                    exploded: "images/jre"
+                },
+                test: {
+                    local: "bundles/\\(jdk.*bin-tests.tar.gz\\)",
+                    remote: [
+                        "bundles/" + pf + "/jdk-" + data.version + "_" + pf + "_bin-tests.tar.gz",
+                        "bundles/" + pf + "/\\1"
+                    ],
+                    exploded: "images/test"
+                },
+                jdk_symbols: {
+                    local: "bundles/\\(jdk.*bin-symbols.tar.gz\\)",
+                    remote: [
+                        "bundles/" + pf + "/jdk-" + data.version + "_" + pf + "_bin-symbols.tar.gz",
+                        "bundles/" + pf + "/\\1"
+                    ],
+                    subdir: "jdk-" + data.version,
+                    exploded: "images/jdk"
+                },
+                jre_symbols: {
+                    local: "bundles/\\(jre.*bin-symbols.tar.gz\\)",
+                    remote: [
+                        "bundles/" + pf + "/jre-" + data.version + "_" + pf + "_bin-symbols.tar.gz",
+                        "bundles/" + pf + "/\\1"
+                    ],
+                    subdir: "jre-" + data.version,
+                    exploded: "images/jre"
+                },
+                demo: {
+                    local: "bundles/\\(jdk.*demo." + demo_ext + "\\)",
+                    remote: [
+                        "bundles/" + pf + "/jdk-" + data.version + "_" + pf + "_demo." + demo_ext,
+                        "bundles/" + pf + "/\\1"
+                    ],
+                }
+            }
+        };
+    };
+
+
+    /**
+     * Define common artifacts template for all debug profiles
+     * @param pf - Name of platform in bundle names
+     */
+    common.debug_profile_artifacts = function (pf) {
+        return {
+            artifacts: {
+                jdk: {
+                    local: "bundles/\\(jdk.*bin-debug.tar.gz\\)",
+                    remote: [
+                        "bundles/" + pf + "/jdk-" + data.version + "_" + pf + "_bin-debug.tar.gz",
+                        "bundles/" + pf + "/\\1"
+                    ],
+                    subdir: "jdk-" + data.version,
+                    exploded: "images/jdk"
+                },
+                jre: {
+                    local: "bundles/\\(jre.*bin-debug.tar.gz\\)",
+                    remote: [
+                        "bundles/" + pf + "/jre-" + data.version + "_" + pf + "_bin-debug.tar.gz",
+                        "bundles/" + pf + "/\\1"
+                    ],
+                    subdir: "jre-" + data.version,
+                    exploded: "images/jre"
+                },
+                test: {
+                    local: "bundles/\\(jdk.*bin-tests-debug.tar.gz\\)",
+                    remote: [
+                        "bundles/" + pf + "/jdk-" + data.version + "_" + pf + "_bin-tests-debug.tar.gz",
+                        "bundles/" + pf + "/\\1"
+                    ],
+                    exploded: "images/test"
+                },
+                jdk_symbols: {
+                    local: "bundles/\\(jdk.*bin-debug-symbols.tar.gz\\)",
+                    remote: [
+                        "bundles/" + pf + "/jdk-" + data.version + "_" + pf + "_bin-debug-symbols.tar.gz",
+                        "bundles/" + pf + "/\\1"
+                    ],
+                    subdir: "jdk-" + data.version,
+                    exploded: "images/jdk"
+                },
+                jre_symbols: {
+                    local: "bundles/\\(jre.*bin-debug-symbols.tar.gz\\)",
+                    remote: [
+                        "bundles/" + pf + "/jre-" + data.version + "_" + pf + "_bin-debug-symbols.tar.gz",
+                        "bundles/" + pf + "/\\1"
+                    ],
+                    subdir: "jre-" + data.version,
+                    exploded: "images/jre"
+                }
+            }
+        };
+    };
+
+    var boot_jdk_revision = "8";
+    var boot_jdk_subdirpart = "1.8.0";
+    // JDK 8 does not work on sparc M7 cpus, need a newer update when building
+    // on such hardware.
+    if (input.build_cpu == "sparcv9") {
+       var cpu_brand = $EXEC("bash -c \"kstat -m cpu_info | grep brand | head -n1 | awk '{ print \$2 }'\"");
+       if (cpu_brand.trim() == 'SPARC-M7') {
+           boot_jdk_revision = "8u20";
+           boot_jdk_subdirpart = "1.8.0_20";
+       }
+    }
+    common.boot_jdk_revision = boot_jdk_revision;
+    common.boot_jdk_subdirpart = boot_jdk_subdirpart;
+    common.boot_jdk_home = input.get("boot_jdk", "home_path") + "/jdk"
+        + common.boot_jdk_subdirpart
+        + (input.build_os == "macosx" ? ".jdk/Contents/Home" : "");
 
     return common;
 };
@@ -230,135 +412,395 @@
  * @param common The common values
  * @returns {{}} Profiles part of the configuration
  */
-var getJibProfilesProfiles = function (input, common) {
-    var profiles = {};
-
+var getJibProfilesProfiles = function (input, common, data) {
     // Main SE profiles
-    var mainProfiles = {
+    var profiles = {
 
         "linux-x64": {
             target_os: "linux",
             target_cpu: "x64",
-            dependencies: concat(common.dependencies, "devkit"),
-            configure_args: common.configure_args,
-            make_args: common.make_args
+            dependencies: ["devkit"],
+            configure_args: concat(common.configure_args_64bit, "--with-zlib=system"),
+            default_make_targets: ["docs-bundles"],
         },
 
         "linux-x86": {
             target_os: "linux",
             target_cpu: "x86",
             build_cpu: "x64",
-            dependencies: concat(common.dependencies, "devkit"),
-            configure_args: concat(common.configure_args, common.configure_args_32bit),
-            make_args: common.make_args
+            dependencies: ["devkit"],
+            configure_args: concat(common.configure_args_32bit,
+                "--with-jvm-variants=minimal,server", "--with-zlib=system"),
         },
 
         "macosx-x64": {
             target_os: "macosx",
             target_cpu: "x64",
-            dependencies: concat(common.dependencies, "devkit"),
-            configure_args: common.configure_args,
-            make_args: common.make_args
+            dependencies: ["devkit"],
+            configure_args: concat(common.configure_args_64bit, "--with-zlib=system"),
         },
 
         "solaris-x64": {
             target_os: "solaris",
             target_cpu: "x64",
-            dependencies: concat(common.dependencies, "devkit", "cups"),
-            configure_args: common.configure_args,
-            make_args: common.make_args
+            dependencies: ["devkit", "cups"],
+            configure_args: concat(common.configure_args_64bit,
+                "--with-zlib=system", "--enable-dtrace"),
         },
 
         "solaris-sparcv9": {
             target_os: "solaris",
             target_cpu: "sparcv9",
-            dependencies: concat(common.dependencies, "devkit", "cups"),
-            configure_args: common.configure_args,
-            make_args: common.make_args
+            dependencies: ["devkit", "cups"],
+            configure_args: concat(common.configure_args_64bit,
+                "--with-zlib=system", "--enable-dtrace"),
         },
 
         "windows-x64": {
             target_os: "windows",
             target_cpu: "x64",
-            dependencies: concat(common.dependencies, "devkit", "freetype"),
-            configure_args: common.configure_args,
-            make_args: common.make_args
+            dependencies: ["devkit", "freetype"],
+            configure_args: concat(common.configure_args_64bit),
         },
 
         "windows-x86": {
             target_os: "windows",
             target_cpu: "x86",
             build_cpu: "x64",
-            dependencies: concat(common.dependencies, "devkit", "freetype"),
-            configure_args: concat(common.configure_args, common.configure_args_32bit),
-            make_args: common.make_args
+            dependencies: ["devkit", "freetype"],
+            configure_args: concat(common.configure_args_32bit),
         }
     };
-    profiles = concatObjects(profiles, mainProfiles);
+    // Add the base settings to all the main profiles
+    common.main_profile_names.forEach(function (name) {
+        profiles[name] = concatObjects(common.main_profile_base, profiles[name]);
+    });
+
     // Generate debug versions of all the main profiles
-    profiles = concatObjects(profiles, generateDebugProfiles(common, mainProfiles));
+    common.main_profile_names.forEach(function (name) {
+        var debugName = name + common.debug_suffix;
+        profiles[debugName] = concatObjects(profiles[name],
+                                            common.debug_profile_base);
+    });
+    // Generate slowdebug versions of all the main profiles
+    common.main_profile_names.forEach(function (name) {
+        var debugName = name + common.slowdebug_suffix;
+        profiles[debugName] = concatObjects(profiles[name],
+                                            common.slowdebug_profile_base);
+    });
 
-    // Specific open profiles needed for JPRT testing
-    var jprtOpenProfiles = {
+    // Generate open only profiles for all the main profiles for JPRT and reference
+    // implementation builds.
+    common.main_profile_names.forEach(function (name) {
+        var openName = name + common.open_suffix;
+        profiles[openName] = concatObjects(profiles[name],
+                                           common.open_profile_base);
+    });
+    // The open only profiles on linux are used for reference builds and should
+    // produce the compact profile images by default. This adds "profiles" as an
+    // extra default target.
+    var openOnlyProfilesExtra = {
+        "linux-x86-open": {
+            default_make_targets: "profiles",
+            configure_args: "--with-jvm-variants=client,server"
+        }
+    };
+    profiles = concatObjects(profiles, openOnlyProfilesExtra);
 
-        "linux-x64-open": {
-            target_os: mainProfiles["linux-x64"].target_os,
-            target_cpu: mainProfiles["linux-x64"].target_cpu,
-            dependencies: mainProfiles["linux-x64"].dependencies,
-            configure_args: concat(mainProfiles["linux-x64"].configure_args,
-                "--enable-openjdk-only"),
-            make_args: mainProfiles["linux-x64"].make_args,
-            labels: [ "open" ]
+    // Generate debug profiles for the open only profiles
+    common.main_profile_names.forEach(function (name) {
+        var openName = name + common.open_suffix;
+        var openDebugName = openName + common.debug_suffix;
+        profiles[openDebugName] = concatObjects(profiles[openName],
+                                                common.debug_profile_base);
+    });
+
+    // Profiles for building the zero jvm variant. These are used for verification
+    // in JPRT.
+    var zeroProfiles = {
+        "linux-x64-zero": {
+            target_os: "linux",
+            target_cpu: "x64",
+            dependencies: ["devkit"],
+            configure_args: concat(common.configure_args_64bit, [
+                "--with-zlib=system",
+                "--with-jvm-variants=zero",
+                "--enable-libffi-bundling"
+            ])
         },
 
-        "linux-x86-open": {
-            target_os: mainProfiles["linux-x86"].target_os,
-            target_cpu: mainProfiles["linux-x86"].target_cpu,
-            dependencies: mainProfiles["linux-x86"].dependencies,
-            configure_args: concat(mainProfiles["linux-x86"].configure_args,
-                "--enable-openjdk-only"),
-            make_args: mainProfiles["linux-x86"].make_args,
-            labels: [ "open" ]
+        "linux-x86-zero": {
+            target_os: "linux",
+            target_cpu: "x86",
+            build_cpu: "x64",
+            dependencies: ["devkit"],
+            configure_args:  concat(common.configure_args_32bit, [
+                "--with-zlib=system",
+                "--with-jvm-variants=zero",
+                "--enable-libffi-bundling"
+            ])
+        }
+    }
+    profiles = concatObjects(profiles, zeroProfiles);
+
+    // Add the base settings to the zero profiles and generate debug profiles
+    Object.keys(zeroProfiles).forEach(function (name) {
+        var debugName = name + common.debug_suffix;
+        profiles[name] = concatObjects(common.main_profile_base, profiles[name]);
+        profiles[debugName] = concatObjects(profiles[name], common.debug_profile_base);
+    });
+
+    // Profiles used to run tests. Used in JPRT and Mach 5.
+    var testOnlyProfiles = {
+        "run-test-jprt": {
+            target_os: input.build_os,
+            target_cpu: input.build_cpu,
+            dependencies: [ "jtreg", "gnumake", "boot_jdk" ],
+            labels: "test",
+            environment: {
+                "JT_JAVA": common.boot_jdk_home
+            }
         },
 
-        "solaris-x64-open": {
-            target_os: mainProfiles["solaris-x64"].target_os,
-            target_cpu: mainProfiles["solaris-x64"].target_cpu,
-            dependencies: mainProfiles["solaris-x64"].dependencies,
-            configure_args: concat(mainProfiles["solaris-x64"].configure_args,
-                "--enable-openjdk-only"),
-            make_args: mainProfiles["solaris-x64"].make_args,
-            labels: [ "open" ]
-        },
-
-        "windows-x86-open": {
-            target_os: mainProfiles["windows-x86"].target_os,
-            target_cpu: mainProfiles["windows-x86"].target_cpu,
-            dependencies: mainProfiles["windows-x86"].dependencies,
-            configure_args: concat(mainProfiles["windows-x86"].configure_args,
-                "--enable-openjdk-only"),
-            make_args: mainProfiles["windows-x86"].make_args,
-            labels: [ "open" ]
-        }
-    };
-    profiles = concatObjects(profiles, jprtOpenProfiles);
-    // Generate debug profiles for the open jprt profiles
-    profiles = concatObjects(profiles, generateDebugProfiles(common, jprtOpenProfiles));
-
-    // Profiles used to run tests. Used in JPRT.
-    var testOnlyProfiles = {
-
         "run-test": {
             target_os: input.build_os,
             target_cpu: input.build_cpu,
-            dependencies: [ "jtreg", "gnumake" ],
-            labels: "test"
+            dependencies: [ "jtreg", "gnumake", "boot_jdk" ],
+            labels: "test",
+            environment: {
+                "JT_JAVA": common.boot_jdk_home
+            }
         }
     };
     profiles = concatObjects(profiles, testOnlyProfiles);
 
+    // Profiles used to run tests using Jib for internal dependencies.
+    var testedProfile = input.testedProfile;
+    if (testedProfile == null) {
+        testedProfile = input.build_os + "-" + input.build_cpu;
+    }
+    var testOnlyProfilesPrebuilt = {
+        "run-test-prebuilt": {
+            src: "src.conf",
+            dependencies: [ "jtreg", "gnumake", testedProfile + ".jdk",
+                testedProfile + ".test", "src.full"
+            ],
+            work_dir: input.get("src.full", "install_path") + "/test",
+            environment: {
+                "PRODUCT_HOME": input.get(testedProfile + ".jdk", "home_path"),
+                "TEST_IMAGE_DIR": input.get(testedProfile + ".test", "home_path"),
+                "TEST_OUTPUT_DIR": input.src_top_dir
+            },
+            labels: "test"
+        }
+    };
+    // If actually running the run-test-prebuilt profile, verify that the input
+    // variable is valid and if so, add the appropriate target_* values from
+    // the tested profile.
+    if (input.profile == "run-test-prebuilt") {
+        if (profiles[testedProfile] == null) {
+            error("testedProfile is not defined: " + testedProfile);
+        } else {
+            testOnlyProfilesPrebuilt["run-test-prebuilt"]["target_os"]
+                = profiles[testedProfile]["target_os"];
+            testOnlyProfilesPrebuilt["run-test-prebuilt"]["target_cpu"]
+                = profiles[testedProfile]["target_cpu"];
+        }
+    }
+    profiles = concatObjects(profiles, testOnlyProfilesPrebuilt);
+
+    //
+    // Define artifacts for profiles
+    //
+    // Macosx bundles are named osx and Windows demo bundles use zip instead of
+    // tar.gz.
+    var artifactData = {
+        "linux-x64": {
+            platform: "linux-x64",
+            demo_ext: "tar.gz"
+        },
+        "linux-x86": {
+            platform: "linux-x86",
+            demo_ext: "tar.gz"
+        },
+        "macosx-x64": {
+            platform: "osx-x64",
+            demo_ext: "tar.gz"
+        },
+        "solaris-x64": {
+            platform: "solaris-x64",
+            demo_ext: "tar.gz"
+        },
+        "solaris-sparcv9": {
+            platform: "solaris-sparcv9",
+            demo_ext: "tar.gz"
+        },
+        "windows-x64": {
+            platform: "windows-x64",
+            demo_ext: "zip"
+        },
+        "windows-x86": {
+            platform: "windows-x86",
+            demo_ext: "zip"
+        }
+    }
+    // Generate common artifacts for all main profiles
+    common.main_profile_names.forEach(function (name) {
+        profiles[name] = concatObjects(profiles[name],
+            common.main_profile_artifacts(artifactData[name].platform, artifactData[name].demo_ext));
+    });
+
+    // Generate common artifacts for all debug profiles
+    common.main_profile_names.forEach(function (name) {
+        var debugName = name + common.debug_suffix;
+        profiles[debugName] = concatObjects(profiles[debugName],
+            common.debug_profile_artifacts(artifactData[name].platform));
+    });
+
+    // Extra profile specific artifacts
+    profilesArtifacts = {
+        "linux-x64": {
+            artifacts: {
+                doc_api_spec: {
+                    local: "bundles/\\(jdk.*doc-api-spec.tar.gz\\)",
+                    remote: [
+                        "bundles/common/jdk-" + data.version + "_doc-api-spec.tar.gz",
+                        "bundles/linux-x64/\\1"
+                    ],
+                },
+            }
+        },
+
+        "linux-x64-open": {
+            artifacts: {
+                jdk: {
+                    local: "bundles/\\(jdk.*bin.tar.gz\\)",
+                    remote: "bundles/openjdk/GPL/linux-x64/\\1",
+                },
+                jre: {
+                    local: "bundles/\\(jre.*bin.tar.gz\\)",
+                    remote: "bundles/openjdk/GPL/linux-x64/\\1",
+                },
+                test: {
+                    local: "bundles/\\(jdk.*bin-tests.tar.gz\\)",
+                    remote: "bundles/openjdk/GPL/linux-x64/\\1",
+                },
+                jdk_symbols: {
+                    local: "bundles/\\(jdk.*bin-symbols.tar.gz\\)",
+                    remote: "bundles/openjdk/GPL/linux-x64/\\1",
+                },
+                jre_symbols: {
+                    local: "bundles/\\(jre.*bin-symbols.tar.gz\\)",
+                    remote: "bundles/openjdk/GPL/linux-x64/\\1",
+                },
+                demo: {
+                    local: "bundles/\\(jdk.*demo.tar.gz\\)",
+                    remote: "bundles/openjdk/GPL/linux-x64/\\1",
+                },
+                doc_api_spec: {
+                    local: "bundles/\\(jdk.*doc-api-spec.tar.gz\\)",
+                    remote: "bundles/openjdk/GPL/linux-x64/\\1",
+                },
+            }
+        },
+
+        "linux-x86-open": {
+            artifacts: {
+                jdk: {
+                    local: "bundles/\\(jdk.*bin.tar.gz\\)",
+                    remote: "bundles/openjdk/GPL/profile/linux-x86/\\1",
+                },
+                jre: {
+                    local: "bundles/\\(jre.*[0-9]_linux-x86_bin.tar.gz\\)",
+                    remote: "bundles/openjdk/GPL/profile/linux-x86/\\1",
+                },/* The build does not create these
+                jre_compact1: {
+                    local: "bundles/\\(jre.*-compact1_linux-x86_bin.tar.gz\\)",
+                    remote: "bundles/openjdk/GPL/profile/linux-x86/\\1",
+                },
+                jre_compact2: {
+                    local: "bundles/\\(jre.*-compact2_linux-x86_bin.tar.gz\\)",
+                    remote: "bundles/openjdk/GPL/profile/linux-x86/\\1",
+                },
+                jre_compact3: {
+                    local: "bundles/\\(jre.*-compact3_linux-x86_bin.tar.gz\\)",
+                    remote: "bundles/openjdk/GPL/profile/linux-x86/\\1",
+                },*/
+            }
+        },
+
+        "windows-x86-open": {
+            artifacts: {
+                jdk: {
+                    local: "bundles/\\(jdk.*bin.tar.gz\\)",
+                    remote: "bundles/openjdk/GPL/windows-x86/\\1",
+                },
+                jre: {
+                    local: "bundles/\\(jre.*bin.tar.gz\\)",
+                    remote: "bundles/openjdk/GPL/windows-x86/\\1"
+                },
+                test: {
+                    local: "bundles/\\(jdk.*bin-tests.tar.gz\\)",
+                    remote: "bundles/openjdk/GPL/windows-x86/\\1",
+                },
+                jdk_symbols: {
+                    local: "bundles/\\(jdk.*bin-symbols.tar.gz\\)",
+                    remote: "bundles/openjdk/GPL/windows-x86/\\1"
+                },
+                jre_symbols: {
+                    local: "bundles/\\(jre.*bin-symbols.tar.gz\\)",
+                    remote: "bundles/openjdk/GPL/windows-x86/\\1",
+                },
+                demo: {
+                    local: "bundles/\\(jdk.*demo.zip\\)",
+                    remote: "bundles/openjdk/GPL/windows-x86/\\1",
+                }
+            }
+        },
+
+        "linux-x86-open-debug": {
+            artifacts: {
+                jdk: {
+                    local: "bundles/\\(jdk.*bin-debug.tar.gz\\)",
+                    remote: "bundles/openjdk/GPL/profile/linux-x86/\\1",
+                },
+                jre: {
+                    local: "bundles/\\(jre.*bin-debug.tar.gz\\)",
+                    remote: "bundles/openjdk/GPL/profile/linux-x86/\\1",
+                },
+                jdk_symbols: {
+                    local: "bundles/\\(jdk.*bin-debug-symbols.tar.gz\\)",
+                    remote: "bundles/openjdk/GPL/profile/linux-x86/\\1",
+                },
+            }
+        },
+
+    };
+    profiles = concatObjects(profiles, profilesArtifacts);
+
+
+    // Define the reference implementation profiles. These are basically the same
+    // as the open profiles, but upload artifacts to a different location and
+    // are only defined for specific platforms.
+    profiles["linux-x64-ri"] = clone(profiles["linux-x64-open"]);
+    profiles["linux-x86-ri"] = clone(profiles["linux-x86-open"]);
+    profiles["linux-x86-ri-debug"] = clone(profiles["linux-x86-open-debug"]);
+    profiles["windows-x86-ri"] = clone(profiles["windows-x86-open"]);
+
+    // Generate artifacts for ri profiles
+    [ "linux-x64-ri", "linux-x86-ri", "linux-x86-ri-debug", "windows-x86-ri" ]
+        .forEach(function (name) {
+            // Rewrite all remote dirs to "bundles/openjdk/BCL/..."
+            for (artifactName in profiles[name].artifacts) {
+                var artifact = profiles[name].artifacts[artifactName];
+                artifact.remote = replaceAll("\/GPL\/", "/BCL/",
+                    (artifact.remote != null ? artifact.remote : artifact.local));
+            }
+        });
+
     // Generate the missing platform attributes
     profiles = generatePlatformAttributes(profiles);
+    profiles = generateDefaultMakeTargetsConfigureArg(common, profiles);
     return profiles;
 };
 
@@ -375,7 +817,7 @@
         + (input.build_cpu == "x86" ? "i586" : input.build_cpu);
 
     var devkit_platform_revisions = {
-        linux_x64: "gcc4.9.2-OEL6.4+1.0",
+        linux_x64: "gcc4.9.2-OEL6.4+1.1",
         macosx_x64: "Xcode6.3-MacOSX10.9+1.0",
         solaris_x64: "SS12u4-Solaris11u1+1.0",
         solaris_sparcv9: "SS12u4-Solaris11u1+1.0",
@@ -391,12 +833,12 @@
         boot_jdk: {
             server: "javare",
             module: "jdk",
-            revision: "8",
+            revision: common.boot_jdk_revision,
             checksum_file: boot_jdk_platform + "/MD5_VALUES",
-            file: boot_jdk_platform + "/jdk-8-" + boot_jdk_platform + ".tar.gz",
-            configure_args: (input.build_os == "macosx"
-                ? "--with-boot-jdk=" + input.get("boot_jdk", "install_path") + "/jdk1.8.0.jdk/Contents/Home"
-                : "--with-boot-jdk=" + input.get("boot_jdk", "install_path") + "/jdk1.8.0")
+            file: boot_jdk_platform + "/jdk-" + common.boot_jdk_revision
+                + "-" + boot_jdk_platform + ".tar.gz",
+            configure_args: "--with-boot-jdk=" + common.boot_jdk_home,
+            environment_path: common.boot_jdk_home
         },
 
         devkit: {
@@ -421,11 +863,12 @@
 
         jtreg: {
             server: "javare",
-            revision: "4.1",
-            build_number: "b12",
+            revision: "4.2",
+            build_number: "b04",
             checksum_file: "MD5_VALUES",
-            file: "jtreg_bin-4.1.zip",
-            environment_name: "JT_HOME"
+            file: "jtreg_bin-4.2.zip",
+            environment_name: "JT_HOME",
+            environment_path: input.get("jtreg", "install_path") + "/jtreg/bin"
         },
 
         gnumake: {
@@ -479,27 +922,49 @@
 };
 
 /**
- * Generates debug versions of profiles. Clones the given profiles and adds
- * debug metadata.
+ * The default_make_targets attribute on a profile is not a real Jib attribute.
+ * This function rewrites that attribute into the corresponding configure arg.
+ * Calling this function multiple times on the same profiles object is safe.
  *
  * @param common Common values
- * @param profiles Profiles map to generate debug profiles for
- * @returns {{}} New map of profiles containing debug profiles
+ * @param profiles Profiles map to rewrite profiles for
+ * @returns {{}} New map of profiles with the make targets converted
  */
-var generateDebugProfiles = function (common, profiles) {
-    var newProfiles = {};
-    for (var profile in profiles) {
-        var debugProfile = profile + "-debug";
-        newProfiles[debugProfile] = clone(profiles[profile]);
-        newProfiles[debugProfile].debug_level = "fastdebug";
-        newProfiles[debugProfile].labels
-            = concat(newProfiles[debugProfile].labels || [], "debug"),
-            newProfiles[debugProfile].configure_args
-                = concat(newProfiles[debugProfile].configure_args,
-                common.configure_args_debug);
+var generateDefaultMakeTargetsConfigureArg = function (common, profiles) {
+    var ret = concatObjects(profiles, {});
+    for (var profile in ret) {
+        if (ret[profile]["default_make_targets"] != null) {
+            var targetsString = concat(ret[profile].default_make_targets).join(" ");
+            // Iterate over all configure args and see if --with-default-make-target
+            // is already there and change it, otherwise add it.
+            var found = false;
+            for (var i in ret[profile].configure_args) {
+                var arg = ret[profile].configure_args[i];
+                if (arg != null && arg.startsWith("--with-default-make-target=")) {
+                    found = true;
+                    ret[profile].configure_args[i]
+                        = "--with-default-make-target=" + targetsString;
+                }
+            }
+            if (!found) {
+                ret[profile].configure_args = concat(
+                    ret[profile].configure_args,
+                    "--with-default-make-target=" + targetsString);
+            }
+        }
     }
-    return newProfiles;
-};
+    return ret;
+}
+
+var getBuildId = function (input) {
+    if (input.build_id != null) {
+        return input.build_id;
+    } else {
+        var topdir = new java.io.File(__DIR__, "../..").getCanonicalFile().getName();
+        var userName = java.lang.System.getProperty("user.name");
+        return userName + "." + topdir;
+    }
+}
 
 /**
  * Deep clones an object tree.
@@ -521,25 +986,25 @@
 };
 
 /**
- * Copies all elements in an array into a new array but replacing all
- * occurrences of original with replacement.
+ * Takes a String or Array of Strings and does a replace operation on each
+ * of them.
  *
- * @param original Element to look for
- * @param replacement Element to replace with
- * @param a Array to copy
- * @returns {Array} New array with all occurrences of original replaced
- *                  with replacement
+ * @param pattern Pattern to look for
+ * @param replacement Replacement text to insert
+ * @param a String or Array of Strings to replace
+ * @returns {Array} Either a new array or a new string depending on the input
  */
-var replace = function (original, replacement, a) {
+var replaceAll = function (pattern, replacement, a) {
+    // If a is an array
+    if (Array === a.constructor) {
     var newA = [];
     for (var i in a) {
-        if (original == a[i]) {
-            newA.push(replacement);
+            newA.push(a[i].replace(pattern, replacement));
+        }
+        return newA;
         } else {
-            newA.push(a[i]);
-        }
+        return a.replace(pattern, replacement);
     }
-    return newA;
 };
 
 /**
@@ -552,20 +1017,26 @@
  * @returns {{}} New object tree containing the concatenation of o1 and o2
  */
 var concatObjects = function (o1, o2) {
+    if (o1 == null) {
+        return clone(o2);
+    }
+    if (o2 == null) {
+        return clone(o1);
+    }
     var ret = {};
     for (var a in o1) {
         if (o2[a] == null) {
-            ret[a] = o1[a];
+            ret[a] = clone(o1[a]);
         }
     }
     for (var a in o2) {
         if (o1[a] == null) {
-            ret[a] = o2[a];
+            ret[a] = clone(o2[a]);
         } else {
             if (typeof o1[a] == 'string') {
-                ret[a] = [o1[a]].concat(o2[a]);
+                ret[a] = clone([o1[a]].concat(o2[a]));
             } else if (Array.isArray(o1[a])) {
-                ret[a] = o1[a].concat(o2[a]);
+                ret[a] = clone(o1[a].concat(o2[a]));
             } else if (typeof o1[a] == 'object') {
                 ret[a] = concatObjects(o1[a], o2[a]);
             }
@@ -573,3 +1044,45 @@
     }
     return ret;
 };
+
+/**
+ * Constructs the numeric version string from reading the
+ * common/autoconf/version-numbers file and removing all trailing ".0".
+ *
+ * @param major Override major version
+ * @param minor Override minor version
+ * @param security Override security version
+ * @param patch Override patch version
+ * @returns {String} The numeric version string
+ */
+var getVersion = function (major, minor, security, patch) {
+    var version_numbers = getVersionNumbers();
+    var version = (major != null ? major : version_numbers.get("DEFAULT_VERSION_MAJOR"))
+        + "." + (minor != null ? minor : version_numbers.get("DEFAULT_VERSION_MINOR"))
+        + "." + (security != null ? security :  version_numbers.get("DEFAULT_VERSION_SECURITY"))
+        + "." + (patch != null ? patch : version_numbers.get("DEFAULT_VERSION_PATCH"));
+    while (version.match(".*\.0$")) {
+        version = version.substring(0, version.length - 2);
+    }
+    return version;
+};
+
+// Properties representation of the common/autoconf/version-numbers file. Lazily
+// initiated by the function below.
+var version_numbers;
+
+/**
+ * Read the common/autoconf/version-numbers file into a Properties object.
+ *
+ * @returns {java.utilProperties}
+ */
+var getVersionNumbers = function () {
+    // Read version information from common/autoconf/version-numbers
+    if (version_numbers == null) {
+        version_numbers = new java.util.Properties();
+        var stream = new java.io.FileInputStream(__DIR__ + "/../../common/autoconf/version-numbers");
+        version_numbers.load(stream);
+        stream.close();
+    }
+    return version_numbers;
+}