From 7acc36fdafc2be5f0d9316efea60e5edaf956b2f Mon Sep 17 00:00:00 2001
From: tomeichlersmith
Date: Thu, 18 Jul 2024 12:31:12 -0500
Subject: [PATCH 01/31] first draft of justfile from reading docs
patch check calls to be quiet and not run command
partition justfile to have mimics of ldmx at bottom
don't re-print just --list call
fix mimics to only be one arg for image or dir
draft a format function"
---
justfile | 64 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 64 insertions(+)
create mode 100644 justfile
diff --git a/justfile b/justfile
new file mode 100644
index 000000000..30a0676aa
--- /dev/null
+++ b/justfile
@@ -0,0 +1,64 @@
+# we assume denv is installed and denv has access to a supported container runner
+
+_default:
+ @just --list
+
+# configure how ldmx-sw will be built
+configure *CONF:
+ denv cmake -B build -S . {{CONF}}
+
+# compile and install ldmx-sw
+build: configure
+ denv cmake --build build --target install -- -j{{num_cpus()}}
+
+# run ldmx-sw with the input configuration script
+fire config *ARGS: build
+ denv fire {{config}} {{ARGS}}
+
+# initialize a containerized development environment
+init:
+ #!/usr/bin/env sh
+ if ! denv check --workspace --quiet; then
+ denv init --clean-env --name ldmx ldmx/dev:latest ..
+ fi
+
+# check that the necessary programs for running ldmx-sw are present
+check:
+ #!/usr/bin/env sh
+ if ! command -v denv 2>&1 > /dev/null; then
+ echo "ERROR: The program `denv` is not present."
+ fi
+ # denv can check for container runners it needs
+ denv check
+
+alias fmt := format
+
+# format the source code of ldmx-sw
+format *ARGS:
+ #!/usr/bin/env sh
+ git ls-tree -r HEAD --name-only | egrep '(\.h|\.cxx)$' > format.list
+ denv clang-format {{ARGS}} $(cat format.list)
+
+# other recipe ideas:
+# production image building
+
+# below are the mimics of ldmx
+
+# change which image is used for the denv
+use IMAGE:
+ denv config image {{IMAGE}}
+
+# make sure the image is pulled down
+pull IMAGE:
+ denv config image {{IMAGE}} && denv config image pull
+
+# mount a directory into the denv
+mount DIR:
+ denv config mounts {{DIR}}
+
+# pass an environment variable into the denv
+setenv *ENVVAR:
+ denv config env copy {{ENVVAR}}
+
+alias compile := build
+alias recompAndFire := fire
From bc19f61f2d3bc758ef877340cef01d03938ef1c9 Mon Sep 17 00:00:00 2001
From: tomeichlersmith
Date: Thu, 18 Jul 2024 13:17:17 -0500
Subject: [PATCH 02/31] draft deprecation notice
---
scripts/ldmx-env.sh | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/scripts/ldmx-env.sh b/scripts/ldmx-env.sh
index d9fc1b716..03b7f4ecc 100644
--- a/scripts/ldmx-env.sh
+++ b/scripts/ldmx-env.sh
@@ -27,6 +27,25 @@ if [[ -z ${BASH} ]]; then
return 1
fi
+###############################################################################
+# Deprecation Notice
+# We are transitioning into using just+denv rather than the bash functions
+# defined here. This area just checks for just+denv and if both exist,
+# switches to them. If either or both are missing, a warning is issued.
+###############################################################################
+__have() {
+ command -v ${1} &> /dev/null
+}
+if __have just && __have denv; then
+ # make alias and leave
+ alias ldmx=just
+ return 0
+else
+ echo "[ldmx-env.sh] [WARNING] The bash functions that you will be using are deprecated."
+ echo " Please install the commands 'denv' and 'just' to update to the new development workflow."
+fi
+
+
###############################################################################
# __ldmx_has_required_engine
# Checks if user has any of the supported engines for running containers
From cfc6807d08580d7681a694d48d478ebf55667bc4 Mon Sep 17 00:00:00 2001
From: tomeichlersmith
Date: Fri, 19 Jul 2024 09:03:39 -0500
Subject: [PATCH 03/31] format justfile and add some comments
more notes and soup up some of the commands
format requires space between recipes
add some printouts with ansi coloring
use a tempfile for listing c++ files to format
add clean and test recipes
---
justfile | 87 +++++++++++++++++++++++++++++++++++++-------------------
1 file changed, 58 insertions(+), 29 deletions(-)
diff --git a/justfile b/justfile
index 30a0676aa..432390b23 100644
--- a/justfile
+++ b/justfile
@@ -1,64 +1,93 @@
-# we assume denv is installed and denv has access to a supported container runner
+# Developer Notes
+# If you are looking at this file there are a few helpful things to note.
+# - `@` is used to alter what `just` chooses to print.
+# It can largely be ignored during development.
+# - Double curly braces `{{...}}` are used for evaluating `just` variables and functions
+# - By default, these recipes are run from the directory of this file.
+# This can be changed but is very helpful for us.
+# - `just --fmt --unstable` is used to apply the canonical justfile format
_default:
- @just --list
+ @just --list --justfile {{ justfile() }}
# configure how ldmx-sw will be built
-configure *CONF:
- denv cmake -B build -S . {{CONF}}
+configure *CONFIG:
+ denv cmake -B build -S . {{ CONFIG }}
# compile and install ldmx-sw
-build: configure
- denv cmake --build build --target install -- -j{{num_cpus()}}
+build ncpu=num_cpus() *CONFIG="": (configure CONFIG)
+ denv cmake --build build --target install -- -j{{ ncpu }}
+
+# run the ldmx-sw tests
+test *ARGS: build
+ cd build && denv ctest {{ ARGS }}
# run ldmx-sw with the input configuration script
fire config *ARGS: build
- denv fire {{config}} {{ARGS}}
+ denv fire {{ config }} {{ ARGS }}
# initialize a containerized development environment
init:
- #!/usr/bin/env sh
- if ! denv check --workspace --quiet; then
- denv init --clean-env --name ldmx ldmx/dev:latest ..
- fi
+ #!/usr/bin/env sh
+ if denv check --workspace --quiet; then
+ echo "\033[32mWorkspace already initialized.\033[0m"
+ denv config print
+ else
+ denv init --clean-env --name ldmx ldmx/dev:latest ..
+ fi
# check that the necessary programs for running ldmx-sw are present
check:
- #!/usr/bin/env sh
- if ! command -v denv 2>&1 > /dev/null; then
- echo "ERROR: The program `denv` is not present."
- fi
- # denv can check for container runners it needs
- denv check
+ #!/usr/bin/env sh
+ if ! command -v denv 2>&1 > /dev/null; then
+ echo "\033[31mThe program 'denv' is not present.\033[0m"
+ exit 1
+ else
+ echo "\033[32m'denv' has been found.\033[0m"
+ fi
+ # denv can check for container runners it needs
+ denv check
+
+# remove the build and install directories of ldmx-sw
+clean:
+ rm -r build install
alias fmt := format
-# format the source code of ldmx-sw
-format *ARGS:
- #!/usr/bin/env sh
- git ls-tree -r HEAD --name-only | egrep '(\.h|\.cxx)$' > format.list
- denv clang-format {{ARGS}} $(cat format.list)
+# format the ldmx-sw source code
+format: format-cpp
-# other recipe ideas:
-# production image building
+# format the C++ source code of ldmx-sw
+format-cpp *ARGS='-i':
+ #!/usr/bin/env sh
+ set -eu
+ format_list=$(mktemp)
+ git ls-tree -r HEAD --name-only | egrep '(\.h|\.cxx)$' > ${format_list}
+ denv clang-format {{ ARGS }} $(cat ${format_list})
+ rm ${format_list}
+# other recipe ideas:
+# - production image building
+# - testing
+# - run test config scripts
+# - format python
# below are the mimics of ldmx
# change which image is used for the denv
use IMAGE:
- denv config image {{IMAGE}}
+ denv config image {{ IMAGE }}
# make sure the image is pulled down
pull IMAGE:
- denv config image {{IMAGE}} && denv config image pull
+ denv config image {{ IMAGE }} && denv config image pull
# mount a directory into the denv
mount DIR:
- denv config mounts {{DIR}}
+ denv config mounts {{ DIR }}
# pass an environment variable into the denv
-setenv *ENVVAR:
- denv config env copy {{ENVVAR}}
+setenv +ENVVAR:
+ denv config env copy {{ ENVVAR }}
alias compile := build
alias recompAndFire := fire
From c5c1453f2563be0337ee7af3b768a78dbf8aa6c3 Mon Sep 17 00:00:00 2001
From: tomeichlersmith
Date: Fri, 19 Jul 2024 12:27:28 -0500
Subject: [PATCH 04/31] don't auto re-config or auto-rebuild since it takes a
long time
---
justfile | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/justfile b/justfile
index 432390b23..429eff045 100644
--- a/justfile
+++ b/justfile
@@ -15,16 +15,16 @@ configure *CONFIG:
denv cmake -B build -S . {{ CONFIG }}
# compile and install ldmx-sw
-build ncpu=num_cpus() *CONFIG="": (configure CONFIG)
+build ncpu=num_cpus():
denv cmake --build build --target install -- -j{{ ncpu }}
# run the ldmx-sw tests
-test *ARGS: build
+test *ARGS:
cd build && denv ctest {{ ARGS }}
# run ldmx-sw with the input configuration script
-fire config *ARGS: build
- denv fire {{ config }} {{ ARGS }}
+fire config_py *ARGS:
+ denv fire {{ config_py }} {{ ARGS }}
# initialize a containerized development environment
init:
@@ -89,5 +89,6 @@ mount DIR:
setenv +ENVVAR:
denv config env copy {{ ENVVAR }}
-alias compile := build
-alias recompAndFire := fire
+compile ncpu=num_cpus() *CONFIG='': (configure CONFIG) (build ncpu)
+
+recompAndFire config_py *ARGS: build (fire config_py ARGS)
From 02d99ed18e6c1d30b9d6601cccd0df4e8ab6c442 Mon Sep 17 00:00:00 2001
From: tomeichlersmith
Date: Fri, 19 Jul 2024 12:27:35 -0500
Subject: [PATCH 05/31] add more detailed help message
remove format short alias
---
justfile | 17 +++++++++++++----
1 file changed, 13 insertions(+), 4 deletions(-)
diff --git a/justfile b/justfile
index 429eff045..1774df329 100644
--- a/justfile
+++ b/justfile
@@ -7,8 +7,20 @@
# This can be changed but is very helpful for us.
# - `just --fmt --unstable` is used to apply the canonical justfile format
+help_message := "shared recipes for ldmx-sw development
+
+ USAGE:
+ just [arguments...]
+
+ Multiple commands can be provided at once and they will be run in sequence.
+
+ just configure build test
+
+ COMMANDS:
+"
+
_default:
- @just --list --justfile {{ justfile() }}
+ @just --list --justfile {{ justfile() }} --list-heading "{{ help_message }}"
# configure how ldmx-sw will be built
configure *CONFIG:
@@ -52,8 +64,6 @@ check:
clean:
rm -r build install
-alias fmt := format
-
# format the ldmx-sw source code
format: format-cpp
@@ -68,7 +78,6 @@ format-cpp *ARGS='-i':
# other recipe ideas:
# - production image building
-# - testing
# - run test config scripts
# - format python
# below are the mimics of ldmx
From 9d9b06214d069fe7366c81dc82602d19bebeff0c Mon Sep 17 00:00:00 2001
From: tomeichlersmith
Date: Fri, 19 Jul 2024 12:52:30 -0500
Subject: [PATCH 06/31] more documentation comments
---
justfile | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
diff --git a/justfile b/justfile
index 1774df329..a6798e7cc 100644
--- a/justfile
+++ b/justfile
@@ -1,14 +1,23 @@
# Developer Notes
# If you are looking at this file there are a few helpful things to note.
# - `@` is used to alter what `just` chooses to print.
-# It can largely be ignored during development.
+# It can largely be ignored during development and inserted after when tuning the UI.
# - Double curly braces `{{...}}` are used for evaluating `just` variables and functions
# - By default, these recipes are run from the directory of this file.
-# This can be changed but is very helpful for us.
+# This can be changed but is helpful for us.
# - `just --fmt --unstable` is used to apply the canonical justfile format
+# - just does support splitting recipes across multiple files, but
+# should be avoided for our use case to keep it as a single reference.
+#
+# other recipe ideas:
+# - production image building
+# - format python
help_message := "shared recipes for ldmx-sw development
+ Some folks use 'ldmx' as an alias for 'just' in which case you can
+ replace 'just' with 'ldmx' in the examples below.
+
USAGE:
just [arguments...]
@@ -76,10 +85,6 @@ format-cpp *ARGS='-i':
denv clang-format {{ ARGS }} $(cat ${format_list})
rm ${format_list}
-# other recipe ideas:
-# - production image building
-# - run test config scripts
-# - format python
# below are the mimics of ldmx
# change which image is used for the denv
From 4c4a5a4a831200ba10b7f1ff6daa28a243de8b0e Mon Sep 17 00:00:00 2001
From: tomeichlersmith
Date: Wed, 24 Jul 2024 14:28:49 -0500
Subject: [PATCH 07/31] allow fire to run from anywhere with no-cd attribute
---
justfile | 1 +
1 file changed, 1 insertion(+)
diff --git a/justfile b/justfile
index a6798e7cc..a05d06977 100644
--- a/justfile
+++ b/justfile
@@ -44,6 +44,7 @@ test *ARGS:
cd build && denv ctest {{ ARGS }}
# run ldmx-sw with the input configuration script
+[no-cd]
fire config_py *ARGS:
denv fire {{ config_py }} {{ ARGS }}
From a028a1385346ea9bbd4ce4f9e219881c9c94797a Mon Sep 17 00:00:00 2001
From: tomeichlersmith
Date: Wed, 24 Jul 2024 14:29:09 -0500
Subject: [PATCH 08/31] add confirmation to clean to avoid mistakes
---
justfile | 1 +
1 file changed, 1 insertion(+)
diff --git a/justfile b/justfile
index a05d06977..e5efe11c2 100644
--- a/justfile
+++ b/justfile
@@ -71,6 +71,7 @@ check:
denv check
# remove the build and install directories of ldmx-sw
+[confirm("This will remove the build and install directories. Are you sure?")]
clean:
rm -r build install
From 908d93051f5a4a0a566dce945b05a0c27e82e1be Mon Sep 17 00:00:00 2001
From: tomeichlersmith
Date: Wed, 24 Jul 2024 14:29:37 -0500
Subject: [PATCH 09/31] add formatting to justfile and printout the lines
within sh recipe
---
justfile | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/justfile b/justfile
index e5efe11c2..10b0e1c2f 100644
--- a/justfile
+++ b/justfile
@@ -76,17 +76,21 @@ clean:
rm -r build install
# format the ldmx-sw source code
-format: format-cpp
+format: format-cpp format-just
# format the C++ source code of ldmx-sw
format-cpp *ARGS='-i':
#!/usr/bin/env sh
- set -eu
+ set -exu
format_list=$(mktemp)
git ls-tree -r HEAD --name-only | egrep '(\.h|\.cxx)$' > ${format_list}
denv clang-format {{ ARGS }} $(cat ${format_list})
rm ${format_list}
+# format the justfile
+format-just:
+ just --fmt --unstable
+
# below are the mimics of ldmx
# change which image is used for the denv
From 6cda926486b133827449abdbb54d11e65ebd1949 Mon Sep 17 00:00:00 2001
From: tomeichlersmith
Date: Thu, 25 Jul 2024 09:24:49 -0500
Subject: [PATCH 10/31] add description to helpful combinations
---
justfile | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/justfile b/justfile
index 10b0e1c2f..474fad49a 100644
--- a/justfile
+++ b/justfile
@@ -4,8 +4,7 @@
# It can largely be ignored during development and inserted after when tuning the UI.
# - Double curly braces `{{...}}` are used for evaluating `just` variables and functions
# - By default, these recipes are run from the directory of this file.
-# This can be changed but is helpful for us.
-# - `just --fmt --unstable` is used to apply the canonical justfile format
+# This can be changed but is helpful for us in most recipes.
# - just does support splitting recipes across multiple files, but
# should be avoided for our use case to keep it as a single reference.
#
@@ -89,7 +88,7 @@ format-cpp *ARGS='-i':
# format the justfile
format-just:
- just --fmt --unstable
+ @just --fmt --unstable --justfile {{ justfile() }}
# below are the mimics of ldmx
@@ -109,6 +108,8 @@ mount DIR:
setenv +ENVVAR:
denv config env copy {{ ENVVAR }}
+# configure and build ldmx-sw
compile ncpu=num_cpus() *CONFIG='': (configure CONFIG) (build ncpu)
+# re-build ldmx-sw and then run a config
recompAndFire config_py *ARGS: build (fire config_py ARGS)
From efa3539fa819e408bbf00818f2aecf4933e79237 Mon Sep 17 00:00:00 2001
From: tomeichlersmith
Date: Fri, 26 Jul 2024 10:05:23 -0500
Subject: [PATCH 11/31] add important environment variables to pass to
underlying recipes
also label features with just version requirement
---
justfile | 20 ++++++++++++++++++--
1 file changed, 18 insertions(+), 2 deletions(-)
diff --git a/justfile b/justfile
index 474fad49a..d62a183be 100644
--- a/justfile
+++ b/justfile
@@ -27,6 +27,21 @@ help_message := "shared recipes for ldmx-sw development
COMMANDS:
"
+# inherited from ldmx-env bash functions
+# the denv workspace is colloquially known as LDMX_BASE
+export LDMX_BASE := parent_directory( justfile_directory() )
+
+# tell denv where the workspace is
+# usually, denv deduces where the workspace is by finding the .denv directory,
+# but we want to set where the denv is so users could (for example) run their
+# ldmx-sw build from within some other denv by invoking fire from just
+export denv_workspace := LDMX_BASE
+
+# make sure APPTAINER_CACHEDIR is not in the home directory
+# unless the user has already defined it
+# just 1.15
+export APPTAINER_CACHEDIR := env("APPTAINER_CACHEDIR", LDMX_BASE / ".apptainer")
+
_default:
@just --list --justfile {{ justfile() }} --list-heading "{{ help_message }}"
@@ -43,7 +58,7 @@ test *ARGS:
cd build && denv ctest {{ ARGS }}
# run ldmx-sw with the input configuration script
-[no-cd]
+[no-cd] # just 1.9
fire config_py *ARGS:
denv fire {{ config_py }} {{ ARGS }}
@@ -54,7 +69,7 @@ init:
echo "\033[32mWorkspace already initialized.\033[0m"
denv config print
else
- denv init --clean-env --name ldmx ldmx/dev:latest ..
+ denv init --clean-env --name ldmx ldmx/dev:latest ${LDMX_BASE}
fi
# check that the necessary programs for running ldmx-sw are present
@@ -69,6 +84,7 @@ check:
# denv can check for container runners it needs
denv check
+# confirm(PROMPT) just 1.23
# remove the build and install directories of ldmx-sw
[confirm("This will remove the build and install directories. Are you sure?")]
clean:
From 4746b9d4eb71d6aba118aa0d25d888b659bdc978 Mon Sep 17 00:00:00 2001
From: tomeichlersmith
Date: Fri, 26 Jul 2024 10:05:55 -0500
Subject: [PATCH 12/31] rewrite readme separating users from developers
start reworking readme
tighten up listing of git requirement
update links in readme
comment about necessity of just
add `just init` to list of startup commands for developers
---
README.md | 80 +++++++++++++++++++++++++++++++------------------------
1 file changed, 45 insertions(+), 35 deletions(-)
diff --git a/README.md b/README.md
index 7c8bea964..d37b51298 100644
--- a/README.md
+++ b/README.md
@@ -16,50 +16,60 @@
-## Quick Start
+## Start Up
+ldmx-sw is a large software project and so it is helpful to separate _using_ it to
+perform physics studies from _developing_ it to fix/improve/enable other studies.
+In both cases, we use containers to share a fixed software environment, so everyone
+will need a method for running these containers.
- [Install the docker engine](https://docs.docker.com/engine/install/)
-- (on Linux systems) [Manage docker as non-root user](https://docs.docker.com/engine/install/linux-postinstall/#manage-docker-as-a-non-root-user)
-- (on MacOS systems) Make sure `git lfs` is installed. (Test: `git lfs` prints out a help message instead of an error about `lfs` not being found.)
- - The default installation of `git` that is included with Apple's developer tools does not include `git lfs` which is required by acts to download and unpack one of its own submodules. [GitHub has a nice tutorial](https://docs.github.com/en/repositories/working-with-files/managing-large-files/installing-git-large-file-storage?platform=mac) on how to install `git lfs` on MacOS.
- - This is only an issue observed on MacOS systems. Linux repositories (used in WSL and Linux systems) include `git lfs` within their installed versions of `git`.
-- Clone the repo: `git clone --recursive git@github.com:LDMX-Software/ldmx-sw.git`
- - **Note**: You need to [setup an SSH-key with your GitHub account](https://docs.github.com/en/authentication/connecting-to-github-with-ssh) on the computer you are using.
-- Setup the environment (in bash): `source ldmx-sw/scripts/ldmx-env.sh`
- - **Note**: If you are working with ldmx-sw at SLAC's SDF, you will need to set the `TMPDIR` environment variable so that program running the container has more than ~5GB of space to write intermediate files. The default temporary space (`/tmp`) is often full of other files already. A decent replacement is `TMPDIR=${SCRATCH}` which gives the program plenty of room for the files it needs to manipulate.
-- Configure and compile: `ldmx compile`
-- Now you can run any processor in _ldmx-sw_ through `ldmx fire myconfig.py`
-- If you are developing and need to recompile and run `ldmx fire`, you can use `ldmx recompFire myconfig.py`
+ - Only necessary on personal computers. Shared computing clusters should have `apptainer` installed.
+ - (on Linux personal computers) [Manage docker as non-root user](https://docs.docker.com/engine/install/linux-postinstall/#manage-docker-as-a-non-root-user)
+- [Install `denv`](https://tomeichlersmith.github.io/denv/getting_started.html#installation)
-## Documentation
-The full documentation for **ldmx-sw** is available on [github pages](https://ldmx-software.github.io/).
-A brief description of common commands is given below.
+### Users
+In order to use ldmx-sw, no more dependencies are required!
+Simply choose the version of ldmx-sw you wish to use with your project.
+```
+mkdir my-project
+denv init ldmx/pro:v4.0.1 # or some other ldmx-sw version
+```
+And then you can run ldmx-sw with a configuration script of your choice.
+```
+denv fire my-config.py
+```
+More detail on configuration scripts and analyzing the output files
+is given in the first section of the [online manual](ldmx-software.github.io).
-### Common Commands inside Container
+### Developers
+For development, we use a few more tools to help track our changes and share commands
+that we use regularly.
-Command | Purpose
----|---
-`ldmx cmake ..` | Configure the ldmx-sw build
-`ldmx make` | Compile/build ldmx-sw
-`ldmx make install` | Install ldmx-sw
-`ldmx compile` | Configure and compile ldmx-sw
-`ldmx fire config.py` | Use ldmx-sw application and processors with input python configuration
-`ldmx recompFire config.py` | Recompile and run fire on a config file
-`ldmx python3 analysis.py` | Run python-based analysis
-`ldmx ./bin/mg5_aMC` | Run MadGraph5 inside (ubuntu-based) container
+> [!WARNING]
+> If you are on Windows, make sure to install these tools _inside_ WSL where `docker`
+> will be run and ldmx-sw will be developed. Since WSL is often a virtual Ubuntu machine,
+> following the instructions for Ubuntu or Linux can be appropriate.
-### Other Container Configuration Commands
+- Make sure `git` is installed.
+ - `git` is a very common tool used by software developers and so it may already be available.
+ - (on MacOS systems) Make sure `git lfs` is installed. (Test: `git lfs` prints out a help message instead of an error about `lfs` not being found.) The default installation of `git` that is included with Apple's developer tools does not include `git lfs` which is required by acts to download and unpack one of its own submodules. [GitHub has a nice tutorial](https://docs.github.com/en/repositories/working-with-files/managing-large-files/installing-git-large-file-storage?platform=mac) on how to install `git lfs` on MacOS.
+- [Install `just`](https://just.systems/man/en/chapter_5.html)
+ - This tool is not required but it is highly encouraged. The recipes we share via the [justfile](justfile) can be run without `just` but are longer to type.
-The environment script defines several other shell commands to help configure and debug the container environment.
+Then, with these additional tools, developers can clone the repository and start development.
+```
+git clone --recursive git@github.com:LDMX-Software/ldmx-sw.git
+```
-- `ldmx list repo` : List the container tags that you could use with the input repository: `dev`, `pro`, or `local`
-- `ldmx use repo tag` : Setup the environment for the container 'ldmx/repo:tag' and pull down the newest version if the repo is remote
-- `ldmx config` : Print out how the container environment is currently configured
-- `ldmx clean all` : Reset environment to a blank state
+> [!NOTE]
+> You need to [setup an SSH-key with your GitHub account](https://docs.github.com/en/authentication/connecting-to-github-with-ssh) on the computer you are using.
-Use `ldmx help` for a full listing of these commands.
-If we don't define a command outside of the container,
-then the command is given to the container to run inside the current directory.
+```
+cd ldmx-sw
+just # no arguments prints out the possible options
+just init # initialize a new development environment
+just configure build test # configure ldmx-sw, build it, then test it
+```
## Maintainer
From ea7ba96bc7d8bde7bbb60af980bf2ac2861c2a40 Mon Sep 17 00:00:00 2001
From: tomeichlersmith
Date: Wed, 7 Aug 2024 15:44:26 -0500
Subject: [PATCH 13/31] need to go into project directory
---
README.md | 1 +
1 file changed, 1 insertion(+)
diff --git a/README.md b/README.md
index d37b51298..a2f3cf2fc 100644
--- a/README.md
+++ b/README.md
@@ -32,6 +32,7 @@ In order to use ldmx-sw, no more dependencies are required!
Simply choose the version of ldmx-sw you wish to use with your project.
```
mkdir my-project
+cd my-project
denv init ldmx/pro:v4.0.1 # or some other ldmx-sw version
```
And then you can run ldmx-sw with a configuration script of your choice.
From ca12c7618d8f19f0406f9f91767fa84c3318b178 Mon Sep 17 00:00:00 2001
From: tomeichlersmith
Date: Thu, 8 Aug 2024 15:16:37 -0500
Subject: [PATCH 14/31] more comments about future of justfile, fixup spelling
of recomp
---
justfile | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/justfile b/justfile
index d62a183be..b3d4af214 100644
--- a/justfile
+++ b/justfile
@@ -28,6 +28,8 @@ help_message := "shared recipes for ldmx-sw development
"
# inherited from ldmx-env bash functions
+# we could look into removing this and instead having the denv_workspace be
+# the justfile_directory() itself but that is a larger change than introducing just
# the denv workspace is colloquially known as LDMX_BASE
export LDMX_BASE := parent_directory( justfile_directory() )
@@ -107,6 +109,8 @@ format-just:
@just --fmt --unstable --justfile {{ justfile() }}
# below are the mimics of ldmx
+# we could think about removing them if folks are happy with committing to the
+# just-style commands above
# change which image is used for the denv
use IMAGE:
@@ -128,4 +132,4 @@ setenv +ENVVAR:
compile ncpu=num_cpus() *CONFIG='': (configure CONFIG) (build ncpu)
# re-build ldmx-sw and then run a config
-recompAndFire config_py *ARGS: build (fire config_py ARGS)
+recompFire config_py *ARGS: build (fire config_py ARGS)
From 184af67a5cac57f93c0e7b3500086fe17bdddf1b Mon Sep 17 00:00:00 2001
From: tomeichlersmith
Date: Wed, 14 Aug 2024 10:23:44 -0500
Subject: [PATCH 15/31] add shellcheck recipe for running shellcheck over
everything
---
justfile | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/justfile b/justfile
index b3d4af214..8e487d8fa 100644
--- a/justfile
+++ b/justfile
@@ -108,6 +108,20 @@ format-cpp *ARGS='-i':
format-just:
@just --fmt --unstable --justfile {{ justfile() }}
+# shellcheck doesn't have a "apply-formatting" option
+# because it really is more of a tidier (its changes could affect code meaning)
+# so only a check is implemented here
+# ISSUE: the filter implemented here gets all files that are either executable
+# or have the '.sh' extension. This includes a python script in TrigScint
+# and some bash-specific scripts as well. Not sure how to handle them.
+# check the scripts for common errors and bugs
+shellcheck:
+ #!/usr/bin/env sh
+ set -exu
+ format_list=$(mktemp)
+ git ls-tree -r HEAD | awk '{ if ($1 == 100755 || $4 ~ /\.sh/) print $4 }' > ${format_list}
+ shellcheck --severity style --shell sh $(cat ${format_list})
+
# below are the mimics of ldmx
# we could think about removing them if folks are happy with committing to the
# just-style commands above
From 012c76a98b24ade5cfb0a1c72bc3570946397b30 Mon Sep 17 00:00:00 2001
From: tomeichlersmith
Date: Wed, 14 Aug 2024 10:38:53 -0500
Subject: [PATCH 16/31] transition format check CI to use just as example
---
.github/format-check | 24 ------------------------
.github/workflows/format-check.yml | 7 +++++--
2 files changed, 5 insertions(+), 26 deletions(-)
delete mode 100755 .github/format-check
diff --git a/.github/format-check b/.github/format-check
deleted file mode 100755
index 0907722d4..000000000
--- a/.github/format-check
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/bin/bash
-# formatting using the ldmx/dev image which has clang-format in it
-
-set -o errexit
-set -o nounset
-
-if [ -z "${GITHUB_WORKSPACE+x}" ]; then
- # we are not in github actions so we need to error out
- echo "ERROR: this script expects to be run in GitHub actions so should not be run locally."
- exit 1
-fi
-
-ldmx() {
- docker \
- run \
- --rm \
- --volume ${GITHUB_WORKSPACE} \
- --env LDMX_BASE=${GITHUB_WORKSPACE} \
- ldmx/dev:latest \
- ${PWD}
- $@
-}
-find . -type f \( -name '*.h' -o -name '*.cxx' \) > ${TMPDIR:-/tmp}/files-to-format.list
-ldmx clang-format --verbose -Werror --dry-run $(cat ${TMPDIR:-/tmp}/files-to-format.list)
diff --git a/.github/workflows/format-check.yml b/.github/workflows/format-check.yml
index 167859ae2..8a3f91163 100644
--- a/.github/workflows/format-check.yml
+++ b/.github/workflows/format-check.yml
@@ -9,6 +9,9 @@ jobs:
clang-format:
runs-on: ubuntu-latest
steps:
+ - uses: extractions/setup-just@v1
+ with:
+ just-version: 1.26.0
- uses: actions/checkout@v4
- - name: run format check
- run: ./.github/format-check
+ - name: run format check on the C++
+ run: just format-cpp --verbose -Werror --dry-run
From 20e7075ce960f4c2f267b09cf63495c974867c84 Mon Sep 17 00:00:00 2001
From: tomeichlersmith
Date: Thu, 15 Aug 2024 13:01:23 -0500
Subject: [PATCH 17/31] make sure to install denv before attempting to use it
for formatting
---
.github/workflows/format-check.yml | 2 +-
justfile | 5 +++++
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/.github/workflows/format-check.yml b/.github/workflows/format-check.yml
index 8a3f91163..fb7c4a38f 100644
--- a/.github/workflows/format-check.yml
+++ b/.github/workflows/format-check.yml
@@ -14,4 +14,4 @@ jobs:
just-version: 1.26.0
- uses: actions/checkout@v4
- name: run format check on the C++
- run: just format-cpp --verbose -Werror --dry-run
+ run: just install-denv format-cpp --verbose -Werror --dry-run
diff --git a/justfile b/justfile
index 8e487d8fa..4631a03e9 100644
--- a/justfile
+++ b/justfile
@@ -47,6 +47,11 @@ export APPTAINER_CACHEDIR := env("APPTAINER_CACHEDIR", LDMX_BASE / ".apptainer")
_default:
@just --list --justfile {{ justfile() }} --list-heading "{{ help_message }}"
+[private]
+install-denv:
+ curl -s https://raw.githubusercontent.com/tomeichlersmith/denv/main/install | sh
+
+
# configure how ldmx-sw will be built
configure *CONFIG:
denv cmake -B build -S . {{ CONFIG }}
From d7b1b12021e749cd81c2143b9827bf06cf79d7d4 Mon Sep 17 00:00:00 2001
From: tomeichlersmith
Date: Thu, 15 Aug 2024 13:02:50 -0500
Subject: [PATCH 18/31] need to init before format as well
---
.github/workflows/format-check.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/workflows/format-check.yml b/.github/workflows/format-check.yml
index fb7c4a38f..b616a5067 100644
--- a/.github/workflows/format-check.yml
+++ b/.github/workflows/format-check.yml
@@ -14,4 +14,4 @@ jobs:
just-version: 1.26.0
- uses: actions/checkout@v4
- name: run format check on the C++
- run: just install-denv format-cpp --verbose -Werror --dry-run
+ run: just install-denv init format-cpp --verbose -Werror --dry-run
From 1b0f65916689a87877f0cf18928395cf4bf6c5d1 Mon Sep 17 00:00:00 2001
From: tomeichlersmith
Date: Thu, 15 Aug 2024 13:03:09 -0500
Subject: [PATCH 19/31] bump setup-just a version as well
---
.github/workflows/format-check.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/workflows/format-check.yml b/.github/workflows/format-check.yml
index b616a5067..c5e91db3f 100644
--- a/.github/workflows/format-check.yml
+++ b/.github/workflows/format-check.yml
@@ -9,7 +9,7 @@ jobs:
clang-format:
runs-on: ubuntu-latest
steps:
- - uses: extractions/setup-just@v1
+ - uses: extractions/setup-just@v2
with:
just-version: 1.26.0
- uses: actions/checkout@v4
From a3e1724048e936baf1db590329876f630093456c Mon Sep 17 00:00:00 2001
From: tomeichlersmith
Date: Mon, 19 Aug 2024 16:30:29 -0500
Subject: [PATCH 20/31] update ldmx alias to include path to justfile
this makes it operate a bit closer to the original ldmx bash function
which didn't care about where it was run
---
scripts/ldmx-env.sh | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/scripts/ldmx-env.sh b/scripts/ldmx-env.sh
index 03b7f4ecc..9e6cc4aad 100644
--- a/scripts/ldmx-env.sh
+++ b/scripts/ldmx-env.sh
@@ -37,8 +37,10 @@ __have() {
command -v ${1} &> /dev/null
}
if __have just && __have denv; then
+ # back out of scripts
+ _default_justfile="$( dirname ${BASH_SOURCE[0]} )/../justfile"
# make alias and leave
- alias ldmx=just
+ alias ldmx="just -f ${_default_justfile}"
return 0
else
echo "[ldmx-env.sh] [WARNING] The bash functions that you will be using are deprecated."
From 43b9a3f5f005160ba752246d5429ab2040ef15f5 Mon Sep 17 00:00:00 2001
From: tomeichlersmith
Date: Mon, 19 Aug 2024 16:32:22 -0500
Subject: [PATCH 21/31] hack to see if defining denv_workspace in CI is the
issue
---
justfile | 1 +
1 file changed, 1 insertion(+)
diff --git a/justfile b/justfile
index 4631a03e9..87c96c495 100644
--- a/justfile
+++ b/justfile
@@ -72,6 +72,7 @@ fire config_py *ARGS:
# initialize a containerized development environment
init:
#!/usr/bin/env sh
+ unset denv_workspace # make sure test looks for the denv
if denv check --workspace --quiet; then
echo "\033[32mWorkspace already initialized.\033[0m"
denv config print
From 281ad0e4963425de1fa409920f60f98d834079b3 Mon Sep 17 00:00:00 2001
From: tomeichlersmith
Date: Tue, 20 Aug 2024 12:54:34 -0500
Subject: [PATCH 22/31] more documentation on why I choose to set
denv_workspace
---
justfile | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
diff --git a/justfile b/justfile
index 87c96c495..60d91c791 100644
--- a/justfile
+++ b/justfile
@@ -35,8 +35,10 @@ export LDMX_BASE := parent_directory( justfile_directory() )
# tell denv where the workspace is
# usually, denv deduces where the workspace is by finding the .denv directory,
-# but we want to set where the denv is so users could (for example) run their
-# ldmx-sw build from within some other denv by invoking fire from just
+# but we want to set where the denv is within the justfile so users could (for example)
+# run their ldmx-sw build from within some other denv by invoking fire from just
+# just -f path/to/ldmx-sw/justfile fire config.py
+# would run this denv even if there is a denv in the directory where config.py is.
export denv_workspace := LDMX_BASE
# make sure APPTAINER_CACHEDIR is not in the home directory
@@ -47,6 +49,8 @@ export APPTAINER_CACHEDIR := env("APPTAINER_CACHEDIR", LDMX_BASE / ".apptainer")
_default:
@just --list --justfile {{ justfile() }} --list-heading "{{ help_message }}"
+# this install is private since I'd prefer users knowing what tools they are installing;
+# however, the CI needs to install denv before it can run any testing
[private]
install-denv:
curl -s https://raw.githubusercontent.com/tomeichlersmith/denv/main/install | sh
@@ -72,7 +76,13 @@ fire config_py *ARGS:
# initialize a containerized development environment
init:
#!/usr/bin/env sh
- unset denv_workspace # make sure test looks for the denv
+ # while setting the denv_workspace is helpful for other
+ # commands that can assume the denv is already initialized,
+ # we need to unset this environment variable to make sure
+ # the test is done appropriately.
+ # just makes sure this recipe runs from the directory of
+ # the justfile so we know we are in the correct location.
+ unset denv_workspace
if denv check --workspace --quiet; then
echo "\033[32mWorkspace already initialized.\033[0m"
denv config print
From 8b121c7d8260997dceab1165bdf833b4f23752cb Mon Sep 17 00:00:00 2001
From: tomeichlersmith
Date: Tue, 20 Aug 2024 12:58:30 -0500
Subject: [PATCH 23/31] remove advice about single justfile
---
justfile | 2 --
1 file changed, 2 deletions(-)
diff --git a/justfile b/justfile
index 60d91c791..4e4dc85d9 100644
--- a/justfile
+++ b/justfile
@@ -5,8 +5,6 @@
# - Double curly braces `{{...}}` are used for evaluating `just` variables and functions
# - By default, these recipes are run from the directory of this file.
# This can be changed but is helpful for us in most recipes.
-# - just does support splitting recipes across multiple files, but
-# should be avoided for our use case to keep it as a single reference.
#
# other recipe ideas:
# - production image building
From 504c83b07e53901d95c44913a593aae31c0491fa Mon Sep 17 00:00:00 2001
From: tomeichlersmith
Date: Tue, 20 Aug 2024 13:02:47 -0500
Subject: [PATCH 24/31] update example command to be something a new dev could
run immediately
---
justfile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/justfile b/justfile
index 4e4dc85d9..585ef2af4 100644
--- a/justfile
+++ b/justfile
@@ -20,7 +20,7 @@ help_message := "shared recipes for ldmx-sw development
Multiple commands can be provided at once and they will be run in sequence.
- just configure build test
+ just init configure build test
COMMANDS:
"
From 8d3fd5aa73aba704bfefce8f4ff91bf3423827e8 Mon Sep 17 00:00:00 2001
From: tomeichlersmith
Date: Tue, 20 Aug 2024 13:12:47 -0500
Subject: [PATCH 25/31] emphasize init only needs to happen once per clone
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index a2f3cf2fc..bca846881 100644
--- a/README.md
+++ b/README.md
@@ -68,7 +68,7 @@ git clone --recursive git@github.com:LDMX-Software/ldmx-sw.git
```
cd ldmx-sw
just # no arguments prints out the possible options
-just init # initialize a new development environment
+just init # initialize a new development environment (once per clone)
just configure build test # configure ldmx-sw, build it, then test it
```
From 62502dbecca74debe585600451d4cf9783b2c12c Mon Sep 17 00:00:00 2001
From: tomeichlersmith
Date: Tue, 20 Aug 2024 13:13:03 -0500
Subject: [PATCH 26/31] comment about specifying path to justfile
---
scripts/ldmx-env.sh | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/scripts/ldmx-env.sh b/scripts/ldmx-env.sh
index 9e6cc4aad..d79479a43 100644
--- a/scripts/ldmx-env.sh
+++ b/scripts/ldmx-env.sh
@@ -41,6 +41,12 @@ if __have just && __have denv; then
_default_justfile="$( dirname ${BASH_SOURCE[0]} )/../justfile"
# make alias and leave
alias ldmx="just -f ${_default_justfile}"
+ # see https://just.systems/man/en/chapter_55.html
+ # if invoking 'just' directly, you can put the path to ldmx-sw as a prefix
+ # to the command you want to run. The following are all the same.
+ # just path/to/ldmx-sw/build
+ # just -f path/to/ldmx-sw/justfile build
+ # cd path/to/ldmx-sw && just build
return 0
else
echo "[ldmx-env.sh] [WARNING] The bash functions that you will be using are deprecated."
From f22ca2641ee68ab0251159599efb7405fceacaf0 Mon Sep 17 00:00:00 2001
From: tomeichlersmith
Date: Tue, 27 Aug 2024 13:37:52 -0500
Subject: [PATCH 27/31] reformat justfile and add root/rootbrowse
---
justfile | 19 ++++++++++++++++---
1 file changed, 16 insertions(+), 3 deletions(-)
diff --git a/justfile b/justfile
index 585ef2af4..fad754d76 100644
--- a/justfile
+++ b/justfile
@@ -29,7 +29,8 @@ help_message := "shared recipes for ldmx-sw development
# we could look into removing this and instead having the denv_workspace be
# the justfile_directory() itself but that is a larger change than introducing just
# the denv workspace is colloquially known as LDMX_BASE
-export LDMX_BASE := parent_directory( justfile_directory() )
+
+export LDMX_BASE := parent_directory(justfile_directory())
# tell denv where the workspace is
# usually, denv deduces where the workspace is by finding the .denv directory,
@@ -37,23 +38,25 @@ export LDMX_BASE := parent_directory( justfile_directory() )
# run their ldmx-sw build from within some other denv by invoking fire from just
# just -f path/to/ldmx-sw/justfile fire config.py
# would run this denv even if there is a denv in the directory where config.py is.
+
export denv_workspace := LDMX_BASE
# make sure APPTAINER_CACHEDIR is not in the home directory
# unless the user has already defined it
# just 1.15
+
export APPTAINER_CACHEDIR := env("APPTAINER_CACHEDIR", LDMX_BASE / ".apptainer")
_default:
@just --list --justfile {{ justfile() }} --list-heading "{{ help_message }}"
# this install is private since I'd prefer users knowing what tools they are installing;
+
# however, the CI needs to install denv before it can run any testing
[private]
install-denv:
curl -s https://raw.githubusercontent.com/tomeichlersmith/denv/main/install | sh
-
# configure how ldmx-sw will be built
configure *CONFIG:
denv cmake -B build -S . {{ CONFIG }}
@@ -67,7 +70,7 @@ test *ARGS:
cd build && denv ctest {{ ARGS }}
# run ldmx-sw with the input configuration script
-[no-cd] # just 1.9
+[no-cd]
fire config_py *ARGS:
denv fire {{ config_py }} {{ ARGS }}
@@ -101,6 +104,7 @@ check:
denv check
# confirm(PROMPT) just 1.23
+
# remove the build and install directories of ldmx-sw
[confirm("This will remove the build and install directories. Are you sure?")]
clean:
@@ -128,6 +132,7 @@ format-just:
# ISSUE: the filter implemented here gets all files that are either executable
# or have the '.sh' extension. This includes a python script in TrigScint
# and some bash-specific scripts as well. Not sure how to handle them.
+
# check the scripts for common errors and bugs
shellcheck:
#!/usr/bin/env sh
@@ -140,6 +145,14 @@ shellcheck:
# we could think about removing them if folks are happy with committing to the
# just-style commands above
+# open the ROOT shell within the software environment
+root *ARGS="":
+ denv root {{ ARGS }}
+
+# open a ROOT file with a graphical browser
+rootbrowse FILE:
+ denv rootbrowse {{ FILE }}
+
# change which image is used for the denv
use IMAGE:
denv config image {{ IMAGE }}
From a408b2a9d0cfb88b6ad72bf06ca761ed125b582c Mon Sep 17 00:00:00 2001
From: tomeichlersmith
Date: Fri, 30 Aug 2024 15:01:22 -0500
Subject: [PATCH 28/31] first draft at install examples and comments
---
README.md | 47 ++++++++++++++++++++++++++++++++++++++++++++---
1 file changed, 44 insertions(+), 3 deletions(-)
diff --git a/README.md b/README.md
index bca846881..50324a2ca 100644
--- a/README.md
+++ b/README.md
@@ -26,8 +26,29 @@ will need a method for running these containers.
- Only necessary on personal computers. Shared computing clusters should have `apptainer` installed.
- (on Linux personal computers) [Manage docker as non-root user](https://docs.docker.com/engine/install/linux-postinstall/#manage-docker-as-a-non-root-user)
- [Install `denv`](https://tomeichlersmith.github.io/denv/getting_started.html#installation)
+```
+curl -s https://raw.githubusercontent.com/tomeichlersmith/denv/main/install | sh
+```
+Some folks may see an error about something not being within your `PATH`,
+you just need to update your shell's configuration to look for `denv` within
+that directory.
+A program being "in your `PATH`" can be checked by making sure your shell
+can find it.
+```
+denv help
+```
+The above should printout a help message instead of a "command not found"
+message.
+
+Additionally, many folks have gotten used to using `ldmx` as the command
+to put programs into the containerized environment in which case you can
+use the following to add this symlink to your `denv` installation.
+(Note: This requires `denv` to be in your `PATH`!).
+```
+ln -s $(which denv) $(dirname $(which denv))/ldmx
+```
-### Users
+### Using
In order to use ldmx-sw, no more dependencies are required!
Simply choose the version of ldmx-sw you wish to use with your project.
```
@@ -42,7 +63,7 @@ denv fire my-config.py
More detail on configuration scripts and analyzing the output files
is given in the first section of the [online manual](ldmx-software.github.io).
-### Developers
+### Developing
For development, we use a few more tools to help track our changes and share commands
that we use regularly.
@@ -57,7 +78,27 @@ that we use regularly.
- [Install `just`](https://just.systems/man/en/chapter_5.html)
- This tool is not required but it is highly encouraged. The recipes we share via the [justfile](justfile) can be run without `just` but are longer to type.
-Then, with these additional tools, developers can clone the repository and start development.
+One can install `just` in a similar way to `denv`. Below is an example where the
+destination directory is set to the same one as the default for `denv`.
+```
+curl --proto '=https' --tlsv1.2 -sSf https://just.systems/install.sh |\
+ bash -s -- --to ~/.local/bin
+```
+Other [package manager options](https://just.systems/man/en/chapter_4.html) are available
+as well.
+You will probably want to make sure `just`'s tab complete is available.
+If you press `just -` and nothing is listed, then the tab complete is
+not present and you must manually install it.
+This can be accomplished by including its completions within your shell's
+configuration script. For example, in `bash`, we would add the following
+to your `~/.bashrc` file.
+```
+eval "$(just --completions bash)"
+```
+If you are not in `bash`, look to your shell's documentation on where to place
+this line. `just` supports many popular shells including `bash`, `zsh`, and `fish`.
+
+With these additional tools, developers can clone the repository and start development.
```
git clone --recursive git@github.com:LDMX-Software/ldmx-sw.git
```
From 08340ed1c85a6eb622dca4e495f7ba6dd8aa545f Mon Sep 17 00:00:00 2001
From: tomeichlersmith
Date: Fri, 30 Aug 2024 15:01:39 -0500
Subject: [PATCH 29/31] attach just tab complete to ldmx assuming the function
already exists
---
scripts/ldmx-env.sh | 2 ++
1 file changed, 2 insertions(+)
diff --git a/scripts/ldmx-env.sh b/scripts/ldmx-env.sh
index d79479a43..8ca889fca 100644
--- a/scripts/ldmx-env.sh
+++ b/scripts/ldmx-env.sh
@@ -47,6 +47,8 @@ if __have just && __have denv; then
# just path/to/ldmx-sw/build
# just -f path/to/ldmx-sw/justfile build
# cd path/to/ldmx-sw && just build
+ # add just tab complete to ldmx alias
+ complete -F _just -o bashdefault -o default ldmx
return 0
else
echo "[ldmx-env.sh] [WARNING] The bash functions that you will be using are deprecated."
From 57ffa7c45953999ddef27a71423b6d5ccfc6fff9 Mon Sep 17 00:00:00 2001
From: tomeichlersmith
Date: Fri, 30 Aug 2024 16:09:24 -0500
Subject: [PATCH 30/31] mention destination directory so curl call is
understandable
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index 50324a2ca..1a625eafc 100644
--- a/README.md
+++ b/README.md
@@ -79,7 +79,7 @@ that we use regularly.
- This tool is not required but it is highly encouraged. The recipes we share via the [justfile](justfile) can be run without `just` but are longer to type.
One can install `just` in a similar way to `denv`. Below is an example where the
-destination directory is set to the same one as the default for `denv`.
+destination directory is set to the same one as the default for `denv` (`~/.local/bin`).
```
curl --proto '=https' --tlsv1.2 -sSf https://just.systems/install.sh |\
bash -s -- --to ~/.local/bin
From 7e380579ac2992d7810a02414c48fc0363578595 Mon Sep 17 00:00:00 2001
From: tomeichlersmith
Date: Fri, 30 Aug 2024 16:16:12 -0500
Subject: [PATCH 31/31] make sure tab completion is loaded and add link to
readme for anyone seeing deprecation warning
---
scripts/ldmx-env.sh | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/scripts/ldmx-env.sh b/scripts/ldmx-env.sh
index 8ca889fca..aae7a3f4f 100644
--- a/scripts/ldmx-env.sh
+++ b/scripts/ldmx-env.sh
@@ -42,17 +42,25 @@ if __have just && __have denv; then
# make alias and leave
alias ldmx="just -f ${_default_justfile}"
# see https://just.systems/man/en/chapter_55.html
+
# if invoking 'just' directly, you can put the path to ldmx-sw as a prefix
# to the command you want to run. The following are all the same.
# just path/to/ldmx-sw/build
# just -f path/to/ldmx-sw/justfile build
# cd path/to/ldmx-sw && just build
+
+ # we need to make sure that tab completion for just is loaded
+ if ! type -t _just &> /dev/null; then
+ eval "$(just --completions bash)"
+ fi
+
# add just tab complete to ldmx alias
complete -F _just -o bashdefault -o default ldmx
return 0
else
echo "[ldmx-env.sh] [WARNING] The bash functions that you will be using are deprecated."
echo " Please install the commands 'denv' and 'just' to update to the new development workflow."
+ echo " https://github.com/LDMX-Software/ldmx-sw/blob/trunk/README.md"
fi