forked from gtrak/no.disassemble
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use Leiningen's built-in support for Java agents and simplify code
- Loading branch information
Showing
1 changed file
with
5 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,13 @@ | ||
(ns lein-nodisassemble.plugin | ||
(:require [leiningen.core.classpath :as cp])) | ||
(ns lein-nodisassemble.plugin) | ||
|
||
(defn get-version | ||
[project] | ||
(let [[_ version] (first (filter #(re-matches #".*lein-nodisassemble.*" (str (first %))) | ||
(:plugins project)))] | ||
version)) | ||
|
||
(defn find-dep | ||
[project] | ||
(->> (cp/resolve-dependencies :dependencies project) | ||
(filter #(re-find #".*nodisassemble.*" (.getName %))) | ||
first)) | ||
|
||
(defn middleware [project] | ||
(let [version (get-version project) | ||
project (update-in project [:dependencies] conj ['nodisassemble version]) | ||
path (-> (find-dep project) .toURI .getPath)] | ||
(update-in project [:jvm-opts] conj (str "-javaagent:" path)))) | ||
(let [version (get-version project)] | ||
(-> project | ||
(update-in [:dependencies] conj ['nodisassemble version]) | ||
(update-in [:java-agents] conj ['nodisassemble version])))) |
bca1e66
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah, neat. I'll test it out soon. Curious if it affects gtrak#2.
bca1e66
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I already checked and no, it doesn't. :(
So this is purely cosmetic.