423 $(RM) -r $(TOPDIR)/build/.compare-build-temp
424 endef
425
426 # Do the actual comparison of two builds
427 define CompareBuildDoComparison
428 # Compare first and second build. Ignore any error code from compare.sh.
429 $(ECHO) "Comparing between comparison rebuild (this/new) and baseline (other/old)"
430 $(if $(COMPARE_BUILD_COMP_DIR), \
431 +(cd $(COMPARE_BUILD_OUTPUT_ROOT) && ./compare.sh $(COMPARE_BUILD_COMP_OPTS) \
432 -2dirs $(COMPARE_BUILD_OUTPUT_ROOT)/$(COMPARE_BUILD_COMP_DIR) $(OUTPUT_ROOT)/$(COMPARE_BUILD_COMP_DIR) || true), \
433 +(cd $(COMPARE_BUILD_OUTPUT_ROOT) && ./compare.sh $(COMPARE_BUILD_COMP_OPTS) \
434 -o $(OUTPUT_ROOT) || true) \
435 )
436 endef
437
438 define PrintFailureReports
439 $(if $(wildcard $(MAKESUPPORT_OUTPUTDIR)/failure-logs/*), \
440 $(PRINTF) "=== Output from failing command(s) repeated here ===\n" $(NEWLINE) \
441 $(foreach logfile, $(sort $(wildcard $(MAKESUPPORT_OUTPUTDIR)/failure-logs/*)), \
442 $(PRINTF) "* For target $(notdir $(basename $(logfile))):\n" $(NEWLINE) \
443 $(CAT) $(logfile) | $(GREP) -v -e "^Note: including file:" $(NEWLINE) \
444 ) \
445 $(PRINTF) "=== End of repeated output ===\n" \
446 )
447 endef
448
449 define PrintBuildLogFailures
450 if $(GREP) -q "recipe for target .* failed" $(BUILD_LOG) 2> /dev/null; then \
451 $(PRINTF) "=== Make failure sequence repeated here ===\n" ; \
452 $(GREP) "recipe for target .* failed" $(BUILD_LOG) ; \
453 $(PRINTF) "=== End of repeated output ===\n" ; \
454 $(PRINTF) "Hint: Try searching the build log for the name of the first failed target.\n" ; \
455 else \
456 $(PRINTF) "No indication of failed target found.\n" ; \
457 $(PRINTF) "Hint: Try searching the build log for '] Error'.\n" ; \
458 fi
459 endef
460
461 define RotateLogFiles
462 $(RM) $(BUILD_LOG).old 2> /dev/null && \
463 $(MV) $(BUILD_LOG) $(BUILD_LOG).old 2> /dev/null || true
468 endef
469
470 define PrepareFailureLogs
471 $(RM) -r $(MAKESUPPORT_OUTPUTDIR)/failure-logs 2> /dev/null && \
472 $(MKDIR) -p $(MAKESUPPORT_OUTPUTDIR)/failure-logs
473 endef
474
475 # Remove any javac server logs and port files. This
476 # prevents a new make run to reuse the previous servers.
477 define PrepareSmartJavac
478 $(if $(SJAVAC_SERVER_DIR), \
479 $(RM) -r $(SJAVAC_SERVER_DIR) 2> /dev/null && \
480 $(MKDIR) -p $(SJAVAC_SERVER_DIR) \
481 )
482 endef
483
484 define CleanupSmartJavac
485 [ -f $(SJAVAC_SERVER_DIR)/server.port ] && $(ECHO) Stopping sjavac server && \
486 $(TOUCH) $(SJAVAC_SERVER_DIR)/server.port.stop; true
487 endef
488
489 define StartGlobalTimer
490 $(RM) -r $(BUILDTIMESDIR) 2> /dev/null && \
491 $(MKDIR) -p $(BUILDTIMESDIR) && \
492 $(call RecordStartTime,TOTAL)
493 endef
494
495 define StopGlobalTimer
496 $(call RecordEndTime,TOTAL)
497 endef
498
499 # Find all build_time_* files and print their contents in a list sorted
500 # on the name of the sub repository.
501 define ReportBuildTimes
502 $(PRINTF) $(LOG_INFO) -- \
503 "----- Build times -------\nStart %s\nEnd %s\n%s\n%s\n-------------------------\n" \
504 "`$(CAT) $(BUILDTIMESDIR)/build_time_start_TOTAL_human_readable`" \
505 "`$(CAT) $(BUILDTIMESDIR)/build_time_end_TOTAL_human_readable`" \
506 "`$(LS) $(BUILDTIMESDIR)/build_time_diff_* | $(GREP) -v _TOTAL | \
507 $(XARGS) $(CAT) | $(SORT) -k 2`" \
|
423 $(RM) -r $(TOPDIR)/build/.compare-build-temp
424 endef
425
426 # Do the actual comparison of two builds
427 define CompareBuildDoComparison
428 # Compare first and second build. Ignore any error code from compare.sh.
429 $(ECHO) "Comparing between comparison rebuild (this/new) and baseline (other/old)"
430 $(if $(COMPARE_BUILD_COMP_DIR), \
431 +(cd $(COMPARE_BUILD_OUTPUT_ROOT) && ./compare.sh $(COMPARE_BUILD_COMP_OPTS) \
432 -2dirs $(COMPARE_BUILD_OUTPUT_ROOT)/$(COMPARE_BUILD_COMP_DIR) $(OUTPUT_ROOT)/$(COMPARE_BUILD_COMP_DIR) || true), \
433 +(cd $(COMPARE_BUILD_OUTPUT_ROOT) && ./compare.sh $(COMPARE_BUILD_COMP_OPTS) \
434 -o $(OUTPUT_ROOT) || true) \
435 )
436 endef
437
438 define PrintFailureReports
439 $(if $(wildcard $(MAKESUPPORT_OUTPUTDIR)/failure-logs/*), \
440 $(PRINTF) "=== Output from failing command(s) repeated here ===\n" $(NEWLINE) \
441 $(foreach logfile, $(sort $(wildcard $(MAKESUPPORT_OUTPUTDIR)/failure-logs/*)), \
442 $(PRINTF) "* For target $(notdir $(basename $(logfile))):\n" $(NEWLINE) \
443 ($(GREP) -v -e "^Note: including file:" < $(logfile) || true) | $(HEAD) -n 12 $(NEWLINE) \
444 if test `$(WC) -l < $(logfile)` -gt 12; then \
445 $(ECHO) " ... (rest of output omitted)" ; \
446 fi $(NEWLINE) \
447 ) \
448 $(PRINTF) "=== End of repeated output ===\n" \
449 )
450 endef
451
452 define PrintBuildLogFailures
453 if $(GREP) -q "recipe for target .* failed" $(BUILD_LOG) 2> /dev/null; then \
454 $(PRINTF) "=== Make failure sequence repeated here ===\n" ; \
455 $(GREP) "recipe for target .* failed" $(BUILD_LOG) ; \
456 $(PRINTF) "=== End of repeated output ===\n" ; \
457 $(PRINTF) "Hint: Try searching the build log for the name of the first failed target.\n" ; \
458 else \
459 $(PRINTF) "No indication of failed target found.\n" ; \
460 $(PRINTF) "Hint: Try searching the build log for '] Error'.\n" ; \
461 fi
462 endef
463
464 define RotateLogFiles
465 $(RM) $(BUILD_LOG).old 2> /dev/null && \
466 $(MV) $(BUILD_LOG) $(BUILD_LOG).old 2> /dev/null || true
471 endef
472
473 define PrepareFailureLogs
474 $(RM) -r $(MAKESUPPORT_OUTPUTDIR)/failure-logs 2> /dev/null && \
475 $(MKDIR) -p $(MAKESUPPORT_OUTPUTDIR)/failure-logs
476 endef
477
478 # Remove any javac server logs and port files. This
479 # prevents a new make run to reuse the previous servers.
480 define PrepareSmartJavac
481 $(if $(SJAVAC_SERVER_DIR), \
482 $(RM) -r $(SJAVAC_SERVER_DIR) 2> /dev/null && \
483 $(MKDIR) -p $(SJAVAC_SERVER_DIR) \
484 )
485 endef
486
487 define CleanupSmartJavac
488 [ -f $(SJAVAC_SERVER_DIR)/server.port ] && $(ECHO) Stopping sjavac server && \
489 $(TOUCH) $(SJAVAC_SERVER_DIR)/server.port.stop; true
490 endef
491
492 ifeq ($(OPENJDK_BUILD_OS), windows)
493 # On windows we need to synchronize with the javac server to be able to
494 # move or remove the build output directory. Since we have no proper
495 # synchronization process, wait for a while and hope it helps. This is only
496 # used by build comparisons.
497 define WaitForSmartJavacFinish
498 $(if $(SJAVAC_SERVER_DIR), \
499 sleep 5\
500 )
501 endef
502 else
503 define WaitForSmartJavacFinish
504 endef
505 endif
506
507 define StartGlobalTimer
508 $(RM) -r $(BUILDTIMESDIR) 2> /dev/null && \
509 $(MKDIR) -p $(BUILDTIMESDIR) && \
510 $(call RecordStartTime,TOTAL)
511 endef
512
513 define StopGlobalTimer
514 $(call RecordEndTime,TOTAL)
515 endef
516
517 # Find all build_time_* files and print their contents in a list sorted
518 # on the name of the sub repository.
519 define ReportBuildTimes
520 $(PRINTF) $(LOG_INFO) -- \
521 "----- Build times -------\nStart %s\nEnd %s\n%s\n%s\n-------------------------\n" \
522 "`$(CAT) $(BUILDTIMESDIR)/build_time_start_TOTAL_human_readable`" \
523 "`$(CAT) $(BUILDTIMESDIR)/build_time_end_TOTAL_human_readable`" \
524 "`$(LS) $(BUILDTIMESDIR)/build_time_diff_* | $(GREP) -v _TOTAL | \
525 $(XARGS) $(CAT) | $(SORT) -k 2`" \
|