Skip to content

Commit 184b03f

Browse files
authored
Merge pull request #11 from giordano/mg/touch-enable-apple
Touch a file to indicate that user accepts to download macOS SDK
2 parents 0c6cc0d + fc8a2d2 commit 184b03f

File tree

3 files changed

+14
-6
lines changed

3 files changed

+14
-6
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "BinaryBuilderBase"
22
uuid = "7f725544-6523-48cd-82d1-3fa08ff4056e"
33
authors = ["Elliot Saba <[email protected]>"]
4-
version = "0.2.1"
4+
version = "0.3.0"
55

66
[deps]
77
CodecZlib = "944b1d66-785c-5afd-91f1-9de20f533193"

src/BinaryBuilderBase.jl

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,18 +47,27 @@ function storage_dir(args::AbstractString...)
4747
end
4848
ccache_dir() = storage_dir("ccache")
4949

50+
"""
51+
enable_apple_file()
52+
53+
Return the path to file that, if exists, indicates that the user accepts to
54+
download macOS SDK. The file is automatically created when the package is
55+
loaded if the environment variable `BINARYBUILDER_AUTOMATIC_APPLE` is set to
56+
`"true"`.
57+
"""
58+
enable_apple_file() = storage_dir("enable_apple")
59+
5060
# These globals store important information such as where we're downloading
5161
# the rootfs to, and where we're unpacking it. These constants are initialized
5262
# by `__init__()` to allow for environment variable overrides from the user.
5363
storage_cache = ""
54-
automatic_apple = false
5564
use_squashfs = false
5665
allow_ecryptfs = false
5766
use_ccache = false
5867
bootstrap_list = Symbol[]
5968

6069
function __init__()
61-
global runner_override, use_squashfs, automatic_apple, allow_ecryptfs
70+
global runner_override, use_squashfs, allow_ecryptfs
6271
global use_ccache, storage_cache
6372

6473
# Pkg does this lazily; do it explicitly here.
@@ -71,7 +80,7 @@ function __init__()
7180
# If the user has signalled that they really want us to automatically
7281
# accept apple EULAs, do that.
7382
if get(ENV, "BINARYBUILDER_AUTOMATIC_APPLE", "") == "true"
74-
automatic_apple = true
83+
touch(enable_apple_file())
7584
end
7685

7786
# If the user has overridden our runner selection algorithms, honor that

src/Rootfs.jl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,8 +211,7 @@ function mount(cs::CompilerShard, build_prefix::AbstractString; verbose::Bool =
211211
# they must accept the Xcode EULA. This will be skipped if either the
212212
# environment variable BINARYBUILDER_AUTOMATIC_APPLE has been set to `true`
213213
# or if the SDK has been downloaded in the past.
214-
global automatic_apple
215-
if typeof(cs.target) <: MacOS && !automatic_apple && !macos_sdk_already_installed()
214+
if typeof(cs.target) <: MacOS && !isfile(enable_apple_file()) && !macos_sdk_already_installed()
216215
if !isinteractive()
217216
msg = strip("""
218217
This is not an interactive Julia session, so we will not prompt you

0 commit comments

Comments
 (0)