< prev index next >

make/conf/jib-profiles.js

Print this page


   1 /*
   2  * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


  59  * input.target_os
  60  * input.target_cpu
  61  * input.build_os
  62  * input.build_cpu
  63  * input.target_platform
  64  * input.build_platform
  65  * // The build_osenv_* variables describe the unix layer on Windows systems,
  66  * // i.e. Cygwin, which may also be 32 or 64 bit.
  67  * input.build_osenv
  68  * input.build_osenv_cpu
  69  * input.build_osenv_platform
  70  *
  71  * For more complex nested attributes, there is a method "get":
  72  *
  73  * input.get("<dependency>", "<attribute>")
  74  *
  75  * Valid attributes are:
  76  * install_path
  77  * download_path
  78  * download_dir
  79  * home_path
  80  *
  81  *
  82  * The output data generated by this configuration file has the following
  83  * format:
  84  *
  85  * data: {
  86  *   // Identifies the version of this format to the tool reading it
  87  *   format_version: "1.0",
  88  *
  89  *   // Name of base outputdir. JIB assumes the actual output dir is formed
  90  *   // by adding the configuration name: <output_basedir>/<config-name>
  91  *   output_basedir: "build",
  92  *   // Configure argument to use to specify configuration name
  93  *   configuration_configure_arg:
  94  *   // Make argument to use to specify configuration name
  95  *   configuration_make_arg:
  96  *
  97  *   profiles: {
  98  *     <profile-name>: {
  99  *       // Name of os the profile is built to run on


 169  *       checksum_path: <string>
 170  *       path: <string>
 171  *     }
 172  *   }
 173  * }
 174  */
 175 
 176 /**
 177  * Main entry to generate the profile configuration
 178  *
 179  * @param input External data to use for generating the configuration
 180  * @returns {{}} Profile configuration
 181  */
 182 var getJibProfiles = function (input) {
 183 
 184     var data = {};
 185 
 186     // Identifies the version of this format to the tool reading it.
 187     // 1.1 signifies that the publish, publish-src and get-src features are usable.
 188     // 1.2 signifies that artifact uploads should fail on missing artifacts by default.
 189     // 1.3 input.get(<dep>, "home_path") automatically goes down into a single top
 190     //     dir just like default configure_args and environment_path variables.
 191     data.format_version = "1.3";
 192 
 193     // Organization, product and version are used when uploading/publishing build results
 194     data.organization = "";
 195     data.product = "jdk";
 196     data.version = getVersion();
 197 
 198     // The base directory for the build output. JIB will assume that the
 199     // actual build directory will be <output_basedir>/<configuration>
 200     data.output_basedir = "build";
 201     // The configure argument to use to specify the name of the configuration
 202     data.configuration_configure_arg = "--with-conf-name=";
 203     // The make argument to use to specify the name of the configuration
 204     data.configuration_make_arg = "CONF_NAME=";
 205 
 206     // Exclude list to use when Jib creates a source bundle
 207     data.src_bundle_excludes = [
 208         "build", "{,**/}webrev*", "{,**/}.hg", "{,**/}JTwork", "{,**/}JTreport",
 209         "{,**/}.git"
 210     ];
 211     // Include list to use when creating a minimal jib source bundle which


 224     return data;
 225 };
 226 
 227 /**
 228  * Generates some common values
 229  *
 230  * @param input External data to use for generating the configuration
 231  * @returns Common values
 232  */
 233 var getJibProfilesCommon = function (input, data) {
 234     var common = {};
 235 
 236     common.organization = "jpg.infra.builddeps";
 237     common.build_id = getBuildId(input);
 238     common.build_number = input.build_number != null ? input.build_number : "0";
 239 
 240     // List of the main profile names used for iteration
 241     common.main_profile_names = [
 242         "linux-x64", "linux-x86", "macosx-x64", "solaris-x64",
 243         "solaris-sparcv9", "windows-x64", "windows-x86",
 244         "linux-aarch64", "linux-arm32", "linux-ppc64le", "linux-s390x"
 245     ];
 246 
 247     // These are the base setttings for all the main build profiles.
 248     common.main_profile_base = {
 249         dependencies: ["boot_jdk", "gnumake", "jtreg", "jib", "autoconf", "jmh", "jcov"],
 250         default_make_targets: ["product-bundles", "test-bundles"],
 251         configure_args: concat(["--enable-jtreg-failure-handler"],
 252             "--with-exclude-translations=de,es,fr,it,ko,pt_BR,sv,ca,tr,cs,sk,ja_JP_A,ja_JP_HA,ja_JP_HI,ja_JP_I,zh_TW,zh_HK",
 253             "--disable-manpages",
 254             "--with-jvm-features=-shenandoahgc",
 255             versionArgs(input, common))
 256     };
 257     // Extra settings for debug profiles
 258     common.debug_suffix = "-debug";
 259     common.debug_profile_base = {
 260         configure_args: ["--enable-debug"],
 261         labels: "debug"
 262     };
 263     // Extra settings for slowdebug profiles
 264     common.slowdebug_suffix = "-slowdebug";
 265     common.slowdebug_profile_base = {
 266         configure_args: ["--with-debug-level=slowdebug"],
 267         labels: "slowdebug"
 268     };
 269     // Extra settings for openjdk only profiles
 270     common.open_suffix = "-open";
 271     common.open_profile_base = {
 272         configure_args: ["--enable-openjdk-only"],
 273         labels: "open"
 274     };


 348                     local: "bundles/\\(jdk.*bin-tests-debug.tar.gz\\)",
 349                     remote: [
 350                         "bundles/" + pf + "/jdk-" + data.version + "_" + pf + "_bin-tests-debug.tar.gz",
 351                         "bundles/" + pf + "/\\1"
 352                     ],
 353                     exploded: "images/test"
 354                 },
 355                 jdk_symbols: {
 356                     local: "bundles/\\(jdk.*bin-debug-symbols.tar.gz\\)",
 357                     remote: [
 358                         "bundles/" + pf + "/jdk-" + data.version + "_" + pf + "_bin-debug-symbols.tar.gz",
 359                         "bundles/" + pf + "/\\1"
 360                     ],
 361                     subdir: jdk_subdir,
 362                     exploded: "images/jdk"
 363                 },
 364             }
 365         };
 366     };
 367 
 368     common.boot_jdk_version = "12";
 369     common.boot_jdk_build_number = "33";
 370     common.boot_jdk_home = input.get("boot_jdk", "install_path") + "/jdk-"
 371         + common.boot_jdk_version
 372         + (input.build_os == "macosx" ? ".jdk/Contents/Home" : "");
 373 
 374     return common;
 375 };
 376 
 377 /**
 378  * Generates the profiles part of the configuration.
 379  *
 380  * @param input External data to use for generating the configuration
 381  * @param common The common values
 382  * @returns {{}} Profiles part of the configuration
 383  */
 384 var getJibProfilesProfiles = function (input, common, data) {
 385     // Main SE profiles
 386     var profiles = {
 387 
 388         "linux-x64": {
 389             target_os: "linux",
 390             target_cpu: "x64",
 391             dependencies: ["devkit", "graphviz", "pandoc", "graalunit_lib"],
 392             configure_args: concat(common.configure_args_64bit,
 393                 "--enable-full-docs", "--with-zlib=system",
 394                 (isWsl(input) ? [ "--host=x86_64-unknown-linux-gnu",
 395                     "--build=x86_64-unknown-linux-gnu" ] : [])),
 396             default_make_targets: ["docs-bundles"],
 397         },
 398 
 399         "linux-x86": {
 400             target_os: "linux",
 401             target_cpu: "x86",
 402             build_cpu: "x64",
 403             dependencies: ["devkit"],
 404             configure_args: concat(common.configure_args_32bit,
 405                 "--with-jvm-variants=minimal,server", "--with-zlib=system"),
 406         },
 407 
 408         "macosx-x64": {
 409             target_os: "macosx",
 410             target_cpu: "x64",
 411             dependencies: ["devkit", "pandoc", "graalunit_lib"],
 412             configure_args: concat(common.configure_args_64bit, "--with-zlib=system",
 413                 "--with-macosx-version-max=10.9.0"),
 414         },
 415 
 416         "solaris-x64": {
 417             target_os: "solaris",
 418             target_cpu: "x64",
 419             dependencies: ["devkit", "cups"],
 420             configure_args: concat(common.configure_args_64bit,
 421                 "--with-zlib=system", "--enable-dtrace"),
 422         },
 423 
 424         "solaris-sparcv9": {
 425             target_os: "solaris",
 426             target_cpu: "sparcv9",
 427             dependencies: ["devkit", "cups"],
 428             configure_args: concat(common.configure_args_64bit,
 429                 "--with-zlib=system", "--enable-dtrace"),
 430         },
 431 
 432         "windows-x64": {
 433             target_os: "windows",
 434             target_cpu: "x64",
 435             dependencies: ["devkit", "pandoc", "graalunit_lib"],
 436             configure_args: concat(common.configure_args_64bit),
 437         },
 438 
 439         "windows-x86": {
 440             target_os: "windows",
 441             target_cpu: "x86",
 442             build_cpu: "x64",
 443             dependencies: ["devkit"],
 444             configure_args: concat(common.configure_args_32bit),
 445         },
 446 
 447         "linux-aarch64": {
 448             target_os: "linux",
 449             target_cpu: "aarch64",
 450             build_cpu: "x64",
 451             dependencies: ["devkit", "build_devkit", "cups"],
 452             configure_args: [
 453                 "--openjdk-target=aarch64-linux-gnu", "--with-freetype=bundled",
 454                 "--disable-warnings-as-errors"
 455             ],
 456         },
 457 
 458         "linux-arm32": {
 459             target_os: "linux",
 460             target_cpu: "arm",
 461             build_cpu: "x64",
 462             dependencies: ["devkit", "build_devkit", "cups"],
 463             configure_args: [
 464                 "--openjdk-target=arm-linux-gnueabihf", "--with-freetype=bundled",
 465                 "--with-abi-profile=arm-vfp-hflt", "--disable-warnings-as-errors"
 466             ],
 467         },
 468 
 469         "linux-ppc64le": {
 470             target_os: "linux",
 471             target_cpu: "ppc64le",
 472             build_cpu: "x64",
 473             dependencies: ["devkit", "build_devkit", "cups"],
 474             configure_args: [
 475                 "--openjdk-target=ppc64le-linux-gnu", "--with-freetype=bundled",
 476                 "--disable-warnings-as-errors"
 477             ],
 478         },
 479 
 480         "linux-s390x": {
 481             target_os: "linux",
 482             target_cpu: "s390x",
 483             build_cpu: "x64",
 484             dependencies: ["devkit", "build_devkit", "cups"],
 485             configure_args: [
 486                 "--openjdk-target=s390x-linux-gnu", "--with-freetype=bundled",
 487                 "--disable-warnings-as-errors"
 488             ],
 489         },
 490     };
 491 
 492     // Add the base settings to all the main profiles
 493     common.main_profile_names.forEach(function (name) {
 494         profiles[name] = concatObjects(common.main_profile_base, profiles[name]);
 495     });
 496 
 497     // Generate debug versions of all the main profiles
 498     common.main_profile_names.forEach(function (name) {
 499         var debugName = name + common.debug_suffix;
 500         profiles[debugName] = concatObjects(profiles[name],
 501                                             common.debug_profile_base);
 502     });
 503     // Generate slowdebug versions of all the main profiles
 504     common.main_profile_names.forEach(function (name) {
 505         var debugName = name + common.slowdebug_suffix;
 506         profiles[debugName] = concatObjects(profiles[name],
 507                                             common.slowdebug_profile_base);
 508     });
 509     // Generate testmake profiles for the main profile of each build host
 510     // platform. This profile only runs the makefile tests.
 511     // Ant is needed to run the idea project generator test.
 512     var testmakeBase = {
 513         dependencies: [ "ant" ],
 514         environment: {
 515             "ANT_HOME": input.get("ant", "home_path")
 516         }
 517     };
 518     [ "linux-x64", "macosx-x64", "solaris-sparcv9", "solaris-x64", "windows-x64"]
 519         .forEach(function (name) {
 520             var maketestName = name + "-testmake";
 521             profiles[maketestName] = concatObjects(profiles[name], testmakeBase);
 522             profiles[maketestName].default_make_targets = [ "test-make" ];
 523         });
 524 
 525     // Generate -gcov profiles
 526     [ "linux-x64", "macosx-x64" ].forEach(function (name) {
 527         var gcovName = name + "-gcov";
 528         profiles[gcovName] = clone(profiles[name]);
 529         profiles[gcovName].default_make_targets = ["product-bundles", "test-bundles"];
 530         profiles[gcovName].configure_args = concat(profiles[gcovName].configure_args,
 531             ["--enable-native-coverage", "--disable-warnings-as-errors"]);
 532     });
 533 
 534     // Profiles for building the zero jvm variant. These are used for verification.
 535     var zeroProfiles = {
 536         "linux-x64-zero": {
 537             target_os: "linux",
 538             target_cpu: "x64",
 539             dependencies: ["devkit"],
 540             configure_args: concat(common.configure_args_64bit, [
 541                 "--with-zlib=system",
 542                 "--with-jvm-variants=zero",
 543                 "--enable-libffi-bundling"
 544             ])
 545         },
 546 
 547         "linux-x86-zero": {
 548             target_os: "linux",
 549             target_cpu: "x86",
 550             build_cpu: "x64",
 551             dependencies: ["devkit"],
 552             configure_args:  concat(common.configure_args_32bit, [
 553                 "--with-zlib=system",


 592     [ "linux-x64", "macosx-x64", "solaris-sparcv9", "windows-x64"]
 593         .forEach(function (name) {
 594             var bootcycleName = name + "-bootcycle";
 595             var bootcyclePrebuiltName = name + "-bootcycle-prebuilt";
 596             // The base bootcycle profile just changes the default target
 597             // compared to the base profile
 598             profiles[bootcycleName] = clone(profiles[name]);
 599             profiles[bootcycleName].default_make_targets = [ "bootcycle-images" ];
 600             // The prebuilt bootcycle variant modifies the boot jdk argument
 601             var bootcyclePrebuiltBase = {
 602                 dependencies: [ name + ".jdk" ],
 603                 configure_args: "--with-boot-jdk=" + input.get(name + ".jdk", "home_path"),
 604             }
 605             profiles[bootcyclePrebuiltName] = concatObjects(profiles[name],
 606                 bootcyclePrebuiltBase);
 607             var bootJdkIndex = profiles[bootcyclePrebuiltName].dependencies.indexOf("boot_jdk");
 608             delete profiles[bootcyclePrebuiltName].dependencies[bootJdkIndex];
 609             profiles[bootcyclePrebuiltName].default_make_targets = [ "product-images" ];
 610         });
 611 
 612     // JCov profiles build JCov-instrumented JDK image based on images provided through dependencies.
 613     [ "linux-x64", "macosx-x64", "solaris-sparcv9", "windows-x64"]
 614         .forEach(function (name) {
 615             var jcovName = name + "-jcov";
 616             profiles[jcovName] = clone(common.main_profile_base);
 617             profiles[jcovName].target_os = profiles[name].target_os
 618             profiles[jcovName].target_cpu = profiles[name].target_cpu
 619             profiles[jcovName].default_make_targets = [ "jcov-bundles" ];
 620             profiles[jcovName].dependencies = concat(profiles[jcovName].dependencies,
 621                 [ name + ".jdk", "devkit" ]);
 622             profiles[jcovName].configure_args = concat(profiles[jcovName].configure_args,
 623                 ["--with-jcov-input-jdk=" + input.get(name + ".jdk", "home_path")]);
 624         });
 625 
 626     //
 627     // Define artifacts for profiles
 628     //
 629     // Macosx bundles are named osx
 630     // tar.gz.
 631     var artifactData = {
 632         "linux-x64": {
 633             platform: "linux-x64",
 634         },
 635         "linux-x86": {
 636             platform: "linux-x86",
 637         },
 638         "macosx-x64": {
 639             platform: "osx-x64",
 640             jdk_subdir: "jdk-" + data.version +  ".jdk/Contents/Home",
 641         },
 642         "solaris-x64": {
 643             platform: "solaris-x64",
 644         },
 645         "solaris-sparcv9": {
 646             platform: "solaris-sparcv9",
 647         },
 648         "windows-x64": {
 649             platform: "windows-x64",
 650             jdk_suffix: "zip",
 651         },
 652         "windows-x86": {
 653             platform: "windows-x86",
 654             jdk_suffix: "zip",
 655         },
 656        "linux-aarch64": {
 657             platform: "linux-aarch64",
 658         },
 659        "linux-arm32": {
 660             platform: "linux-arm32",
 661         },
 662        "linux-ppc64le": {
 663             platform: "linux-ppc64le",
 664         },
 665        "linux-s390x": {
 666             platform: "linux-s390x",
 667         }
 668     }
 669     // Generate common artifacts for all main profiles
 670     Object.keys(artifactData).forEach(function (name) {
 671         profiles[name] = concatObjects(profiles[name],
 672             common.main_profile_artifacts(artifactData[name]));
 673     });
 674 
 675     // Generate common artifacts for all debug profiles
 676     Object.keys(artifactData).forEach(function (name) {
 677         var debugName = name + common.debug_suffix;
 678         profiles[debugName] = concatObjects(profiles[debugName],
 679             common.debug_profile_artifacts(artifactData[name]));
 680     });
 681 
 682     profilesArtifacts = {
 683         "linux-x64": {
 684             artifacts: {
 685                 doc_api_spec: {
 686                     local: "bundles/\\(jdk.*doc-api-spec.tar.gz\\)",


 729         profiles[riDebugName] = clone(profiles[openDebugName]);
 730         // Rewrite all remote dirs to "bundles/openjdk/BCL/..."
 731         for (artifactName in profiles[riName].artifacts) {
 732             var artifact = profiles[riName].artifacts[artifactName];
 733             artifact.remote = replaceAll(
 734                 "\/GPL\/", "/BCL/",
 735                 (artifact.remote != null ? artifact.remote : artifact.local));
 736         }
 737     });
 738 
 739     // For open profiles, the non-debug jdk bundles, need an "open" prefix on the
 740     // remote bundle names, forming the word "openjdk". See JDK-8188789.
 741     common.main_profile_names.forEach(function (name) {
 742         var openName = name + common.open_suffix;
 743         profiles[openName].artifacts["jdk"].remote = replaceAll(
 744             "\/jdk-", "/openjdk-",
 745             replaceAll("\/\\1", "/open\\1",
 746                        profiles[openName].artifacts["jdk"].remote));
 747     });
 748 








 749     // Generate cmp-baseline profiles for each main profile and their
 750     // corresponding debug profile. This profile does a compare build run with no
 751     // changes to verify that the compare script has a clean baseline
 752     common.main_profile_names.forEach(function (name) {
 753         [ "", common.open_suffix ].forEach(function (suffix) {
 754             var cmpBaselineName = name + suffix + "-cmp-baseline";
 755             profiles[cmpBaselineName] = clone(profiles[name + suffix]);
 756             // Only compare the images target. This should pressumably be expanded
 757             // to include more build targets when possible.
 758             profiles[cmpBaselineName].default_make_targets = [ "images", "test-image" ];
 759             if (name == "linux-x64") {
 760                 profiles[cmpBaselineName].default_make_targets
 761                     = concat(profiles[cmpBaselineName].default_make_targets, "docs");
 762             }
 763             profiles[cmpBaselineName].make_args = [ "COMPARE_BUILD=CONF=" ];
 764             // Do not inherit artifact definitions from base profile
 765             delete profiles[cmpBaselineName].artifacts;
 766         });
 767     });
 768 
 769     // Artifacts of JCov profiles
 770     [ "linux-x64", "macosx-x64", "solaris-sparcv9", "windows-x64"]
 771         .forEach(function (name) {
 772             var o = artifactData[name]
 773             var jdk_subdir = (o.jdk_subdir != null ? o.jdk_subdir : "jdk-" + data.version);
 774             var jdk_suffix = (o.jdk_suffix != null ? o.jdk_suffix : "tar.gz");
 775             var pf = o.platform
 776             var jcovName = name + "-jcov";
 777             profiles[jcovName].artifacts = {
 778                 jdk: {
 779                     local: "bundles/\\(jdk-jcov.*bin." + jdk_suffix + "\\)",
 780                     remote: [
 781                         "bundles/" + pf + "/jdk-jcov-" + data.version + "_" + pf + "_bin." + jdk_suffix
 782                     ],
 783                     subdir: jdk_subdir,
 784                     exploded: "images/jdk-jcov"
 785                 }
 786             };
 787         });
 788 
 789     // Artifacts of gcov (native-code-coverage) profiles
 790     [ "linux-x64", "macosx-x64" ].forEach(function (name) {
 791         var o = artifactData[name]
 792         var pf = o.platform
 793         var jdk_subdir = (o.jdk_subdir != null ? o.jdk_subdir : "jdk-" + data.version);
 794         var jdk_suffix = (o.jdk_suffix != null ? o.jdk_suffix : "tar.gz");
 795         var gcovName = name + "-gcov";
 796         profiles[gcovName].artifacts = {
 797             jdk: {
 798                 local: "bundles/\\(jdk.*bin." + jdk_suffix + "\\)",
 799                 remote: [
 800                     "bundles/" + pf + "/jdk-" + data.version + "_" + pf + "_bin-gcov." + jdk_suffix,
 801                 ],
 802                 subdir: jdk_subdir,
 803                 exploded: "images/jdk",
 804             },
 805             test: {
 806                     local: "bundles/\\(jdk.*bin-tests.tar.gz\\)",
 807                     remote: [
 808                         "bundles/" + pf + "/jdk-" + data.version + "_" + pf + "_bin-gcov-tests.tar.gz",
 809                     ],
 810                     exploded: "images/test"
 811             },
 812             jdk_symbols: {
 813                     local: "bundles/\\(jdk.*bin-symbols.tar.gz\\)",
 814                     remote: [
 815                         "bundles/" + pf + "/jdk-" + data.version + "_" + pf + "_bin-gcov-symbols.tar.gz",
 816                     ],
 817                     subdir: jdk_subdir,
 818                     exploded: "images/jdk"
 819                 },
 820             };
 821     });
 822 
 823     // Profiles used to run tests.
 824     var testOnlyProfiles = {
 825         "run-test": {
 826             target_os: input.build_os,
 827             target_cpu: input.build_cpu,
 828             dependencies: [ "jtreg", "gnumake", "boot_jdk", "devkit", "jib" ],
 829             labels: "test",
 830             environment: {
 831                 "JT_JAVA": common.boot_jdk_home
 832             }
 833         }
 834     };
 835     profiles = concatObjects(profiles, testOnlyProfiles);
 836 
 837     // Profiles used to run tests using Jib for internal dependencies.
 838     var testedProfile = input.testedProfile;
 839     if (testedProfile == null) {
 840         testedProfile = input.build_os + "-" + input.build_cpu;
 841     }
 842     var testedProfileJDK = testedProfile + ".jdk";
 843     var testedProfileTest = ""
 844     if (testedProfile.endsWith("-jcov")) {
 845         testedProfileTest = testedProfile.substring(0, testedProfile.length - "-jcov".length) + ".test";
 846     } else {
 847         testedProfileTest = testedProfile + ".test";
 848     }
 849     var testOnlyMake = [ "run-test-prebuilt", "LOG_CMDLINES=true", "JTREG_VERBOSE=fail,error,time" ];
 850     if (testedProfile.endsWith("-gcov")) {
 851         testOnlyMake = concat(testOnlyMake, "GCOV_ENABLED=true")
 852     }
 853     var testOnlyProfilesPrebuilt = {
 854         "run-test-prebuilt": {
 855             target_os: input.build_os,
 856             target_cpu: input.build_cpu,
 857             dependencies: [
 858                 "jtreg", "gnumake", "boot_jdk", "devkit", "jib", "jcov", testedProfileJDK,
 859                 testedProfileTest
 860             ],
 861             src: "src.conf",
 862             make_args: testOnlyMake,
 863             environment: {
 864                 "BOOT_JDK": common.boot_jdk_home,
 865                 "JDK_IMAGE_DIR": input.get(testedProfileJDK, "home_path"),
 866                 "TEST_IMAGE_DIR": input.get(testedProfileTest, "home_path")
 867             },
 868             labels: "test"
 869         }
 870     };
 871 
 872     // If actually running the run-test-prebuilt profile, verify that the input
 873     // variable is valid and if so, add the appropriate target_* values from
 874     // the tested profile.
 875     if (input.profile == "run-test-prebuilt") {
 876         if (profiles[testedProfile] == null) {
 877             error("testedProfile is not defined: " + testedProfile);
 878         }
 879     }
 880     if (profiles[testedProfile] != null) {
 881         testOnlyProfilesPrebuilt["run-test-prebuilt"]["target_os"]
 882             = profiles[testedProfile]["target_os"];
 883         testOnlyProfilesPrebuilt["run-test-prebuilt"]["target_cpu"]
 884             = profiles[testedProfile]["target_cpu"];
 885     }
 886     profiles = concatObjects(profiles, testOnlyProfilesPrebuilt);


 927         profiles["run-test-prebuilt"] = concatObjects(profiles["run-test-prebuilt"],
 928             runTestPrebuiltSrcFullExtra);
 929     }
 930 
 931     // Generate the missing platform attributes
 932     profiles = generatePlatformAttributes(profiles);
 933     profiles = generateDefaultMakeTargetsConfigureArg(common, profiles);
 934     return profiles;
 935 };
 936 
 937 /**
 938  * Generate the dependencies part of the configuration
 939  *
 940  * @param input External data to use for generating the configuration
 941  * @param common The common values
 942  * @returns {{}} Dependencies part of configuration
 943  */
 944 var getJibProfilesDependencies = function (input, common) {
 945 
 946     var devkit_platform_revisions = {
 947         linux_x64: "gcc8.2.0-OL6.4+1.0",
 948         macosx_x64: "Xcode10.1-MacOSX10.14+1.0",
 949         solaris_x64: "SS12u4-Solaris11u1+1.0",
 950         solaris_sparcv9: "SS12u6-Solaris11u3+1.0",
 951         windows_x64: "VS2017-15.9.6+1.0",
 952         linux_aarch64: "gcc8.2.0-Fedora27+1.0",
 953         linux_arm: "gcc8.2.0-Fedora27+1.0",
 954         linux_ppc64le: "gcc8.2.0-Fedora27+1.0",
 955         linux_s390x: "gcc8.2.0-Fedora27+1.0"
 956     };
 957 
 958     var devkit_platform = (input.target_cpu == "x86"
 959         ? input.target_os + "_x64"
 960         : input.target_platform);
 961 
 962     var devkit_cross_prefix = "";
 963     if (input.build_platform != input.target_platform
 964        && input.build_platform != devkit_platform) {
 965         devkit_cross_prefix = input.build_platform + "-to-";
 966     }
 967 
 968     var boot_jdk_platform = (input.build_os == "macosx" ? "osx" : input.build_os)
 969         + "-" + input.build_cpu;
 970     var boot_jdk_ext = (input.build_os == "windows" ? ".zip" : ".tar.gz")
 971     // If running in WSL and building for Windows, it will look like Linux,
 972     // but we need a Windows boot JDK.
 973     if (isWsl(input) && input.target_os == "windows") {
 974         boot_jdk_platform = "windows-" + input.build_cpu;
 975         boot_jdk_ext = ".zip";
 976     }
 977 
 978     var makeBinDir = (input.build_os == "windows"
 979         ? input.get("gnumake", "install_path") + "/cygwin/bin"
 980         : input.get("gnumake", "install_path") + "/bin");
 981 
 982     var dependencies = {
 983 
 984         boot_jdk: {
 985             server: "jpg",
 986             product: "jdk",
 987             version: common.boot_jdk_version,
 988             build_number: common.boot_jdk_build_number,
 989             file: "bundles/" + boot_jdk_platform + "/jdk-" + common.boot_jdk_version + "_"
 990                 + boot_jdk_platform + "_bin" + boot_jdk_ext,

 991             configure_args: "--with-boot-jdk=" + common.boot_jdk_home,
 992             environment_path: common.boot_jdk_home + "/bin"
 993         },
 994 
 995         devkit: {
 996             organization: common.organization,
 997             ext: "tar.gz",
 998             module: "devkit-" + devkit_cross_prefix + devkit_platform,
 999             revision: devkit_platform_revisions[devkit_platform],
1000             environment: {
1001                 "DEVKIT_HOME": input.get("devkit", "home_path"),
1002             }
1003         },
1004 
1005         build_devkit: {
1006             organization: common.organization,
1007             ext: "tar.gz",
1008             module: "devkit-" + input.build_platform,
1009             revision: devkit_platform_revisions[input.build_platform]
1010         },
1011 
1012         cups: {
1013             organization: common.organization,
1014             ext: "tar.gz",
1015             revision: "1.0118+1.0"
1016         },
1017 
1018         jtreg: {
1019             server: "javare",
1020             revision: "4.2",
1021             build_number: "b14",
1022             checksum_file: "MD5_VALUES",
1023             file: "jtreg_bin-4.2.zip",
1024             environment_name: "JT_HOME",
1025             environment_path: input.get("jtreg", "install_path") + "/jtreg/bin"
1026         },
1027 
1028         jmh: {
1029             organization: common.organization,
1030             ext: "tar.gz",
1031             revision: "1.21+1.0"
1032         },
1033 
1034         jcov: {
1035             // Until an official build of JCov is available, use custom
1036             // build to support classfile version 57.
1037             // See CODETOOLS-7902358 for more info.
1038             // server: "jpg",
1039             // product: "jcov",
1040             // version: "3.0",
1041             // build_number: "b07",
1042             // file: "bundles/jcov-3_0.zip",
1043             organization: common.organization,
1044             revision: "3.0-58-support+1.0",
1045             ext: "zip",
1046             environment_name: "JCOV_HOME",
1047         },
1048 
1049         gnumake: {
1050             organization: common.organization,
1051             ext: "tar.gz",
1052             revision: "4.0+1.0",
1053 
1054             module: (input.build_os == "windows"
1055                 ? "gnumake-" + input.build_osenv_platform
1056                 : "gnumake-" + input.build_platform),
1057 
1058             configure_args: "MAKE=" + makeBinDir + "/make",
1059 
1060             environment: {
1061                 "MAKE": makeBinDir + "/make"
1062             },
1063 
1064             environment_path: makeBinDir
1065         },
1066 
1067         autoconf: {
1068             organization: common.organization,


1071             module: (input.build_os == "windows"
1072                 ? "autoconf-" + input.build_osenv_platform
1073                 : "autoconf-" + input.build_platform),
1074             configure_args: "",
1075             environment_path: input.get("autoconf", "install_path")
1076         },
1077 
1078         graphviz: {
1079             organization: common.organization,
1080             ext: "tar.gz",
1081             revision: "2.38.0-1+1.1",
1082             module: "graphviz-" + input.target_platform,
1083             configure_args: "DOT=" + input.get("graphviz", "install_path") + "/dot",
1084             environment_path: input.get("graphviz", "install_path")
1085         },
1086 
1087         pandoc: {
1088             organization: common.organization,
1089             ext: "tar.gz",
1090             revision: "2.3.1+1.0",
1091             module: "pandoc-" + input.build_platform,
1092             configure_args: "PANDOC=" + input.get("pandoc", "install_path") + "/pandoc/pandoc",
1093             environment_path: input.get("pandoc", "install_path") + "/pandoc"
1094         },
1095 
1096         // This adds java jib as a dependency for the test artifacts resolver
1097         jib: {
1098             organization: "com.oracle.java.jib",
1099             ext: "zip",
1100             classifier: "distribution",
1101             revision: "3.0-SNAPSHOT",
1102             environment_name: "JIB_HOME",
1103             environment_value: input.get("jib", "home_path")

1104         },
1105 
1106         ant: {
1107             organization: common.organization,
1108             ext: "zip",
1109             revision: "1.7.1+1.0",
1110             configure_args: "",
1111         },
1112 
1113         graalunit_lib: {
1114             organization: common.organization,
1115             ext: "zip",
1116             revision: "619_Apr_12_2018",
1117             module: "graalunit-lib",
1118             configure_args: "--with-graalunit-lib=" + input.get("graalunit_lib", "install_path"),
1119             environment_name: "GRAALUNIT_LIB"
1120         },
1121     };
1122 
1123     return dependencies;


1266         }
1267     }
1268     return ret;
1269 };
1270 
1271 /**
1272  * Constructs the numeric version string from reading the
1273  * make/autoconf/version-numbers file and removing all trailing ".0".
1274  *
1275  * @param feature Override feature version
1276  * @param interim Override interim version
1277  * @param update Override update version
1278  * @param patch Override patch version
1279  * @returns {String} The numeric version string
1280  */
1281 var getVersion = function (feature, interim, update, patch) {
1282     var version_numbers = getVersionNumbers();
1283     var version = (feature != null ? feature : version_numbers.get("DEFAULT_VERSION_FEATURE"))
1284         + "." + (interim != null ? interim : version_numbers.get("DEFAULT_VERSION_INTERIM"))
1285         + "." + (update != null ? update :  version_numbers.get("DEFAULT_VERSION_UPDATE"))
1286         + "." + (patch != null ? patch : version_numbers.get("DEFAULT_VERSION_PATCH"))
1287         + "." + version_numbers.get("DEFAULT_VERSION_EXTRA1")
1288         + "." + version_numbers.get("DEFAULT_VERSION_EXTRA2")
1289         + "." + version_numbers.get("DEFAULT_VERSION_EXTRA3");
1290     while (version.match(".*\\.0$")) {
1291         version = version.substring(0, version.length - 2);
1292     }
1293     return version;
1294 };
1295 
1296 /**
1297  * Constructs the common version configure args based on build type and
1298  * other version inputs
1299  */
1300 var versionArgs = function(input, common) {
1301     var args = ["--with-version-build=" + common.build_number];
1302     if (input.build_type == "promoted") {
1303         args = concat(args,
1304                       "--with-version-pre=" + version_numbers.get("DEFAULT_PROMOTED_VERSION_PRE"),


1305                       "--without-version-opt");
1306     } else if (input.build_type == "ci") {
1307         var optString = input.build_id_data.ciBuildNumber;
1308         var preString = input.build_id_data.projectName;
1309         if (preString == "jdk") {
1310             preString = version_numbers.get("DEFAULT_PROMOTED_VERSION_PRE");
1311         }
1312         args = concat(args, "--with-version-pre=" + preString,
1313                      "--with-version-opt=" + optString);
1314     } else {
1315         args = concat(args, "--with-version-opt=" + common.build_id);
1316     }
1317     return args;
1318 }
1319 
1320 // Properties representation of the make/autoconf/version-numbers file. Lazily
1321 // initiated by the function below.
1322 var version_numbers;
1323 
1324 /**
1325  * Read the make/autoconf/version-numbers file into a Properties object.
1326  *
1327  * @returns {java.utilProperties}
1328  */
1329 var getVersionNumbers = function () {
1330     // Read version information from make/autoconf/version-numbers
1331     if (version_numbers == null) {
1332         version_numbers = new java.util.Properties();
1333         var stream = new java.io.FileInputStream(__DIR__ + "/../autoconf/version-numbers");
1334         version_numbers.load(stream);
1335         stream.close();
1336     }
1337     return version_numbers;
1338 }
1339 
1340 /**
1341  * Returns true if running in Windows Subsystem for Linux. Jib does not yet
1342  * detect wsl as osenv, so fall back on linux with version containing Microsoft.
1343  */
1344 var isWsl = function (input) {
1345     return ( input.build_osenv == "wsl"
1346              || (input.build_os == "linux"
1347                  && java.lang.System.getProperty("os.version").contains("Microsoft")));
1348 }
   1 /*
   2  * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


  59  * input.target_os
  60  * input.target_cpu
  61  * input.build_os
  62  * input.build_cpu
  63  * input.target_platform
  64  * input.build_platform
  65  * // The build_osenv_* variables describe the unix layer on Windows systems,
  66  * // i.e. Cygwin, which may also be 32 or 64 bit.
  67  * input.build_osenv
  68  * input.build_osenv_cpu
  69  * input.build_osenv_platform
  70  *
  71  * For more complex nested attributes, there is a method "get":
  72  *
  73  * input.get("<dependency>", "<attribute>")
  74  *
  75  * Valid attributes are:
  76  * install_path
  77  * download_path
  78  * download_dir

  79  *
  80  *
  81  * The output data generated by this configuration file has the following
  82  * format:
  83  *
  84  * data: {
  85  *   // Identifies the version of this format to the tool reading it
  86  *   format_version: "1.0",
  87  *
  88  *   // Name of base outputdir. JIB assumes the actual output dir is formed
  89  *   // by adding the configuration name: <output_basedir>/<config-name>
  90  *   output_basedir: "build",
  91  *   // Configure argument to use to specify configuration name
  92  *   configuration_configure_arg:
  93  *   // Make argument to use to specify configuration name
  94  *   configuration_make_arg:
  95  *
  96  *   profiles: {
  97  *     <profile-name>: {
  98  *       // Name of os the profile is built to run on


 168  *       checksum_path: <string>
 169  *       path: <string>
 170  *     }
 171  *   }
 172  * }
 173  */
 174 
 175 /**
 176  * Main entry to generate the profile configuration
 177  *
 178  * @param input External data to use for generating the configuration
 179  * @returns {{}} Profile configuration
 180  */
 181 var getJibProfiles = function (input) {
 182 
 183     var data = {};
 184 
 185     // Identifies the version of this format to the tool reading it.
 186     // 1.1 signifies that the publish, publish-src and get-src features are usable.
 187     // 1.2 signifies that artifact uploads should fail on missing artifacts by default.
 188     data.format_version = "1.2";


 189 
 190     // Organization, product and version are used when uploading/publishing build results
 191     data.organization = "";
 192     data.product = "jdk";
 193     data.version = getVersion();
 194 
 195     // The base directory for the build output. JIB will assume that the
 196     // actual build directory will be <output_basedir>/<configuration>
 197     data.output_basedir = "build";
 198     // The configure argument to use to specify the name of the configuration
 199     data.configuration_configure_arg = "--with-conf-name=";
 200     // The make argument to use to specify the name of the configuration
 201     data.configuration_make_arg = "CONF_NAME=";
 202 
 203     // Exclude list to use when Jib creates a source bundle
 204     data.src_bundle_excludes = [
 205         "build", "{,**/}webrev*", "{,**/}.hg", "{,**/}JTwork", "{,**/}JTreport",
 206         "{,**/}.git"
 207     ];
 208     // Include list to use when creating a minimal jib source bundle which


 221     return data;
 222 };
 223 
 224 /**
 225  * Generates some common values
 226  *
 227  * @param input External data to use for generating the configuration
 228  * @returns Common values
 229  */
 230 var getJibProfilesCommon = function (input, data) {
 231     var common = {};
 232 
 233     common.organization = "jpg.infra.builddeps";
 234     common.build_id = getBuildId(input);
 235     common.build_number = input.build_number != null ? input.build_number : "0";
 236 
 237     // List of the main profile names used for iteration
 238     common.main_profile_names = [
 239         "linux-x64", "linux-x86", "macosx-x64", "solaris-x64",
 240         "solaris-sparcv9", "windows-x64", "windows-x86",
 241         "linux-aarch64", "linux-arm32"
 242     ];
 243 
 244     // These are the base setttings for all the main build profiles.
 245     common.main_profile_base = {
 246         dependencies: ["boot_jdk", "gnumake", "jtreg", "jib", "autoconf", "jmh"],
 247         default_make_targets: ["product-bundles", "test-bundles"],
 248         configure_args: concat(["--enable-jtreg-failure-handler"],
 249             "--with-exclude-translations=de,es,fr,it,ko,pt_BR,sv,ca,tr,cs,sk,ja_JP_A,ja_JP_HA,ja_JP_HI,ja_JP_I,zh_TW,zh_HK",
 250             "--disable-manpages",

 251             versionArgs(input, common))
 252     };
 253     // Extra settings for debug profiles
 254     common.debug_suffix = "-debug";
 255     common.debug_profile_base = {
 256         configure_args: ["--enable-debug"],
 257         labels: "debug"
 258     };
 259     // Extra settings for slowdebug profiles
 260     common.slowdebug_suffix = "-slowdebug";
 261     common.slowdebug_profile_base = {
 262         configure_args: ["--with-debug-level=slowdebug"],
 263         labels: "slowdebug"
 264     };
 265     // Extra settings for openjdk only profiles
 266     common.open_suffix = "-open";
 267     common.open_profile_base = {
 268         configure_args: ["--enable-openjdk-only"],
 269         labels: "open"
 270     };


 344                     local: "bundles/\\(jdk.*bin-tests-debug.tar.gz\\)",
 345                     remote: [
 346                         "bundles/" + pf + "/jdk-" + data.version + "_" + pf + "_bin-tests-debug.tar.gz",
 347                         "bundles/" + pf + "/\\1"
 348                     ],
 349                     exploded: "images/test"
 350                 },
 351                 jdk_symbols: {
 352                     local: "bundles/\\(jdk.*bin-debug-symbols.tar.gz\\)",
 353                     remote: [
 354                         "bundles/" + pf + "/jdk-" + data.version + "_" + pf + "_bin-debug-symbols.tar.gz",
 355                         "bundles/" + pf + "/\\1"
 356                     ],
 357                     subdir: jdk_subdir,
 358                     exploded: "images/jdk"
 359                 },
 360             }
 361         };
 362     };
 363 
 364     common.boot_jdk_version = "11";
 365     common.boot_jdk_home = input.get("boot_jdk", "home_path") + "/jdk-"

 366         + common.boot_jdk_version
 367         + (input.build_os == "macosx" ? ".jdk/Contents/Home" : "");
 368 
 369     return common;
 370 };
 371 
 372 /**
 373  * Generates the profiles part of the configuration.
 374  *
 375  * @param input External data to use for generating the configuration
 376  * @param common The common values
 377  * @returns {{}} Profiles part of the configuration
 378  */
 379 var getJibProfilesProfiles = function (input, common, data) {
 380     // Main SE profiles
 381     var profiles = {
 382 
 383         "linux-x64": {
 384             target_os: "linux",
 385             target_cpu: "x64",
 386             dependencies: ["devkit", "graphviz", "pandoc", "graalunit_lib"],
 387             configure_args: concat(common.configure_args_64bit,
 388                 "--enable-full-docs", "--with-zlib=system"),


 389             default_make_targets: ["docs-bundles"],
 390         },
 391 
 392         "linux-x86": {
 393             target_os: "linux",
 394             target_cpu: "x86",
 395             build_cpu: "x64",
 396             dependencies: ["devkit"],
 397             configure_args: concat(common.configure_args_32bit,
 398                 "--with-jvm-variants=minimal,server", "--with-zlib=system"),
 399         },
 400 
 401         "macosx-x64": {
 402             target_os: "macosx",
 403             target_cpu: "x64",
 404             dependencies: ["devkit", "pandoc", "graalunit_lib"],
 405             configure_args: concat(common.configure_args_64bit, "--with-zlib=system",
 406                 "--with-macosx-version-max=10.9.0"),
 407         },
 408 
 409         "solaris-x64": {
 410             target_os: "solaris",
 411             target_cpu: "x64",
 412             dependencies: ["devkit", "cups"],
 413             configure_args: concat(common.configure_args_64bit,
 414                 "--with-zlib=system", "--enable-dtrace"),
 415         },
 416 
 417         "solaris-sparcv9": {
 418             target_os: "solaris",
 419             target_cpu: "sparcv9",
 420             dependencies: ["devkit", "cups"],
 421             configure_args: concat(common.configure_args_64bit,
 422                 "--with-zlib=system", "--enable-dtrace"),
 423         },
 424 
 425         "windows-x64": {
 426             target_os: "windows",
 427             target_cpu: "x64",
 428             dependencies: ["devkit", "graalunit_lib"],
 429             configure_args: concat(common.configure_args_64bit),
 430         },
 431 
 432         "windows-x86": {
 433             target_os: "windows",
 434             target_cpu: "x86",
 435             build_cpu: "x64",
 436             dependencies: ["devkit"],
 437             configure_args: concat(common.configure_args_32bit),
 438         },
 439 
 440         "linux-aarch64": {
 441             target_os: "linux",
 442             target_cpu: "aarch64",
 443             build_cpu: "x64",
 444             dependencies: ["devkit", "build_devkit", "cups"],
 445             configure_args: [
 446                 "--openjdk-target=aarch64-linux-gnu", "--with-freetype=bundled",
 447                 "--disable-warnings-as-errors"
 448             ],
 449         },
 450 
 451         "linux-arm32": {
 452             target_os: "linux",
 453             target_cpu: "arm",
 454             build_cpu: "x64",
 455             dependencies: ["devkit", "build_devkit", "cups"],
 456             configure_args: [
 457                 "--openjdk-target=arm-linux-gnueabihf", "--with-freetype=bundled",
 458                 "--with-abi-profile=arm-vfp-hflt", "--disable-warnings-as-errors"
 459             ],
 460         },






















 461     };
 462 
 463     // Add the base settings to all the main profiles
 464     common.main_profile_names.forEach(function (name) {
 465         profiles[name] = concatObjects(common.main_profile_base, profiles[name]);
 466     });
 467 
 468     // Generate debug versions of all the main profiles
 469     common.main_profile_names.forEach(function (name) {
 470         var debugName = name + common.debug_suffix;
 471         profiles[debugName] = concatObjects(profiles[name],
 472                                             common.debug_profile_base);
 473     });
 474     // Generate slowdebug versions of all the main profiles
 475     common.main_profile_names.forEach(function (name) {
 476         var debugName = name + common.slowdebug_suffix;
 477         profiles[debugName] = concatObjects(profiles[name],
 478                                             common.slowdebug_profile_base);
 479     });
 480     // Generate testmake profiles for the main profile of each build host
 481     // platform. This profile only runs the makefile tests.
 482     // Ant is needed to run the idea project generator test.
 483     var testmakeBase = {
 484         dependencies: [ "ant" ],
 485         environment: {
 486             "ANT_HOME": input.get("ant", "install_path") + "/apache-ant-1.7.1"
 487         }
 488     };
 489     [ "linux-x64", "macosx-x64", "solaris-sparcv9", "solaris-x64", "windows-x64"]
 490         .forEach(function (name) {
 491             var maketestName = name + "-testmake";
 492             profiles[maketestName] = concatObjects(profiles[name], testmakeBase);
 493             profiles[maketestName].default_make_targets = [ "test-make" ];
 494         });
 495 









 496     // Profiles for building the zero jvm variant. These are used for verification.
 497     var zeroProfiles = {
 498         "linux-x64-zero": {
 499             target_os: "linux",
 500             target_cpu: "x64",
 501             dependencies: ["devkit"],
 502             configure_args: concat(common.configure_args_64bit, [
 503                 "--with-zlib=system",
 504                 "--with-jvm-variants=zero",
 505                 "--enable-libffi-bundling"
 506             ])
 507         },
 508 
 509         "linux-x86-zero": {
 510             target_os: "linux",
 511             target_cpu: "x86",
 512             build_cpu: "x64",
 513             dependencies: ["devkit"],
 514             configure_args:  concat(common.configure_args_32bit, [
 515                 "--with-zlib=system",


 554     [ "linux-x64", "macosx-x64", "solaris-sparcv9", "windows-x64"]
 555         .forEach(function (name) {
 556             var bootcycleName = name + "-bootcycle";
 557             var bootcyclePrebuiltName = name + "-bootcycle-prebuilt";
 558             // The base bootcycle profile just changes the default target
 559             // compared to the base profile
 560             profiles[bootcycleName] = clone(profiles[name]);
 561             profiles[bootcycleName].default_make_targets = [ "bootcycle-images" ];
 562             // The prebuilt bootcycle variant modifies the boot jdk argument
 563             var bootcyclePrebuiltBase = {
 564                 dependencies: [ name + ".jdk" ],
 565                 configure_args: "--with-boot-jdk=" + input.get(name + ".jdk", "home_path"),
 566             }
 567             profiles[bootcyclePrebuiltName] = concatObjects(profiles[name],
 568                 bootcyclePrebuiltBase);
 569             var bootJdkIndex = profiles[bootcyclePrebuiltName].dependencies.indexOf("boot_jdk");
 570             delete profiles[bootcyclePrebuiltName].dependencies[bootJdkIndex];
 571             profiles[bootcyclePrebuiltName].default_make_targets = [ "product-images" ];
 572         });
 573 














 574     //
 575     // Define artifacts for profiles
 576     //
 577     // Macosx bundles are named osx
 578     // tar.gz.
 579     var artifactData = {
 580         "linux-x64": {
 581             platform: "linux-x64",
 582         },
 583         "linux-x86": {
 584             platform: "linux-x86",
 585         },
 586         "macosx-x64": {
 587             platform: "osx-x64",
 588             jdk_subdir: "jdk-" + data.version +  ".jdk/Contents/Home",
 589         },
 590         "solaris-x64": {
 591             platform: "solaris-x64",
 592         },
 593         "solaris-sparcv9": {
 594             platform: "solaris-sparcv9",
 595         },
 596         "windows-x64": {
 597             platform: "windows-x64",
 598             jdk_suffix: "zip",
 599         },
 600         "windows-x86": {
 601             platform: "windows-x86",
 602             jdk_suffix: "zip",
 603         },
 604        "linux-aarch64": {
 605             platform: "linux-aarch64",
 606         },
 607        "linux-arm32": {
 608             platform: "linux-arm32",






 609         }
 610     }
 611     // Generate common artifacts for all main profiles
 612     Object.keys(artifactData).forEach(function (name) {
 613         profiles[name] = concatObjects(profiles[name],
 614             common.main_profile_artifacts(artifactData[name]));
 615     });
 616 
 617     // Generate common artifacts for all debug profiles
 618     Object.keys(artifactData).forEach(function (name) {
 619         var debugName = name + common.debug_suffix;
 620         profiles[debugName] = concatObjects(profiles[debugName],
 621             common.debug_profile_artifacts(artifactData[name]));
 622     });
 623 
 624     profilesArtifacts = {
 625         "linux-x64": {
 626             artifacts: {
 627                 doc_api_spec: {
 628                     local: "bundles/\\(jdk.*doc-api-spec.tar.gz\\)",


 671         profiles[riDebugName] = clone(profiles[openDebugName]);
 672         // Rewrite all remote dirs to "bundles/openjdk/BCL/..."
 673         for (artifactName in profiles[riName].artifacts) {
 674             var artifact = profiles[riName].artifacts[artifactName];
 675             artifact.remote = replaceAll(
 676                 "\/GPL\/", "/BCL/",
 677                 (artifact.remote != null ? artifact.remote : artifact.local));
 678         }
 679     });
 680 
 681     // For open profiles, the non-debug jdk bundles, need an "open" prefix on the
 682     // remote bundle names, forming the word "openjdk". See JDK-8188789.
 683     common.main_profile_names.forEach(function (name) {
 684         var openName = name + common.open_suffix;
 685         profiles[openName].artifacts["jdk"].remote = replaceAll(
 686             "\/jdk-", "/openjdk-",
 687             replaceAll("\/\\1", "/open\\1",
 688                        profiles[openName].artifacts["jdk"].remote));
 689     });
 690 
 691     // Enable ZGC in linux-x64-open builds
 692     [ "linux-x64-open" ].forEach(function (name) {
 693         var configureArgs = { configure_args: [ "--with-jvm-features=zgc" ] };
 694         var debugName = name + common.debug_suffix;
 695         profiles[name] = concatObjects(profiles[name], configureArgs);
 696         profiles[debugName] = concatObjects(profiles[debugName], configureArgs);
 697     });
 698 
 699     // Generate cmp-baseline profiles for each main profile and their
 700     // corresponding debug profile. This profile does a compare build run with no
 701     // changes to verify that the compare script has a clean baseline
 702     common.main_profile_names.forEach(function (name) {
 703         [ "", common.open_suffix ].forEach(function (suffix) {
 704             var cmpBaselineName = name + suffix + "-cmp-baseline";
 705             profiles[cmpBaselineName] = clone(profiles[name + suffix]);
 706             // Only compare the images target. This should pressumably be expanded
 707             // to include more build targets when possible.
 708             profiles[cmpBaselineName].default_make_targets = [ "images" ];




 709             profiles[cmpBaselineName].make_args = [ "COMPARE_BUILD=CONF=" ];
 710             // Do not inherit artifact definitions from base profile
 711             delete profiles[cmpBaselineName].artifacts;
 712         });
 713     });
 714 






















































 715     // Profiles used to run tests.
 716     var testOnlyProfiles = {
 717         "run-test": {
 718             target_os: input.build_os,
 719             target_cpu: input.build_cpu,
 720             dependencies: [ "jtreg", "gnumake", "boot_jdk", "devkit", "jib" ],
 721             labels: "test",
 722             environment: {
 723                 "JT_JAVA": common.boot_jdk_home
 724             }
 725         }
 726     };
 727     profiles = concatObjects(profiles, testOnlyProfiles);
 728 
 729     // Profiles used to run tests using Jib for internal dependencies.
 730     var testedProfile = input.testedProfile;
 731     if (testedProfile == null) {
 732         testedProfile = input.build_os + "-" + input.build_cpu;
 733     }











 734     var testOnlyProfilesPrebuilt = {
 735         "run-test-prebuilt": {
 736             target_os: input.build_os,
 737             target_cpu: input.build_cpu,
 738             dependencies: [
 739                 "jtreg", "gnumake", "boot_jdk", "devkit", "jib", testedProfile + ".jdk",
 740                 testedProfile + ".test"
 741             ],
 742             src: "src.conf",
 743             make_args: [ "run-test-prebuilt", "LOG_CMDLINES=true", "JTREG_VERBOSE=fail,error,time" ],
 744             environment: {
 745                 "BOOT_JDK": common.boot_jdk_home,
 746                 "JDK_IMAGE_DIR": input.get(testedProfile + ".jdk", "home_path"),
 747                 "TEST_IMAGE_DIR": input.get(testedProfile + ".test", "home_path")
 748             },
 749             labels: "test"
 750         }
 751     };
 752 
 753     // If actually running the run-test-prebuilt profile, verify that the input
 754     // variable is valid and if so, add the appropriate target_* values from
 755     // the tested profile.
 756     if (input.profile == "run-test-prebuilt") {
 757         if (profiles[testedProfile] == null) {
 758             error("testedProfile is not defined: " + testedProfile);
 759         }
 760     }
 761     if (profiles[testedProfile] != null) {
 762         testOnlyProfilesPrebuilt["run-test-prebuilt"]["target_os"]
 763             = profiles[testedProfile]["target_os"];
 764         testOnlyProfilesPrebuilt["run-test-prebuilt"]["target_cpu"]
 765             = profiles[testedProfile]["target_cpu"];
 766     }
 767     profiles = concatObjects(profiles, testOnlyProfilesPrebuilt);


 808         profiles["run-test-prebuilt"] = concatObjects(profiles["run-test-prebuilt"],
 809             runTestPrebuiltSrcFullExtra);
 810     }
 811 
 812     // Generate the missing platform attributes
 813     profiles = generatePlatformAttributes(profiles);
 814     profiles = generateDefaultMakeTargetsConfigureArg(common, profiles);
 815     return profiles;
 816 };
 817 
 818 /**
 819  * Generate the dependencies part of the configuration
 820  *
 821  * @param input External data to use for generating the configuration
 822  * @param common The common values
 823  * @returns {{}} Dependencies part of configuration
 824  */
 825 var getJibProfilesDependencies = function (input, common) {
 826 
 827     var devkit_platform_revisions = {
 828         linux_x64: "gcc7.3.0-OEL6.4+1.1",
 829         macosx_x64: "Xcode9.4-MacOSX10.13+1.0",
 830         solaris_x64: "SS12u4-Solaris11u1+1.0",
 831         solaris_sparcv9: "SS12u6-Solaris11u3+1.0",
 832         windows_x64: "VS2017-15.5.5+1.0",
 833         linux_aarch64: "gcc7.3.0-Fedora27+1.1",
 834         linux_arm: "gcc7.3.0-Fedora27+1.1"


 835     };
 836 
 837     var devkit_platform = (input.target_cpu == "x86"
 838         ? input.target_os + "_x64"
 839         : input.target_platform);
 840 






 841     var boot_jdk_platform = (input.build_os == "macosx" ? "osx" : input.build_os)
 842         + "-" + input.build_cpu;







 843 
 844     var makeBinDir = (input.build_os == "windows"
 845         ? input.get("gnumake", "install_path") + "/cygwin/bin"
 846         : input.get("gnumake", "install_path") + "/bin");
 847 
 848     var dependencies = {
 849 
 850         boot_jdk: {
 851             server: "jpg",
 852             product: "jdk",
 853             version: common.boot_jdk_version,
 854             build_number: "28",
 855             file: "bundles/" + boot_jdk_platform + "/jdk-" + common.boot_jdk_version + "_"
 856                 + boot_jdk_platform + "_bin"
 857                 + (input.build_os == "windows" ? ".zip" : ".tar.gz"),
 858             configure_args: "--with-boot-jdk=" + common.boot_jdk_home,
 859             environment_path: common.boot_jdk_home + "/bin"
 860         },
 861 
 862         devkit: {
 863             organization: common.organization,
 864             ext: "tar.gz",
 865             module: "devkit-" + devkit_platform,
 866             revision: devkit_platform_revisions[devkit_platform],
 867             environment: {
 868                 "DEVKIT_HOME": input.get("devkit", "home_path"),
 869             }
 870         },
 871 
 872         build_devkit: {
 873             organization: common.organization,
 874             ext: "tar.gz",
 875             module: "devkit-" + input.build_platform,
 876             revision: devkit_platform_revisions[input.build_platform]
 877         },
 878 
 879         cups: {
 880             organization: common.organization,
 881             ext: "tar.gz",
 882             revision: "1.0118+1.0"
 883         },
 884 
 885         jtreg: {
 886             server: "javare",
 887             revision: "4.2",
 888             build_number: "b13",
 889             checksum_file: "MD5_VALUES",
 890             file: "jtreg_bin-4.2.zip",
 891             environment_name: "JT_HOME",
 892             environment_path: input.get("jtreg", "install_path") + "/jtreg/bin"
 893         },
 894 
 895         jmh: {
 896             organization: common.organization,
 897             ext: "tar.gz",
 898             revision: "1.21+1.0"
 899         },
 900 















 901         gnumake: {
 902             organization: common.organization,
 903             ext: "tar.gz",
 904             revision: "4.0+1.0",
 905 
 906             module: (input.build_os == "windows"
 907                 ? "gnumake-" + input.build_osenv_platform
 908                 : "gnumake-" + input.build_platform),
 909 
 910             configure_args: "MAKE=" + makeBinDir + "/make",
 911 
 912             environment: {
 913                 "MAKE": makeBinDir + "/make"
 914             },
 915 
 916             environment_path: makeBinDir
 917         },
 918 
 919         autoconf: {
 920             organization: common.organization,


 923             module: (input.build_os == "windows"
 924                 ? "autoconf-" + input.build_osenv_platform
 925                 : "autoconf-" + input.build_platform),
 926             configure_args: "",
 927             environment_path: input.get("autoconf", "install_path")
 928         },
 929 
 930         graphviz: {
 931             organization: common.organization,
 932             ext: "tar.gz",
 933             revision: "2.38.0-1+1.1",
 934             module: "graphviz-" + input.target_platform,
 935             configure_args: "DOT=" + input.get("graphviz", "install_path") + "/dot",
 936             environment_path: input.get("graphviz", "install_path")
 937         },
 938 
 939         pandoc: {
 940             organization: common.organization,
 941             ext: "tar.gz",
 942             revision: "2.3.1+1.0",
 943             module: "pandoc-" + input.target_platform,
 944             configure_args: "PANDOC=" + input.get("pandoc", "install_path") + "/pandoc/pandoc",
 945             environment_path: input.get("pandoc", "install_path") + "/pandoc"
 946         },
 947 
 948         // This adds java jib as a dependency for the test artifacts resolver
 949         jib: {
 950             organization: "com.oracle.java.jib",
 951             ext: "zip",
 952             classifier: "distribution",
 953             revision: "3.0-SNAPSHOT",
 954             environment_name: "JIB_HOME",
 955             environment_value: input.get("jib", "install_path")
 956                 + "/jib-3.0-SNAPSHOT-distribution"
 957         },
 958 
 959         ant: {
 960             organization: common.organization,
 961             ext: "zip",
 962             revision: "1.7.1+1.0",
 963             configure_args: "",
 964         },
 965 
 966         graalunit_lib: {
 967             organization: common.organization,
 968             ext: "zip",
 969             revision: "619_Apr_12_2018",
 970             module: "graalunit-lib",
 971             configure_args: "--with-graalunit-lib=" + input.get("graalunit_lib", "install_path"),
 972             environment_name: "GRAALUNIT_LIB"
 973         },
 974     };
 975 
 976     return dependencies;


1119         }
1120     }
1121     return ret;
1122 };
1123 
1124 /**
1125  * Constructs the numeric version string from reading the
1126  * make/autoconf/version-numbers file and removing all trailing ".0".
1127  *
1128  * @param feature Override feature version
1129  * @param interim Override interim version
1130  * @param update Override update version
1131  * @param patch Override patch version
1132  * @returns {String} The numeric version string
1133  */
1134 var getVersion = function (feature, interim, update, patch) {
1135     var version_numbers = getVersionNumbers();
1136     var version = (feature != null ? feature : version_numbers.get("DEFAULT_VERSION_FEATURE"))
1137         + "." + (interim != null ? interim : version_numbers.get("DEFAULT_VERSION_INTERIM"))
1138         + "." + (update != null ? update :  version_numbers.get("DEFAULT_VERSION_UPDATE"))
1139         + "." + (patch != null ? patch : version_numbers.get("DEFAULT_VERSION_PATCH"));



1140     while (version.match(".*\\.0$")) {
1141         version = version.substring(0, version.length - 2);
1142     }
1143     return version;
1144 };
1145 
1146 /**
1147  * Constructs the common version configure args based on build type and
1148  * other version inputs
1149  */
1150 var versionArgs = function(input, common) {
1151     var args = ["--with-version-build=" + common.build_number];
1152     if (input.build_type == "promoted") {
1153         args = concat(args,
1154                       // This needs to be changed when we start building release candidates
1155                       // with-version-pre must be set to ea for 'ea' and empty for fcs build
1156                       "--with-version-pre=ea",
1157                       "--without-version-opt");








1158     } else {
1159         args = concat(args, "--with-version-opt=" + common.build_id);
1160     }
1161     return args;
1162 }
1163 
1164 // Properties representation of the make/autoconf/version-numbers file. Lazily
1165 // initiated by the function below.
1166 var version_numbers;
1167 
1168 /**
1169  * Read the make/autoconf/version-numbers file into a Properties object.
1170  *
1171  * @returns {java.utilProperties}
1172  */
1173 var getVersionNumbers = function () {
1174     // Read version information from make/autoconf/version-numbers
1175     if (version_numbers == null) {
1176         version_numbers = new java.util.Properties();
1177         var stream = new java.io.FileInputStream(__DIR__ + "/../autoconf/version-numbers");
1178         version_numbers.load(stream);
1179         stream.close();
1180     }
1181     return version_numbers;










1182 }
< prev index next >