technomancy / leiningen

Moved to Codeberg; this is a convenience mirror
https://codeberg.org/leiningen/leiningen
Other
7.29k stars 1.61k forks source link

Support reading version from scm instead of hard-coded into defproject #1411

Closed technomancy closed 10 years ago

technomancy commented 10 years ago
(defproject my-project :git
   :dependencies ...)

Upsides: removes redundancy between scm and project.clj file, ensures users don't forget to tag releases.

Downsides: not sure how versions in between a release would be chosen; leiningen can't tell if this is a major, minor, or bugfix version bump from the last tagged version.

Thoughts?

johnwalker commented 10 years ago

The duplication doesn't seem particularly important, and maybe even a little unsafe (ties leiningen to scm). What about a leiningen plugin that sets tags? (Is that what you want lein release to do?)

technomancy commented 10 years ago

All the SCM-specific stuff would be implemented in terms of multimethods, which would be trivial to extend to other SCMs.

If we can't come up with a good way to determine sensible snapshot versioning I am OK just dropping this in favour of lein release setting tags.

johnwalker commented 10 years ago

I'm not sure what you mean by leiningen can't tell if this is a major, minor or bugfix version bump. Shouldn't the user specify with something like below?

lein release major
lein release minor
technomancy commented 10 years ago

I mean it's difficult to determine it from the SCM history alone. Making it so lein release major makes changes to project.clj allows this information to be stored, which is the main argument against drawing the version info exclusively from the SCM.

jchauncey commented 10 years ago

So I am working on this very thing. Basically we want to use git tags for versions instead of committing a VERSION file to SCM. I have a good conversion of the thor-scmversion gem from Riotgames but would love to see this integrated directly into leiningen.

AeroNotix commented 10 years ago

SCM tags are not immutable. I am roughly -181,123,612 for this.

AeroNotix commented 10 years ago

I'd also recommend using lein-ver, which does commit it into VCS but is very easy to use. I'm also finding it hard to imagine a situation where you would find the presence of a VERSION file (which, when using lein-ver make it accessible from your code!) unwanted.

technomancy commented 10 years ago

@AeroNotix I don't understand the objection. We're talking about reading project version information from SCM tags. The current way of storing versioning information is also not immutable, so I don't see how this is worse in that regard.

AeroNotix commented 10 years ago

Sorry I got some wires crossed, I thought we were talking about building specific versions as per the VCS tag. Ignore.

jchauncey commented 10 years ago

So we found that keeping our versions in a file was problematic when it came time to run our projects through CI. Instead, we are moving to using git tags that follow major.minor.patch and the CI system will auto bump the patch level with each push.

You cna then use commit messages to bump major and minor using [minor]|#minor or [major]|#major

So far this works really well using the thor-scmversion gem but we would rather have leiningen tasks to do this since polluting clojure/java projects wtih ruby sucks =\

technomancy commented 10 years ago

I'm up for discussing this if anyone has some bright ideas about how to determine snapshot numbers from the SCM alone, but I'm inclined to think it can't be done well.