Skip to content

Commit

Permalink
Fix build by using plain git clone instead of git-clone-related.
Browse files Browse the repository at this point in the history
(#38)
  • Loading branch information
netdpb authored Oct 4, 2022
1 parent 87faaf0 commit 2c6c364
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 19 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ jobs:
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
restore-keys: |
${{ runner.os }}-gradle-
- run: ./initialize-project
- run: SHALLOW=1 ./initialize-project
- run: ./gradlew spotlessCheck build
- run: ./gradlew jspecifySamplesTest -x ensureCheckerFrameworkBuilt
70 changes: 52 additions & 18 deletions initialize-project
Original file line number Diff line number Diff line change
@@ -1,26 +1,60 @@
#!/bin/bash
# Initializes the JSpecify reference checker project by downloading required
# sibling projects.
#
# USAGE
#
# initialize-project
#
# ENVIRONMENT VARIABLES
#
# Set SHALLOW=1 to clone sibling projects at depth 1.
#
# Set FORK to the GitHub organization that holds your fork of
# jspecify/checker-framework, jspecify/jspecify, or jspecify/jdk.
#
# For example, FORK=myorg means this script tries to clone the following before
# falling back to the JSpecify repos:
#
# git@github:myorg/checker-framework.git
# git@github:myorg/jspecify.git
# git@github:myorg/jdk.git


set -eu

readonly PLUME_SCRIPTS=.plume-scripts
readonly CHECKER_FRAMEWORK=../checker-framework
readonly JSPECIFY=../jspecify
run() {
printf '%q ' "$@"
echo
"$@"
}

git_clone() {
local repo="$1"
shift

if [[ -d "../${repo}" ]]; then
return
fi

local git=(git clone)
if (( "${SHALLOW:-0}" )); then
git+=(--depth 1 --single-branch)
fi
git+=("$@")

if [[ ! -d "${PLUME_SCRIPTS}" ]]; then
git clone -q --depth 1 https://github.com/plume-lib/plume-scripts.git \
"${PLUME_SCRIPTS}"
fi
if [[ -n "${FORK:-}" ]]; then
if run "${git[@]}" "[email protected]:${FORK}/${repo}.git" "../${repo}"; then
return
fi
fi
run "${git[@]}" "https://github.com/jspecify/${repo}.git" "../${repo}"
}

if [[ ! -d "${CHECKER_FRAMEWORK}" ]]; then
"${PLUME_SCRIPTS}"/git-clone-related jspecify checker-framework
fi
git_clone checker-framework

if [[ ! -d "${JSPECIFY}" ]]; then
# We test using some modified samples in a different branch of the jspecify
# repo, so we check out that branch.
"${PLUME_SCRIPTS}"/git-clone-related --upstream-branch samples-google-prototype jspecify jspecify
fi
# We test using some modified samples in a different branch of the jspecify
# repo, so we check out that branch.
git_clone jspecify --branch samples-google-prototype

if [[ ! -d "../jdk" ]]; then
"${PLUME_SCRIPTS}"/git-clone-related jspecify jdk
fi
git_clone jdk --depth 1 --single-branch

0 comments on commit 2c6c364

Please sign in to comment.