crystal-lang / distribution-scripts

40 stars 24 forks source link

Add git shallow clones #52

Open Daniel-Worrall opened 4 years ago

Daniel-Worrall commented 4 years ago

Optimises git cloning with shallow clone.

Reduces processing time & file size.

RX14 commented 4 years ago

Unfortunately this doesn't allow checking out a specific sha1 revision, unless it happens to be tagged.

If you ask for a specific revision from github it will refuse, unless the revision corresponds to an existing ref, such as a tag or a branch.

So, yes this works great for building tagged releases but breaks in the general case :(

straight-shoota commented 4 years ago

I guess then there's nothing to do here.

Daniel-Worrall commented 4 years ago

Good catch

I can remove the changes with references to the crystal sha and keep the ones that use a tagged version like bdwgc, libatomic and shards. If it changes in the future that we need to use a specific sha, we could use a conditional.

RX14 commented 4 years ago

@Daniel-Worrall there's scope for wanting to build with a custom GC version in the future but I think that would be fine

Daniel-Worrall commented 4 years ago

Done.

Also, I noticed that there could be further optimizations such as in the Linux Dockerfile, various things are cloned twice. These could be copied over to the 2nd build stage before altered so that it saves on cloning. The only problem with this is that currently all the cloning/configuration is done on a single RUN and splitting that up might just end up removing any optimizations. Anyway, I'm not going to delve into it any further.