slipset / deps-deploy

deploy your stuff
Eclipse Public License 1.0
148 stars 31 forks source link

Feature ideas #26

Closed dcj closed 3 years ago

dcj commented 3 years ago
As of 2.0.next, depstar allows the value of any exec argument to be a keyword which is then looked up as an alias in the full project basis (including your user deps.edn file).

This can be helpful in keeping a deps.edn file DRY (things are only defined once) IMHO it would be nice if deps-deploy supported this convention as well. Furthermore, I use private maven repos, which are already defined in my deps.edn under the :mvn/repos key, when specifying the :repository exec-arg to deps-deploy, it would be DRYer if I could specify a string that matched a key in the existing :mvn/repos map. I am not sure what the best way to get the credentials for this repository. ATM, the credentials are in the ~/.m2/settings.xml file, is there a way that deps-deploy could get them from there? The current CLOJARS_ environment variables are not looked up when not using the default-repository. I suppose another alternative would be to look up other env vars for non-default repos, but ATM I don't love that idea.
What do you think of all this? Would you consider a pull request on this?

seancorfield commented 3 years ago

For reference, here's the function in depstar that handles this: https://github.com/seancorfield/depstar/blob/develop/src/hf/depstar/uberjar.clj#L605-L622

The alias t is clojure.tools.deps.alpha and the read-edn-files function is: https://github.com/seancorfield/depstar/blob/develop/src/hf/depstar/uberjar.clj#L305-L312 (depstar has a second usage that can ignore the user deps.edn file so this can be simplified further if you do not care about that).

dcj commented 3 years ago

I've taken a stab at this in PR #27

Here is a first draft implementation of this feature:

These features combine to enable DRYer deps.edn files, i.e.

  :artifact-id       deps-deploy
  :group-id          com.dcj
  :version           "2.0.999-SNAPSHOT"
  :jar/filename      "deps-deploy.jar"

  :depstar {:replace-deps
            {com.github.seancorfield/depstar ; 2.0.next:
             {:git/url "https://github.com/seancorfield/depstar"
              :sha "5f4df9ffece4769d01559f7914bd88de024e1348"}}
            :exec-fn hf.depstar/jar
            :exec-args {:jar         :jar/filename
                        :artifact-id :artifact-id
                        :group-id    :group-id
                        :version     :version
                        :sync-pom true}}

  :deploy {:extra-deps {com.dcj/deps-deploy {:mvn/version "2.0.999-SNAPSHOT"}}
           :exec-fn deps-deploy.deps-deploy/deploy
           :exec-args {:installer :remote
                       :sign-releases? true
                       :artifact :jar/filename}}