aboutsummaryrefslogtreecommitdiff
path: root/scripts/add-dependency.sh
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/add-dependency.sh')
-rwxr-xr-xscripts/add-dependency.sh17
1 files changed, 17 insertions, 0 deletions
diff --git a/scripts/add-dependency.sh b/scripts/add-dependency.sh
new file mode 100755
index 0000000..2f941ff
--- /dev/null
+++ b/scripts/add-dependency.sh
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+# This script adds a dependency to the project.
+set -e
+
+NEW_DEP=$1
+
+# Add argument to dune-project after the word (depends
+# So (depends dune dream ppx becomes (depends dune dream ppx NEW_DEP
+sed -i "s/\(depends.*\)/\1 $NEW_DEP/" dune-project
+
+# Run dune to update the project
+dune build ann_bloop.opam
+
+
+# Run cat to generate a new package-deps.json
+cat $(nix eval .#package-defs --raw) > package-defs.json