@@ -2,6 +2,8 @@ export build_tarballs, autobuild, build, get_meta_json
22import GitHub: gh_get_json, DEFAULT_API
33import SHA: sha256, sha1
44using TOML, Dates, UUIDs
5+ using TimerOutputs: @timeit , print_timer
6+ using BinaryBuilderBase: BBB_TIMER, reset_bbb_timer!
57using RegistryTools
68import LibGit2
79import PkgLicenses
@@ -193,6 +195,7 @@ function build_tarballs(ARGS, src_name, src_version, sources, script,
193195 compression_format:: String = " gzip" ,
194196 kwargs... )
195197 @nospecialize
198+ reset_bbb_timer! ()
196199 # See if someone has passed in `--help`, and if so, give them the
197200 # assistance they so clearly long for
198201 if " --help" in ARGS
@@ -441,6 +444,8 @@ function build_tarballs(ARGS, src_name, src_version, sources, script,
441444 upload_to_github_releases (deploy_bin_repo, tag, products_dir; verbose= verbose)
442445 end
443446
447+ print_timer (BBB_TIMER; sortby= :firstexec )
448+ println ()
444449 return build_output_meta
445450end
446451
@@ -836,13 +841,14 @@ function autobuild(dir::AbstractString,
836841 end
837842
838843 # We must prepare our sources. Download them, hash them, etc...
839- source_files = download_source .(sources; verbose= verbose)
844+ source_files = @timeit BBB_TIMER " Downloading sources " download_source .(sources; verbose= verbose)
840845
841846 # Our build products will go into ./products
842847 out_path = joinpath (dir, " products" )
843848 try mkpath (out_path) catch ; end
844849
845850 for platform in sort (collect (platforms), by = triplet)
851+ @timeit BBB_TIMER " Building for $(triplet (platform)) " begin
846852 timer = BuildTimer ()
847853 timer. begin_setup = time ()
848854
@@ -928,7 +934,7 @@ function autobuild(dir::AbstractString,
928934 """
929935
930936 dest_prefix = Prefix (BinaryBuilderBase. destdir (prefix. path, concrete_platform))
931- did_succeed = with_logfile (dest_prefix, " $(src_name) .log" ; subdir= src_name) do io
937+ did_succeed = @timeit BBB_TIMER " Running build script " with_logfile (dest_prefix, " $(src_name) .log" ; subdir= src_name) do io
932938 # Let's start the presentations with BinaryBuilder.jl
933939 write (io, " BinaryBuilder.jl version: $(get_bb_version ()) \n\n " )
934940 # Get the list of compilers...
@@ -959,6 +965,7 @@ function autobuild(dir::AbstractString,
959965 # Run an audit of the prefix to ensure it is properly relocatable
960966 timer. begin_audit = time ()
961967 if ! skip_audit
968+ @timeit BBB_TIMER " Auditing build artifacts" begin
962969 audit_result = audit (dest_prefix, src_name;
963970 platform= platform, verbose= verbose,
964971 has_csl = any (getname .(dependencies) .== " CompilerSupportLibraries_jll" ),
@@ -971,6 +978,7 @@ function autobuild(dir::AbstractString,
971978 """ , ' \n ' => ' ' )
972979 error (strip (msg))
973980 end
981+ end # @timeit audit
974982 end
975983 timer. end_audit = time ()
976984
@@ -1075,6 +1083,7 @@ function autobuild(dir::AbstractString,
10751083 rm (build_path; recursive= true )
10761084 end
10771085 verbose && @info " $(timer) "
1086+ end # @timeit platform
10781087 end
10791088
10801089 # Return our product hashes
@@ -1473,11 +1482,11 @@ function build_jll_package(src_name::String,
14731482 libgfortran_version_mapping = BinaryPlatforms.libgfortran_version_mapping
14741483 cxxstring_abi_mapping = BinaryPlatforms.cxxstring_abi_mapping
14751484 libstdcxx_version_mapping = BinaryPlatforms.libstdcxx_version_mapping
1476-
1485+
14771486 # Helper function to collapse dictionary of mappings down into a regex of
14781487 # named capture groups joined by "|" operators
14791488 c(mapping) = string("(",join(["(?<$k>$v)" for (k, v) in mapping], "|"), ")")
1480-
1489+
14811490 # We're going to build a mondo regex here to parse everything:
14821491 triplet_regex = Regex(string(
14831492 "^",
@@ -1494,7 +1503,7 @@ function build_jll_package(src_name::String,
14941503 "(?<tags>(?:-[^-]+\\ +[^-]+)*)?",
14951504 "\$ ",
14961505 ))
1497-
1506+
14981507 m = match(triplet_regex, triplet)
14991508 if m !== nothing
15001509 # Helper function to find the single named field within the giant regex
@@ -1517,7 +1526,7 @@ function build_jll_package(src_name::String,
15171526 end
15181527 end
15191528 end
1520-
1529+
15211530 # Extract the information we're interested in:
15221531 arch = get_field(m, arch_mapping)
15231532 os = get_field(m, os_mapping)
@@ -1534,7 +1543,7 @@ function build_jll_package(src_name::String,
15341543 return map(v -> Symbol(v[1]) => v[2], split.(tag_fields, "+"))
15351544 end
15361545 tags = split_tags(m["tags"])
1537-
1546+
15381547 # Special parsing of os version number, if any exists
15391548 function extract_os_version(os_name, pattern)
15401549 m_osvn = match(pattern, m[os_name])
@@ -1553,7 +1562,7 @@ function build_jll_package(src_name::String,
15531562 if os == "openbsd"
15541563 os_version = extract_os_version("openbsd", r".*openbsd([\d .]+)"sa)
15551564 end
1556-
1565+
15571566 return Platform(
15581567 arch, os;
15591568 validate_strict,
0 commit comments