forked from ki-editor/ki-editor
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjustfile
More file actions
188 lines (148 loc) · 6.02 KB
/
Copy pathjustfile
File metadata and controls
188 lines (148 loc) · 6.02 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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
default:
npm install
@just check
@just build-all
@just lint
@just test
@just doc
run path="":
rustup default 1.89.0
CARGO_CODEGEN_BACKEND=cranelift CARGO_UNSTABLE_CODEGEN_BACKEND=true cargo +nightly run {{path}}
check: check-typeshare fmt-check lint
build-all: tree-sitter-quickfix build vscode-build
install:
rm -r ~/.cache/ki/zed-themes || echo "ok"
cargo install --locked --path .
fmt-check:
@echo "Checking formating"
cargo fmt --all -- --check
alejandra --exclude ./nvim-treesitter-highlight-queries/nvim-treesitter/ --check ./
fmt:
cargo fmt --all
npm run format
alejandra --exclude ./nvim-treesitter-highlight-queries/nvim-treesitter/ ./
build:
@echo "Running cargo build..."
cargo build --workspace --tests --locked
watch-build:
cargo watch --ignore ki-vscode --ignore ki-jetbrains -- cargo build
# Note: not removing the generated file on error here is intentional,
# partially because it is more annoying.
check-typeshare:
typeshare ki-protocol-types/src --lang typescript -o ki-vscode/src/protocol/types.ts2
cd ki-vscode/src/protocol && cmp types.ts types.ts2 && rm types.ts2
typeshare ki-protocol-types/src --lang kotlin -o ki-jetbrains/src/kotlin/protocol/Types.kt2
cd ki-jetbrains/src/kotlin/protocol && cmp Types.kt2 Types.kt && rm Types.kt2
update-typeshare:
typeshare ki-protocol-types/src --lang typescript -o ki-vscode/src/protocol/types.ts
typeshare ki-protocol-types/src --lang kotlin -o ki-jetbrains/src/kotlin/protocol/Types.kt
lint:
@echo "Running cargo clippy..."
cargo clippy --workspace -- -D warnings
cargo clippy --tests -- -D warnings
cargo machete
npm install
npm run lint
@just vscode-lint
[working-directory: 'ki-vscode']
vscode-lint:
npm install
./node_modules/.bin/ts-unused-exports tsconfig.json --ignoreFiles="src/protocol/types"
lint-fix:
cargo clippy --workspace --tests --fix --allow-staged --allow-dirty
@just vscode-lint-fix
vscode-lint-fix:
npm run lint:fix
test-setup:
git config --get --global user.name || git config --global user.name Tester
git config --get --global user.email || git config --global user.email tester@gmail.com
test testname="": test-setup
echo "Running cargo nextest..."
cargo nextest run --workspace --no-fail-fast -- --skip 'doc_assets_' {{testname}}
tree-sitter-quickfix:
just -f tree_sitter_quickfix/justfile
doc-assets testname="": test-setup
RUST_BACKTRACE=1 cargo nextest run --workspace -- 'doc_assets_' {{testname}}
doc-assets-generate-keymaps:
cargo test -- doc_assets_export_keymaps_json
check-config-schema:
#!/bin/sh
set -e
set -x
cargo build
cargo test -- doc_assets_export_json_schemas
if ! git diff --exit-code docs/static/app_config_json_schema.json; then
echo "❌ Config schema is out of date!"
echo "Please run 'just check-config-schema' and commit 'docs/static/app_config_json_schema.json'."
exit 1
fi
# This command helps you locate the actual recipe that is failing
doc-assets-get-recipes-error:
just doc-assets generate_recipes > /dev/null
doc: doc-assets
just check-config-schema
just -f docs/justfile
doc-serve:
cd docs && just start
codecov:
cargo tarpaulin --out html
watch-test testname:
CARGO_CODEGEN_BACKEND=cranelift CARGO_UNSTABLE_CODEGEN_BACKEND=true RUST_BACKTRACE=1 cargo watch --ignore ki-vscode --ignore ki-jetbrains --ignore 'mock_repos/*' --ignore 'docs/static/*.json' -- cargo test --workspace -- {{testname}}
watch-clippy:
RUST_BACKTRACE=1 cargo watch --ignore ki-vscode --ignore ki-jetbrains -- cargo clippy --workspace --tests
vscode-build: build
cd ki-vscode && npm install
vscode-package:
@just vscode-build-binaries
cd ki-vscode && npm run package
vscode-publish: vscode-package
cd ki-vscode && npm run publish
# Build and install the locally build VS Code extension
vscode-install:
rm ki-vscode/ki-editor-vscode-*.vsix || true
cargo build --release
cp target/release/ki ./ki-vscode/dist/bin/ki-darwin-arm64
cd ki-vscode && npm install
cd ki-vscode && npm run package
rm -rf ~/.vscode/extensions/ki-editor.ki-editor-vscode-0.0.*/**
code --install-extension ki-vscode/ki-editor-vscode-*.vsix
# Build and package Ki Editor binary for a specific platform
_vscode-build-binary platform nix_target output_name binary_name="ki":
#!/usr/bin/env bash
mkdir -p ki-vscode/dist/bin
nix build -L .#{{nix_target}}
BUILD_PATH=$(readlink -f result 2>/dev/null || echo "")
if [[ -n "${BUILD_PATH}" && -f "${BUILD_PATH}/bin/{{binary_name}}" ]]; then
cp -f "${BUILD_PATH}/bin/{{binary_name}}" "ki-vscode/dist/bin/{{output_name}}"
if [[ "{{binary_name}}" == "ki" ]]; then
chmod +x "ki-vscode/dist/bin/{{output_name}}"
fi
echo "Copied {{platform}} build"
else
echo "{{platform}} build not found"
exit 1
fi
rm -f result
# Build and package Ki Editor binary for macOS ARM64
vscode-build-binary-mac-arm64:
just _vscode-build-binary "aarch64-darwin" "aarch64-darwin" "ki-darwin-arm64"
# Build and package Ki Editor binary for Linux x86_64
vscode-build-binary-linux-x64:
just _vscode-build-binary "x86_64-linux-musl" "x86_64-linux-musl" "ki-linux-x64"
# Build and package Ki Editor binary for Linux ARM64
vscode-build-binary-linux-arm64:
just _vscode-build-binary "aarch64-linux" "aarch64-linux" "ki-linux-arm64"
# Build and package Ki Editor binary for Windows x86_64
vscode-build-binary-windows-x64:
just _vscode-build-binary "x86_64-windows-gnu" "x86_64-windows-gnu" "ki-win32-x64.exe" "ki.exe"
# Build Ki Editor for all platforms and copy binaries to ki-vscode/dist/bin
vscode-build-binaries:
just vscode-build-binary-mac-arm64
just vscode-build-binary-linux-x64
just vscode-build-binary-linux-arm64
just vscode-build-binary-windows-x64
ls -la ki-vscode/dist/bin/
echo "Done!"
profile args="":
cargo build --release
samply record ./target/release/ki {{args}}