branch: elpa/cider
commit 53e0c1718ffd9026652880f43ca92be2e739f343
Author: Bozhidar Batsov <[email protected]>
Commit: Bozhidar Batsov <[email protected]>

    Remove deprecated cider-*-global-options
---
 CHANGELOG.md        |   1 +
 cider.el            | 127 ++++++++--------------------------------------------
 test/cider-tests.el |  65 +++++++--------------------
 3 files changed, 35 insertions(+), 158 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 90f105299d3..36326e24391 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -6,6 +6,7 @@
 
 - [#3854](https://github.com/clojure-emacs/cider/pull/3854): Use buttons for 
items in `cider-ns-browser` to allow clicking and evil's `RET` to navigate.
 - Drop support for Emacs 27.
+- Remove deprecated `cider-*-global-opts`.
 
 ### Bugs fixed
 
diff --git a/cider.el b/cider.el
index b10870fd9f0..dd8b9d22f5c 100644
--- a/cider.el
+++ b/cider.el
@@ -114,12 +114,6 @@
   "The command used to execute Leiningen."
   :type 'string)
 
-(defcustom cider-lein-global-options
-  nil
-  "Command global options used to execute Leiningen (e.g.: -o for offline)."
-  :type 'string
-  :safe #'stringp)
-
 (defcustom cider-lein-parameters
   "repl :headless :host localhost"
   "Params passed to Leiningen to start an nREPL server via `cider-jack-in'."
@@ -132,13 +126,6 @@
   :type 'string
   :package-version '(cider . "0.9.0"))
 
-(defcustom cider-boot-global-options
-  nil
-  "Command global options used to execute Boot (e.g.: -c for checkouts)."
-  :type 'string
-  :safe #'stringp
-  :package-version '(cider . "0.14.0"))
-
 (defcustom cider-boot-parameters
   "repl -s -b localhost wait"
   "Params passed to boot to start an nREPL server via `cider-jack-in'."
@@ -159,13 +146,6 @@ default to \"powershell\"."
   :safe #'stringp
   :package-version '(cider . "0.17.0"))
 
-(defcustom cider-clojure-cli-global-options
-  nil
-  "Command line options used to execute clojure with tools.deps."
-  :type 'string
-  :safe #'stringp
-  :package-version '(cider . "0.17.0"))
-
 (defcustom cider-clojure-cli-parameters
   nil
   "Params passed to clojure cli to start an nREPL server via `cider-jack-in'."
@@ -204,13 +184,6 @@ By default we favor the project-specific shadow-cljs over 
the system-wide."
   :safe #'stringp
   :package-version '(cider . "0.17.0"))
 
-(defcustom cider-shadow-cljs-global-options
-  ""
-  "Command line options used to execute shadow-cljs (e.g.: -v for verbose 
mode)."
-  :type 'string
-  :safe #'stringp
-  :package-version '(cider . "0.17.0"))
-
 (defcustom cider-shadow-cljs-parameters
   "server"
   "Params passed to shadow-cljs to start an nREPL server via `cider-jack-in'."
@@ -225,13 +198,6 @@ By default we favor the project-specific shadow-cljs over 
the system-wide."
   :safe #'stringp
   :package-version '(cider . "0.10.0"))
 
-(defcustom cider-gradle-global-options
-  ""
-  "Command line options used to execute Gradle (e.g.: -m for dry run)."
-  :type 'string
-  :safe #'stringp
-  :package-version '(cider . "0.14.0"))
-
 (defcustom cider-gradle-parameters
   "clojureRepl"
   "Params passed to gradle to start an nREPL server via `cider-jack-in'."
@@ -246,13 +212,6 @@ By default we favor the project-specific shadow-cljs over 
the system-wide."
   :safe #'stringp
   :package-version '(cider . "1.2.0"))
 
-(defcustom cider-babashka-global-options
-  nil
-  "Command line options used to execute Babashka."
-  :type 'string
-  :safe #'stringp
-  :package-version '(cider . "1.2.0"))
-
 (defcustom cider-babashka-parameters
   "nrepl-server localhost:0"
   "Params passed to babashka to start an nREPL server via `cider-jack-in'."
@@ -267,13 +226,6 @@ By default we favor the project-specific shadow-cljs over 
the system-wide."
   :safe #'stringp
   :package-version '(cider . "1.6.0"))
 
-(defcustom cider-nbb-global-options
-  nil
-  "Command line options used to execute nbb."
-  :type 'string
-  :safe #'stringp
-  :package-version '(cider . "1.6.0"))
-
 (defcustom cider-nbb-parameters
   "nrepl-server"
   "Params passed to nbb to start an nREPL server via `cider-jack-in'."
@@ -298,15 +250,6 @@ By default we favor the project-specific shadow-cljs over 
the system-wide."
   :safe #'stringp
   :package-version '(cider . "1.14.0"))
 
-(make-obsolete-variable 'cider-lein-global-options 'cider-lein-parameters 
"1.8.0")
-(make-obsolete-variable 'cider-boot-command nil "1.8.0")
-(make-obsolete-variable 'cider-boot-parameters nil "1.8.0")
-(make-obsolete-variable 'cider-boot-global-options nil "1.8.0")
-(make-obsolete-variable 'cider-clojure-cli-global-options 
'cider-clojure-cli-parameters "1.8.0")
-(make-obsolete-variable 'cider-shadow-cljs-global-options 
'cider-shadow-cljs-parameters "1.8.0")
-(make-obsolete-variable 'cider-gradle-global-options 'cider-gradle-parameters 
"1.8.0")
-(make-obsolete-variable 'cider-babashka-global-options 
'cider-babashka-parameters "1.8.0")
-(make-obsolete-variable 'cider-nbb-global-options 'cider-nbb-parameters 
"1.8.0")
 (make-obsolete-variable 'cider-enrich-classpath nil "1.19.0")
 
 (defcustom cider-jack-in-default
@@ -484,18 +427,6 @@ Throws an error if PROJECT-TYPE is unknown."
     ('basilisp (cider--resolve-command cider-basilisp-command))
     (_ (user-error "Unsupported project type `%S'" project-type))))
 
-(defun cider-jack-in-global-options (project-type)
-  "Determine the command line options for `cider-jack-in' for the 
PROJECT-TYPE."
-  (pcase project-type
-    ('lein        cider-lein-global-options)
-    ('clojure-cli cider-clojure-cli-global-options)
-    ('babashka    cider-babashka-global-options)
-    ('shadow-cljs cider-shadow-cljs-global-options)
-    ('gradle      cider-gradle-global-options)
-    ('nbb         cider-nbb-global-options)
-    ('basilisp    nil)
-    (_            (user-error "Unsupported project type `%S'" project-type))))
-
 (defun cider-jack-in-params (project-type)
   "Determine the commands params for `cider-jack-in' for the PROJECT-TYPE."
   ;; The format of these command-line strings must consider different shells,
@@ -699,16 +630,14 @@ ClojureNRepl task."
              middlewares
              " "))
 
-(defun cider-gradle-jack-in-dependencies (global-opts params dependencies 
middlewares)
+(defun cider-gradle-jack-in-dependencies (params dependencies middlewares)
   "Create gradle jack in dependencies.
-Does so by concatenating GLOBAL-OPTS, DEPENDENCIES,
-and MIDDLEWARES.  GLOBAL-OPTS and PARAMS are taken as-is.
+Does so by concatenating PARAMS, DEPENDENCIES,
+and MIDDLEWARES.  PARAMS are taken as-is.
 DEPENDENCIES are translated into Gradle's typical
 group:artifact:version notation and MIDDLEWARES are
 prepared as arguments to Clojurephant's ClojureNRepl task."
-  (concat global-opts
-          (unless (seq-empty-p global-opts) " ")
-          (when cider-enable-nrepl-jvmti-agent
+  (concat (when cider-enable-nrepl-jvmti-agent
             "-Pjdk.attach.allowAttachSelf ")
           (cider--gradle-jack-in-property (append 
(cider--jack-in-required-dependencies) dependencies))
           " "
@@ -729,13 +658,11 @@ of EXCLUSIONS can be provided as well.  The returned
 string is quoted for passing as argument to an inferior shell."
   (shell-quote-argument (format "[%s %S%s]" (car list) (cadr list) 
(cider--lein-artifact-exclusions exclusions))))
 
-(defun cider-lein-jack-in-dependencies (global-opts params dependencies 
dependencies-exclusions lein-plugins &optional lein-middlewares)
+(defun cider-lein-jack-in-dependencies (params dependencies 
dependencies-exclusions lein-plugins &optional lein-middlewares)
   "Create lein jack-in dependencies.
-Does so by concatenating GLOBAL-OPTS, DEPENDENCIES, with 
DEPENDENCIES-EXCLUSIONS
+Does so by concatenating DEPENDENCIES, with DEPENDENCIES-EXCLUSIONS
 removed, LEIN-PLUGINS, LEIN-MIDDLEWARES and finally PARAMS."
   (concat
-   global-opts
-   (unless (seq-empty-p global-opts) " ")
    (mapconcat #'identity
               (append (seq-map (lambda (dep)
                                  (let ((exclusions (cadr (assoc (car dep) 
dependencies-exclusions))))
@@ -803,12 +730,12 @@ rules to quote it."
             (concat ":" aliases)))
       "")))
 
-(defun cider-clojure-cli-jack-in-dependencies (global-options params 
dependencies &optional command)
+(defun cider-clojure-cli-jack-in-dependencies (params dependencies &optional 
command)
   "Create Clojure tools.deps jack-in dependencies.
-Does so by concatenating DEPENDENCIES, PARAMS and GLOBAL-OPTIONS into a
-suitable `clojure` invocation and quoting, also accounting for COMMAND if
-provided.  The main is placed in an inline alias :cider/nrepl so that if
-your aliases contain any mains, the cider/nrepl one will be the one used."
+Does so by concatenating DEPENDENCIES and PARAMS into a suitable `clojure`
+invocation and quoting, also accounting for COMMAND if provided.  The main
+is placed in an inline alias :cider/nrepl so that if your aliases contain
+any mains, the cider/nrepl one will be the one used."
   (let* ((all-deps (thread-last dependencies
                                 (append (cider--jack-in-required-dependencies))
                                 ;; Duplicates are never OK since they would 
result in
@@ -836,20 +763,16 @@ your aliases contain any mains, the cider/nrepl one will 
be the one used."
                          "")
                        main-opts))
          (deps-quoted (cider--shell-quote-argument deps command)))
-    (format "%s-Sdeps %s -M%s:cider/nrepl%s"
-            ;; TODO: global-options are deprecated and should be removed in 
CIDER 2.0
-            (if global-options (format "%s " global-options) "")
+    (format "-Sdeps %s -M%s:cider/nrepl%s"
             deps-quoted
             (cider--combined-aliases)
             (if params (format " %s" params) ""))))
 
-(defun cider-shadow-cljs-jack-in-dependencies (global-opts params dependencies)
+(defun cider-shadow-cljs-jack-in-dependencies (params dependencies)
   "Create shadow-cljs jack-in deps.
-Does so by concatenating GLOBAL-OPTS, DEPENDENCIES finally PARAMS."
+Does so by concatenating PARAMS and DEPENDENCIES."
   (let ((dependencies (append (cider--jack-in-required-dependencies) 
dependencies)))
     (concat
-     global-opts
-     (unless (seq-empty-p global-opts) " ")
      (mapconcat #'identity
                 (seq-map (lambda (dep) (format "-d %s:%s" (car dep) (cadr 
dep))) dependencies)
                 " ")
@@ -873,8 +796,8 @@ See also `cider-jack-in-auto-inject-clojure'."
               dependencies))
     dependencies))
 
-(defun cider-inject-jack-in-dependencies (global-opts params project-type 
&optional command)
-  "Return GLOBAL-OPTS and PARAMS with injected REPL dependencies.
+(defun cider-inject-jack-in-dependencies (params project-type &optional 
command)
+  "Return PARAMS with injected REPL dependencies.
 These are set in `cider-jack-in-dependencies', `cider-jack-in-lein-plugins'
 and `cider-jack-in-nrepl-middlewares' are injected from the CLI according
 to the used PROJECT-TYPE, and COMMAND if provided.  Eliminates the need for
@@ -882,7 +805,6 @@ hacking profiles.clj for supporting CIDER with its nREPL 
middleware and
 dependencies."
   (pcase project-type
     ('lein (cider-lein-jack-in-dependencies
-            global-opts
             params
             (cider-add-clojure-dependencies-maybe
              (append `(("nrepl/nrepl" ,cider-injected-nrepl-version)) 
cider-jack-in-dependencies))
@@ -890,30 +812,21 @@ dependencies."
             (cider-jack-in-normalized-lein-plugins)
             cider-jack-in-lein-middlewares))
     ('clojure-cli (cider-clojure-cli-jack-in-dependencies
-                   global-opts
                    params
                    (cider-add-clojure-dependencies-maybe
                     cider-jack-in-dependencies)
                    command))
-    ('babashka (concat
-                global-opts
-                (unless (seq-empty-p global-opts) " ")
-                params))
+    ('babashka params)
     ('shadow-cljs (cider-shadow-cljs-jack-in-dependencies
-                   global-opts
                    params
                    (cider-add-clojure-dependencies-maybe
                     cider-jack-in-dependencies)))
     ('gradle (cider-gradle-jack-in-dependencies
-              global-opts
               params
               (cider-add-clojure-dependencies-maybe
                cider-jack-in-dependencies)
               (cider-jack-in-normalized-nrepl-middlewares)))
-    ('nbb (concat
-           global-opts
-           (unless (seq-empty-p global-opts) " ")
-           params))
+    ('nbb params)
     ('basilisp params)
     (_ (error "Unsupported project type `%S'" project-type))))
 
@@ -1664,8 +1577,6 @@ PARAMS is a plist with the following keys (non-exhaustive 
list)
                                (cider-project-type project-dir)))
              (command (cider-jack-in-command project-type))
              (command-resolved (cider-jack-in-resolve-command project-type))
-             ;; TODO: global-options are deprecated and should be removed in 
CIDER 2.0
-             (command-global-opts (cider-jack-in-global-options project-type))
              (command-params (cider-jack-in-params project-type)))
         (if command-resolved
             (with-current-buffer (or (plist-get params :--context-buffer)
@@ -1676,7 +1587,7 @@ PARAMS is a plist with the following keys (non-exhaustive 
list)
                                                       
'cider--jack-in-nrepl-params-history)
                                        command-params))
                      (cmd-params (if cider-inject-dependencies-at-jack-in
-                                     (cider-inject-jack-in-dependencies 
command-global-opts command-params
+                                     (cider-inject-jack-in-dependencies 
command-params
                                                                         
project-type command)
                                    command-params)))
                 (if (or project-dir cider-allow-jack-in-without-project)
diff --git a/test/cider-tests.el b/test/cider-tests.el
index c9e22bbe1bd..ada0b033c99 100644
--- a/test/cider-tests.el
+++ b/test/cider-tests.el
@@ -150,7 +150,7 @@
       (setq-local cider-enable-nrepl-jvmti-agent t))
 
     (it "can inject dependencies in a lein project"
-      (expect (cider-inject-jack-in-dependencies "" "repl :headless" 'lein)
+      (expect (cider-inject-jack-in-dependencies "repl :headless" 'lein)
               :to-equal (concat "update-in :dependencies conj "
                                 (shell-quote-argument "[nrepl/nrepl 
\"1.2.3\"]")
                                 " -- update-in :plugins conj "
@@ -160,7 +160,7 @@
 
     (it "can inject dependencies in a lein project with an exclusion"
       (setq-local cider-jack-in-dependencies-exclusions '(("nrepl/nrepl" 
("org.clojure/clojure"))))
-      (expect (cider-inject-jack-in-dependencies "" "repl :headless" 'lein)
+      (expect (cider-inject-jack-in-dependencies "repl :headless" 'lein)
               :to-equal (concat
                          "update-in :dependencies conj "
                          (shell-quote-argument "[nrepl/nrepl \"1.2.3\" 
:exclusions [org.clojure/clojure]]")
@@ -171,7 +171,7 @@
 
     (it "can inject dependencies in a lein project with multiple exclusions"
       (setq-local cider-jack-in-dependencies-exclusions '(("nrepl/nrepl" 
("org.clojure/clojure" "foo.bar/baz"))))
-      (expect (cider-inject-jack-in-dependencies "" "repl :headless" 'lein)
+      (expect (cider-inject-jack-in-dependencies "repl :headless" 'lein)
               :to-equal (concat "update-in :dependencies conj "
                                 (shell-quote-argument "[nrepl/nrepl \"1.2.3\" 
:exclusions [org.clojure/clojure foo.bar/baz]]")
                                 " -- update-in :plugins conj "
@@ -180,9 +180,8 @@
                                 " -- repl :headless")))
 
     (it "can inject dependencies in a gradle project"
-      (expect (cider-inject-jack-in-dependencies "--no-daemon" ":clojureRepl" 
'gradle)
-              :to-equal (concat "--no-daemon "
-                                "-Pjdk.attach.allowAttachSelf "
+      (expect (cider-inject-jack-in-dependencies ":clojureRepl" 'gradle)
+              :to-equal (concat "-Pjdk.attach.allowAttachSelf "
                                 (shell-quote-argument 
"-Pdev.clojurephant.jack-in.nrepl=nrepl:nrepl:1.2.3,cider:cider-nrepl:2.3.4")
                                 " :clojureRepl "
                                 (shell-quote-argument 
"--middleware=cider.nrepl/cider-middleware")))))
@@ -194,7 +193,7 @@
       (setq-local cider-jack-in-nrepl-middlewares 
'("refactor-nrepl.middleware/wrap-refactor" "cider.nrepl/cider-middleware"))
       (setq-local cider-jack-in-dependencies-exclusions '()))
     (it "can inject dependencies in a lein project"
-      (expect (cider-inject-jack-in-dependencies "" "repl :headless" 'lein)
+      (expect (cider-inject-jack-in-dependencies "repl :headless" 'lein)
               :to-equal (concat "update-in :dependencies conj "
                                 (shell-quote-argument "[nrepl/nrepl 
\"1.2.3\"]")
                                 " -- update-in :plugins conj "
@@ -204,28 +203,6 @@
                                 " -- update-in :jvm-opts conj 
'\"-Djdk.attach.allowAttachSelf\"'"
                                 " -- repl :headless"))))
 
-  (describe "when there are global options"
-    (before-each
-      ;; FIXME: Needed because its set in an earlier test
-      (setq-local cider-jack-in-lein-plugins nil)
-      (setq-local cider-jack-in-dependencies nil)
-      (setq-local cider-jack-in-nrepl-middlewares 
'("cider.nrepl/cider-middleware"))
-      (setq-local cider-jack-in-dependencies-exclusions '()))
-    (it "can concat in a lein project"
-      (expect (cider-inject-jack-in-dependencies "-o -U" "repl :headless" 
'lein)
-              :to-equal (concat "-o -U update-in :dependencies conj "
-                                (shell-quote-argument "[nrepl/nrepl 
\"1.2.3\"]")
-                                " -- update-in :plugins conj "
-                                (shell-quote-argument "[cider/cider-nrepl 
\"2.3.4\"]")
-                                " -- update-in :jvm-opts conj 
'\"-Djdk.attach.allowAttachSelf\"'"
-                                " -- repl :headless")))
-    (it "can concat in a gradle project"
-      (expect (cider-inject-jack-in-dependencies "--no-daemon" ":clojureRepl" 
'gradle)
-              :to-equal (concat "--no-daemon "
-                                "-Pjdk.attach.allowAttachSelf "
-                                (shell-quote-argument 
"-Pdev.clojurephant.jack-in.nrepl=nrepl:nrepl:1.2.3,cider:cider-nrepl:2.3.4")
-                                " :clojureRepl "
-                                (shell-quote-argument 
"--middleware=cider.nrepl/cider-middleware")))))
 
   (describe "when there are predicates"
     :var (plugins-predicate middlewares-predicate)
@@ -276,7 +253,7 @@
                                   ("cider/cider-nrepl" "2.3.4")))
       (setq-local cider-jack-in-dependencies-exclusions '()))
     (it "uses them in a lein project"
-      (expect (cider-inject-jack-in-dependencies "" "repl :headless" 'lein)
+      (expect (cider-inject-jack-in-dependencies "repl :headless" 'lein)
               :to-equal (concat "update-in :dependencies conj "
                                 (shell-quote-argument "[nrepl/nrepl 
\"1.2.3\"]")
                                 " -- update-in :plugins conj "
@@ -360,7 +337,6 @@
       (setq-local cider-edit-jack-in-command nil)
       (spy-on 'cider-project-type :and-return-value 'clojure-cli)
       (spy-on 'cider-jack-in-resolve-command :and-return-value 
"resolved-powershell")
-      (spy-on 'cider-jack-in-global-options)
       (spy-on 'cider-jack-in-params :and-return-value "\"cmd-params\"")
       (expect (plist-get (cider--update-jack-in-cmd nil) :jack-in-cmd)
               :to-equal (concat "resolved-powershell -encodedCommand "
@@ -414,7 +390,7 @@
                                                                      command)
                                        " -M:dev:test:cider/nrepl")
                                      "")))
-          (expect (cider-clojure-cli-jack-in-dependencies nil nil 
'(("nrepl/nrepl" "1.2.3")
+          (expect (cider-clojure-cli-jack-in-dependencies nil '(("nrepl/nrepl" 
"1.2.3")
                                                                     
("nrepl/nrepl" "1.2.3"))
                                                           command)
                   :to-equal expected))))
@@ -427,38 +403,27 @@
                                    ""))
             (deps '(("nrepl/nrepl" "1.2.3"))))
         (let ((cider-clojure-cli-aliases ":test"))
-          (expect (cider-clojure-cli-jack-in-dependencies nil nil deps)
+          (expect (cider-clojure-cli-jack-in-dependencies nil deps)
                   :to-equal expected))
         (describe "should strip out leading exec opts -A -M -T -X, and ensure 
there's a leading :"
           (let ((cider-clojure-cli-aliases ":test"))
-            (expect (cider-clojure-cli-jack-in-dependencies nil nil deps)
+            (expect (cider-clojure-cli-jack-in-dependencies nil deps)
                     :to-equal expected))
           (let ((cider-clojure-cli-aliases "test"))
-            (expect (cider-clojure-cli-jack-in-dependencies nil nil deps)
+            (expect (cider-clojure-cli-jack-in-dependencies nil deps)
                     :to-equal expected))
           (let ((cider-clojure-cli-aliases "-A:test"))
-            (expect (cider-clojure-cli-jack-in-dependencies nil nil deps)
+            (expect (cider-clojure-cli-jack-in-dependencies nil deps)
                     :to-equal expected))
           (let ((cider-clojure-cli-aliases "-M:test"))
-            (expect (cider-clojure-cli-jack-in-dependencies nil nil deps)
+            (expect (cider-clojure-cli-jack-in-dependencies nil deps)
                     :to-equal expected))
           (let ((cider-clojure-cli-aliases "-T:test"))
-            (expect (cider-clojure-cli-jack-in-dependencies nil nil deps)
+            (expect (cider-clojure-cli-jack-in-dependencies nil deps)
                     :to-equal expected))
           (let ((cider-clojure-cli-aliases "-T:test"))
-            (expect (cider-clojure-cli-jack-in-dependencies nil nil deps)
+            (expect (cider-clojure-cli-jack-in-dependencies nil deps)
                     :to-equal expected)))))
-    (it "allows for global options"
-        (setq-local cider-injected-nrepl-version "1.2.3")
-        (setq-local cider-injected-middleware-version "2.3.4")
-        (let ((expected (string-join `("-J-Xverify:none -Sdeps "
-                                       ,(shell-quote-argument "{:deps 
{cider/cider-nrepl {:mvn/version \"2.3.4\"} nrepl/nrepl {:mvn/version 
\"1.2.3\"}} :aliases {:cider/nrepl {:jvm-opts 
[\"-Djdk.attach.allowAttachSelf\"], :main-opts [\"-m\" \"nrepl.cmdline\" 
\"--middleware\" \"[cider.nrepl/cider-middleware]\"]}}}")
-                                     " -M:test:cider/nrepl")
-                                   ""))
-            (deps '(("nrepl/nrepl" "1.2.3"))))
-        (let ((cider-clojure-cli-aliases ":test"))
-          (expect (cider-clojure-cli-jack-in-dependencies "-J-Xverify:none" 
nil deps)
-                  :to-equal expected))))
     (it "allows to specify git coordinate as cider-jack-in-dependency"
       (setq-local cider-injected-nrepl-version "1.2.3")
       (setq-local cider-injected-middleware-version "2.3.4")

Reply via email to