mirror of
https://github.com/hexedtech/codemp.git
synced 2024-11-22 15:24:48 +01:00
build(lua): add rockspec
This commit is contained in:
parent
65721f3e6a
commit
95c9897b10
4 changed files with 51 additions and 19 deletions
20
dist/lua/README.md
vendored
20
dist/lua/README.md
vendored
|
@ -8,20 +8,12 @@ This is important because Lua looks up the constructor symbol based on filename.
|
||||||
|
|
||||||
Type hints are provided in `annotations.lua`, just include them in your language server: `---@module 'annotations'`.
|
Type hints are provided in `annotations.lua`, just include them in your language server: `---@module 'annotations'`.
|
||||||
|
|
||||||
## Example loader
|
## LuaRocks
|
||||||
A simple loader is provided here:
|
`codemp` is available as a rock on [LuaRocks](https://luarocks.org/modules/alemi/codemp)
|
||||||
|
|
||||||
```lua
|
## Manual bundling
|
||||||
---@module 'annotations'
|
LuaRocks compiles from source, which only works if have the rust toolchain available. To provide a reasonable NeoVim experience, we provide pre-built binaries.
|
||||||
|
|
||||||
---@return Codemp
|
> Download latest build and annotations from [here](https://codemp.dev/releases/lua/)
|
||||||
local function load()
|
|
||||||
local native, _ = require("codemp.native")
|
|
||||||
return native
|
|
||||||
end
|
|
||||||
|
|
||||||
return {
|
|
||||||
load = load,
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
|
You will need a loader file to provide annotations: you can use provided `codemp.lua`
|
||||||
|
|
5
dist/lua/build.sh
vendored
5
dist/lua/build.sh
vendored
|
@ -1,5 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
|
|
||||||
cd ../..
|
|
||||||
cargo build --release --features=lua
|
|
||||||
mv ./target/release/libcodemp.so ./dist/lua/codemp_native.so
|
|
40
dist/lua/codemp-0.0.1-1.rockspec
vendored
Normal file
40
dist/lua/codemp-0.0.1-1.rockspec
vendored
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
package = "codemp"
|
||||||
|
version = "0.0.1-1"
|
||||||
|
|
||||||
|
source = {
|
||||||
|
-- url = "git+https://github.com/hexedtech/codemp",
|
||||||
|
url = "git+file:///home/alemi/source/work/codemp/lib",
|
||||||
|
branch = "ci",
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies = {
|
||||||
|
"Lua >= 5.1",
|
||||||
|
"luarocks-build-rust-mlua",
|
||||||
|
}
|
||||||
|
|
||||||
|
description = {
|
||||||
|
summary = "code multiplexer -- lua bindings",
|
||||||
|
detailed = [[
|
||||||
|
codemp is a cooperative live editing framework by hexed.technology
|
||||||
|
|
||||||
|
it provides a batteries-included CRDT-powered client capable of keeping
|
||||||
|
in sync local buffers and sharing cursor event to all workspace members.
|
||||||
|
this is a native lua library, completely written in Rust
|
||||||
|
]],
|
||||||
|
homepage = "https://code.mp",
|
||||||
|
license = "GPL-3.0",
|
||||||
|
-- labels = { "codemp", "cooperative", "ffi", "editor", "rust" },
|
||||||
|
maintainer = "alemi <me@alemi.dev>",
|
||||||
|
}
|
||||||
|
|
||||||
|
build = {
|
||||||
|
type = "rust-mlua",
|
||||||
|
modules = {
|
||||||
|
["codemp_native"] = "codemp",
|
||||||
|
},
|
||||||
|
target_path = "../..",
|
||||||
|
include = {
|
||||||
|
"codemp.lua",
|
||||||
|
"annotations.lua",
|
||||||
|
}
|
||||||
|
}
|
5
dist/lua/codemp.lua
vendored
Normal file
5
dist/lua/codemp.lua
vendored
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
---@module 'annotations'
|
||||||
|
---@type Codemp
|
||||||
|
local native = require('codemp.native')
|
||||||
|
|
||||||
|
return native
|
Loading…
Reference in a new issue