210 * |
210 * |
211 * @param input External data to use for generating the configuration |
211 * @param input External data to use for generating the configuration |
212 * @returns Common values |
212 * @returns Common values |
213 */ |
213 */ |
214 var getJibProfilesCommon = function (input) { |
214 var getJibProfilesCommon = function (input) { |
215 var common = { |
215 var common = {}; |
216 dependencies: ["boot_jdk", "gnumake", "jtreg"], |
216 |
217 configure_args: ["--with-default-make-target=all", "--enable-jtreg-failure-handler"], |
217 common.dependencies = ["boot_jdk", "gnumake", "jtreg"], |
218 configure_args_32bit: ["--with-target-bits=32", "--with-jvm-variants=client,server"], |
218 common.default_make_targets = ["product-images", "test-image"], |
219 configure_args_debug: ["--enable-debug"], |
219 common.default_make_targets_debug = common.default_make_targets; |
220 configure_args_slowdebug: ["--with-debug-level=slowdebug"], |
220 common.default_make_targets_slowdebug = common.default_make_targets; |
221 organization: "jpg.infra.builddeps" |
221 common.configure_args = ["--enable-jtreg-failure-handler"], |
222 }; |
222 common.configure_args_32bit = ["--with-target-bits=32", "--with-jvm-variants=client,server"], |
|
223 common.configure_args_debug = ["--enable-debug"], |
|
224 common.configure_args_slowdebug = ["--with-debug-level=slowdebug"], |
|
225 common.organization = "jpg.infra.builddeps" |
223 |
226 |
224 return common; |
227 return common; |
225 }; |
228 }; |
226 |
229 |
227 /** |
230 /** |
239 |
242 |
240 "linux-x64": { |
243 "linux-x64": { |
241 target_os: "linux", |
244 target_os: "linux", |
242 target_cpu: "x64", |
245 target_cpu: "x64", |
243 dependencies: concat(common.dependencies, "devkit"), |
246 dependencies: concat(common.dependencies, "devkit"), |
244 configure_args: concat(common.configure_args, "--with-zlib=system"), |
247 configure_args: concat(common.configure_args, "--with-zlib=system"), |
245 make_args: common.make_args |
248 default_make_targets: concat(common.default_make_targets, "docs-image") |
246 }, |
249 }, |
247 |
250 |
248 "linux-x86": { |
251 "linux-x86": { |
249 target_os: "linux", |
252 target_os: "linux", |
250 target_cpu: "x86", |
253 target_cpu: "x86", |
251 build_cpu: "x64", |
254 build_cpu: "x64", |
252 dependencies: concat(common.dependencies, "devkit"), |
255 dependencies: concat(common.dependencies, "devkit"), |
253 configure_args: concat(common.configure_args, common.configure_args_32bit, |
256 configure_args: concat(common.configure_args, common.configure_args_32bit, |
254 "--with-zlib=system"), |
257 "--with-zlib=system"), |
255 make_args: common.make_args |
258 default_make_targets: common.default_make_targets |
256 }, |
259 }, |
257 |
260 |
258 "macosx-x64": { |
261 "macosx-x64": { |
259 target_os: "macosx", |
262 target_os: "macosx", |
260 target_cpu: "x64", |
263 target_cpu: "x64", |
261 dependencies: concat(common.dependencies, "devkit"), |
264 dependencies: concat(common.dependencies, "devkit"), |
262 configure_args: concat(common.configure_args, "--with-zlib=system"), |
265 configure_args: concat(common.configure_args, "--with-zlib=system"), |
263 make_args: common.make_args |
266 default_make_targets: common.default_make_targets |
264 }, |
267 }, |
265 |
268 |
266 "solaris-x64": { |
269 "solaris-x64": { |
267 target_os: "solaris", |
270 target_os: "solaris", |
268 target_cpu: "x64", |
271 target_cpu: "x64", |
269 dependencies: concat(common.dependencies, "devkit", "cups"), |
272 dependencies: concat(common.dependencies, "devkit", "cups"), |
270 configure_args: concat(common.configure_args, "--with-zlib=system"), |
273 configure_args: concat(common.configure_args, "--with-zlib=system"), |
271 make_args: common.make_args |
274 default_make_targets: common.default_make_targets |
272 }, |
275 }, |
273 |
276 |
274 "solaris-sparcv9": { |
277 "solaris-sparcv9": { |
275 target_os: "solaris", |
278 target_os: "solaris", |
276 target_cpu: "sparcv9", |
279 target_cpu: "sparcv9", |
277 dependencies: concat(common.dependencies, "devkit", "cups"), |
280 dependencies: concat(common.dependencies, "devkit", "cups"), |
278 configure_args: concat(common.configure_args, "--with-zlib=system"), |
281 configure_args: concat(common.configure_args, "--with-zlib=system"), |
279 make_args: common.make_args |
282 default_make_targets: common.default_make_targets |
280 }, |
283 }, |
281 |
284 |
282 "windows-x64": { |
285 "windows-x64": { |
283 target_os: "windows", |
286 target_os: "windows", |
284 target_cpu: "x64", |
287 target_cpu: "x64", |
285 dependencies: concat(common.dependencies, "devkit", "freetype"), |
288 dependencies: concat(common.dependencies, "devkit", "freetype"), |
286 configure_args: common.configure_args, |
289 configure_args: concat(common.configure_args), |
287 make_args: common.make_args |
290 default_make_targets: common.default_make_targets |
288 }, |
291 }, |
289 |
292 |
290 "windows-x86": { |
293 "windows-x86": { |
291 target_os: "windows", |
294 target_os: "windows", |
292 target_cpu: "x86", |
295 target_cpu: "x86", |
293 build_cpu: "x64", |
296 build_cpu: "x64", |
294 dependencies: concat(common.dependencies, "devkit", "freetype"), |
297 dependencies: concat(common.dependencies, "devkit", "freetype"), |
295 configure_args: concat(common.configure_args, common.configure_args_32bit), |
298 configure_args: concat(common.configure_args, common.configure_args_32bit), |
296 make_args: common.make_args |
299 default_make_targets: common.default_make_targets |
297 } |
300 } |
298 }; |
301 }; |
299 profiles = concatObjects(profiles, mainProfiles); |
302 profiles = concatObjects(profiles, mainProfiles); |
300 // Generate debug versions of all the main profiles |
303 // Generate debug versions of all the main profiles |
301 profiles = concatObjects(profiles, generateDebugProfiles(common, mainProfiles)); |
304 profiles = concatObjects(profiles, generateDebugProfiles(common, mainProfiles)); |
304 |
307 |
305 // Generate open only profiles for all the main profiles for JPRT and reference |
308 // Generate open only profiles for all the main profiles for JPRT and reference |
306 // implementation builds. |
309 // implementation builds. |
307 var openOnlyProfiles = generateOpenOnlyProfiles(common, mainProfiles); |
310 var openOnlyProfiles = generateOpenOnlyProfiles(common, mainProfiles); |
308 // The open only profiles on linux are used for reference builds and should |
311 // The open only profiles on linux are used for reference builds and should |
309 // produce the compact profile images by default. |
312 // produce the compact profile images by default. This adds "profiles" as an |
|
313 // extra default target. |
310 var openOnlyProfilesExtra = { |
314 var openOnlyProfilesExtra = { |
311 "linux-x64-open": { |
315 "linux-x64-open": { |
312 configure_args: ["--with-default-make-target=all profiles"], |
316 default_make_targets: "profiles" |
313 }, |
317 }, |
314 |
318 |
315 "linux-x86-open": { |
319 "linux-x86-open": { |
316 configure_args: ["--with-default-make-target=all profiles"], |
320 default_make_targets: "profiles" |
317 } |
321 } |
318 }; |
322 }; |
319 var openOnlyProfiles = concatObjects(openOnlyProfiles, openOnlyProfilesExtra); |
323 var openOnlyProfiles = concatObjects(openOnlyProfiles, openOnlyProfilesExtra); |
320 |
324 |
321 profiles = concatObjects(profiles, openOnlyProfiles); |
325 profiles = concatObjects(profiles, openOnlyProfiles); |
467 var newProfiles = {}; |
472 var newProfiles = {}; |
468 for (var profile in profiles) { |
473 for (var profile in profiles) { |
469 var debugProfile = profile + "-debug"; |
474 var debugProfile = profile + "-debug"; |
470 newProfiles[debugProfile] = clone(profiles[profile]); |
475 newProfiles[debugProfile] = clone(profiles[profile]); |
471 newProfiles[debugProfile].debug_level = "fastdebug"; |
476 newProfiles[debugProfile].debug_level = "fastdebug"; |
|
477 newProfiles[debugProfile].default_make_targets |
|
478 = common.default_make_targets_debug; |
472 newProfiles[debugProfile].labels |
479 newProfiles[debugProfile].labels |
473 = concat(newProfiles[debugProfile].labels || [], "debug"), |
480 = concat(newProfiles[debugProfile].labels || [], "debug"), |
474 newProfiles[debugProfile].configure_args |
481 newProfiles[debugProfile].configure_args |
475 = concat(newProfiles[debugProfile].configure_args, |
482 = concat(newProfiles[debugProfile].configure_args, |
476 common.configure_args_debug); |
483 common.configure_args_debug); |
490 var newProfiles = {}; |
497 var newProfiles = {}; |
491 for (var profile in profiles) { |
498 for (var profile in profiles) { |
492 var debugProfile = profile + "-slowdebug"; |
499 var debugProfile = profile + "-slowdebug"; |
493 newProfiles[debugProfile] = clone(profiles[profile]); |
500 newProfiles[debugProfile] = clone(profiles[profile]); |
494 newProfiles[debugProfile].debug_level = "slowdebug"; |
501 newProfiles[debugProfile].debug_level = "slowdebug"; |
|
502 newProfiles[debugProfile].default_make_targets |
|
503 = common.default_make_targets_slowdebug; |
495 newProfiles[debugProfile].labels |
504 newProfiles[debugProfile].labels |
496 = concat(newProfiles[debugProfile].labels || [], "slowdebug"), |
505 = concat(newProfiles[debugProfile].labels || [], "slowdebug"), |
497 newProfiles[debugProfile].configure_args |
506 newProfiles[debugProfile].configure_args |
498 = concat(newProfiles[debugProfile].configure_args, |
507 = concat(newProfiles[debugProfile].configure_args, |
499 common.configure_args_slowdebug); |
508 common.configure_args_slowdebug); |
520 = concat(newProfiles[openProfile].configure_args, |
529 = concat(newProfiles[openProfile].configure_args, |
521 "--enable-openjdk-only"); |
530 "--enable-openjdk-only"); |
522 } |
531 } |
523 return newProfiles; |
532 return newProfiles; |
524 }; |
533 }; |
|
534 |
|
535 /** |
|
536 * The default_make_targets attribute on a profile is not a real Jib attribute. |
|
537 * This function rewrites that attribute into the corresponding configure arg. |
|
538 * Calling this function multiple times on the same profiles object is safe. |
|
539 * |
|
540 * @param common Common values |
|
541 * @param profiles Profiles map to rewrite profiles for |
|
542 * @returns {{}} New map of profiles with the make targets converted |
|
543 */ |
|
544 var generateDefaultMakeTargetsConfigureArg = function (common, profiles) { |
|
545 var ret = concatObjects(profiles, {}); |
|
546 for (var profile in ret) { |
|
547 if (ret[profile]["default_make_targets"] != null) { |
|
548 var targetsString = concat(ret[profile].default_make_targets).join(" "); |
|
549 // Iterate over all configure args and see if --with-default-make-target |
|
550 // is already there and change it, otherwise add it. |
|
551 var found = false; |
|
552 for (var arg in ret[profile].configure_args) { |
|
553 if (arg.startsWith("--with-default-make-target")) { |
|
554 found = true; |
|
555 arg.replace(/=.*/, "=" + targetsString); |
|
556 } |
|
557 } |
|
558 if (!found) { |
|
559 ret[profile].configure_args = concat( |
|
560 ret[profile].configure_args, |
|
561 "--with-default-make-target=" + targetsString); |
|
562 } |
|
563 } |
|
564 } |
|
565 return ret; |
|
566 } |
525 |
567 |
526 /** |
568 /** |
527 * Deep clones an object tree. |
569 * Deep clones an object tree. |
528 * |
570 * |
529 * @param o Object to clone |
571 * @param o Object to clone |