You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@annotator.apache.org by ra...@apache.org on 2020/05/05 05:09:52 UTC

[incubator-annotator] 03/03: Make dist by creating a shallow clone

This is an automated email from the ASF dual-hosted git repository.

randall pushed a commit to branch clone-dist
in repository https://gitbox.apache.org/repos/asf/incubator-annotator.git

commit 938fc5f857ad3cdfd5cba60ff8903cdd205ac047
Author: Randall Leeds <ra...@apache.org>
AuthorDate: Mon May 4 20:54:07 2020 -0700

    Make dist by creating a shallow clone
    
    Create a distribution by creating a shallow git clone.
    
    Distributing a shallow clone has several befenits:
    
      - Join upstream development with `git fetch --unshallow`
    
      - Husky install is contained (close #72)
    
      - The distribution can reproduce itself
---
 Makefile | 36 +++++++++++++-----------------------
 1 file changed, 13 insertions(+), 23 deletions(-)

diff --git a/Makefile b/Makefile
index 1d67816..498828b 100644
--- a/Makefile
+++ b/Makefile
@@ -10,20 +10,6 @@
 # License for the specific language governing permissions and limitations under
 # the License.
 
-# Determine the version identifier from lerna.json or git.
-
-# Are we in a release?
-in_release = $(shell if [ ! -d .git ]; then echo true; fi)
-
-ifeq ($(in_release), true)
-
-# Get the version information from lerna.json.
-annotator_vsn = $(shell jq -r .version < lerna.json)
-
-else
-
-# Get the version information from git.
-
 # What is the prerelease version?
 vsn_pre = $(shell git describe --tags --always --first-parent \
         | grep -Eo -- '(-rc\.[0-9]+)?$$' \
@@ -43,9 +29,6 @@ vsn_tag = $(shell git describe --tags --always --first-parent \
 
 annotator_vsn = $(vsn_rel)
 
-endif
-
-
 .PHONY: all
 all: build
 
@@ -71,17 +54,24 @@ else
 
 .PHONY: dist
 dist:
-	@rm -rf apache-annotator-$(annotator_vsn)$(vsn_pre)-incubating
-	@git archive \
-        --output apache-annotator-$(annotator_vsn)$(vsn_pre)-incubating.tar.gz \
-        --prefix apache-annotator-$(annotator_vsn)-incubating/ \
-        HEAD
+	@rm -rf apache-annotator-$(annotator_vsn)-incubating
+	@git clone \
+        --branch v$(vsn_tag) \
+        --config advice.detachedHead=false \
+        --depth 1 \
+        --quiet \
+        file://"$(shell git rev-parse --show-toplevel)" \
+        apache-annotator-$(annotator_vsn)-incubating
+	@git --git-dir apache-annotator-$(annotator_vsn)-incubating/.git config \
+        remote.origin.url https://github.com/apache/incubator-annotator.git
+	@tar czf \
+        apache-annotator-$(annotator_vsn)$(vsn_pre)-incubating.tar.gz \
+        apache-annotator-$(annotator_vsn)-incubating
 	@echo "Done: apache-annotator-$(annotator_vsn)$(vsn_pre)-incubating.tar.gz"
 
 endif
 
 .PHONY: distcheck
-distcheck: export HUSKY_SKIP_INSTALL=1
 distcheck: dist
 	@tar xzf apache-annotator-$(annotator_vsn)$(vsn_pre)-incubating.tar.gz
 	@make -C apache-annotator-$(annotator_vsn)-incubating check