-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJustfile
More file actions
113 lines (97 loc) · 3.34 KB
/
Justfile
File metadata and controls
113 lines (97 loc) · 3.34 KB
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
# Default: build transpiler, bundle it in plugin, and build plugin
default: build
# Build everything: transpiler + bundle + plugin
build target="":
#!/usr/bin/env bash
set -e
ROOT="{{justfile_directory()}}"
if [ "{{target}}" = "transpiler" ] || [ "{{target}}" = "" ]; then
echo "Building transpiler..."
cd "$ROOT/rust" && cargo build --release
fi
if [ "{{target}}" = "plugin" ] || [ "{{target}}" = "" ]; then
if [ "{{target}}" = "" ]; then
echo "Bundling transpiler in plugin..."
just _bundle
fi
echo "Building JetBrains plugin..."
cd "$ROOT/editors/jetbrains-plugin" && ./gradlew clean buildPlugin
cp "$ROOT/editors/jetbrains-plugin/build/distributions"/*.zip "$ROOT/editors/jetbrains-plugin/hyper-plugin.zip"
echo ""
echo "✅ Plugin built!"
echo "📦 Install: editors/jetbrains-plugin/hyper-plugin.zip"
fi
# Run transpiler or plugin
run target *args:
#!/usr/bin/env bash
set -e
ROOT="{{justfile_directory()}}"
case "{{target}}" in
transpiler)
"$ROOT/rust/target/release/hyper" {{args}}
;;
plugin)
cd "$ROOT/editors/jetbrains-plugin" && ./gradlew runIde
;;
*)
echo "Usage: just run [transpiler|plugin] [args...]"
exit 1
;;
esac
# Test transpiler or plugin
test target:
#!/usr/bin/env bash
set -e
ROOT="{{justfile_directory()}}"
case "{{target}}" in
transpiler)
cd "$ROOT/rust" && cargo test
;;
plugin)
cd "$ROOT/editors/jetbrains-plugin" && ./gradlew test
;;
*)
echo "Usage: just test [transpiler|plugin]"
exit 1
;;
esac
# Update all expected test files from current transpiler output
test-accept *filter:
cd {{justfile_directory()}}/rust && cargo run --bin accept_expected -- {{filter}}
# Show diff between expected and actual transpiler output
test-diff *filter:
#!/usr/bin/env bash
cd "{{justfile_directory()}}/rust" && cargo test --test expected_tests 2>&1 | head -100
# Run expected tests only (faster than full test suite)
test-expected:
cd {{justfile_directory()}}/rust && cargo test --test expected_tests
# Bundle transpiler binary into plugin resources (internal helper)
_bundle:
#!/usr/bin/env bash
set -e
ROOT="{{justfile_directory()}}"
# Detect platform
OS=$(uname -s | tr '[:upper:]' '[:lower:]')
ARCH=$(uname -m)
case "$OS" in
darwin) OS_NAME="darwin" ;;
linux) OS_NAME="linux" ;;
*) OS_NAME="$OS" ;;
esac
case "$ARCH" in
arm64|aarch64) ARCH_NAME="arm64" ;;
x86_64|amd64) ARCH_NAME="x64" ;;
*) ARCH_NAME="$ARCH" ;;
esac
BINARY_NAME="hyper-${OS_NAME}-${ARCH_NAME}"
SRC="$ROOT/rust/target/release/hyper"
DEST="$ROOT/editors/jetbrains-plugin/src/main/resources/bin/${BINARY_NAME}"
mkdir -p "$(dirname "$DEST")"
cp "$SRC" "$DEST"
echo "✓ Bundled: $DEST"
# Generate Python from .hyper files
generate *files:
{{justfile_directory()}}/rust/target/release/hyper generate {{files}}
# Compile .hyper file(s) (build + run, for quick iteration)
compile *files:
cd {{justfile_directory()}}/rust && RUSTFLAGS="-Awarnings" cargo run -q -- generate {{files}}