@@ -14,7 +14,8 @@ import ..Artifacts: ensure_all_artifacts_installed, artifact_names, extract_all_
1414using Base. BinaryPlatforms
1515import ... Pkg
1616import ... Pkg: pkg_server
17- import .. Pkg: can_fancyprint
17+ import ... Pkg: can_fancyprint, DEFAULT_IO
18+ import .. Types: printpkgstyle
1819
1920# ########
2021# Utils #
565566function install_archive (
566567 urls:: Vector{Pair{String,Bool}} ,
567568 hash:: SHA1 ,
568- version_path:: String
569+ version_path:: String ;
570+ io:: IO = DEFAULT_IO[]
569571):: Bool
570572 tmp_objects = String[]
571573 url_success = false
@@ -574,7 +576,7 @@ function install_archive(
574576 push! (tmp_objects, path) # for cleanup
575577 url_success = true
576578 try
577- PlatformEngines. download (url, path; verbose= false )
579+ PlatformEngines. download (url, path; verbose= false , io = io )
578580 catch e
579581 e isa InterruptException && rethrow ()
580582 url_success = false
@@ -669,20 +671,22 @@ end
669671function download_artifacts (ctx:: Context , pkgs:: Vector{PackageSpec} ;
670672 platform:: AbstractPlatform = HostPlatform (),
671673 julia_version = VERSION ,
672- verbose:: Bool = false )
674+ verbose:: Bool = false ,
675+ io:: IO = DEFAULT_IO[])
673676 # Filter out packages that have no source_path()
674677 # pkg_roots = String[p for p in source_path.((ctx,), pkgs) if p !== nothing] # this runs up against inference limits?
675678 pkg_roots = String[]
676679 for pkg in pkgs
677680 p = source_path (ctx, pkg)
678681 p != = nothing && push! (pkg_roots, p)
679682 end
680- return download_artifacts (ctx, pkg_roots; platform= platform, verbose= verbose)
683+ return download_artifacts (ctx, pkg_roots; platform= platform, verbose= verbose, io = io )
681684end
682685
683686function download_artifacts (ctx:: Context , pkg_roots:: Vector{String} ;
684687 platform:: AbstractPlatform = HostPlatform (),
685- verbose:: Bool = false )
688+ verbose:: Bool = false ,
689+ io:: IO = DEFAULT_IO[])
686690 # List of Artifacts.toml files that we're going to download from
687691 artifacts_tomls = String[]
688692
@@ -776,7 +780,7 @@ function download_source(ctx::Context, pkgs::Vector{PackageSpec},
776780 url = get_archive_url_for_version (repo_url, pkg. tree_hash)
777781 url != = nothing && push! (archive_urls, url => false )
778782 end
779- success = install_archive (archive_urls, pkg. tree_hash, path)
783+ success = install_archive (archive_urls, pkg. tree_hash, path, io = ctx . io )
780784 if success && readonly
781785 set_readonly (path) # In add mode, files should be read-only
782786 end
@@ -1101,17 +1105,15 @@ function rm(ctx::Context, pkgs::Vector{PackageSpec})
11011105 println (ctx. io, " No changes" )
11021106 return
11031107 end
1104- # only declare `compat` for direct dependencies
1108+ # only declare `compat` for remaining direct or `extra` dependencies
11051109 # `julia` is always an implicit direct dependency
11061110 filter! (ctx. env. project. compat) do (name, _)
1107- name == " julia" || name in keys (ctx. env. project. deps)
1111+ name == " julia" || name in keys (ctx. env. project. deps) || name in keys (ctx . env . project . extras)
11081112 end
1109- deps_names = append! (collect (keys (ctx. env. project. deps)),
1110- collect (keys (ctx. env. project. extras)))
1113+ deps_names = union (keys (ctx. env. project. deps), keys (ctx. env. project. extras))
11111114 filter! (ctx. env. project. targets) do (target, deps)
11121115 ! isempty (filter! (in (deps_names), deps))
11131116 end
1114-
11151117 # only keep reachable manifest entires
11161118 prune_manifest (ctx)
11171119 # update project & manifest
@@ -1232,7 +1234,7 @@ function add(ctx::Context, pkgs::Vector{PackageSpec}, new_git=UUID[];
12321234
12331235 # After downloading resolutionary packages, search for (Julia)Artifacts.toml files
12341236 # and ensure they are all downloaded and unpacked as well:
1235- download_artifacts (ctx, pkgs; platform= platform)
1237+ download_artifacts (ctx, pkgs; platform= platform, io = ctx . io )
12361238
12371239 write_env (ctx. env) # write env before building
12381240 show_update (ctx)
@@ -1251,7 +1253,7 @@ function develop(ctx::Context, pkgs::Vector{PackageSpec}, new_git::Vector{UUID};
12511253 pkgs, deps_map = _resolve (ctx, pkgs, preserve)
12521254 update_manifest! (ctx, pkgs, deps_map)
12531255 new_apply = download_source (ctx, pkgs; readonly= true )
1254- download_artifacts (ctx, pkgs; platform= platform)
1256+ download_artifacts (ctx, pkgs; platform= platform, io = ctx . io )
12551257 write_env (ctx. env) # write env before building
12561258 show_update (ctx)
12571259 build_versions (ctx, union (UUID[pkg. uuid for pkg in new_apply], new_git))
@@ -1316,7 +1318,7 @@ function up(ctx::Context, pkgs::Vector{PackageSpec}, level::UpgradeLevel)
13161318 deps_map = resolve_versions! (ctx, pkgs)
13171319 update_manifest! (ctx, pkgs, deps_map)
13181320 new_apply = download_source (ctx, pkgs)
1319- download_artifacts (ctx, pkgs)
1321+ download_artifacts (ctx, pkgs; io = ctx . io )
13201322 write_env (ctx. env) # write env before building
13211323 show_update (ctx)
13221324 build_versions (ctx, union (UUID[pkg. uuid for pkg in new_apply], new_git))
@@ -1359,7 +1361,7 @@ function pin(ctx::Context, pkgs::Vector{PackageSpec})
13591361 update_manifest! (ctx, pkgs, deps_map)
13601362
13611363 new = download_source (ctx, pkgs)
1362- download_artifacts (ctx, pkgs)
1364+ download_artifacts (ctx, pkgs; io = ctx . io )
13631365 write_env (ctx. env) # write env before building
13641366 show_update (ctx)
13651367 build_versions (ctx, UUID[pkg. uuid for pkg in new])
@@ -1396,7 +1398,7 @@ function free(ctx::Context, pkgs::Vector{PackageSpec})
13961398 pkgs, deps_map = _resolve (ctx, pkgs, PRESERVE_TIERED)
13971399 update_manifest! (ctx, pkgs, deps_map)
13981400 new = download_source (ctx, pkgs)
1399- download_artifacts (ctx, new)
1401+ download_artifacts (ctx, new; io = ctx . io )
14001402 write_env (ctx. env) # write env before building
14011403 show_update (ctx)
14021404 build_versions (ctx, UUID[pkg. uuid for pkg in new])
@@ -1742,12 +1744,14 @@ print_single(ctx::Context, pkg::PackageSpec) = printstyled(ctx.io, stat_rep(pkg)
17421744
17431745is_instantiated (:: Nothing ) = false
17441746is_instantiated (x:: PackageSpec ) = x. version != VersionSpec () || is_stdlib (x. uuid)
1747+ # Compare an old and new node of the dependency graph and print a single line to summarize the change
17451748function print_diff (ctx:: Context , old:: Union{Nothing,PackageSpec} , new:: Union{Nothing,PackageSpec} )
17461749 if ! is_instantiated (old) && is_instantiated (new)
17471750 printstyled (ctx. io, " + $(stat_rep (new)) " ; color= :light_green )
17481751 elseif ! is_instantiated (new)
17491752 printstyled (ctx. io, " - $(stat_rep (old)) " ; color= :light_red )
1750- elseif is_tracking_registry (old) && is_tracking_registry (new) && new. version isa VersionNumber && old. version isa VersionNumber
1753+ elseif is_tracking_registry (old) && is_tracking_registry (new) &&
1754+ new. version isa VersionNumber && old. version isa VersionNumber && new. version != old. version
17511755 if new. version > old. version
17521756 printstyled (ctx. io, " ↑ $(stat_rep (old)) ⇒ $(stat_rep (new; name= false )) " ; color= :light_yellow )
17531757 else
0 commit comments