File tree Expand file tree Collapse file tree 3 files changed +17
-2
lines changed Expand file tree Collapse file tree 3 files changed +17
-2
lines changed Original file line number Diff line number Diff line change 11{:paths [" src/scripts" ]
22 :tasks {tag scripts/tag
33 build-plugin scripts/build-plugin
4+ install-plugin scripts/install-plugin
45 publish-plugin scripts/publish-plugin}}
Original file line number Diff line number Diff line change 44
55or
66
7- ` ./gradlew buildPlugin ` to build the plugin, then install it from disk in Intellij, the zip should be on ` ./build/distributions/*.zip ` .
7+ ` bb install-plugin ` to build and install the plugin .
88
99## NREPL
1010
Original file line number Diff line number Diff line change 11(ns scripts
22 (:require
3+ [babashka.fs :as fs]
34 [babashka.tasks :refer [shell]]
45 [clojure.string :as string]))
56
7+ (def version-regex #"pluginVersion = ([0-9]+.[0-9]+.[0-9]+.*)" )
8+
69(defn ^:private replace-in-file [file regex content]
710 (as-> (slurp file) $
811 (string/replace $ regex content)
1720
1821(defn ^:private replace-tag [tag]
1922 (replace-in-file " gradle.properties"
20- #"pluginVersion = [0-9]+.[0-9]+.[0-9]+.*"
23+ version-regex
2124 (format " pluginVersion = %s" tag)))
2225
2326#_{:clj-kondo/ignore [:clojure-lsp/unused-public-var ]}
3639(defn build-plugin []
3740 (shell " ./gradlew buildPlugin" ))
3841
42+ #_{:clj-kondo/ignore [:clojure-lsp/unused-public-var ]}
43+ (defn install-plugin [& [intellij-plugins-path]]
44+ (if-not intellij-plugins-path
45+ (println " Specify the Intellij plugins path\n e.g: bb install-plugin /home/greg/.local/share/JetBrains/IdeaIC2024.3" )
46+ (let [version (last (re-find version-regex (slurp " gradle.properties" )))]
47+ (build-plugin )
48+ (fs/unzip (format " ./build/distributions/clojure-lsp-%s.zip" version)
49+ intellij-plugins-path
50+ {:replace-existing true })
51+ (println " Installed!" ))))
52+
3953#_{:clj-kondo/ignore [:clojure-lsp/unused-public-var ]}
4054(defn publish-plugin []
4155 (shell " ./gradlew clean publishPlugin" ))
You can’t perform that action at this time.
0 commit comments