@@ -13,6 +13,9 @@ export create_artifact, artifact_exists, artifact_path, remove_artifact, verify_
1313 artifact_meta, artifact_hash, bind_artifact!, unbind_artifact!, download_artifact,
1414 find_artifacts_toml, ensure_artifact_installed, @artifact_str , archive_artifact
1515
16+ # keep in sync with Base.project_names and Base.manifest_names
17+ const artifact_names = (" JuliaArtifacts.toml" , " Artifacts.toml" )
18+
1619const ARTIFACTS_DIR_OVERRIDE = Ref {Union{String,Nothing}} (nothing )
1720"""
1821 with_artifacts_directory(f::Function, artifacts_dir::String)
@@ -370,12 +373,12 @@ returns the `Platform` object that this entry specifies. Returns `nothing` on e
370373"""
371374function unpack_platform (entry:: Dict , name:: String , artifacts_toml:: String )
372375 if ! haskey (entry, " os" )
373- @error (" Invalid Artifacts.toml at '$(artifacts_toml) ': platform-specific artifact entry '$name ' missing 'os' key" )
376+ @error (" Invalid artifacts file at '$(artifacts_toml) ': platform-specific artifact entry '$name ' missing 'os' key" )
374377 return nothing
375378 end
376379
377380 if ! haskey (entry, " arch" )
378- @error (" Invalid Artifacts.toml at '$(artifacts_toml) ': platform-specific artifact entrty '$name ' missing 'arch' key" )
381+ @error (" Invalid artifacts file at '$(artifacts_toml) ': platform-specific artifact entrty '$name ' missing 'arch' key" )
379382 return nothing
380383 end
381384
439442 load_artifacts_toml(artifacts_toml::String;
440443 pkg_uuid::Union{UUID,Nothing}=nothing)
441444
442- Loads an `Artifacts.toml` file from disk. If `pkg_uuid` is set to the `UUID` of the
445+ Loads an `(Julia) Artifacts.toml` file from disk. If `pkg_uuid` is set to the `UUID` of the
443446owning package, UUID/name overrides stored in a depot `Overrides.toml` will be resolved.
444447"""
445448function load_artifacts_toml (artifacts_toml:: String ;
480483 pkg_uuid::Union{Base.UUID,Nothing}=nothing)
481484
482485Get metadata about a given artifact (identified by name) stored within the given
483- `Artifacts.toml` file. If the artifact is platform-specific, use `platform` to choose the
486+ `(Julia) Artifacts.toml` file. If the artifact is platform-specific, use `platform` to choose the
484487most appropriate mapping. If none is found, return `nothing`.
485488"""
486489function artifact_meta (name:: String , artifacts_toml:: String ;
@@ -508,13 +511,13 @@ function artifact_meta(name::String, artifact_dict::Dict, artifacts_toml::String
508511 meta = select_platform (dl_dict, platform)
509512 # If it's NOT a dict, complain
510513 elseif ! isa (meta, Dict)
511- @error (" Invalid Artifacts.toml at $(artifacts_toml) : artifact '$name ' malformed, must be array or dict!" )
514+ @error (" Invalid artifacts file at $(artifacts_toml) : artifact '$name ' malformed, must be array or dict!" )
512515 return nothing
513516 end
514517
515518 # This is such a no-no, we are going to call it out right here, right now.
516519 if meta != nothing && ! haskey (meta, " git-tree-sha1" )
517- @error (" Invalid Artifacts.toml at $(artifacts_toml) : artifact '$name ' contains no `git-tree-sha1`!" )
520+ @error (" Invalid artifacts file at $(artifacts_toml) : artifact '$name ' contains no `git-tree-sha1`!" )
518521 return nothing
519522 end
520523
546549 lazy::Bool = false,
547550 force::Bool = false)
548551
549- Writes a mapping of `name` -> `hash` within the given `Artifacts.toml` file. If
552+ Writes a mapping of `name` -> `hash` within the given `(Julia) Artifacts.toml` file. If
550553`platform` is not `nothing`, this artifact is marked as platform-specific, and will be
551554a multi-mapping. It is valid to bind multiple artifacts with the same name, but
552555different `platform`s and `hash`'es within the same `artifacts_toml`. If `force` is set
@@ -566,7 +569,7 @@ function bind_artifact!(artifacts_toml::String, name::String, hash::SHA1;
566569 # First, check to see if this artifact is already bound:
567570 if isfile (artifacts_toml)
568571 artifact_dict = parse_toml (artifacts_toml)
569-
572+
570573 if ! force && haskey (artifact_dict, name)
571574 meta = artifact_dict[name]
572575 if ! isa (meta, Array)
633636"""
634637 unbind_artifact!(artifacts_toml::String, name::String; platform = nothing)
635638
636- Unbind the given `name` from an `Artifacts.toml` file. Silently fails if no such binding
637- exists within the file.
639+ Unbind the given `name` from an `(Julia) Artifacts.toml` file.
640+ Silently fails if no such binding exists within the file.
638641"""
639642function unbind_artifact! (artifacts_toml:: String , name:: String ;
640643 platform:: Union{Platform,Nothing} = nothing )
730733 find_artifacts_toml(path::String)
731734
732735Given the path to a `.jl` file, (such as the one returned by `__source__.file` in a macro
733- context), find the `Artifacts.toml` that is contained within the containing project (if it
736+ context), find the `(Julia) Artifacts.toml` that is contained within the containing project (if it
734737exists), otherwise return `nothing`.
735738"""
736739function find_artifacts_toml (path:: String )
@@ -740,25 +743,22 @@ function find_artifacts_toml(path::String)
740743
741744 # Run until we hit the root directory.
742745 while dirname (path) != path
743- # Also check for `JuliaArtifacts.toml`, preferring that as it's more specific
744- artifacts_toml_path = joinpath (path, " JuliaArtifacts.toml" )
745- if isfile (artifacts_toml_path)
746- return abspath (artifacts_toml_path)
747- end
748-
749- # Does this `Artifacts.toml` exist?
750- artifacts_toml_path = joinpath (path, " Artifacts.toml" )
751- if isfile (artifacts_toml_path)
752- return abspath (artifacts_toml_path)
746+ for f in artifact_names
747+ artifacts_toml_path = joinpath (path, f)
748+ if isfile (artifacts_toml_path)
749+ return abspath (artifacts_toml_path)
750+ end
753751 end
754752
755- # Does a `Project.toml` file exist here, in the absence of an Artifacts.toml?
753+ # Does a `(Julia) Project.toml` file exist here, in the absence of an Artifacts.toml?
756754 # If so, stop the search as we've probably hit the top-level of this package,
757755 # and we don't want to escape out into the larger filesystem.
758- if isfile (joinpath (path, " Project.toml" ))
759- return nothing
756+ for f in Base. project_names
757+ if isfile (joinpath (path, f))
758+ return nothing
759+ end
760760 end
761-
761+
762762 # Move up a directory
763763 path = dirname (path)
764764 end
@@ -796,7 +796,7 @@ function ensure_artifact_installed(name::String, meta::Dict, artifacts_toml::Str
796796 if ! haskey (meta, " download" )
797797 error (" Cannot automatically install '$(name) '; no download section in '$(artifacts_toml) '" )
798798 end
799-
799+
800800 # Attempt to download from all sources
801801 for entry in meta[" download" ]
802802 url = entry[" url" ]
818818 pkg_uuid = nothing,
819819 include_lazy = false)
820820
821- Installs all non-lazy artifacts from a given `Artifacts.toml` file. `package_uuid` must
821+ Installs all non-lazy artifacts from a given `(Julia) Artifacts.toml` file. `package_uuid` must
822822be provided to properly support overrides from `Overrides.toml` entries in depots.
823823
824824If `include_lazy` is set to `true`, then lazy packages will be installed as well.
@@ -855,14 +855,14 @@ end
855855
856856Macro that is used to automatically ensure an artifact is installed, and return its
857857location on-disk. Automatically looks the artifact up by name in the project's
858- `Artifacts.toml` file. Throws an error on inability to install the requested artifact.
858+ `(Julia) Artifacts.toml` file. Throws an error on inability to install the requested artifact.
859859"""
860860macro artifact_str (name)
861861 return quote
862862 local artifacts_toml = $ (find_artifacts_toml)($ (string (__source__. file)))
863863 if artifacts_toml === nothing
864864 error (string (
865- " Cannot locate 'Artifacts.toml' file when attempting to use artifact '" ,
865+ " Cannot locate '(Julia) Artifacts.toml' file when attempting to use artifact '" ,
866866 $ (esc (name)),
867867 " ' in '" ,
868868 $ (esc (__module__)),
0 commit comments