From f5fbe8e3b58b707eadac70de94ca0475071e5da9 Mon Sep 17 00:00:00 2001 From: Thomas Vigouroux Date: Tue, 2 Jun 2020 22:16:54 +0200 Subject: treesitter: add update script and update runtime Update treesitter runtime to : 9a82dcc666d06617cbab3061467075019fae0b0d --- scripts/update-ts-runtime.sh | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100755 scripts/update-ts-runtime.sh (limited to 'scripts/update-ts-runtime.sh') diff --git a/scripts/update-ts-runtime.sh b/scripts/update-ts-runtime.sh new file mode 100755 index 0000000000..6f3cc7ba39 --- /dev/null +++ b/scripts/update-ts-runtime.sh @@ -0,0 +1,35 @@ +#!/bin/sh +# +# This script will update the treesitter runtime to the provided commit. +# Usage : +# $0 + +ts_source_dir="/tmp/tree-sitter" +ts_url="https://github.com/tree-sitter/tree-sitter.git" + +base_dir="$(cd "$(dirname $(dirname $0))" && pwd)" +ts_dest_dir="$base_dir/src/tree_sitter/" + +echo "$ts_dest_dir" + +if [ ! -d "$ts_source_dir" ]; then + echo "Cloning treesitter..." + git clone "$ts_url" "$ts_source_dir" +else + echo "Found a non-empty $ts_source_dir directory..." +fi + +echo "Checking out $1..." +cd "$ts_source_dir" +git -C "$ts_source_dir" checkout $1 + +echo "Removing old files..." +find "$ts_dest_dir" -not -name "LICENSE" -not -type d -delete + +echo "Copying files..." +cp -t "$ts_dest_dir" -r "$ts_source_dir/lib/src"/* +cp -t "$ts_dest_dir" "$ts_source_dir/lib/include/tree_sitter"/* + +cd "$base_dir" +make +TEST_FILE="$base_dir/test/functional/lua/treesitter_spec.lua" make test -- cgit From 662688817b2156edd47019f00f53774e5e00224a Mon Sep 17 00:00:00 2001 From: Thomas Vigouroux Date: Tue, 2 Jun 2020 22:32:49 +0200 Subject: treesitter: enhance script and add README The script now updates a `treesitter_commit_sha.txt` file to keep track of which commit/branch/tag we're at. --- scripts/update-ts-runtime.sh | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'scripts/update-ts-runtime.sh') diff --git a/scripts/update-ts-runtime.sh b/scripts/update-ts-runtime.sh index 6f3cc7ba39..c75c5d2a39 100755 --- a/scripts/update-ts-runtime.sh +++ b/scripts/update-ts-runtime.sh @@ -3,14 +3,16 @@ # This script will update the treesitter runtime to the provided commit. # Usage : # $0 +set -e ts_source_dir="/tmp/tree-sitter" ts_url="https://github.com/tree-sitter/tree-sitter.git" base_dir="$(cd "$(dirname $(dirname $0))" && pwd)" ts_dest_dir="$base_dir/src/tree_sitter/" +ts_current_commit="$ts_dest_dir/treesitter_commit_hash.txt" -echo "$ts_dest_dir" +echo "Updating treesitter runtime from $(cat "$ts_current_commit") to $1..." if [ ! -d "$ts_source_dir" ]; then echo "Cloning treesitter..." @@ -20,16 +22,17 @@ else fi echo "Checking out $1..." -cd "$ts_source_dir" git -C "$ts_source_dir" checkout $1 echo "Removing old files..." -find "$ts_dest_dir" -not -name "LICENSE" -not -type d -delete +find "$ts_dest_dir" -not -name "LICENSE" -not -name "README.md" -not -type d -delete echo "Copying files..." cp -t "$ts_dest_dir" -r "$ts_source_dir/lib/src"/* cp -t "$ts_dest_dir" "$ts_source_dir/lib/include/tree_sitter"/* -cd "$base_dir" +echo "$1" > "$ts_current_commit" + make TEST_FILE="$base_dir/test/functional/lua/treesitter_spec.lua" make test + -- cgit From 6b949211a06e21af67bf4cb3a20c6f87c932ef2a Mon Sep 17 00:00:00 2001 From: Thomas Vigouroux Date: Wed, 3 Jun 2020 21:33:34 +0200 Subject: treesitter: update runtime Update to 81d533d2d1b580fdb507accabc91ceddffb5b6f0. --- scripts/update-ts-runtime.sh | 1 + 1 file changed, 1 insertion(+) (limited to 'scripts/update-ts-runtime.sh') diff --git a/scripts/update-ts-runtime.sh b/scripts/update-ts-runtime.sh index c75c5d2a39..1a947e0ac9 100755 --- a/scripts/update-ts-runtime.sh +++ b/scripts/update-ts-runtime.sh @@ -19,6 +19,7 @@ if [ ! -d "$ts_source_dir" ]; then git clone "$ts_url" "$ts_source_dir" else echo "Found a non-empty $ts_source_dir directory..." + git -C "$ts_source_dir" fetch fi echo "Checking out $1..." -- cgit