From 52de3bb240667a5d98e11c471d0e5c67ca95b57d Mon Sep 17 00:00:00 2001 From: Gabriel Gerlero Date: Mon, 26 Jun 2023 01:43:54 -0300 Subject: [PATCH 1/5] Take postcreate.jl from julia-vscode/julia-devcontainer --- src/julia/postcreate.jl | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 src/julia/postcreate.jl diff --git a/src/julia/postcreate.jl b/src/julia/postcreate.jl new file mode 100644 index 0000000..f22c29a --- /dev/null +++ b/src/julia/postcreate.jl @@ -0,0 +1,26 @@ +#!/usr/local/julia/bin/julia + +using Pkg + +function has_manifest_file() + return isfile(joinpath(pwd(),"Manifest.toml")) || isfile(joinpath(pwd(),"JuliaManifest.toml")) +end + +function has_project_file() + return isfile(joinpath(pwd(),"Project.toml")) || isfile(joinpath(pwd(),"JuliaProject.toml")) +end + +function is_package() + return has_project_file() && !has_manifest_file() +end + +function is_app() + return has_project_file() && has_manifest_file() +end + +if is_app() + Pkg.activate(pwd()) + Pkg.instantiate() +elseif is_package() + Pkg.develop(path=pwd()) +end From 6073f56151e1ea804fa47019e07d90a71b287868 Mon Sep 17 00:00:00 2001 From: Gabriel Gerlero Date: Mon, 26 Jun 2023 01:44:44 -0300 Subject: [PATCH 2/5] Fix shebang --- src/julia/postcreate.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/julia/postcreate.jl b/src/julia/postcreate.jl index f22c29a..4d356bd 100644 --- a/src/julia/postcreate.jl +++ b/src/julia/postcreate.jl @@ -1,4 +1,4 @@ -#!/usr/local/julia/bin/julia +#!/usr/bin/env julia using Pkg From 55ebb15fba576764e381ce3ad998c7910357c00f Mon Sep 17 00:00:00 2001 From: Gabriel Gerlero Date: Mon, 26 Jun 2023 01:52:23 -0300 Subject: [PATCH 3/5] Add postCreateCommand to feature --- src/julia/devcontainer-feature.json | 1 + src/julia/install.sh | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/src/julia/devcontainer-feature.json b/src/julia/devcontainer-feature.json index 9c2b406..21dde9f 100644 --- a/src/julia/devcontainer-feature.json +++ b/src/julia/devcontainer-feature.json @@ -18,6 +18,7 @@ "installsAfter": [ "ghcr.io/devcontainers/features/common-utils" ], + "postCreateCommand": ["/usr/local/julia-devcontainer-features/postcreate.jl"], "customizations": { "vscode": { "extensions": [ diff --git a/src/julia/install.sh b/src/julia/install.sh index cc575e5..fb0f13d 100755 --- a/src/julia/install.sh +++ b/src/julia/install.sh @@ -57,4 +57,11 @@ su "${USERNAME}" -c "curl -fsSL https://install.julialang.org | sh -s -- --yes - # Clean up cleanup_apt +# Copy postcreate.jl into the container +echo "Copying postcreate.jl into the container..." +SCRIPT_DIR=/usr/local/julia-devcontainer-features/ +mkdir -p "${SCRIPT_DIR}" +cp postcreate.jl "${SCRIPT_DIR}/" +chmod +x "${SCRIPT_DIR}/postcreate.jl" + echo "Done!" From b4bf791eaed7719b7223ed8389669b3a8830face Mon Sep 17 00:00:00 2001 From: Gabriel Gerlero Date: Mon, 26 Jun 2023 02:33:56 -0300 Subject: [PATCH 4/5] Incorporate suggested changes --- src/julia/devcontainer-feature.json | 4 +++- src/julia/install.sh | 1 - src/julia/postcreate.jl | 0 3 files changed, 3 insertions(+), 2 deletions(-) mode change 100644 => 100755 src/julia/postcreate.jl diff --git a/src/julia/devcontainer-feature.json b/src/julia/devcontainer-feature.json index 21dde9f..506dc35 100644 --- a/src/julia/devcontainer-feature.json +++ b/src/julia/devcontainer-feature.json @@ -18,7 +18,9 @@ "installsAfter": [ "ghcr.io/devcontainers/features/common-utils" ], - "postCreateCommand": ["/usr/local/julia-devcontainer-features/postcreate.jl"], + "postCreateCommand": { + "julia-activate": "/usr/local/julia-devcontainer-features/postcreate.jl" + }, "customizations": { "vscode": { "extensions": [ diff --git a/src/julia/install.sh b/src/julia/install.sh index fb0f13d..e9626ab 100755 --- a/src/julia/install.sh +++ b/src/julia/install.sh @@ -62,6 +62,5 @@ echo "Copying postcreate.jl into the container..." SCRIPT_DIR=/usr/local/julia-devcontainer-features/ mkdir -p "${SCRIPT_DIR}" cp postcreate.jl "${SCRIPT_DIR}/" -chmod +x "${SCRIPT_DIR}/postcreate.jl" echo "Done!" diff --git a/src/julia/postcreate.jl b/src/julia/postcreate.jl old mode 100644 new mode 100755 From 94d752ef033ed828d03b58707e76e62c7468ea0a Mon Sep 17 00:00:00 2001 From: Gabriel Gerlero Date: Mon, 26 Jun 2023 02:35:42 -0300 Subject: [PATCH 5/5] Bump minor version --- src/julia/devcontainer-feature.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/julia/devcontainer-feature.json b/src/julia/devcontainer-feature.json index 506dc35..77dda01 100644 --- a/src/julia/devcontainer-feature.json +++ b/src/julia/devcontainer-feature.json @@ -1,7 +1,7 @@ { "name": "Julia (via Juliaup)", "id": "julia", - "version": "1.0.2", + "version": "1.1.0", "description": "Install the Julia programming language", "documentationURL": "https://github.com/JuliaLang/devcontainer-features/tree/main/src/julia", "options": {