Skip to content

Commit 6793a99

Browse files
authored
Replace Babashka with FFI/Sidecar library (#43)
* replace send/list commands with rust sidecar * add github actions pipeline * refactor from nvim-oxi to mlua * add support for setting default editor and add 'bridge' cli tool to run neovim * fix unix permissions not being included on windows * add support for focus switching * add support for downloading/managing neovide * add clippy support and fix linter results * fix building on macos * only check for updates once a week * add support for managing mobdap * move .cargo/config.toml to crates/sidecar * cache editor port to improve editor interaction performance drastically * remove intermediate lua -> runner json config file * add editor port validation to lua * add debug settings * add ability to download releases by arbitrary match functions and add clear downloads func * remove temp files for neovide and mobdap after download * add ability to download defold annotations * add project dependency management (without .script_api support) * move editor and editor_config code into core, add find-editor-port and send-command sub commands to bridge * move run script to the same place we download our executables * make find_port validate the cached port * fix bridge debug flag blocking launch via defold * add script api compiler with bridge integration * add .script_api compilation * update lsp library dirs when using :DefoldFetch * move data into data dir (XDG_DATA_HOME or eqv) * add experimental github action for releases * update deps * remove fail fast * build macos with deployment target * move macos specific build args to build.rs * fix artifact names, remove libssl dependency (use rustls), implement auto downloading of sidecar * restore loading debug builds * add build step to lazy.nvim setup * fix initialization only working when opts are supplied * add support for zigbuild and build linux with glibc 2.31 * add zig to pipeline * only build linux with zigbuild * add bridge download/management * add better panic handling * check for errors when calling set_log_level * make launcher type optional as intended * switch to debug builds as release just crashes neovim on error * Revert "switch to debug builds as release just crashes neovim on error" This reverts commit fc960dd. * switch to cross for linux builds * fix cross device link error on ubuntu * fix builds on windows * implement file/dir move via fs_extra * apparently fs_extra doesnt create dirs * enable anyhow backtrace * add tracing::instrument to lua functions to block mlua from removing context * fix fs_extra::dir::move_dir not working as expected * log bridge usage errors into log, dont show tracing in stdout anymore * add untested support for neovide download on mac * fix downloads on windows * fix windows run script * maybe fix macos using dmgwiz * replace dmgwiz with dmg * add ability to enforce sidecar/bridge updates * fix macos using different path for Defold preferences * if neovide/mobdap/bridge dont exist always re-download * fix alacritty name, only add class on linux * add tests for game.project * install neovide on macos as an .app * fix launching neovim with line number not working * escape executable path, fix bug with new line syntax * remove defold_api * remove redundant code
1 parent 33f7b88 commit 6793a99

106 files changed

Lines changed: 8473 additions & 9779 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.cljfmt.edn

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

.editorconfig

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
root = true
2+
3+
[*]
4+
end_of_line = lf
5+
insert_final_newline = true
6+
indent_style = space
7+
indent_size = 4
8+
9+
[*.{yml,yaml}]
10+
indent_size = 2

.envrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
use nix

.github/workflows/release.yml

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags: ["v*"]
6+
7+
permissions:
8+
contents: write
9+
10+
jobs:
11+
release:
12+
name: Release ${{ matrix.config.name }}
13+
runs-on: ${{ matrix.config.os }}
14+
strategy:
15+
fail-fast: false
16+
matrix:
17+
config:
18+
- name: Linux x86
19+
os: ubuntu-latest
20+
artifact:
21+
sidecar: target/x86_64-unknown-linux-gnu/release/libdefold_nvim_sidecar.so
22+
bridge: target/x86_64-unknown-linux-gnu/release/defold-nvim-bridge
23+
dist:
24+
sidecar: target/release/linux-x86-libdefold_nvim_sidecar.so
25+
bridge: target/release/linux-x86-defold-nvim-bridge
26+
- name: MacOS x86
27+
os: macos-15-intel
28+
artifact:
29+
sidecar: target/release/libdefold_nvim_sidecar.dylib
30+
bridge: target/release/defold-nvim-bridge
31+
dist:
32+
sidecar: target/release/macos-x86-libdefold_nvim_sidecar.dylib
33+
bridge: target/release/macos-x86-defold-nvim-bridge
34+
- name: MacOS ARM
35+
os: macos-latest
36+
artifact:
37+
sidecar: target/release/libdefold_nvim_sidecar.dylib
38+
bridge: target/release/defold-nvim-bridge
39+
dist:
40+
sidecar: target/release/macos-arm-libdefold_nvim_sidecar.dylib
41+
bridge: target/release/macos-arm-defold-nvim-bridge
42+
- name: Windows x86
43+
os: windows-latest
44+
artifact:
45+
sidecar: target/release/defold_nvim_sidecar.dll
46+
bridge: target/release/defold-nvim-bridge.exe
47+
dist:
48+
sidecar: target/release/windows-x86-defold_nvim_sidecar.dll
49+
bridge: target/release/windows-x86-defold-nvim-bridge
50+
51+
steps:
52+
- uses: actions/checkout@v5
53+
- uses: actions-rust-lang/setup-rust-toolchain@v1
54+
with:
55+
rustflags: ""
56+
57+
- name: build ${{ matrix.config.name }}
58+
if: contains(matrix.config.os, 'ubuntu')
59+
run: |
60+
cargo install cargo-cross
61+
cargo cross build --release --target x86_64-unknown-linux-gnu
62+
63+
- name: build ${{ matrix.config.name }}
64+
if: contains(matrix.config.os, 'macos')
65+
run: MACOSX_DEPLOYMENT_TARGET="13" cargo build --release
66+
67+
- name: build ${{ matrix.config.name }}
68+
if: contains(matrix.config.os, 'windows')
69+
run: cargo build --release
70+
71+
- name: prepare ${{ matrix.config.name }}
72+
run: |
73+
# rename builds to be unique
74+
mv "${{ matrix.config.artifact.sidecar }}" "${{ matrix.config.dist.sidecar }}"
75+
mv "${{ matrix.config.artifact.bridge }}" "${{ matrix.config.dist.bridge }}"
76+
77+
# generate sha256 sum
78+
shasum -a 256 "${{ matrix.config.dist.sidecar }}" > "${{ matrix.config.dist.sidecar }}.sha256"
79+
shasum -a 256 "${{ matrix.config.dist.bridge }}" > "${{ matrix.config.dist.bridge }}.sha256"
80+
81+
- name: upload ${{ matrix.config.name }}
82+
uses: softprops/action-gh-release@v2
83+
with:
84+
files: |
85+
${{ matrix.config.dist.sidecar }}
86+
${{ matrix.config.dist.bridge }}
87+
${{ matrix.config.dist.sidecar }}.sha256
88+
${{ matrix.config.dist.bridge }}.sha256

.github/workflows/test.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
on:
2+
pull_request:
3+
push:
4+
branches:
5+
- master
6+
7+
jobs:
8+
test:
9+
name: Test on ${{ matrix.os }}
10+
runs-on: ${{ matrix.os }}
11+
strategy:
12+
fail-fast: false
13+
matrix:
14+
os:
15+
- ubuntu-latest
16+
- macos-latest
17+
- windows-latest
18+
19+
steps:
20+
- uses: actions/checkout@v5
21+
- uses: actions-rust-lang/setup-rust-toolchain@v1
22+
with:
23+
rustflags: ""
24+
25+
- name: Run tests
26+
run: cargo test --workspace --verbose
27+
28+
- name: Clippy
29+
run: cargo clippy

.github/workflows/update-defold-api.yml

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

.gitignore

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1+
/defold-nvim*
2+
/libdefold-nvim*
13
.clj-kondo
24
.lsp
35
.nrepl*
46

5-
# Created by https://www.toptal.com/developers/gitignore/api/windows,macos,linux,lua
6-
# Edit at https://www.toptal.com/developers/gitignore?templates=windows,macos,linux,lua
7+
# Created by https://www.toptal.com/developers/gitignore/api/windows,macos,linux,lua,rust
8+
# Edit at https://www.toptal.com/developers/gitignore?templates=windows,macos,linux,lua,rust
79

810
### Linux ###
911
*~
@@ -96,6 +98,22 @@ Temporary Items
9698
# iCloud generated files
9799
*.icloud
98100

101+
### Rust ###
102+
# Generated by Cargo
103+
# will have compiled files and executables
104+
debug/
105+
target/
106+
107+
# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
108+
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
109+
# Cargo.lock
110+
111+
# These are backup files generated by rustfmt
112+
**/*.rs.bk
113+
114+
# MSVC Windows builds of rustc generate these, which store debugging information
115+
*.pdb
116+
99117
### Windows ###
100118
# Windows thumbnail cache files
101119
Thumbs.db
@@ -122,4 +140,4 @@ $RECYCLE.BIN/
122140
# Windows shortcuts
123141
*.lnk
124142

125-
# End of https://www.toptal.com/developers/gitignore/api/windows,macos,linux,lua
143+
# End of https://www.toptal.com/developers/gitignore/api/windows,macos,linux,lua,rust

0 commit comments

Comments
 (0)