erlware / rebar_vsn_plugin Goto Github PK
View Code? Open in Web Editor NEWProvides a more reasonable versioning scheme then the rebar standard 'git' vsn extension
Provides a more reasonable versioning scheme then the rebar standard 'git' vsn extension
While it is nice the we can sync the version in app to git tag.
But the version does not propage to reltool.config {rel, "hello", "1", <<<<----- still a default 1, rather than tag version.
Possible to add that to the plugin? It looks like be a huge win. Thanks
Could you add an example of a project using this plugin to the README?
I've tried to activate it in https://github.com/alexeyr/erlang-sqlite3/tree/rebar_vsn but this doesn't seem to have any effect (from Explanation
it isn't clear where the version string will be placed; I assumed ebin/<app-name>.app
).
The reason why we want to make it compatible with rebar3 is that some other procjects (for example erlcron) uses it. If it is used as a plugin from erlcron, rebar3 will complain about missing rebar_vsn_plugin:init/1 function.
If other vsn than ".*" is used in rebar deps section rebar will fail to get dependency because the process of changing version to tag is done at post_compile time.
ERROR: Dependency dir /media/dev/erlang-app/deps/depapp failed application validation with reason:
{version_mismatch,{"/media/dev/erlang-app/deps/depapp/src/depapp.app.src",
{expected,"2.0.*"},
{has,"semver"}}}.
ERROR: 'get-deps' failed while processing /media/dev/erlang-app: rebar_abort
usual erlang-friendly would be nice (MIT/ALv2 etc)
Is this repo still maintained?
It should be mentioned that in order to use this plugin as a dep this section should be added to rebar.config:
{plugin_dir, "deps/rebar_vsn_plugin/src"}.
Without this section if we run
rebar get-deps
rebar compile
All the code will be compiled but the plugin would not work, because at the compile of the application it wasnot already compiled. Plugin_dir will force compiling of a plugin and will load it at run-time.
This changes should be done to prevent from failing of compilation if rel directory is set in sub_dirs. Rebar plugin mechanism is calling post and pre hooks for targets both for app files and for reltool.config files, and functions are provided to check wherether it is app dir or rel dir.
rebar_vsn_plugin/src/rebar_vsn_plugin.erl
@@ -29,14 +29,19 @@
%% API
%%============================================================================
post_compile(Config, AppFile) ->
- {AppName, SrcDetail} =
- get_app_meta(Config, AppFile),
- case proplists:get_value(vsn, SrcDetail) of
- "semver" ->
- do_vsn_replacement(AppName, Config, AppFile);
- semver ->
- do_vsn_replacement(AppName, Config, AppFile);
- _ ->
+ case rebar_app_utils:is_app_dir() of
+ {true, AppFile} ->
+ {AppName, SrcDetail} =
+ get_app_meta(Config, AppFile),
+ case proplists:get_value(vsn, SrcDetail) of
+ "semver" ->
+ do_vsn_replacement(AppName, Config, AppFile);
+ semver ->
+ do_vsn_replacement(AppName, Config, AppFile);
+ _ ->
+ ok
+ end;
+ false ->
ok
end.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.