var getJibProfiles = function (input) {
var data = {};
data.format_version = "1.3";
data.organization = "";
data.product = "jdk";
data.version = getVersion();
data.output_basedir = "build";
data.configuration_configure_arg = "--with-conf-name=";
data.configuration_make_arg = "CONF_NAME=";
data.src_bundle_excludes = [
"build", "{,**/}webrev*", "{,**/}.hg", "{,**/}JTwork*", "{,**/}JTreport*",
"{,**/}.git"
];
data.conf_bundle_includes = [
"make/conf/version-numbers.conf",
];
var common = getJibProfilesCommon(input, data);
data.profiles = getJibProfilesProfiles(input, common, data);
data.dependencies = getJibProfilesDependencies(input, common, data);
return data;
};
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";
common.main_profile_names = [
"linux-x64", "linux-x86", "macosx-x64", "macosx-aarch64",
"windows-x64", "windows-x86", "windows-aarch64",
"linux-aarch64", "linux-arm32", "linux-ppc64le", "linux-s390x"
];
common.main_profile_base = {
dependencies: ["boot_jdk", "gnumake", "jtreg", "jib", "autoconf", "jmh", "jcov"],
default_make_targets: ["product-bundles", "test-bundles", "static-libs-bundles"],
configure_args: concat("--enable-jtreg-failure-handler",
"--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",
"--disable-manpages",
"--disable-jvm-feature-shenandoahgc",
versionArgs(input, common))
};
common.release_profile_base = {
configure_args: [
"--enable-reproducible-build",
"--with-source-date=current",
],
};
common.debug_suffix = "-debug";
common.debug_profile_base = {
configure_args: ["--enable-debug"],
labels: "debug"
};
common.slowdebug_suffix = "-slowdebug";
common.slowdebug_profile_base = {
configure_args: ["--with-debug-level=slowdebug"],
labels: "slowdebug"
};
common.optimized_suffix = "-optimized";
common.optimized_profile_base = {
configure_args: ["--with-debug-level=optimized"],
labels: "optimized",
};
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"];
common.main_profile_artifacts = function (o) {
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
return {
artifacts: {
jdk: {
local: "bundles/\\(jdk.*bin." + jdk_suffix + "\\)",
remote: [
"bundles/" + pf + "/jdk-" + data.version + "_" + pf + "_bin." + jdk_suffix,
"bundles/" + pf + "/\\1"
],
subdir: jdk_subdir,
exploded: "images/jdk"
},
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"
},
test_demos: {
local: "bundles/\\(jdk.*bin-tests-demos.tar.gz\\)",
remote: [
"bundles/" + pf + "/jdk-" + data.version + "_" + pf + "_bin-tests-demos.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_subdir,
exploded: "images/jdk"
},
static_libs: {
local: "bundles/\\(jdk.*bin-static-libs.tar.gz\\)",
remote: [
"bundles/" + pf + "/jdk-" + data.version + "_" + pf + "_bin-static-libs.tar.gz",
"bundles/" + pf + "/\\1"
],
subdir: jdk_subdir,
},
}
};
};
common.debug_profile_artifacts = function (o) {
var jdk_subdir = "jdk-" + data.version + "/fastdebug";
var jdk_suffix = (o.jdk_suffix != null ? o.jdk_suffix : "tar.gz");
var pf = o.platform
return {
artifacts: {
jdk: {
local: "bundles/\\(jdk.*bin-debug." + jdk_suffix + "\\)",
remote: [
"bundles/" + pf + "/jdk-" + data.version + "_" + pf + "_bin-debug." + jdk_suffix,
"bundles/" + pf + "/\\1"
],
subdir: jdk_subdir,
exploded: "images/jdk"
},
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_subdir,
exploded: "images/jdk"
},
static_libs: {
local: "bundles/\\(jdk.*bin-static-libs-debug.tar.gz\\)",
remote: [
"bundles/" + pf + "/jdk-" + data.version + "_" + pf + "_bin-static-libs-debug.tar.gz",
"bundles/" + pf + "/\\1"
],
subdir: jdk_subdir,
},
}
};
};
if (input.build_os == 'macosx' && input.build_cpu == 'aarch64') {
common.boot_jdk_version = "17";
common.boot_jdk_build_number = "24";
} else {
common.boot_jdk_version = "16";
common.boot_jdk_build_number = "36";
}
common.boot_jdk_home = input.get("boot_jdk", "install_path") + "/jdk-"
+ common.boot_jdk_version
+ (input.build_os == "macosx" ? ".jdk/Contents/Home" : "");
return common;
};
var getJibProfilesProfiles = function (input, common, data) {
var profiles = {
"linux-x64": {
target_os: "linux",
target_cpu: "x64",
dependencies: ["devkit", "gtest", "build_devkit", "graphviz", "pandoc"],
configure_args: concat(
(input.build_cpu == "x64" ? common.configure_args_64bit
: "--openjdk-target=x86_64-linux-gnu"),
"--with-zlib=system", "--disable-dtrace",
(isWsl(input) ? [ "--host=x86_64-unknown-linux-gnu",
"--build=x86_64-unknown-linux-gnu" ] : [])),
},
"linux-x86": {
target_os: "linux",
target_cpu: "x86",
build_cpu: "x64",
dependencies: ["devkit", "gtest"],
configure_args: concat(common.configure_args_32bit,
"--with-jvm-variants=minimal,server", "--with-zlib=system"),
},
"macosx-x64": {
target_os: "macosx",
target_cpu: "x64",
dependencies: ["devkit", "gtest", "pandoc"],
configure_args: concat(common.configure_args_64bit, "--with-zlib=system",
"--with-macosx-version-max=10.12.00",
"--enable-compatible-cds-alignment",
"SETFILE=/usr/bin/SetFile"),
},
"macosx-aarch64": {
target_os: "macosx",
target_cpu: "aarch64",
dependencies: ["devkit", "gtest"],
configure_args: concat(common.configure_args_64bit, "--with-zlib=system",
"--with-macosx-version-max=11.00.00"),
},
"windows-x64": {
target_os: "windows",
target_cpu: "x64",
dependencies: ["devkit", "gtest", "pandoc"],
configure_args: concat(common.configure_args_64bit),
},
"windows-x86": {
target_os: "windows",
target_cpu: "x86",
build_cpu: "x64",
dependencies: ["devkit", "gtest"],
configure_args: concat(common.configure_args_32bit),
},
"windows-aarch64": {
target_os: "windows",
target_cpu: "aarch64",
dependencies: ["devkit", "gtest", "build_devkit"],
configure_args: [
"--openjdk-target=aarch64-unknown-cygwin",
],
},
"linux-aarch64": {
target_os: "linux",
target_cpu: "aarch64",
build_cpu: "x64",
dependencies: ["devkit", "gtest", "build_devkit", "pandoc"],
configure_args: [
"--openjdk-target=aarch64-linux-gnu",
"--with-zlib=system",
"--disable-dtrace",
"--enable-compatible-cds-alignment",
],
},
"linux-arm32": {
target_os: "linux",
target_cpu: "arm",
build_cpu: "x64",
dependencies: ["devkit", "gtest", "build_devkit"],
configure_args: [
"--openjdk-target=arm-linux-gnueabihf", "--with-freetype=bundled",
"--with-abi-profile=arm-vfp-hflt", "--disable-warnings-as-errors"
],
},
"linux-ppc64le": {
target_os: "linux",
target_cpu: "ppc64le",
build_cpu: "x64",
dependencies: ["devkit", "gtest", "build_devkit"],
configure_args: [
"--openjdk-target=ppc64le-linux-gnu", "--with-freetype=bundled",
"--disable-warnings-as-errors"
],
},
"linux-s390x": {
target_os: "linux",
target_cpu: "s390x",
build_cpu: "x64",
dependencies: ["devkit", "gtest", "build_devkit"],
configure_args: [
"--openjdk-target=s390x-linux-gnu", "--with-freetype=bundled",
"--disable-warnings-as-errors"
],
},
};
common.main_profile_names.forEach(function (name) {
profiles[name] = concatObjects(common.main_profile_base, profiles[name]);
});
common.main_profile_names.forEach(function (name) {
var debugName = name + common.debug_suffix;
profiles[debugName] = concatObjects(profiles[name],
common.debug_profile_base);
});
common.main_profile_names.forEach(function (name) {
var debugName = name + common.slowdebug_suffix;
profiles[debugName] = concatObjects(profiles[name],
common.slowdebug_profile_base);
});
common.main_profile_names.forEach(function (name) {
var optName = name + common.optimized_suffix;
profiles[optName] = concatObjects(profiles[name],
common.optimized_profile_base);
profiles[optName].default_make_targets = [ "hotspot" ];
});
var testmakeBase = {
dependencies: [ "ant" ],
environment: {
"ANT_HOME": input.get("ant", "home_path")
}
};
[ "linux-x64", "macosx-x64", "windows-x64"]
.forEach(function (name) {
var maketestName = name + "-testmake";
profiles[maketestName] = concatObjects(profiles[name], testmakeBase);
profiles[maketestName].default_make_targets = [ "test-make" ];
});
[ "linux-aarch64", "linux-x64", "macosx-x64", "macosx-aarch64" ].forEach(function (name) {
var gcovName = name + "-gcov";
profiles[gcovName] = clone(profiles[name]);
profiles[gcovName].default_make_targets = ["product-bundles", "test-bundles"];
profiles[gcovName].configure_args = concat(profiles[gcovName].configure_args,
["--enable-native-coverage", "--disable-warnings-as-errors"]);
});
var zeroProfiles = {
"linux-x64-zero": {
target_os: "linux",
target_cpu: "x64",
dependencies: ["devkit", "gtest"],
configure_args: concat(common.configure_args_64bit, [
"--with-zlib=system",
"--with-jvm-variants=zero",
"--enable-libffi-bundling"
])
},
"linux-x86-zero": {
target_os: "linux",
target_cpu: "x86",
build_cpu: "x64",
dependencies: ["devkit", "gtest"],
configure_args: concat(common.configure_args_32bit, [
"--with-zlib=system",
"--with-jvm-variants=zero",
"--enable-libffi-bundling"
])
}
}
profiles = concatObjects(profiles, zeroProfiles);
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);
});
var noPchProfiles = {
"linux-x64-debug-nopch": {
target_os: "linux",
target_cpu: "x64",
dependencies: ["devkit", "gtest"],
configure_args: concat(common.configure_args_64bit,
"--with-zlib=system", "--disable-precompiled-headers"),
},
};
profiles = concatObjects(profiles, noPchProfiles);
Object.keys(noPchProfiles).forEach(function (name) {
profiles[name] = concatObjects(common.main_profile_base, profiles[name]);
profiles[name] = concatObjects(common.debug_profile_base, profiles[name]);
profiles[name].default_make_targets = ["hotspot"];
});
[ "linux-x64", "macosx-x64", "windows-x64" ]
.forEach(function (name) {
var bootcycleName = name + "-bootcycle";
var bootcyclePrebuiltName = name + "-bootcycle-prebuilt";
profiles[bootcycleName] = clone(profiles[name]);
profiles[bootcycleName].default_make_targets = [ "bootcycle-images" ];
var bootcyclePrebuiltBase = {
dependencies: [ name + ".jdk" ],
configure_args: [
"--with-boot-jdk=" + input.get(name + ".jdk", "home_path"),
]
}
profiles[bootcyclePrebuiltName] = concatObjects(profiles[name],
bootcyclePrebuiltBase);
var bootJdkIndex = profiles[bootcyclePrebuiltName].dependencies.indexOf("boot_jdk");
delete profiles[bootcyclePrebuiltName].dependencies[bootJdkIndex];
profiles[bootcyclePrebuiltName].default_make_targets = [ "product-images" ];
});
[ "linux-aarch64", "linux-x64", "macosx-x64", "macosx-aarch64", "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")]);
});
var artifactData = {
"linux-x64": {
platform: "linux-x64",
},
"linux-x86": {
platform: "linux-x86",
},
"macosx-x64": {
platform: "macos-x64",
jdk_subdir: "jdk-" + data.version + ".jdk/Contents/Home",
},
"macosx-aarch64": {
platform: "macos-aarch64",
jdk_subdir: "jdk-" + data.version + ".jdk/Contents/Home",
},
"windows-x64": {
platform: "windows-x64",
jdk_suffix: "zip",
},
"windows-x86": {
platform: "windows-x86",
jdk_suffix: "zip",
},
"windows-aarch64": {
platform: "windows-aarch64",
jdk_suffix: "zip",
},
"linux-aarch64": {
platform: "linux-aarch64",
},
"linux-arm32": {
platform: "linux-arm32",
},
"linux-ppc64le": {
platform: "linux-ppc64le",
},
"linux-s390x": {
platform: "linux-s390x",
}
}
Object.keys(artifactData).forEach(function (name) {
profiles[name] = concatObjects(profiles[name],
common.main_profile_artifacts(artifactData[name]));
});
Object.keys(artifactData).forEach(function (name) {
var debugName = name + common.debug_suffix;
profiles[debugName] = concatObjects(profiles[debugName],
common.debug_profile_artifacts(artifactData[name]));
});
buildJdkDep = input.build_os + "-" + input.build_cpu + ".jdk";
docsProfiles = {
"docs": {
target_os: input.build_os,
target_cpu: input.build_cpu,
dependencies: [
"boot_jdk", "devkit", "graphviz", "pandoc", buildJdkDep,
],
configure_args: concat(
"--enable-full-docs",
versionArgs(input, common),
"--with-build-jdk=" + input.get(buildJdkDep, "home_path"),
"--with-docs-reference-jdk=" + input.get(buildJdkDep, "home_path")
),
default_make_targets: ["all-docs-bundles"],
artifacts: {
doc_api_spec: {
local: "bundles/\\(jdk-" + data.version + ".*doc-api-spec.tar.gz\\)",
remote: [
"bundles/common/jdk-" + data.version + "_doc-api-spec.tar.gz",
"bundles/common/\\1"
],
},
javase_doc_api_spec: {
local: "bundles/\\(javase-" + data.version + ".*doc-api-spec.tar.gz\\)",
remote: [
"bundles/common/javase-" + data.version + "_doc-api-spec.tar.gz",
"bundles/common/\\1"
],
},
reference_doc_api_spec: {
local: "bundles/\\(jdk-reference-" + data.version + ".*doc-api-spec.tar.gz\\)",
remote: [
"bundles/common/jdk-reference-" + data.version + "_doc-api-spec.tar.gz",
"bundles/common/\\1"
],
},
}
}
};
profiles = concatObjects(profiles, docsProfiles);
common.main_profile_names.forEach(function (name) {
var openName = name + common.open_suffix;
profiles[openName] = concatObjects(profiles[name],
common.open_profile_base);
for (artifactName in profiles[openName].artifacts) {
var artifact = profiles[openName].artifacts[artifactName];
artifact.remote = replaceAll(
"bundles\/", "bundles/openjdk/GPL/",
(artifact.remote != null ? artifact.remote : artifact.local));
}
var debugName = name + common.debug_suffix;
var openDebugName = name + common.open_suffix + common.debug_suffix;
profiles[openDebugName] = concatObjects(profiles[debugName],
common.open_profile_base);
for (artifactName in profiles[openDebugName].artifacts) {
var artifact = profiles[openDebugName].artifacts[artifactName];
artifact.remote = replaceAll(
"bundles\/", "bundles/openjdk/GPL/",
(artifact.remote != null ? artifact.remote : artifact.local));
}
});
common.main_profile_names.forEach(function (name) {
var riName = name + "-ri";
var riDebugName = riName + common.debug_suffix;
var openName = name + common.open_suffix;
var openDebugName = openName + common.debug_suffix;
profiles[riName] = clone(profiles[openName]);
profiles[riDebugName] = clone(profiles[openDebugName]);
for (artifactName in profiles[riName].artifacts) {
var artifact = profiles[riName].artifacts[artifactName];
artifact.remote = replaceAll(
"\/GPL\/", "/BCL/",
(artifact.remote != null ? artifact.remote : artifact.local));
}
});
common.main_profile_names.forEach(function (name) {
var openName = name + common.open_suffix;
profiles[openName].artifacts["jdk"].remote = replaceAll(
"\/jdk-", "/openjdk-",
replaceAll("\/\\1", "/open\\1",
profiles[openName].artifacts["jdk"].remote));
});
common.main_profile_names.forEach(function (name) {
[ "", common.open_suffix ].forEach(function (suffix) {
var cmpBaselineName = name + suffix + "-cmp-baseline";
profiles[cmpBaselineName] = clone(profiles[name + suffix]);
profiles[cmpBaselineName].default_make_targets = [ "images", "test-image" ];
if (name == "linux-x64") {
profiles[cmpBaselineName].default_make_targets
= concat(profiles[cmpBaselineName].default_make_targets, "docs");
}
profiles[cmpBaselineName].make_args = [ "COMPARE_BUILD=CONF=" ];
profiles[cmpBaselineName].configure_args = concat(
profiles[cmpBaselineName].configure_args,
"--with-hotspot-build-time=n/a",
"--disable-precompiled-headers");
delete profiles[cmpBaselineName].artifacts;
});
});
common.main_profile_names.forEach(function (name) {
profiles[name] = concatObjects(profiles[name],
common.release_profile_base);
});
[ "linux-aarch64", "linux-x64", "macosx-x64", "macosx-aarch64", "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"
}
};
});
[ "linux-aarch64", "linux-x64", "macosx-x64", "macosx-aarch64" ].forEach(function (name) {
var o = artifactData[name]
var pf = o.platform
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 gcovName = name + "-gcov";
profiles[gcovName].artifacts = {
jdk: {
local: "bundles/\\(jdk.*bin." + jdk_suffix + "\\)",
remote: [
"bundles/" + pf + "/jdk-" + data.version + "_" + pf + "_bin-gcov." + jdk_suffix,
],
subdir: jdk_subdir,
exploded: "images/jdk",
},
test: {
local: "bundles/\\(jdk.*bin-tests.tar.gz\\)",
remote: [
"bundles/" + pf + "/jdk-" + data.version + "_" + pf + "_bin-gcov-tests.tar.gz",
],
exploded: "images/test"
},
jdk_symbols: {
local: "bundles/\\(jdk.*bin-symbols.tar.gz\\)",
remote: [
"bundles/" + pf + "/jdk-" + data.version + "_" + pf + "_bin-gcov-symbols.tar.gz",
],
subdir: jdk_subdir,
exploded: "images/jdk"
},
};
});
var testOnlyProfiles = {
"run-test": {
target_os: input.build_os,
target_cpu: input.build_cpu,
dependencies: [ "jtreg", "gnumake", "boot_jdk", "devkit", "jib" ],
labels: "test",
environment: {
"JT_JAVA": common.boot_jdk_home
}
}
};
profiles = concatObjects(profiles, testOnlyProfiles);
var testedProfile = input.testedProfile;
if (testedProfile == null) {
testedProfile = input.build_os + "-" + input.build_cpu;
}
var testedProfileJdk = testedProfile + ".jdk";
var testImageProfile;
if (input.testImageProfile != null) {
testImageProfile = input.testImageProfile;
} else if (testedProfile.endsWith("-jcov")) {
testImageProfile = testedProfile.substring(0, testedProfile.length - "-jcov".length);
} else {
testImageProfile = testedProfile;
}
var testedProfileTest = testImageProfile + ".test"
var testOnlyMake = [ "test-prebuilt", "LOG_CMDLINES=true", "JTREG_VERBOSE=fail,error,time" ];
if (testedProfile.endsWith("-gcov")) {
testOnlyMake = concat(testOnlyMake, "GCOV_ENABLED=true")
}
var testOnlyProfilesPrebuilt = {
"run-test-prebuilt": {
target_os: input.build_os,
target_cpu: input.build_cpu,
dependencies: [
"jtreg", "gnumake", "boot_jdk", "devkit", "jib", "jcov", testedProfileJdk,
testedProfileTest
],
src: "src.conf",
make_args: testOnlyMake,
environment: {
"BOOT_JDK": common.boot_jdk_home,
"JT_HOME": input.get("jtreg", "home_path"),
"JDK_IMAGE_DIR": input.get(testedProfileJdk, "home_path"),
"TEST_IMAGE_DIR": input.get(testedProfileTest, "home_path")
},
labels: "test"
}
};
if (input.profile == "run-test-prebuilt") {
if (profiles[testedProfile] == null && profiles[testImageProfile] == null) {
error("testedProfile is not defined: " + testedProfile + " " + testImageProfile);
}
}
if (profiles[testedProfile] != null) {
testOnlyProfilesPrebuilt["run-test-prebuilt"]["target_os"]
= profiles[testedProfile]["target_os"];
testOnlyProfilesPrebuilt["run-test-prebuilt"]["target_cpu"]
= profiles[testedProfile]["target_cpu"];
} else if (profiles[testImageProfile] != null) {
testOnlyProfilesPrebuilt["run-test-prebuilt"]["target_os"]
= profiles[testImageProfile]["target_os"];
testOnlyProfilesPrebuilt["run-test-prebuilt"]["target_cpu"]
= profiles[testImageProfile]["target_cpu"];
}
profiles = concatObjects(profiles, testOnlyProfilesPrebuilt);
if (input.build_os == "macosx") {
macosxRunTestExtra = {
dependencies: [ "lldb" ],
environment_path: [
input.get("gnumake", "install_path") + "/bin",
input.get("lldb", "install_path") + "/Xcode.app/Contents/Developer/usr/bin",
],
};
profiles["run-test"] = concatObjects(profiles["run-test"], macosxRunTestExtra);
profiles["run-test-prebuilt"] = concatObjects(profiles["run-test-prebuilt"], macosxRunTestExtra);
}
if (input.build_os == "windows") {
windowsRunTestPrebuiltExtra = {
dependencies: [ testedProfile + ".jdk_symbols" ],
environment: {
"SYMBOLS_IMAGE_DIR": input.get(testedProfile + ".jdk_symbols", "home_path"),
}
};
profiles["run-test-prebuilt"] = concatObjects(profiles["run-test-prebuilt"],
windowsRunTestPrebuiltExtra);
}
if (!new java.io.File(__DIR__, "../../README.md").exists()) {
var runTestPrebuiltSrcFullExtra = {
dependencies: "src.full",
work_dir: input.get("src.full", "install_path"),
}
profiles["run-test-prebuilt"] = concatObjects(profiles["run-test-prebuilt"],
runTestPrebuiltSrcFullExtra);
}
profiles = generatePlatformAttributes(profiles);
profiles = generateDefaultMakeTargetsConfigureArg(common, profiles);
return profiles;
};
var getJibProfilesDependencies = function (input, common) {
var devkit_platform_revisions = {
linux_x64: "gcc10.3.0-OL6.4+1.0",
macosx: "Xcode12.4+1.0",
windows_x64: "VS2019-16.9.3+1.0",
linux_aarch64: "gcc10.3.0-OL7.6+1.0",
linux_arm: "gcc8.2.0-Fedora27+1.0",
linux_ppc64le: "gcc8.2.0-Fedora27+1.0",
linux_s390x: "gcc8.2.0-Fedora27+1.0"
};
var devkit_platform = (input.target_cpu == "x86"
? input.target_os + "_x64"
: input.target_platform);
if (input.target_platform == "windows_aarch64") {
devkit_platform = "windows_x64";
} else if (input.target_os == "macosx") {
devkit_platform = "macosx";
}
var devkit_cross_prefix = "";
if (!(input.target_os == "windows")) {
if (input.build_platform != input.target_platform
&& input.build_platform != devkit_platform) {
devkit_cross_prefix = input.build_platform + "-to-";
}
}
var boot_jdk_os = input.build_os;
if (input.build_os == "macosx") {
if (input.build_cpu == "aarch64") {
boot_jdk_os = "macos";
} else {
boot_jdk_os = "osx";
}
}
var boot_jdk_platform = boot_jdk_os + "-" + input.build_cpu;
var boot_jdk_ext = (input.build_os == "windows" ? ".zip" : ".tar.gz")
if (isWsl(input) && input.target_os == "windows") {
boot_jdk_platform = "windows-" + input.build_cpu;
boot_jdk_ext = ".zip";
}
var boot_jdk = {
server: "jpg",
product: "jdk",
version: common.boot_jdk_version,
build_number: common.boot_jdk_build_number,
file: "bundles/" + boot_jdk_platform + "/jdk-" + common.boot_jdk_version + "_"
+ boot_jdk_platform + "_bin" + boot_jdk_ext,
configure_args: "--with-boot-jdk=" + common.boot_jdk_home,
environment_path: common.boot_jdk_home + "/bin"
}
var makeBinDir = (input.build_os == "windows"
? input.get("gnumake", "install_path") + "/cygwin/bin"
: input.get("gnumake", "install_path") + "/bin");
var dependencies = {
boot_jdk: boot_jdk,
devkit: {
organization: common.organization,
ext: "tar.gz",
module: "devkit-" + devkit_cross_prefix + devkit_platform,
revision: devkit_platform_revisions[devkit_platform],
environment: {
"DEVKIT_HOME": input.get("devkit", "home_path"),
}
},
build_devkit: {
organization: common.organization,
ext: "tar.gz",
module: "devkit-" + input.build_platform,
revision: devkit_platform_revisions[input.build_platform],
configure_args: (input.build_cpu == input.target_cpu ? false
: "--with-build-devkit=" + input.get("build_devkit", "home_path"))
},
lldb: {
organization: common.organization,
ext: "tar.gz",
module: "devkit-macosx" + (input.build_cpu == "x64" ? "_x64" : ""),
revision: (input.build_cpu == "x64" ? "Xcode11.3.1-MacOSX10.15+1.1" : devkit_platform_revisions[devkit_platform])
},
cups: {
organization: common.organization,
ext: "tar.gz",
revision: "1.0118+1.0"
},
jtreg: {
server: "jpg",
product: "jtreg",
version: "6",
build_number: "1",
file: "bundles/jtreg-6+1.zip",
environment_name: "JT_HOME",
environment_path: input.get("jtreg", "home_path") + "/bin",
configure_args: "--with-jtreg=" + input.get("jtreg", "home_path"),
},
jmh: {
organization: common.organization,
ext: "tar.gz",
revision: "1.28+1.0"
},
jcov: {
organization: common.organization,
revision: "3.0-7-jdk-asm+1.0",
ext: "zip",
environment_name: "JCOV_HOME",
},
gnumake: {
organization: common.organization,
ext: "tar.gz",
revision: "4.0+1.0",
module: (input.build_os == "windows"
? "gnumake-" + input.build_osenv_platform
: "gnumake-" + input.build_platform),
configure_args: "MAKE=" + makeBinDir + "/make",
environment: {
"MAKE": makeBinDir + "/make"
},
environment_path: makeBinDir
},
autoconf: {
organization: common.organization,
ext: "tar.gz",
revision: "2.69+1.0.1",
module: (input.build_os == "windows"
? "autoconf-" + input.build_osenv_platform
: "autoconf-" + input.build_platform),
configure_args: "",
environment_path: input.get("autoconf", "install_path")
},
graphviz: {
organization: common.organization,
ext: "tar.gz",
revision: "2.38.0-1+1.1",
module: "graphviz-" + input.target_platform,
configure_args: "DOT=" + input.get("graphviz", "install_path") + "/dot",
environment_path: input.get("graphviz", "install_path")
},
pandoc: {
organization: common.organization,
ext: "tar.gz",
revision: (input.build_cpu == 'aarch64' ? "2.5+1.0" : "2.3.1+1.0"),
module: "pandoc-" + input.build_platform,
configure_args: "PANDOC=" + input.get("pandoc", "install_path") + "/pandoc/pandoc",
environment_path: input.get("pandoc", "install_path") + "/pandoc"
},
jib: {
organization: "com.oracle.java.jib",
ext: "zip",
classifier: "distribution",
revision: "3.0-SNAPSHOT",
environment_name: "JIB_HOME",
environment_value: input.get("jib", "home_path")
},
ant: {
organization: common.organization,
ext: "zip",
revision: "1.7.1+1.0",
configure_args: "",
},
gtest: {
organization: common.organization,
ext: "tar.gz",
revision: "1.8.1"
},
};
return dependencies;
};
var generatePlatformAttributes = function (profiles) {
var ret = concatObjects(profiles, {});
for (var profile in profiles) {
if (ret[profile].build_os == null) {
ret[profile].build_os = ret[profile].target_os;
}
if (ret[profile].build_cpu == null) {
ret[profile].build_cpu = ret[profile].target_cpu;
}
ret[profile].target_platform = ret[profile].target_os + "_" + ret[profile].target_cpu;
ret[profile].build_platform = ret[profile].build_os + "_" + ret[profile].build_cpu;
}
return ret;
};
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(" ");
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 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;
}
}
var clone = function (o) {
return JSON.parse(JSON.stringify(o));
};
var concat = function () {
return Array.prototype.concat.apply([], arguments);
};
var replaceAll = function (pattern, replacement, a) {
if (Array === a.constructor) {
var newA = [];
for (var i in a) {
newA.push(a[i].replace(pattern, replacement));
}
return newA;
} else {
return a.replace(pattern, replacement);
}
};
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] = clone(o1[a]);
}
}
for (var a in o2) {
if (o1[a] == null) {
ret[a] = clone(o2[a]);
} else {
if (typeof o1[a] == 'string') {
ret[a] = clone([o1[a]].concat(o2[a]));
} else if (Array.isArray(o1[a])) {
ret[a] = clone(o1[a].concat(o2[a]));
} else if (typeof o1[a] == 'object') {
ret[a] = concatObjects(o1[a], o2[a]);
}
}
}
return ret;
};
var getVersion = function (feature, interim, update, patch, extra1, extra2, extra3) {
var version_numbers = getVersionNumbers();
var version = (feature != null ? feature : version_numbers.get("DEFAULT_VERSION_FEATURE"))
+ "." + (interim != null ? interim : version_numbers.get("DEFAULT_VERSION_INTERIM"))
+ "." + (update != null ? update : version_numbers.get("DEFAULT_VERSION_UPDATE"))
+ "." + (patch != null ? patch : version_numbers.get("DEFAULT_VERSION_PATCH"))
+ "." + (extra1 != null ? extra1 : version_numbers.get("DEFAULT_VERSION_EXTRA1"))
+ "." + (extra2 != null ? extra2 : version_numbers.get("DEFAULT_VERSION_EXTRA2"))
+ "." + (extra3 != null ? extra3 : version_numbers.get("DEFAULT_VERSION_EXTRA3"));
while (version.match(".*\\.0$")) {
version = version.substring(0, version.length - 2);
}
return version;
};
var versionArgs = function(input, common) {
var args = ["--with-version-build=" + common.build_number];
if (input.build_type == "promoted") {
args = concat(args,
"--with-version-pre=" + version_numbers.get("DEFAULT_PROMOTED_VERSION_PRE"),
"--without-version-opt");
} else if (input.build_type == "ci") {
var ciBuildNumber = input.build_id_data.ciBuildNumber;
var preString = input.build_id_data.projectName;
if (preString == "jdk") {
preString = version_numbers.get("DEFAULT_PROMOTED_VERSION_PRE");
}
args = concat(args, "--with-version-pre=" + preString,
"--with-version-opt=" + ciBuildNumber);
if (input.target_os == "macosx") {
args = concat(args, "--with-macosx-bundle-build-version="
+ common.build_number + "." + ciBuildNumber);
}
} else {
args = concat(args, "--with-version-opt=" + common.build_id);
}
return args;
}
var version_numbers;
var getVersionNumbers = function () {
if (version_numbers == null) {
version_numbers = new java.util.Properties();
var stream = new java.io.FileInputStream(__DIR__ + "/version-numbers.conf");
version_numbers.load(stream);
stream.close();
}
return version_numbers;
}
var isWsl = function (input) {
return ( input.build_osenv == "wsl"
|| (input.build_os == "linux"
&& java.lang.System.getProperty("os.version").contains("Microsoft")));
}
var error = function (s) {
java.lang.System.err.println("[ERROR] " + s);
exit(1);
};