-
Notifications
You must be signed in to change notification settings - Fork 55
/
Copy pathyour_program.sh
executable file
·37 lines (34 loc) · 1.63 KB
/
your_program.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/bin/sh
#
# Use this script to run your program LOCALLY.
#
# Note: Changing this script WILL NOT affect how CodeCrafters runs your program.
#
# Learn more: https://codecrafters.io/program-interface
set -e # Exit early if any commands fail
# Copied from .codecrafters/compile.sh
#
# - Edit this to change how your program compiles locally
# - Edit .codecrafters/compile.sh to change how your program compiles remotely
(
cd "$(dirname "$0")" # Ensure compile steps are run within the repository directory
if [ -d "/tmp/codecrafters-build-redis-swift" ]; then
echo "Build directory already exists. Proceeding with the build..."
# This does NOT trigger a rebuild
# mv /tmp/codecrafters-build-redis-swift /tmp/codecrafters-build-redis-swift-old
# mv /tmp/codecrafters-build-redis-swift-old /tmp/codecrafters-build-redis-swift
# This DOES trigger a rebuild! inode changes?
# mv /tmp/codecrafters-build-redis-swift /tmp/codecrafters-build-redis-swift-old
# cp -R /tmp/codecrafters-build-redis-swift-old /tmp/codecrafters-build-redis-swift
mv /tmp/codecrafters-build-redis-swift /tmp/codecrafters-build-redis-swift-old
cp -R /tmp/codecrafters-build-redis-swift-old /tmp/codecrafters-build-redis-swift
else
echo "Build directory does not exist."
fi
swift build -c release --build-path /tmp/codecrafters-build-redis-swift
)
# Copied from .codecrafters/run.sh
#
# - Edit this to change how your program runs locally
# - Edit .codecrafters/run.sh to change how your program runs remotely
exec swift run -c release --skip-build --build-path /tmp/codecrafters-build-redis-swift build-your-own-redis "$@"