Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions docs/src/toml-files.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,15 @@ Specifiying a path or repo (+ branch) for a dependency is done in the `[sources]
These are especially useful for controlling unregistered dependencies without having to bundle a
corresponding manifest file.

Each entry in the `[sources]` section supports the following keys:

- **`url`**: The URL of the Git repository. Cannot be used with `path`.
- **`rev`**: The Git revision (branch name, tag, or commit hash) to use. Only valid with `url`.
- **`subdir`**: A subdirectory within the repository containing the package.
- **`path`**: A local filesystem path to the package. Cannot be used with `url` or `rev`.

This might in practice look something like:

```toml
[sources]
Example = {url = "https://github.com/JuliaLang/Example.jl", rev = "custom_branch"}
Expand Down
6 changes: 4 additions & 2 deletions src/API.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1148,10 +1148,12 @@ function precompile(ctx::Context, pkgs::Vector{PackageSpec}; internal_call::Bool
end

io = ctx.io
if io isa IOContext{IO}
if io isa IOContext{IO} && !isa(io.io, Base.PipeEndpoint)
# precompile does quite a bit of output and using the IOContext{IO} can cause
# some slowdowns, the important part here is to not specialize the whole
# precompile function on the io
# precompile function on the io.
# But don't unwrap the IOContext if it is a PipeEndpoint, as that would
# cause the output to lose color.
io = io.io
end

Expand Down
19 changes: 13 additions & 6 deletions src/Operations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ using Base.BinaryPlatforms
import ...Pkg
import ...Pkg: pkg_server, Registry, pathrepr, can_fancyprint, printpkgstyle, stderr_f, OFFLINE_MODE
import ...Pkg: UPDATED_REGISTRY_THIS_SESSION, RESPECT_SYSIMAGE_VERSIONS, should_autoprecompile
import ...Pkg: usable_io
import ...Pkg: usable_io, discover_repo

#########
# Utils #
Expand Down Expand Up @@ -350,7 +350,7 @@ function collect_project(pkg::Union{PackageSpec, Nothing}, path::String)
end

is_tracking_path(pkg) = pkg.path !== nothing
is_tracking_repo(pkg) = pkg.repo.source !== nothing
is_tracking_repo(pkg) = (pkg.repo.source !== nothing || pkg.repo.rev !== nothing)
is_tracking_registry(pkg) = !is_tracking_path(pkg) && !is_tracking_repo(pkg)
isfixed(pkg) = !is_tracking_registry(pkg) || pkg.pinned

Expand Down Expand Up @@ -533,7 +533,7 @@ function resolve_versions!(env::EnvCache, registries::Vector{Registry.RegistryIn
# We only fixup a JLL if the old major/minor/patch matches the new major/minor/patch
if old_v !== nothing && Base.thispatch(old_v) == Base.thispatch(vers_fix[uuid])
new_v = vers_fix[uuid]
if old_v != new_v
if old_v != new_v && haskey(compat_map[uuid], old_v)
compat_map[uuid][old_v] = compat_map[uuid][new_v]
# Note that we don't delete!(compat_map[uuid], old_v) because we want to keep the compat info around
# in case there's JLL version confusion between the sysimage pkgorigins version and manifest
Expand Down Expand Up @@ -568,6 +568,10 @@ function resolve_versions!(env::EnvCache, registries::Vector{Registry.RegistryIn
deps_fixed
else
d = Dict{String, UUID}()
if !haskey(compat_map[pkg.uuid], pkg.version)
available_versions = sort!(collect(keys(compat_map[pkg.uuid])))
pkgerror("version $(pkg.version) of package $(pkg.name) is not available. Available versions: $(join(available_versions, ", "))")
end
for (uuid, _) in compat_map[pkg.uuid][pkg.version]
d[names[uuid]] = uuid
end
Expand Down Expand Up @@ -2326,7 +2330,9 @@ function test(ctx::Context, pkgs::Vector{PackageSpec};

if should_autoprecompile()
cacheflags = Base.CacheFlags(parse(UInt8, read(`$(Base.julia_cmd()) $(flags) --eval 'show(ccall(:jl_cache_flags, UInt8, ()))'`, String)))
Pkg.precompile(; io=ctx.io, configs = flags => cacheflags)
# Don't warn about already loaded packages, since we are going to run tests in a new
# subprocess anyway.
Pkg.precompile(; io=ctx.io, warn_loaded = false, configs = flags => cacheflags)
end

printpkgstyle(ctx.io, :Testing, "Running tests...")
Expand Down Expand Up @@ -2901,10 +2907,11 @@ function status(env::EnvCache, registries::Vector{Registry.RegistryInstance}, pk
old_env = nothing
if git_diff
project_dir = dirname(env.project_file)
if !ispath(joinpath(project_dir, ".git"))
git_repo_dir = discover_repo(project_dir)
if git_repo_dir == nothing
@warn "diff option only available for environments in git repositories, ignoring."
else
old_env = git_head_env(env, project_dir)
old_env = git_head_env(env, git_repo_dir)
if old_env === nothing
@warn "could not read project from HEAD, displaying absolute status instead."
end
Expand Down
2 changes: 1 addition & 1 deletion src/REPLMode/REPLMode.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module REPLMode

using Markdown, UUIDs, Dates

import ..casesensitive_isdir, ..OFFLINE_MODE, ..linewrap, ..pathrepr
import ..OFFLINE_MODE, ..linewrap, ..pathrepr
using ..Types, ..Operations, ..API, ..Registry, ..Resolve, ..Apps
import ..stdout_f, ..stderr_f

Expand Down
Loading