Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
joshday committed Jun 25, 2024
1 parent c9e65ad commit 6cc2b9b
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 6 deletions.
14 changes: 11 additions & 3 deletions src/DepotDelivery.jl
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ function sandbox(f::Function)
end

#-----------------------------------------------------------------------------# build
function build(path::String; platform = Base.BinaryPlatforms.HostPlatform())
function build(path::String; platform = Base.BinaryPlatforms.HostPlatform(), verbose=true)
depot = mktempdir()
sandbox() do
proj_file = joinpath(path, "Project.toml")
Expand All @@ -38,7 +38,7 @@ function build(path::String; platform = Base.BinaryPlatforms.HostPlatform())
name = proj["name"]
build_spec = Dict(
:datetime => Dates.now(),
:versioninfo => (buf = IOBuffer(); InteractiveUtils.versioninfo(buf); String(take!(buf))),
:versioninfo => sprint(InteractiveUtils.versioninfo),
:project_file => proj_file,
:project => proj,
:platform => string(platform)
Expand All @@ -50,7 +50,15 @@ function build(path::String; platform = Base.BinaryPlatforms.HostPlatform())

cp(path, joinpath(depot, "dev", name)) # Copy project into dev/
Pkg.activate(joinpath(depot, "dev", name))
Pkg.instantiate(; platform)
Pkg.instantiate(; platform, verbose)

# Ensure all artifacts (including lazy ones) are installed for the correct platform
manifest_file = replace(proj_file, "Project" => "Manifest")
for (uuid, entry) in Pkg.Types.read_manifest(manifest_file)
src = Pkg.dir(entry.name) # How to get the source directory of a package?
# find entry's Artifacts.toml
end


open(io -> TOML.print(io, build_spec), joinpath(depot, "config", "depot_build.toml"), "w")
open(io -> print(io, startup_script(name)), joinpath(depot, "config", "depot_startup.jl"), "w")
Expand Down
6 changes: 3 additions & 3 deletions test/TestProject/Manifest.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# This file is machine-generated - editing it directly is not advised

julia_version = "1.10.1"
julia_version = "1.10.2"
manifest_format = "2.0"
project_hash = "441ce5673294795b2311ef0d574564a3f3e7c070"
project_hash = "b6c8be5a742fdffa37a9701ccc32d1928629b873"

[[deps.ArgTools]]
uuid = "0dad84c5-d112-42e6-8d28-ef12dabb789f"
Expand Down Expand Up @@ -58,7 +58,7 @@ version = "0.17.1"

[[deps.HDF5_jll]]
deps = ["Artifacts", "CompilerSupportLibraries_jll", "JLLWrappers", "LazyArtifacts", "LibCURL_jll", "Libdl", "MPICH_jll", "MPIPreferences", "MPItrampoline_jll", "MicrosoftMPI_jll", "OpenMPI_jll", "OpenSSL_jll", "TOML", "Zlib_jll", "libaec_jll"]
git-tree-sha1 = "e4591176488495bf44d7456bd73179d87d5e6eab"
path = "/Users/joshday/.julia/dev/HDF5_jll"
uuid = "0234f1f7-429e-5d53-9886-15a909be8d59"
version = "1.14.3+1"

Expand Down
1 change: 1 addition & 0 deletions test/TestProject/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ uuid = "f3e3185f-ad83-4044-845c-222ba027dc34"

[deps]
HDF5 = "f67ccb44-e63f-5c2f-98bd-6dc0ccc4ba2f"
HDF5_jll = "0234f1f7-429e-5d53-9886-15a909be8d59"
5 changes: 5 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,8 @@ DepotDelivery.sandbox() do
@test !occursin(".julia", pathof(TestProject.HDF5))
@test !occursin(".julia", pathof(TestProject.HDF5.API.HDF5_jll))
end


depot2 = DepotDelivery.build(joinpath(@__DIR__, "TestProject"), platform = Pkg.BinaryPlatforms.Windows(:x86_64))

path = joinpath(depot2, "packages", "HDF5_jll")

0 comments on commit 6cc2b9b

Please sign in to comment.