Skip to content

Commit eafa135

Browse files
committed
Introduce --no-namespace-maps, version bumps, etc.
Introduce a new option, --no-namespace-map (or in :launchpad/options : `:namespace-maps false`), which adds an nrepl middleware that turns off *print-namespace-maps*. Add negative versions of the booleans flags `(--no-go, --no-emacs, etc)`, useful for overriding local/global/per-project defaults. Bump dependency versions. Add a release hook to keep the internal launchpad version in sync.
1 parent 54a5140 commit eafa135

File tree

7 files changed

+102
-63
lines changed

7 files changed

+102
-63
lines changed

CHANGELOG.md

+6-2
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,14 @@
22

33
## Added
44

5-
## Fixed
5+
- `--[no-]namespace-maps` option (disable `*print-namespace-maps*`)
66

77
## Changed
88

9+
- Boolean flags are now defined as `--[no-]...`, so that you can override
10+
local/global/project defaults from the command line, e.g. `bin/launchpad
11+
--no-go`
12+
913
# 0.35.156-alpha (2025-01-09 / 0592491)
1014

1115
## Fixed
@@ -268,4 +272,4 @@ Initial release
268272
- lambdaisland.classpath integration
269273
- Support for cider-nrepl, refactor-nrepl
270274
- Basic support for shadow-cljs cljs nREPL-base REPL
271-
- Auto-connect for Emacs
275+
- Auto-connect for Emacs

bb.edn

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
{:paths ["src" "resources"]
22
:deps
3-
{lambdaisland/open-source {:git/url "https://github.com/lambdaisland/open-source"
4-
:git/sha "7ce125cbd14888590742da7ab3b6be9bba46fc7a"}
5-
com.lambdaisland/launchpad {:local/root "."}}}
3+
{borkdude/rewrite-edn {:mvn/version "0.4.8"}
4+
com.lambdaisland/launchpad {:local/root "."}
5+
com.lambdaisland/cli {:mvn/version "0.22.87"}
6+
lambdaisland/open-source {:git/url "https://github.com/lambdaisland/open-source"
7+
:git/sha "6cb675d2adae284021f8cd94dcfbd078986b39bd"}}}

bin/proj

+19-6
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,27 @@
11
#!/usr/bin/env bb
22

33
(ns proj
4-
(:require [lioss.main :as lioss]))
4+
(:require
5+
[borkdude.rewrite-edn :as re]
6+
[lioss.main :as lioss]))
7+
8+
(def versions-file "resources/launchpad/deps.edn")
9+
10+
(defn set-launchpad-version [{:keys [version] :as opts}]
11+
(spit versions-file
12+
(-> versions-file
13+
slurp
14+
re/parse-string
15+
(re/assoc-in [:deps 'com.lambdaisland/launchpad :mvn/version] version)))
16+
opts)
517

618
(lioss/main
7-
{:license :mpl
8-
:inception-year 2022
9-
:description "Clojure dev process launcher"
10-
:group-id "com.lambdaisland"
11-
:version-qualifier "alpha"
19+
{:license :mpl
20+
:inception-year 2022
21+
:description "Clojure dev process launcher"
22+
:group-id "com.lambdaisland"
23+
:version-qualifier "alpha"
24+
:pre-release-hook set-launchpad-version
1225
:aliases-as-scope-provided [:clojure]})
1326

1427
;; Local Variables:

deps.edn

+7-10
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,23 @@
11
{:paths ["src" "resources"]
22

33
:deps
4-
{org.clojure/clojure {:mvn/version "1.11.2"}
4+
{org.clojure/clojure {:mvn/version "1.12.0"}
55
com.lambdaisland/dotenv {:mvn/version "0.2.5"}
6-
com.lambdaisland/cli {:mvn/version "0.18.74"}}
6+
com.lambdaisland/cli {:mvn/version "0.22.87"}}
77

88
:aliases
99
{:clojure
10-
{:extra-deps {babashka/babashka {:mvn/version "1.3.190" :scope "provided"}
10+
{:extra-deps {babashka/babashka {:mvn/version "1.12.196" :scope "provided"}
1111
org.clojure/tools.deps.alpha {:mvn/version "0.15.1254"}
1212
com.nextjournal/beholder {:mvn/version "1.0.2"}
13-
thheller/shadow-cljs {:mvn/version "2.28.3"}
13+
thheller/shadow-cljs {:mvn/version "2.28.20"}
1414
;; prevent tools.deps.alpha from dragging in an old guava
15-
com.google.guava/guava {:mvn/version "33.1.0-jre"}
16-
com.lambdaisland/classpath {:mvn/version "0.5.48"}}}
17-
:dev
18-
{:extra-paths ["dev"]
19-
:extra-deps {djblue/portal {:mvn/version "RELEASE"}}}
15+
com.google.guava/guava {:mvn/version "33.4.0-jre"}
16+
com.lambdaisland/classpath {:mvn/version "0.6.58"}}}
2017

2118
:test
2219
{:extra-paths ["test"]
23-
:extra-deps {lambdaisland/kaocha {:mvn/version "1.88.1376"}}}
20+
:extra-deps {lambdaisland/kaocha {:mvn/version "1.91.1392"}}}
2421

2522
:self-deps
2623
{:extra-deps {com.lambdaisland/launchpad-deps {:local/root "resources/launchpad"}}}

resources/launchpad/deps.edn

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
;; This file is just a lookup file for Launchpad to find the version of various
2-
;; things to use. We keep it in deps.edn format so antq can automatically
3-
;; upgrade versions.
2+
;; things to use. We keep it in deps.edn format so we can automatically upgrade
3+
;; versions.
44
{:deps
5-
{com.lambdaisland/launchpad {:mvn/version "0.33.149-alpha"}
5+
{com.lambdaisland/launchpad {:mvn/version "0.35.156-alpha"}
66
com.lambdaisland/classpath {:mvn/version "0.6.58"}
7-
com.github.jnr/jnr-posix {:mvn/version "3.1.19"}
7+
com.github.jnr/jnr-posix {:mvn/version "3.1.20"}
88
thheller/shadow-cljs {:mvn/version "2.28.20"}
9-
com.google.guava/guava {:mvn/version "33.1.0-jre"}
10-
cider/cider-nrepl {:mvn/version "0.50.3"}
11-
nrepl/nrepl {:mvn/version "1.3.0"}
9+
com.google.guava/guava {:mvn/version "33.4.0-jre"}
10+
cider/cider-nrepl {:mvn/version "0.52.0"}
11+
nrepl/nrepl {:mvn/version "1.3.1"}
1212
refactor-nrepl/refactor-nrepl {:mvn/version "3.10.0"}
13-
djblue/portal {:mvn/version "0.58.3"}
13+
djblue/portal {:mvn/version "0.58.5"}
1414
com.billpiel/sayid {:mvn/version "0.1.0"}
1515
com.gfredericks/debug-repl {:mvn/version "0.3.1-p1"}
1616
}}

src/lambdaisland/launchpad.clj

+46-34
Original file line numberDiff line numberDiff line change
@@ -39,25 +39,35 @@
3939
(set-signal-handler! "TERM" cleanup)
4040

4141
(def flags
42-
["-v,--verbose" "Print debug information"
43-
"-p,--nrepl-port PORT" {:doc "Start nrepl on port. Defaults to 0 (= random)"
44-
:parse-fn #(Integer/parseInt %)}
45-
"-b,--nrepl-bind ADDR" {:doc "Bind address of nrepl, by default \"127.0.0.1\"."
46-
:default "127.0.0.1"}
47-
"--emacs" {:doc "Shorthand for --cider-nrepl --refactor-nrepl --cider-connect"
48-
:handler (fn [ctx] (assoc ctx
49-
:cider-nrepl true
50-
:refactor-nrepl true
51-
:cider-connect true))}
52-
"--vs-code" {:doc "Alias for --cider-nrepl"
53-
:handler (fn [ctx] (assoc ctx :cider-nrepl true))}
54-
"--cider-nrepl" "Include CIDER nREPL dependency and middleware"
55-
"--refactor-nrepl" "Include refactor-nrepl dependency and middleware"
56-
"--cider-connect" "Automatically connect Emacs CIDER"
57-
"--portal" "Include djblue/portal as a dependency, and define (user/portal)"
58-
"--sayid" "Include Sayid dependency and middleware"
59-
"--debug-repl" "Include gfredericks/debug-repl dependency and middleware"
60-
"--go" "Call (user/go) on boot"])
42+
["-v,--verbose" {:doc "Print debug information"
43+
:value true}
44+
"-p,--nrepl-port PORT" {:doc "Start nrepl on port. Defaults to 0 (= random)"
45+
:parse-fn #(Integer/parseInt %)}
46+
"-b,--nrepl-bind ADDR" {:doc "Bind address of nrepl, by default \"127.0.0.1\"."
47+
:default "127.0.0.1"}
48+
"--[no-]emacs" {:doc "Shorthand for --cider-nrepl --refactor-nrepl --cider-connect"
49+
:handler (fn [ctx v]
50+
(assoc ctx
51+
:cider-nrepl v
52+
:refactor-nrepl v
53+
:cider-connect v))}
54+
"--[no-]vs-code" {:doc "Alias for --cider-nrepl"
55+
:handler (fn [ctx] (assoc ctx :cider-nrepl true))}
56+
"--[no-]cider-nrepl" {:doc "Include CIDER nREPL dependency and middleware"
57+
:value true}
58+
"--[no-]refactor-nrepl" {:doc "Include refactor-nrepl dependency and middleware"
59+
:value true}
60+
"--[no-]cider-connect" {:doc "Automatically connect Emacs CIDER"
61+
:value true}
62+
"--[no-]portal" {:doc "Include djblue/portal as a dependency, and define (user/portal)"
63+
:value true}
64+
"--[no-]sayid" {:doc "Include Sayid dependency and middleware"
65+
:value true}
66+
"--[no-]debug-repl" {:doc "Include gfredericks/debug-repl dependency and middleware"
67+
:value true}
68+
"--[no-]go" {:doc "Call (user/go) on boot"}
69+
"--[no-]namespace-maps" {:doc "Disable *print-namespace-maps* through nREPL middleware"
70+
:value true}])
6171

6272
(def library-versions
6373
(:deps (edn/read-string (slurp (io/resource "launchpad/deps.edn")))))
@@ -210,6 +220,9 @@
210220
(-> (assoc-extra-dep 'com.gfredericks/debug-repl)
211221
((add-nrepl-middleware 'com.gfredericks.debug-repl/wrap-debug-repl)))
212222

223+
(false? (:namespace-maps ctx))
224+
((add-nrepl-middleware 'lambdaisland.launchpad.middleware/wrap-no-print-namespace-maps))
225+
213226
(:portal ctx)
214227
(-> (assoc-extra-dep 'djblue/portal)
215228
(update :eval-forms (fnil conj [])
@@ -544,8 +557,7 @@
544557
:background? true
545558
:show-command? false}) ctx)))
546559

547-
(def before-steps [read-deps-edn
548-
handle-cli-args
560+
(def before-steps [handle-cli-args
549561
get-nrepl-port
550562
get-nrepl-bind
551563
;; inject dependencies and enable behavior
@@ -580,19 +592,19 @@
580592

581593
(defn initial-context [ctx]
582594
(let [project-root (:project-root ctx (find-project-root))]
583-
(merge
584-
{:main-opts *command-line-args*
585-
:executable (or (:executable ctx)
586-
(str/replace *file*
587-
(str project-root "/")
588-
""))
589-
:env (into {} (System/getenv))
590-
:steps (:default-steps ctx)
591-
:project-root project-root
592-
:middleware []
593-
:java-args []
594-
:eval-forms []}
595-
ctx)))
595+
(-> {:main-opts *command-line-args*
596+
:executable (or (:executable ctx)
597+
(str/replace *file*
598+
(str project-root "/")
599+
""))
600+
:env (into {} (System/getenv))
601+
:steps (:default-steps ctx)
602+
:project-root project-root
603+
:middleware []
604+
:java-args []
605+
:eval-forms []}
606+
(merge ctx)
607+
read-deps-edn)))
596608

597609
(defn process-steps [ctx steps]
598610
(reduce #(%2 %1) ctx steps))
+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
(ns lambdaisland.launchpad.middleware
2+
"Launchpad-specific nREPL middleware")
3+
4+
;; [NOTE] This approach via middleware is the only way I've found to ensure that
5+
;; this setting is off from the start.
6+
(defn wrap-no-print-namespace-maps
7+
"Bind *print-namespace-maps* to false during nREPL requests"
8+
[h]
9+
(fn [msg]
10+
(binding [*print-namespace-maps* false]
11+
(h msg))))

0 commit comments

Comments
 (0)