Skip to content

Commit

Permalink
small stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
KristofferC committed Nov 15, 2024
1 parent 177c751 commit 0374c81
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
16 changes: 7 additions & 9 deletions docs/src/apps.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@
!!! note
The app support in Pkg is currently considered experimental and some functionality and API may change.

Some inconveniences that can be encountered are:
- You need to manually make `~/.julia/bin` available on the PATH environment.
- The path to the julia executable used is the same as the one used to install the app. If this
julia installation gets removed, you might need to reinstall the app.
used by the app might not be found.
- You can only have one app installed

Apps are Julia packages that are intended to be run as a "standalone programs" (by e.g. typing the name of the app in the terminal possibly together with some arguments or flags/options).
This is in contrast to most Julia packages that are used as "libraries" and are loaded by other files or in the Julia REPL.

Expand Down Expand Up @@ -37,7 +44,6 @@ end # module
[apps]
reverse = {}
```

The empty table `{}` is to allow for giving metadata about the app but it is currently unused.

After installing this app one could run:
Expand All @@ -52,11 +58,3 @@ directly in the terminal.
## Installing Julia apps

The installation of Julia apps are similar to installing julia libraries but instead of using e.g. `Pkg.add` or `pkg> add` one uses `Pkg.Apps.add` or `pkg> app add` (`develop` is also available).

!!! note
The path `.julia/bin` has to be added to your `PATH` in order for apps to be runnable after being installed.
Pkg currently does not do this for you.

## Other information

- The app will currently run with the same Julia executable as was used to install the app.
7 changes: 5 additions & 2 deletions src/Apps/Apps.jl
Original file line number Diff line number Diff line change
Expand Up @@ -77,23 +77,24 @@ function _resolve(manifest::Manifest, pkgname=nothing)
continue
end
if pkg.path == nothing
# TODO: Just use a normal project file now since the project itself is part of the manifest now?

projectfile = joinpath(app_env_folder(), pkg.name, "Project.toml")
sourcepath = source_path(app_manifest_file(), pkg)
project = get_project(sourcepath)
project.entryfile = joinpath(sourcepath, "src", "$(project.name).jl")
mkpath(dirname(projectfile))
write_project(project, projectfile)
package_manifest_file = manifestfile_path(sourcepath; strict=true)
# Move manifest if it exists here.
if package_manifest_file !== nothing
cp(package_manifest_file, joinpath(app_env_folder(), pkg.name, basename(package_manifest_file)); force=true)
end
# Move manifest if it exists here.

Pkg.activate(joinpath(app_env_folder(), pkg.name)) do
Pkg.instantiate()
end
else
# TODO: Not hardcode Project.toml
projectfile = projectfile_path(source_path(app_manifest_file(), pkg))
end

Expand Down Expand Up @@ -345,6 +346,7 @@ function bash_shim(pkgname, julia::String, env)
$SHIM_HEADER
export JULIA_LOAD_PATH=$(repr(env))
export JULIA_DEPOT_PATH=$(repr(join(DEPOT_PATH, ':')))
exec $julia \\
--startup-file=no \\
-m $(pkgname) \\
Expand All @@ -356,6 +358,7 @@ function windows_shim(pkgname, julia::String, env)
return """
@echo off
set JULIA_LOAD_PATH=$(repr(env))
set JULIA_DEPOT_PATH=$(repr(join(DEPOT_PATH, ';')))
$julia ^
--startup-file=no ^
Expand Down

0 comments on commit 0374c81

Please sign in to comment.