<div dir="ltr">I think you can probably trust Loïc to do the right thing and never point those tags at different commits. So for that code, tag is probably fine.<div><br></div><div>Generally I find myself pointing at commits, though; not that much more effort, and provides a solid invariant.<br><div><br></div><div>For code that absolutely has to work (manages $10B or more in assets under management, runs MRI machines, etc.), I fork the project on github and point my project at my fork. That way even if the base repo dies or, worse, suffers some kind of malevolent attack, the dependency is safe as long as github itself is safe. You can fork infinitely on github.</div></div><div><br></div><div>Over $500B assets under management, I run my own repo...</div><div><br></div><div>F.</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Mar 18, 2015 at 10:51 AM, Joe Armstrong <span dir="ltr"><<a href="mailto:erlang@gmail.com" target="_blank">erlang@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">On Tue, Mar 17, 2015 at 3:07 PM, Loïc Hoguin <<a href="mailto:essen@ninenines.eu">essen@ninenines.eu</a>> wrote:<br>
> On 03/17/2015 02:53 PM, Joe Armstrong wrote:<br>
>><br>
>> How do I include another application in my application?<br>
>><br>
>> I've written a program that I want to distibute.<br>
>> I'll make it available on github.<br>
>><br>
>> The problem is that my program uses cowboy and a few other<br>
>> things (which are also on github)<br>
>><br>
>> I'd like my program to work "out of the box" - just type Make and off<br>
>> you go.<br>
>><br>
>> I'd also like my to work for a long time so if rebar and<br>
>> cowboy change in the future I'd like my program to still build<br>
>> correctly.<br>
>><br>
>> Now what I could do is:<br>
>><br>
>> use rebar and a rebar.config file that point to cowboy etc.<br>
>><br>
>> My rebar-config is like this<br>
>><br>
>> {deps, [<br>
>> ...<br>
>> {cowboy, ".*", {git, "git://<a href="http://github.com/extend/cowboy.git" target="_blank">github.com/extend/cowboy.git</a>", "master"}}<br>
>> ]}.<br>
>><br>
>> The problem with this is that<br>
>><br>
>> 1) my version of rebar might not be the same as on the target machine<br>
>> where the makefile is run<br>
><br>
><br>
> This is a problem <a href="http://erlang.mk" target="_blank">erlang.mk</a> solves. You include <a href="http://erlang.mk" target="_blank">erlang.mk</a> in your project<br>
> therefore everyone has the same when they compile it.<br>
><br>
> You still are at the whim of Make having an incompatible change that breaks<br>
> something, but you also have that issue with rebar when a newer Erlang<br>
> version breaks something in it. The chances of either happening are very<br>
> slim though.<br>
><br>
>> 2) The cowboy reference is to "the latest version" and not<br>
>> an immutable version that I know works<br>
>><br>
>> So How should I fix this? Is the answer:<br>
>><br>
>> a) Include rebar in my distribution<br>
>> (I don't really like this, since I'd just like to have my code in<br>
>> my project archive)<br>
><br>
><br>
> That's what I would advise you to do, though. Do note however that if your<br>
> project is to be used as a dependency then it won't be your rebar that will<br>
> be used but the user's (or the top-level project's) rebar.<br>
><br>
> This is another issue <a href="http://erlang.mk" target="_blank">erlang.mk</a> solves as the dependency's Makefile is<br>
> always used and not the top-level <a href="http://erlang.mk" target="_blank">erlang.mk</a>. The dependency can run a<br>
> different <a href="http://erlang.mk" target="_blank">erlang.mk</a> or just a plain Makefile, or even a Makefile that calls<br>
> the bundled rebar, it doesn't matter as long as there is a Makefile.<br>
><br>
>> b) Point to a absolute version of cowboy - but how do I do this?<br>
><br>
><br>
> Simply put the tag or commit number instead of "master" in rebar.config, for<br>
> example "1.0.1".<br>
><br>
> Make sure to do this with all your dependencies, and check that the<br>
> dependencies themselves do it.<br>
<br>
</div></div>I've run into another problem -<br>
Right now I have a working program that I want to make sure works on<br>
other peoples machines. So they need to get exactly the version I have<br>
<br>
Right now I clone cowboy cowlib and ranch<br>
<br>
I then checkout master from cowboy<br>
tag 1.2.0 from cowlib<br>
tag 1.0.0 from ranch<br>
<br>
Everything works fine - great<br>
<br>
If I publish this I assume the tagged versions 1.2.0 1.0.0 or cowlib and ranch<br>
will be the same - but in the future master won't be the same<br>
<br>
I then did a (inside cowboy)<br>
<br>
> git checkout master<br>
<br>
and then<br>
<br>
> git describe<br>
<br>
fatal: No annotated tags can describe<br>
'90ae31998e8d0887b9efe4b441136ac047708bb9'.<br>
<br>
>From which I assume that I can use 90ae... etc as an immutable reference to<br>
cowboy, and the 1.2.0 1.0.0 tags for cowlib and ranch<br>
<br>
So now what I have to do is<br>
<br>
clone cowboy and checkout 90ae31998e8d0887b9efe4b441136ac047708bb9'.<br>
clone cowlib and checkout 1.2.0<br>
clone ranch and checkout 1.0.0<br>
<br>
Anybody who does this should get the same code as I have on my machine<br>
is this correct?<br>
<br>
Can I trust the tags? - do I have to converts these to shas with git describe<br>
as well?<br>
<br>
Cheers<br>
<span class="HOEnZb"><font color="#888888"><br>
/Joe<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
<br>
<br>
<br>
<br>
><br>
> I believe rebar3 has a way to lock dependencies into a specific commit for<br>
> the projects that depend on another's "master".<br>
><br>
>> Or c)<br>
>> Include all the source code of cowboy etc in my release<br>
><br>
><br>
> This also works but will prove to be more time consuming when you need to<br>
> update dependencies. However if you intend to just release the project and<br>
> make little maintenance over it afterward (for example if it's a proof of<br>
> concept or a prototype) then this might just be the way to go.<br>
><br>
> --<br>
> Loïc Hoguin<br>
> <a href="http://ninenines.eu" target="_blank">http://ninenines.eu</a><br>
_______________________________________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
</div></div></blockquote></div><br></div>