diff options
author | Loïc Hoguin <[email protected]> | 2017-06-09 11:44:12 +0200 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2017-06-09 11:44:12 +0200 |
commit | f3ab9ef65d948469e864184bcf95114bf8025ad1 (patch) | |
tree | 77458e2ece4e95d5e16ae7466ef22750c0edc9ac /docs/en/erlang.mk/1 | |
parent | 5a0feb20ace7a923b1101c274ef2ff12fa47a776 (diff) | |
download | ninenines.eu-f3ab9ef65d948469e864184bcf95114bf8025ad1.tar.gz ninenines.eu-f3ab9ef65d948469e864184bcf95114bf8025ad1.tar.bz2 ninenines.eu-f3ab9ef65d948469e864184bcf95114bf8025ad1.zip |
Release the tale of 2.0 cowboy slides
Diffstat (limited to 'docs/en/erlang.mk/1')
-rw-r--r-- | docs/en/erlang.mk/1/guide/releases.asciidoc | 61 | ||||
-rw-r--r-- | docs/en/erlang.mk/1/guide/releases/index.html | 59 |
2 files changed, 120 insertions, 0 deletions
diff --git a/docs/en/erlang.mk/1/guide/releases.asciidoc b/docs/en/erlang.mk/1/guide/releases.asciidoc index 67abe879..f1e20e6b 100644 --- a/docs/en/erlang.mk/1/guide/releases.asciidoc +++ b/docs/en/erlang.mk/1/guide/releases.asciidoc @@ -118,3 +118,64 @@ Or on Windows: $ bin/example_release.cmd upgrade "2/example_release" Your release was upgraded! + +=== Getting Relx semver value + +There is a *workaround* to get the semver value which is +generated by Relx based on VCS history. + +Create a file 'rel/version' with only one line inside: + +[source,erlang] +{{ release_version }} + +Add/Update the `overlay` section of your `relx.config`: + +[source,erlang] +{overlay, [ + {template, "rel/version", "version"} +]}. + +When you run `make rel` it creates the file '$(RELX_OUTPUT_DIR)/example/version' +which contains the version value generated by Relx. + +[source,bash] +$ cat _rel/app/release +1.0.0+build.11.ref5612aa0 + +In your `Makefile` you can use this simple snippet to get the version, +but please keep in mind that this should depend on the `rel` target: + +[source,make] +$(shell cat $(RELX_OUTPUT_DIR)/$(RELX_REL_NAME)/version) + +For example: + +[source,make] +---- +include erlang.mk + +APP_VERSION = $(shell cat $(RELX_OUTPUT_DIR)/$(RELX_REL_NAME)/version) +myrecipe: all + echo APP_VERSION = $(APP_VERSION) +---- + +Would output: + +[source,bash] +---- +$ make myrecipe +... +===> Starting relx build process ... +===> Resolving OTP Applications from directories: + /home/username/example/apps + /home/username/example/deps + /usr/lib/erlang/lib + /home/username/example/_rel +===> Resolved example-0.3.10+build.11.ref5612aa0 +===> Including Erts from /usr/lib/erlang +===> release successfully created! +===> tarball /home/username/example/_rel/example/example-0.3.10+build.11.ref5612aa0.tar.gz successfully created! +echo APP_VERSION = 0.3.10+build.11.ref5612aa0 +APP_VERSION = 0.3.10+build.11.ref5612aa0 +---- diff --git a/docs/en/erlang.mk/1/guide/releases/index.html b/docs/en/erlang.mk/1/guide/releases/index.html index 9ebd52ba..e3c46057 100644 --- a/docs/en/erlang.mk/1/guide/releases/index.html +++ b/docs/en/erlang.mk/1/guide/releases/index.html @@ -195,6 +195,65 @@ http://www.gnu.org/software/src-highlite --> <div class="paragraph"><p>Your release was upgraded!</p></div>
</div>
</div>
+<div class="sect1">
+<h2 id="_getting_relx_semver_value">Getting Relx semver value</h2>
+<div class="sectionbody">
+<div class="paragraph"><p>There is a <strong>workaround</strong> to get the semver value which is
+generated by Relx based on VCS history.</p></div>
+<div class="paragraph"><p>Create a file <em>rel/version</em> with only one line inside:</p></div>
+<div class="listingblock">
+<div class="content"><!-- Generator: GNU source-highlight 3.1.8
+by Lorenzo Bettini
+http://www.lorenzobettini.it
+http://www.gnu.org/software/src-highlite -->
+<pre><tt>{{ <span style="color: #FF6600">release_version</span> }}</tt></pre></div></div>
+<div class="paragraph"><p>Add/Update the <code>overlay</code> section of your <code>relx.config</code>:</p></div>
+<div class="listingblock">
+<div class="content"><!-- Generator: GNU source-highlight 3.1.8
+by Lorenzo Bettini
+http://www.lorenzobettini.it
+http://www.gnu.org/software/src-highlite -->
+<pre><tt>{<span style="color: #FF6600">overlay</span>, [
+ {<span style="color: #FF6600">template</span>, <span style="color: #FF0000">"rel/version"</span>, <span style="color: #FF0000">"version"</span>}
+]}<span style="color: #990000">.</span></tt></pre></div></div>
+<div class="paragraph"><p>When you run <code>make rel</code> it creates the file <em>$(RELX_OUTPUT_DIR)/example/version</em>
+which contains the version value generated by Relx.</p></div>
+<div class="listingblock">
+<div class="content"><!-- Generator: GNU source-highlight 3.1.8
+by Lorenzo Bettini
+http://www.lorenzobettini.it
+http://www.gnu.org/software/src-highlite -->
+<pre><tt>$ cat _rel/app/release
+<span style="color: #993399">1.0</span><span style="color: #990000">.</span><span style="color: #993399">0</span><span style="color: #990000">+</span>build<span style="color: #990000">.</span><span style="color: #993399">11</span><span style="color: #990000">.</span>ref5612aa0</tt></pre></div></div>
+<div class="paragraph"><p>In your <code>Makefile</code> you can use this simple snippet to get the version,
+but please keep in mind that this should depend on the <code>rel</code> target:</p></div>
+<div class="listingblock">
+<div class="content"></div></div>
+<div class="paragraph"><p>For example:</p></div>
+<div class="listingblock">
+<div class="content"></div></div>
+<div class="paragraph"><p>Would output:</p></div>
+<div class="listingblock">
+<div class="content"><!-- Generator: GNU source-highlight 3.1.8
+by Lorenzo Bettini
+http://www.lorenzobettini.it
+http://www.gnu.org/software/src-highlite -->
+<pre><tt>$ make myrecipe
+<span style="color: #990000">...</span>
+<span style="color: #990000">===></span> Starting relx build process <span style="color: #990000">...</span>
+<span style="color: #990000">===></span> Resolving OTP Applications from directories<span style="color: #990000">:</span>
+ /home/username/example/apps
+ /home/username/example/deps
+ /usr/lib/erlang/lib
+ /home/username/example<span style="color: #990000">/</span>_rel
+<span style="color: #990000">===></span> Resolved example-<span style="color: #993399">0.3</span><span style="color: #990000">.</span><span style="color: #993399">10</span><span style="color: #990000">+</span>build<span style="color: #990000">.</span><span style="color: #993399">11</span><span style="color: #990000">.</span>ref5612aa0
+<span style="color: #990000">===></span> Including Erts from /usr/lib/erlang
+<span style="color: #990000">===></span> release successfully created<span style="color: #990000">!</span>
+<span style="color: #990000">===></span> tarball /home/username/example<span style="color: #990000">/</span>_rel/example/example-<span style="color: #993399">0.3</span><span style="color: #990000">.</span><span style="color: #993399">10</span><span style="color: #990000">+</span>build<span style="color: #990000">.</span><span style="color: #993399">11</span><span style="color: #990000">.</span>ref5612aa0<span style="color: #990000">.</span>tar<span style="color: #990000">.</span>gz successfully created<span style="color: #990000">!</span>
+echo APP_VERSION <span style="color: #990000">=</span> <span style="color: #993399">0.3</span><span style="color: #990000">.</span><span style="color: #993399">10</span><span style="color: #990000">+</span>build<span style="color: #990000">.</span><span style="color: #993399">11</span><span style="color: #990000">.</span>ref5612aa0
+APP_VERSION <span style="color: #990000">=</span> <span style="color: #993399">0.3</span><span style="color: #990000">.</span><span style="color: #993399">10</span><span style="color: #990000">+</span>build<span style="color: #990000">.</span><span style="color: #993399">11</span><span style="color: #990000">.</span>ref5612aa0</tt></pre></div></div>
+</div>
+</div>
|