Skip to content

Commit 67c71fa

Browse files
authored
fix: make sure that created Project.toml gets included in the appbundle (#44)
* test: rename, group packagebundler test * fix: always include the Project.toml in the appbundle create_pkg_context generates the Project.toml, but is currently called after the files have been copied over to the temporary directory that gets tarred up. This patch moves the copying of the appbundle contents after the Project.toml has been created. * fix: support relative paths in appbundle paths * docs: clarify the appbundle() docstring * Add CHANGELOG, set version to 0.1.6
1 parent ded9e62 commit 67c71fa

File tree

17 files changed

+331
-42
lines changed

17 files changed

+331
-42
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22

33
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
44

5+
## Version v0.1.6 - 2023-11-27
6+
7+
### Fixed
8+
9+
* `JuliaHub.appbundle`, when it has to generate a `Projec.toml` file, now correctly includes it in the appbundle tarball. (#44)
10+
* `JuliaHub.appbundle` now works with relative paths such as `"."`. (#44)
11+
512
## Version v0.1.5 - 2023-09-27
613

714
### Added

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "JuliaHub"
22
uuid = "bc7fa6ce-b75e-4d60-89ad-56c957190b6e"
33
authors = ["JuliaHub Inc."]
4-
version = "0.1.5"
4+
version = "0.1.6"
55

66
[deps]
77
Base64 = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"

src/PackageBundler/PackageBundler.jl

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,9 @@ The return value is used when requesting a sysimage build, in which case we have
6262
manifest's hash with the submit request.
6363
"""
6464
function bundle(dir; output="", force=false, allownoenv=false, verbose=true)::String
65+
# We'll normalize the path passed by the user, in case they pass a relative path
66+
# like `.`
67+
dir = abspath(dir)
6568
if !isdir(dir)
6669
error("'$(dir)' is not a directory")
6770
end
@@ -74,12 +77,11 @@ function bundle(dir; output="", force=false, allownoenv=false, verbose=true)::St
7477
error("file '$output_tar' already exists")
7578
end
7679
end
77-
tmp_dir = mktempdir()
78-
output_dir = joinpath(tmp_dir, name)
79-
cp(dir, output_dir; follow_symlinks=true)
8080

8181
packages_tracked_pkg_server = find_packages_tracked_pkg_server()
8282

83+
# This step may modify the user's bundle directory (`dir`) by creating a Project.toml
84+
# and Manifest.toml, if either or both are missing.
8385
ctx = create_pkg_context(dir, allownoenv)
8486
if isempty(ctx.env.manifest)
8587
@warn "No Manifest available. Resolving environment."
@@ -90,6 +92,11 @@ function bundle(dir; output="", force=false, allownoenv=false, verbose=true)::St
9092
ctx = create_pkg_context(dir, allownoenv)
9193
end
9294

95+
# We'll copy the files we want to bundle to a temporary directory. We then
96+
# add the depot and such, and finally tar all that up.
97+
tmp_dir = mktempdir()
98+
output_dir = joinpath(tmp_dir, name)
99+
cp(dir, output_dir; follow_symlinks=true)
93100
bundle_dir = joinpath(output_dir, ".bundle")
94101
mkpath(bundle_dir)
95102
# Bundle artifacts

src/jobsubmission.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -723,7 +723,9 @@ The following should be kept in mind about how appbundles are handled:
723723
724724
* The bundler looks for a Julia environment (i.e. `Project.toml` and/or `Manifest.toml` files)
725725
at the root of the directory. If the environment does not exist (i.e. the files are missing),
726-
one is created.
726+
the missing files are created. If the manifest is missing, then the environment is re-instantiated
727+
from scratch based on the contents of `Project.toml`. The generated files will also be left
728+
in the user-provided directory `directory`.
727729
728730
* Development dependencies of the environment (i.e. packages added with `pkg> develop` or
729731
`Pkg.develop()`) are also bundled up into the archive that gets submitted to JuliaHub
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
using Pkg1
2+
3+
@assert Pkg1.whoami() == "pkg1"
4+
@assert Pkg1.Pkg2.whoami() == "pkg2"
5+
@assert Pkg1.Pkg3.whoami() == "pkg3"
6+
7+
for i in 1:100
8+
println(i)
9+
sleep(1)
10+
end
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[deps]
2+
Example = "7876af07-990d-54b4-ab0e-23690620f79a"
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
using Pkg1
2+
3+
@assert Pkg1.whoami() == "pkg1"
4+
@assert Pkg1.Pkg2.whoami() == "pkg2"
5+
@assert Pkg1.Pkg3.whoami() == "pkg3"
6+
7+
for i in 1:100
8+
println(i)
9+
sleep(1)
10+
end
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
using Pkg1
2+
3+
@assert Pkg1.whoami() == "pkg1"
4+
@assert Pkg1.Pkg2.whoami() == "pkg2"
5+
@assert Pkg1.Pkg3.whoami() == "pkg3"
6+
7+
for i in 1:100
8+
println(i)
9+
sleep(1)
10+
end

0 commit comments

Comments
 (0)