147
147
148
148
# Provide some convenience calls
149
149
for f in (:develop , :add , :rm , :up , :pin , :free , :test , :build , :status , :why , :precompile )
150
+ f_under = Symbol (" _" , f)
150
151
@eval begin
151
152
$ f (pkg:: Union{AbstractString, PackageSpec} ; kwargs... ) = $ f ([pkg]; kwargs... )
152
153
$ f (pkgs:: Vector{<:AbstractString} ; kwargs... ) = $ f ([PackageSpec (pkg) for pkg in pkgs]; kwargs... )
@@ -161,12 +162,12 @@ for f in (:develop, :add, :rm, :up, :pin, :free, :test, :build, :status, :why, :
161
162
kwargs = merge ((;kwargs... ), (:io => io,))
162
163
pkgs = deepcopy (pkgs) # don't mutate input
163
164
foreach (handle_package_input!, pkgs)
164
- ret = $ f (ctx, pkgs; kwargs... )
165
+ ret = $ f_under (ctx, pkgs; kwargs... ) # note the underscore for private entrypoint
165
166
$ (f in (:up , :pin , :free , :build )) && Pkg. _auto_precompile (ctx)
166
167
$ (f in (:up , :pin , :free , :rm )) && Pkg. _auto_gc (ctx)
167
168
return ret
168
169
end
169
- $ f (ctx:: Context ; kwargs... ) = $ f (ctx, PackageSpec[]; kwargs... )
170
+ $ f_under (ctx:: Context ; kwargs... ) = $ f_under (ctx, PackageSpec[]; kwargs... )
170
171
function $f (; name:: Union{Nothing,AbstractString} = nothing , uuid:: Union{Nothing,String,UUID} = nothing ,
171
172
version:: Union{VersionNumber, String, VersionSpec, Nothing} = nothing ,
172
173
url= nothing , rev= nothing , path= nothing , mode= PKGMODE_PROJECT, subdir= nothing , kwargs... )
@@ -218,7 +219,7 @@ function update_source_if_set(project, pkg)
218
219
end
219
220
end
220
221
221
- function develop (ctx:: Context , pkgs:: Vector{PackageSpec} ; shared:: Bool = true ,
222
+ function _develop (ctx:: Context , pkgs:: Vector{PackageSpec} ; shared:: Bool = true ,
222
223
preserve:: PreserveLevel = Operations. default_preserve (), platform:: AbstractPlatform = HostPlatform (), kwargs... )
223
224
require_not_empty (pkgs, :develop )
224
225
Context! (ctx; kwargs... )
@@ -264,7 +265,7 @@ function develop(ctx::Context, pkgs::Vector{PackageSpec}; shared::Bool=true,
264
265
return
265
266
end
266
267
267
- function add (ctx:: Context , pkgs:: Vector{PackageSpec} ; preserve:: PreserveLevel = Operations. default_preserve (),
268
+ function _add (ctx:: Context , pkgs:: Vector{PackageSpec} ; preserve:: PreserveLevel = Operations. default_preserve (),
268
269
platform:: AbstractPlatform = HostPlatform (), target:: Symbol = :deps , allow_autoprecomp:: Bool = true , kwargs... )
269
270
require_not_empty (pkgs, :add )
270
271
Context! (ctx; kwargs... )
@@ -318,7 +319,7 @@ function add(ctx::Context, pkgs::Vector{PackageSpec}; preserve::PreserveLevel=Op
318
319
return
319
320
end
320
321
321
- function rm (ctx:: Context , pkgs:: Vector{PackageSpec} ; mode= PKGMODE_PROJECT, all_pkgs:: Bool = false , kwargs... )
322
+ function _rm (ctx:: Context , pkgs:: Vector{PackageSpec} ; mode= PKGMODE_PROJECT, all_pkgs:: Bool = false , kwargs... )
322
323
Context! (ctx; kwargs... )
323
324
if all_pkgs
324
325
! isempty (pkgs) && pkgerror (" cannot specify packages when operating on all packages" )
@@ -364,7 +365,7 @@ function append_all_pkgs!(pkgs, ctx, mode)
364
365
return
365
366
end
366
367
367
- function up (ctx:: Context , pkgs:: Vector{PackageSpec} ;
368
+ function _up (ctx:: Context , pkgs:: Vector{PackageSpec} ;
368
369
level:: UpgradeLevel = UPLEVEL_MAJOR, mode:: PackageMode = PKGMODE_PROJECT,
369
370
preserve:: Union{Nothing,PreserveLevel} = isempty (pkgs) ? nothing : PRESERVE_ALL,
370
371
update_registry:: Bool = true ,
@@ -395,12 +396,12 @@ function up(ctx::Context, pkgs::Vector{PackageSpec};
395
396
end
396
397
397
398
resolve (; io:: IO = stderr_f (), kwargs... ) = resolve (Context (;io); kwargs... )
398
- function resolve (ctx:: Context ; skip_writing_project:: Bool = false , kwargs... )
399
- up (ctx; level= UPLEVEL_FIXED, mode= PKGMODE_MANIFEST, update_registry= false , skip_writing_project, kwargs... )
399
+ function _resolve (ctx:: Context ; skip_writing_project:: Bool = false , kwargs... )
400
+ _up (ctx; level= UPLEVEL_FIXED, mode= PKGMODE_MANIFEST, update_registry= false , skip_writing_project, kwargs... )
400
401
return nothing
401
402
end
402
403
403
- function pin (ctx:: Context , pkgs:: Vector{PackageSpec} ; all_pkgs:: Bool = false , kwargs... )
404
+ function _pin (ctx:: Context , pkgs:: Vector{PackageSpec} ; all_pkgs:: Bool = false , kwargs... )
404
405
Context! (ctx; kwargs... )
405
406
if all_pkgs
406
407
! isempty (pkgs) && pkgerror (" cannot specify packages when operating on all packages" )
@@ -435,7 +436,7 @@ function pin(ctx::Context, pkgs::Vector{PackageSpec}; all_pkgs::Bool=false, kwar
435
436
return
436
437
end
437
438
438
- function free (ctx:: Context , pkgs:: Vector{PackageSpec} ; all_pkgs:: Bool = false , kwargs... )
439
+ function _free (ctx:: Context , pkgs:: Vector{PackageSpec} ; all_pkgs:: Bool = false , kwargs... )
439
440
Context! (ctx; kwargs... )
440
441
if all_pkgs
441
442
! isempty (pkgs) && pkgerror (" cannot specify packages when operating on all packages" )
@@ -462,7 +463,7 @@ function free(ctx::Context, pkgs::Vector{PackageSpec}; all_pkgs::Bool=false, kwa
462
463
return
463
464
end
464
465
465
- function test (ctx:: Context , pkgs:: Vector{PackageSpec} ;
466
+ function _test (ctx:: Context , pkgs:: Vector{PackageSpec} ;
466
467
coverage= false , test_fn= nothing ,
467
468
julia_args:: Union{Cmd, AbstractVector{<:AbstractString}} = ` ` ,
468
469
test_args:: Union{Cmd, AbstractVector{<:AbstractString}} = ` ` ,
@@ -526,7 +527,11 @@ admin privileges depending on the setup).
526
527
527
528
Use verbose mode (`verbose=true`) for detailed output.
528
529
"""
529
- function gc (ctx:: Context = Context (); collect_delay:: Period = Day (7 ), verbose= false , force= false , kwargs... )
530
+ function gc (; collect_delay:: Period = Day (7 ), verbose= false , force= false , kwargs... )
531
+ ctx = Context ()
532
+ return _gc (ctx; collect_delay, verbose, force, kwargs... )
533
+ end
534
+ function _gc (ctx:: Context ; collect_delay:: Period = Day (7 ), verbose:: Bool = false , force:: Bool = false , kwargs... )
530
535
Context! (ctx; kwargs... )
531
536
env = ctx. env
532
537
@@ -1097,7 +1102,7 @@ function gc(ctx::Context=Context(); collect_delay::Period=Day(7), verbose=false,
1097
1102
return
1098
1103
end
1099
1104
1100
- function build (ctx:: Context , pkgs:: Vector{PackageSpec} ; verbose= false , kwargs... )
1105
+ function _build (ctx:: Context , pkgs:: Vector{PackageSpec} ; verbose= false , kwargs... )
1101
1106
Context! (ctx; kwargs... )
1102
1107
1103
1108
if isempty (pkgs)
@@ -1134,7 +1139,7 @@ function get_or_make_pkgspec(pkgspecs::Vector{PackageSpec}, ctx::Context, uuid)
1134
1139
end
1135
1140
end
1136
1141
1137
- function precompile (ctx:: Context , pkgs:: Vector{PackageSpec} ; internal_call:: Bool = false ,
1142
+ function _precompile (ctx:: Context , pkgs:: Vector{PackageSpec} ; internal_call:: Bool = false ,
1138
1143
strict:: Bool = false , warn_loaded = true , already_instantiated = false , timing:: Bool = false ,
1139
1144
_from_loading:: Bool = false , configs:: Union{Base.Precompilation.Config,Vector{Base.Precompilation.Config}} = (` ` => Base. CacheFlags ()),
1140
1145
workspace:: Bool = false , kwargs... )
@@ -1199,7 +1204,7 @@ function instantiate(ctx::Context; manifest::Union{Bool, Nothing}=nothing,
1199
1204
if (! isfile (ctx. env. manifest_file) && manifest === nothing ) || manifest == false
1200
1205
# given no manifest exists, only allow invoking a registry update if there are project deps
1201
1206
allow_registry_update = isfile (ctx. env. project_file) && ! isempty (ctx. env. project. deps)
1202
- up (ctx; update_registry = update_registry && allow_registry_update)
1207
+ _up (ctx; update_registry = update_registry && allow_registry_update)
1203
1208
allow_autoprecomp && Pkg. _auto_precompile (ctx, already_instantiated = true )
1204
1209
return
1205
1210
end
@@ -1289,7 +1294,7 @@ end
1289
1294
1290
1295
@deprecate status (mode:: PackageMode ) status (mode= mode)
1291
1296
1292
- function status (ctx:: Context , pkgs:: Vector{PackageSpec} ; diff:: Bool = false , mode= PKGMODE_PROJECT, workspace:: Bool = false , outdated:: Bool = false , compat:: Bool = false , extensions:: Bool = false , io:: IO = stdout_f ())
1297
+ function _status (ctx:: Context , pkgs:: Vector{PackageSpec} ; diff:: Bool = false , mode= PKGMODE_PROJECT, workspace:: Bool = false , outdated:: Bool = false , compat:: Bool = false , extensions:: Bool = false , io:: IO = stdout_f ())
1293
1298
if compat
1294
1299
diff && pkgerror (" Compat status has no `diff` mode" )
1295
1300
outdated && pkgerror (" Compat status has no `outdated` mode" )
@@ -1392,7 +1397,7 @@ function activate(f::Function, new_project::AbstractString)
1392
1397
end
1393
1398
end
1394
1399
1395
- function compat (ctx:: Context , pkg:: String , compat_str:: Union{Nothing,String} ; io = nothing , kwargs... )
1400
+ function _compat (ctx:: Context , pkg:: String , compat_str:: Union{Nothing,String} ; io = nothing , kwargs... )
1396
1401
io = something (io, ctx. io)
1397
1402
pkg = pkg == " Julia" ? " julia" : pkg
1398
1403
isnothing (compat_str) || (compat_str = string (strip (compat_str, ' "' )))
@@ -1429,7 +1434,7 @@ compat(;kwargs...) = compat(Context(); kwargs...)
1429
1434
# why #
1430
1435
# ######
1431
1436
1432
- function why (ctx:: Context , pkgs:: Vector{PackageSpec} ; io:: IO , workspace:: Bool = false , kwargs... )
1437
+ function _why (ctx:: Context , pkgs:: Vector{PackageSpec} ; io:: IO , workspace:: Bool = false , kwargs... )
1433
1438
require_not_empty (pkgs, :why )
1434
1439
1435
1440
manifest_resolve! (ctx. env. manifest, pkgs)
0 commit comments