diff --git a/src/AutoBuild.jl b/src/AutoBuild.jl index 9e00161a4..07ae39ae1 100644 --- a/src/AutoBuild.jl +++ b/src/AutoBuild.jl @@ -140,6 +140,23 @@ function build_tarballs(ARGS, src_name, src_version, sources, script, # Are we skipping building and just outputting JSON? meta_json, meta_json_file = extract_flag!(ARGS, "--meta-json") + # Output settings. If provided by the user, we need to resolve the relative paths. + output, output_path = extract_flag!(ARGS, "--output", pwd()) + if output + output_path = abspath(joinpath(pwd(), output_path)) + end + output_bin, output_bin_path = extract_flag!(ARGS, "--output-bin", joinpath(output_path, "products")) + if output_bin + output_bin_path = abspath(joinpath(pwd(), output_bin_path)) + end + # TODO: change the default of output_jll_path to joinpath(output_path, "$(src_name)_jll") + output_jll, output_jll_path = extract_flag!(ARGS, "--output-jll", joinpath(Pkg.devdir(), "$(src_name)_jll")) + if output_jll + output_jll_path = abspath(joinpath(pwd(), output_jll_path)) + end + # Shove the _jll path into `kwargs` so that we are passing it along + kwargs = (; kwargs..., code_dir = output_jll_path) + # This sets whether we are going to deploy our binaries/wrapper code to GitHub releases deploy, deploy_repo = extract_flag!(ARGS, "--deploy", "JuliaBinaryWrappers/$(src_name)_jll.jl") deploy_bin, deploy_bin_repo = extract_flag!(ARGS, "--deploy-bin", "JuliaBinaryWrappers/$(src_name)_jll.jl") @@ -170,13 +187,6 @@ function build_tarballs(ARGS, src_name, src_version, sources, script, error("Cannot register with a local deployment!") end - if deploy_bin || deploy_jll - code_dir = joinpath(Pkg.devdir(), "$(src_name)_jll") - - # Shove them into `kwargs` so that we are conditionally passing them along - kwargs = (; kwargs..., code_dir = code_dir) - end - # If --meta-json was passed, error out if any confusing options were passed meta_json_stream = nothing if meta_json @@ -218,7 +228,7 @@ function build_tarballs(ARGS, src_name, src_version, sources, script, # We need to make sure that the JLL repo at least exists, so that we can deploy binaries to it # even if we're not planning to register things to it today. if deploy_jll_repo != "local" - init_jll_package(src_name, code_dir, deploy_jll_repo) + init_jll_package(src_name, output_jll_path, deploy_jll_repo) end end @@ -265,9 +275,10 @@ function build_tarballs(ARGS, src_name, src_version, sources, script, # Build the given platforms using the given sources build_output_meta = autobuild( # Controls output product placement, mount directory placement, etc... - pwd(), + output_path, args...; + products_dir = output_bin_path, # Flags verbose=verbose, @@ -287,10 +298,10 @@ function build_tarballs(ARGS, src_name, src_version, sources, script, # The location the binaries will be available from bin_path = "https://github.com/$(deploy_jll_repo)/releases/download/$(tag)" - build_jll_package(src_name, build_version, sources, code_dir, build_output_meta, + build_jll_package(src_name, build_version, sources, output_jll_path, build_output_meta, dependencies, bin_path; verbose=verbose, extra_kwargs...) if deploy_jll_repo != "local" - push_jll_package(src_name, build_version; code_dir=code_dir, deploy_repo=deploy_jll_repo) + push_jll_package(src_name, build_version; code_dir=output_jll_path, deploy_repo=deploy_jll_repo) end if register if verbose @@ -298,7 +309,7 @@ function build_tarballs(ARGS, src_name, src_version, sources, script, end register_jll(src_name, build_version, dependencies, julia_compat; - deploy_repo=deploy_jll_repo, code_dir=code_dir) + deploy_repo=deploy_jll_repo, code_dir=output_jll_path) end end @@ -307,7 +318,7 @@ function build_tarballs(ARGS, src_name, src_version, sources, script, if verbose @info("Deploying binaries to release $(tag) on $(deploy_bin_repo) via `ghr`...") end - upload_to_github_releases(deploy_bin_repo, tag, joinpath(pwd(), "products"); verbose=verbose) + upload_to_github_releases(deploy_bin_repo, tag, output_bin_path; verbose=verbose) end return build_output_meta @@ -580,6 +591,8 @@ here are the relevant actors, broken down in brief: * `code_dir`: sets where autogenerated JLL packages will be put. +* `products_dir`: sets the directory where generated tarballs get put. + * `require_license` enables a special audit pass that requires licenses to be installed by all packages. """ @@ -597,6 +610,7 @@ function autobuild(dir::AbstractString, ignore_audit_errors::Bool = true, autofix::Bool = true, code_dir::Union{String,Nothing} = nothing, + products_dir::String = joinpath(dir, "products"), require_license::Bool = true, kwargs...) @nospecialize @@ -633,9 +647,8 @@ function autobuild(dir::AbstractString, # We must prepare our sources. Download them, hash them, etc... source_files = download_source.(sources; verbose=verbose) - # Our build products will go into ./products - out_path = joinpath(dir, "products") - try mkpath(out_path) catch; end + # Our build products will go into products_dir (usually ./products) + try mkpath(products_dir) catch; end for platform in sort(collect(platforms), by = triplet) # We build in a platform-specific directory @@ -801,7 +814,7 @@ function autobuild(dir::AbstractString, # Once we're built up, go ahead and package this dest_prefix out tarball_path, tarball_hash, git_hash = package( dest_prefix, - joinpath(out_path, src_name), + joinpath(products_dir, src_name), src_version; platform=platform, verbose=verbose,