|
160 | 160 | :additions {'rewrite-clj/rewrite-clj {:mvn/version rewrite-clj-version}}})
|
161 | 161 | (patch-rewrite-cljc-sources home-dir))
|
162 | 162 |
|
| 163 | +(defn- replace-in-file [fname match replacement] |
| 164 | + (let [orig-filename (str fname ".orig") |
| 165 | + content (slurp fname)] |
| 166 | + (fs/copy fname orig-filename) |
| 167 | + (status/line :detail (format "- hacking %s" fname)) |
| 168 | + (let [new-content (string/replace content match replacement)] |
| 169 | + (if (= new-content content) |
| 170 | + (throw (ex-info (format "hacking file failed: %s" fname) {})) |
| 171 | + (spit fname new-content))) |
| 172 | + (status/line :detail (format "-> here's the diff for %s" fname)) |
| 173 | + (shcmd-no-exit ["git" "--no-pager" "diff" "--no-index" orig-filename fname]))) |
| 174 | + |
163 | 175 | ;;
|
164 | 176 | ;; antq
|
165 | 177 | ;;
|
|
197 | 209 | :additions {'rewrite-clj/rewrite-clj {:mvn/version rewrite-clj-version}
|
198 | 210 | 'cljfmt/cljfmt {:mvn/version "0.7.0" :exclusions ['rewrite-cljs/rewrite-cljs
|
199 | 211 | 'rewrite-clj/rewrite-clj]}}}))
|
| 212 | + |
| 213 | +;; |
| 214 | +;; cljstyle |
| 215 | +;; |
| 216 | + |
| 217 | +(defn- cljstyle-patch [{:keys [home-dir rewrite-clj-version]}] |
| 218 | + (patch-deps {:filename (str (fs/file home-dir "project.clj")) |
| 219 | + :removals #{'rewrite-clj} |
| 220 | + :additions [['rewrite-clj rewrite-clj-version]]}) |
| 221 | + |
| 222 | + (status/line :detail "=> cljstyle needs to hacks to work with rewrite-clj v1") |
| 223 | + (status/line :detail "=> hack 1 of 2: update ref to internal use of StringNode") |
| 224 | + (replace-in-file (str (fs/file home-dir "src/cljstyle/format/zloc.clj")) |
| 225 | + "rewrite_clj.node.string.StringNode" |
| 226 | + "rewrite_clj.node.stringz.StringNode") |
| 227 | + |
| 228 | + (status/line :detail "=> hack 2 of 2: update test expectation of exception type") |
| 229 | + (replace-in-file (str (fs/file home-dir "test/cljstyle/task_test.clj")) |
| 230 | + "java.lang.Exception: Unexpected" |
| 231 | + "clojure.lang.ExceptionInfo: Unexpected")) |
| 232 | + |
200 | 233 | ;;
|
201 | 234 | ;; mranderson
|
202 | 235 | ;;
|
|
303 | 336 | :patch-fn cljfmt-patch
|
304 | 337 | :show-deps-fn lein-deps-tree
|
305 | 338 | :test-cmds [["lein" "test"]]}
|
| 339 | + {:name "cljstyle" |
| 340 | + :version "0.14.0" |
| 341 | + :platforms [:clj] |
| 342 | + :note "2 minor hacks to pass with rewrite-clj v1" |
| 343 | + :github-release {:repo "greglook/cljstyle" |
| 344 | + :via :tag} |
| 345 | + :patch-fn cljstyle-patch |
| 346 | + :show-deps-fn lein-deps-tree |
| 347 | + :test-cmds [["lein" "check"] |
| 348 | + ["lein" "test"]]} |
306 | 349 | {:name "clojure-lsp"
|
307 | 350 | :platforms [:clj]
|
308 | 351 | :version "2021.03.06-17.05.35"
|
|
350 | 393 | {:name "zprint"
|
351 | 394 | :version "1.1.1"
|
352 | 395 | :platforms [:clj :cljs]
|
353 |
| - :note "zprint src hacked to pass with rewrite-clj v1" |
| 396 | + :note "1 minor hack to pass with rewrite-clj v1" |
354 | 397 | :github-release {:repo "kkinnear/zprint"}
|
355 | 398 | :patch-fn zprint-patch
|
356 | 399 | :prep-fn zprint-prep
|
|
375 | 418 | (fetch-lib-release lib))
|
376 | 419 | home-dir (str (fs/file home-dir (or root "")))
|
377 | 420 | lib (assoc lib :home-dir home-dir)]
|
| 421 | + (status/line :detail "git init-ing target, some libs expect that they were cloned") |
| 422 | + (shcmd ["git" "init"] {:dir home-dir}) |
| 423 | + |
378 | 424 | (when patch-fn
|
379 | 425 | (status/line :info (format "%s: Patching" name))
|
380 | 426 | (patch-fn lib))
|
|
402 | 448 | (status/line :detail (format "(re)creating: %s" target-root-dir))
|
403 | 449 | (when (fs/exists? target-root-dir) (fs/delete-tree target-root-dir))
|
404 | 450 | (.mkdirs (fs/file target-root-dir))
|
405 |
| - (status/line :detail "git init-ing target to avoid polluting our project git config/hooks with any changes libs under test might effect") |
406 |
| - (shcmd ["git" "init"] {:dir target-root-dir})) |
| 451 | + ) |
407 | 452 |
|
408 | 453 | ;;
|
409 | 454 | ;; cmds
|
|
0 commit comments