2023-09-25 21:43:32 +01:00
|
|
|
EXT := if os() == "windows" { ".exe" } else { "" }
|
|
|
|
CWD := invocation_directory()
|
|
|
|
BIN_NAME := "lune"
|
|
|
|
|
|
|
|
# Default hidden recipe for listing other recipes + cwd
|
|
|
|
[no-cd]
|
|
|
|
[no-exit-message]
|
|
|
|
[private]
|
|
|
|
default:
|
|
|
|
#!/usr/bin/env bash
|
|
|
|
set -euo pipefail
|
|
|
|
printf "Current directory:\n {{CWD}}\n"
|
|
|
|
just --list
|
|
|
|
|
|
|
|
# Builds the Lune CLI binary
|
|
|
|
[no-exit-message]
|
|
|
|
build *ARGS:
|
|
|
|
#!/usr/bin/env bash
|
|
|
|
set -euo pipefail
|
|
|
|
cargo build --bin {{BIN_NAME}} {{ARGS}}
|
2023-03-25 10:12:09 +00:00
|
|
|
|
2023-03-27 12:00:45 +01:00
|
|
|
# Run an individual file using the Lune CLI
|
2023-09-25 21:43:32 +01:00
|
|
|
[no-exit-message]
|
|
|
|
run FILE_PATH:
|
|
|
|
#!/usr/bin/env bash
|
|
|
|
set -euo pipefail
|
|
|
|
cargo run --bin {{BIN_NAME}} -- "{{FILE_PATH}}"
|
2023-03-27 12:00:45 +01:00
|
|
|
|
2023-03-22 13:12:05 +00:00
|
|
|
# Run tests for the Lune library
|
2023-09-25 21:43:32 +01:00
|
|
|
[no-exit-message]
|
|
|
|
test *ARGS:
|
|
|
|
#!/usr/bin/env bash
|
|
|
|
set -euo pipefail
|
|
|
|
cargo test --lib -- {{ARGS}}
|
|
|
|
|
|
|
|
# Run tests for the Lune binary
|
|
|
|
[no-exit-message]
|
|
|
|
test-bin *ARGS:
|
|
|
|
#!/usr/bin/env bash
|
|
|
|
set -euo pipefail
|
|
|
|
cargo test --bin {{BIN_NAME}} -- {{ARGS}}
|
|
|
|
|
|
|
|
# Apply formatting for all Rust & Luau files
|
|
|
|
[no-exit-message]
|
|
|
|
fmt:
|
|
|
|
#!/usr/bin/env bash
|
|
|
|
set -euo pipefail
|
2023-09-25 22:30:26 +01:00
|
|
|
stylua .lune scripts tests types \
|
2023-09-25 21:43:32 +01:00
|
|
|
--glob "tests/**/*.luau" \
|
|
|
|
--glob "!tests/roblox/rbx-test-files/**"
|
|
|
|
cargo fmt
|
2023-09-25 20:30:07 +01:00
|
|
|
|
|
|
|
# Check formatting for all Rust & Luau files
|
2023-09-25 21:43:32 +01:00
|
|
|
[no-exit-message]
|
2023-09-25 20:30:07 +01:00
|
|
|
fmt-check:
|
|
|
|
#!/usr/bin/env bash
|
|
|
|
set -euo pipefail
|
2023-09-25 22:30:26 +01:00
|
|
|
stylua .lune scripts tests types \
|
2023-09-25 20:30:07 +01:00
|
|
|
--glob "tests/**/*.luau" \
|
|
|
|
--glob "!tests/roblox/rbx-test-files/**"
|
|
|
|
cargo fmt --check
|
2023-09-25 21:43:32 +01:00
|
|
|
|
2023-09-25 22:30:26 +01:00
|
|
|
# Analyze and lint Luau files using luau-lsp
|
|
|
|
[no-exit-message]
|
|
|
|
analyze:
|
|
|
|
#!/usr/bin/env bash
|
|
|
|
set -euo pipefail
|
2024-01-04 19:00:44 +00:00
|
|
|
luau-lsp analyze \
|
2023-09-25 22:30:26 +01:00
|
|
|
--settings=".vscode/settings.json" \
|
2024-01-04 19:00:44 +00:00
|
|
|
--ignore="tests/roblox/rbx-test-files/**" \
|
|
|
|
.lune scripts tests types
|
2023-09-25 22:30:26 +01:00
|
|
|
|
2023-09-25 21:43:32 +01:00
|
|
|
# Zips up the built binary into a single zip file
|
|
|
|
[no-exit-message]
|
|
|
|
zip-release TARGET_TRIPLE:
|
|
|
|
#!/usr/bin/env bash
|
|
|
|
set -euo pipefail
|
|
|
|
rm -rf staging
|
|
|
|
rm -rf release.zip
|
|
|
|
mkdir -p staging
|
|
|
|
cp "target/{{TARGET_TRIPLE}}/release/{{BIN_NAME}}{{EXT}}" staging/
|
|
|
|
cd staging
|
|
|
|
if [ "{{os_family()}}" = "windows" ]; then
|
|
|
|
7z a ../release.zip *
|
|
|
|
else
|
|
|
|
chmod +x {{BIN_NAME}}
|
|
|
|
zip ../release.zip *
|
|
|
|
fi
|
|
|
|
cd "{{CWD}}"
|
|
|
|
rm -rf staging
|
|
|
|
|
|
|
|
# Used in GitHub workflow to move per-matrix release zips
|
|
|
|
[no-exit-message]
|
|
|
|
[private]
|
|
|
|
unpack-releases RELEASES_DIR:
|
|
|
|
#!/usr/bin/env bash
|
|
|
|
set -euo pipefail
|
|
|
|
#
|
|
|
|
if [ ! -d "{{RELEASES_DIR}}" ]; then
|
|
|
|
echo "Releases directory is missing"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
#
|
|
|
|
cd "{{RELEASES_DIR}}"
|
|
|
|
echo ""
|
|
|
|
echo "Releases dir:"
|
|
|
|
ls -lhrt
|
|
|
|
echo ""
|
|
|
|
echo "Searching for zipped releases..."
|
|
|
|
#
|
|
|
|
for DIR in * ; do
|
|
|
|
if [ -d "$DIR" ]; then
|
|
|
|
cd "$DIR"
|
|
|
|
for FILE in * ; do
|
|
|
|
if [ ! -d "$FILE" ]; then
|
|
|
|
if [ "$FILE" = "release.zip" ]; then
|
|
|
|
echo "Found zipped release '$DIR'"
|
|
|
|
mv "$FILE" "../$DIR.zip"
|
|
|
|
rm -rf "../$DIR/"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
cd ..
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
#
|
|
|
|
echo ""
|
|
|
|
echo "Releases dir:"
|
|
|
|
ls -lhrt
|