make/conf/jib-profiles.js
changeset 53692 314075ea3fcb
parent 53689 b5f7bb57de2f
parent 53642 2336cd378e7f
child 53711 8041cefba76b
--- a/make/conf/jib-profiles.js	Thu Feb 07 01:49:10 2019 -0800
+++ b/make/conf/jib-profiles.js	Fri Feb 08 02:57:40 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2019, 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
@@ -76,6 +76,7 @@
  * install_path
  * download_path
  * download_dir
+ * home_path
  *
  *
  * The output data generated by this configuration file has the following
@@ -185,7 +186,9 @@
     // 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.
     // 1.2 signifies that artifact uploads should fail on missing artifacts by default.
-    data.format_version = "1.2";
+    // 1.3 input.get(<dep>, "home_path") automatically goes down into a single top
+    //     dir just like default configure_args and environment_path variables.
+    data.format_version = "1.3";
 
     // Organization, product and version are used when uploading/publishing build results
     data.organization = "";
@@ -363,7 +366,7 @@
     };
 
     common.boot_jdk_version = "11";
-    common.boot_jdk_home = input.get("boot_jdk", "home_path") + "/jdk-"
+    common.boot_jdk_home = input.get("boot_jdk", "install_path") + "/jdk-"
         + common.boot_jdk_version
         + (input.build_os == "macosx" ? ".jdk/Contents/Home" : "");
 
@@ -386,7 +389,9 @@
             target_cpu: "x64",
             dependencies: ["devkit", "graphviz", "pandoc", "graalunit_lib"],
             configure_args: concat(common.configure_args_64bit,
-                "--enable-full-docs", "--with-zlib=system"),
+                "--enable-full-docs", "--with-zlib=system",
+                (isWsl(input) ? [ "--host=x86_64-unknown-linux-gnu",
+                    "--build=x86_64-unknown-linux-gnu" ] : [])),
             default_make_targets: ["docs-bundles"],
         },
 
@@ -484,7 +489,7 @@
     var testmakeBase = {
         dependencies: [ "ant" ],
         environment: {
-            "ANT_HOME": input.get("ant", "install_path") + "/apache-ant-1.7.1"
+            "ANT_HOME": input.get("ant", "home_path")
         }
     };
     [ "linux-x64", "macosx-x64", "solaris-sparcv9", "solaris-x64", "windows-x64"]
@@ -572,6 +577,20 @@
             profiles[bootcyclePrebuiltName].default_make_targets = [ "product-images" ];
         });
 
+    // JCov profiles build JCov-instrumented JDK image based on images provided through dependencies.
+    [ "linux-x64", "macosx-x64", "solaris-sparcv9", "windows-x64"]
+        .forEach(function (name) {
+            var jcovName = name + "-jcov";
+            profiles[jcovName] = clone(common.main_profile_base);
+            profiles[jcovName].target_os = profiles[name].target_os
+            profiles[jcovName].target_cpu = profiles[name].target_cpu
+            profiles[jcovName].default_make_targets = [ "jcov-bundles" ];
+            profiles[jcovName].dependencies = concat(profiles[jcovName].dependencies,
+                [ name + ".jdk", "devkit" ]);
+            profiles[jcovName].configure_args = concat(profiles[jcovName].configure_args,
+                ["--with-jcov-input-jdk=" + input.get(name + ".jdk", "home_path")]);
+        });
+
     //
     // Define artifacts for profiles
     //
@@ -705,6 +724,26 @@
         });
     });
 
+    // Artifacts of JCov profiles
+    [ "linux-x64", "macosx-x64", "solaris-sparcv9", "windows-x64"]
+        .forEach(function (name) {
+            var o = artifactData[name]
+            var jdk_subdir = (o.jdk_subdir != null ? o.jdk_subdir : "jdk-" + data.version);
+            var jdk_suffix = (o.jdk_suffix != null ? o.jdk_suffix : "tar.gz");
+            var pf = o.platform
+            var jcovName = name + "-jcov";
+            profiles[jcovName].artifacts = {
+                jdk: {
+                    local: "bundles/\\(jdk-jcov.*bin." + jdk_suffix + "\\)",
+                    remote: [
+                        "bundles/" + pf + "/jdk-jcov-" + data.version + "_" + pf + "_bin." + jdk_suffix
+                    ],
+                    subdir: jdk_subdir,
+                    exploded: "images/jdk-jcov"
+                }
+            };
+        });
+
     // Profiles used to run tests.
     var testOnlyProfiles = {
         "run-test": {
@@ -724,20 +763,27 @@
     if (testedProfile == null) {
         testedProfile = input.build_os + "-" + input.build_cpu;
     }
+    var testedProfileJDK = testedProfile + ".jdk";
+    var testedProfileTest = ""
+    if (testedProfile.endsWith("-jcov")) {
+        testedProfileTest = testedProfile.substring(0, testedProfile.length - "-jcov".length) + ".test";
+    } else {
+        testedProfileTest = testedProfile + ".test";
+    }
     var testOnlyProfilesPrebuilt = {
         "run-test-prebuilt": {
             target_os: input.build_os,
             target_cpu: input.build_cpu,
             dependencies: [
-                "jtreg", "gnumake", "boot_jdk", "devkit", "jib", testedProfile + ".jdk",
-                testedProfile + ".test"
+                "jtreg", "gnumake", "boot_jdk", "devkit", "jib", "jcov", testedProfileJDK,
+                testedProfileTest
             ],
             src: "src.conf",
             make_args: [ "run-test-prebuilt", "LOG_CMDLINES=true", "JTREG_VERBOSE=fail,error,time" ],
             environment: {
                 "BOOT_JDK": common.boot_jdk_home,
-                "JDK_IMAGE_DIR": input.get(testedProfile + ".jdk", "home_path"),
-                "TEST_IMAGE_DIR": input.get(testedProfile + ".test", "home_path")
+                "JDK_IMAGE_DIR": input.get(testedProfileJDK, "home_path"),
+                "TEST_IMAGE_DIR": input.get(testedProfileTest, "home_path")
             },
             labels: "test"
         }
@@ -818,13 +864,13 @@
 var getJibProfilesDependencies = function (input, common) {
 
     var devkit_platform_revisions = {
-        linux_x64: "gcc7.3.0-OEL6.4+1.1",
+        linux_x64: "gcc7.3.0-OEL6.4+1.2",
         macosx_x64: "Xcode9.4-MacOSX10.13+1.0",
         solaris_x64: "SS12u4-Solaris11u1+1.0",
         solaris_sparcv9: "SS12u6-Solaris11u3+1.0",
         windows_x64: "VS2017-15.5.5+1.0",
-        linux_aarch64: "gcc7.3.0-Fedora27+1.1",
-        linux_arm: "gcc7.3.0-Fedora27+1.1"
+        linux_aarch64: "gcc7.3.0-Fedora27+1.2",
+        linux_arm: "gcc7.3.0-Fedora27+1.2"
     };
 
     var devkit_platform = (input.target_cpu == "x86"
@@ -833,6 +879,13 @@
 
     var boot_jdk_platform = (input.build_os == "macosx" ? "osx" : input.build_os)
         + "-" + input.build_cpu;
+    var boot_jdk_ext = (input.build_os == "windows" ? ".zip" : ".tar.gz")
+    // If running in WSL and building for Windows, it will look like Linux,
+    // but we need a Windows boot JDK.
+    if (isWsl(input) && input.target_os == "windows") {
+        boot_jdk_platform = "windows-" + input.build_cpu;
+        boot_jdk_ext = ".zip";
+    }
 
     var makeBinDir = (input.build_os == "windows"
         ? input.get("gnumake", "install_path") + "/cygwin/bin"
@@ -846,8 +899,7 @@
             version: common.boot_jdk_version,
             build_number: "28",
             file: "bundles/" + boot_jdk_platform + "/jdk-" + common.boot_jdk_version + "_"
-                + boot_jdk_platform + "_bin"
-		+ (input.build_os == "windows" ? ".zip" : ".tar.gz"),
+                + boot_jdk_platform + "_bin" + boot_jdk_ext,
             configure_args: "--with-boot-jdk=" + common.boot_jdk_home,
             environment_path: common.boot_jdk_home + "/bin"
         },
@@ -897,6 +949,7 @@
             version: "3.0",
             build_number: "b07",
             file: "bundles/jcov-3_0.zip",
+            environment_name: "JCOV_HOME",
         },
 
         gnumake: {
@@ -941,7 +994,7 @@
             organization: common.organization,
             ext: "tar.gz",
             revision: "2.3.1+1.0",
-            module: "pandoc-" + input.target_platform,
+            module: "pandoc-" + input.build_platform,
             configure_args: "PANDOC=" + input.get("pandoc", "install_path") + "/pandoc/pandoc",
             environment_path: input.get("pandoc", "install_path") + "/pandoc"
         },
@@ -953,8 +1006,7 @@
             classifier: "distribution",
             revision: "3.0-SNAPSHOT",
             environment_name: "JIB_HOME",
-            environment_value: input.get("jib", "install_path")
-                + "/jib-3.0-SNAPSHOT-distribution"
+            environment_value: input.get("jib", "home_path")
         },
 
         ant: {
@@ -1154,7 +1206,7 @@
         args = concat(args,
                       // This needs to be changed when we start building release candidates
                       // with-version-pre must be set to ea for 'ea' and empty for fcs build
-                      "--with-version-pre=",
+                      "--with-version-pre=ea",
                       "--without-version-opt");
     } else {
         args = concat(args, "--with-version-opt=" + common.build_id);
@@ -1181,3 +1233,13 @@
     }
     return version_numbers;
 }
+
+/**
+ * Returns true if running in Windows Subsystem for Linux. Jib does not yet
+ * detect wsl as osenv, so fall back on linux with version containing Microsoft.
+ */
+var isWsl = function (input) {
+    return ( input.build_osenv == "wsl"
+             || (input.build_os == "linux"
+                 && java.lang.System.getProperty("os.version").contains("Microsoft")));
+}