Skip to content

Commit 1c7474b

Browse files
committed
[GR-19220] Update the Spin configuration for the latest version of Spin (#2685)
PullRequest: truffleruby/3409
2 parents 7a9dd96 + 35b3730 commit 1c7474b

File tree

4 files changed

+50
-18
lines changed

4 files changed

+50
-18
lines changed

.spin/bin/env

Lines changed: 0 additions & 15 deletions
This file was deleted.

.spin/bin/bootstrap renamed to .spin/bootstrap

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,14 @@ set -ex
44

55
SCRIPT_PATH=$(dirname "$0")
66
SCRIPT_PATH=$(cd "$SCRIPT_PATH" && pwd)
7-
TRUFFLERUBY_DIR=$SCRIPT_PATH/../..
7+
TRUFFLERUBY_DIR=$SCRIPT_PATH/..
88

9-
sudo apt-get install -y cmake libssl-dev libz-dev python
9+
if [ ! -z "$SPIN" ]; then
10+
echo "source '$TRUFFLERUBY_DIR/.spin/env-custom'" > ~/.zshrc.d/truffleruby
11+
fi
1012

11-
source "$TRUFFLERUBY_DIR"/.spin/bin/env
13+
export SPIN_INITIALIZING=true
14+
source "$TRUFFLERUBY_DIR"/.spin/env-custom
1215

1316
mkdir -p ~/.rubies
1417

.spin/env-custom

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# $BASH_SOURCE[0] is for Bash, ${(%):-%x} is for Zsh
2+
SCRIPT_PATH=$(dirname "${BASH_SOURCE[0]:-${(%):-%x}}")
3+
SCRIPT_PATH=$(cd "$SCRIPT_PATH" && pwd)
4+
TRUFFLERUBY_DIR=$SCRIPT_PATH/..
5+
export JT_ENV=jvm-ce
6+
export JT_SPECS_COMPILATION=false
7+
8+
unset JAVA_HOME
9+
10+
# Use CRuby to run jt
11+
export SYSTEM_RUBY=$(which ruby)
12+
13+
function jt {
14+
if [ -z "$SPIN" -o ! -z "$SPIN_INITIALIZING" ]; then
15+
"$TRUFFLERUBY_DIR"/bin/jt "$@"
16+
else
17+
service_status=$(systemctl show -p ActiveState --value spin-environment@shopify--truffleruby)
18+
case "$service_status" in
19+
active)
20+
"$TRUFFLERUBY_DIR"/bin/jt "$@"
21+
;;
22+
23+
activating|inactive)
24+
echo "\033[0;31mTruffleRuby is still building..."
25+
return 1
26+
;;
27+
28+
failed)
29+
echo "\033[0;31mTruffleRuby failed to build."
30+
return 1
31+
;;
32+
33+
*)
34+
echo "\033[0;31mUnknown TruffleRuby service status: $service_status"
35+
return 1
36+
;;
37+
esac
38+
fi
39+
}

.spin/packages.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
- cmake
3+
- libssl-dev
4+
- libz-dev
5+
- python

0 commit comments

Comments
 (0)