chore: cargo features (#66)
Some checks are pending
test / test-unit (push) Waiting to run
test / test-beta (beta) (push) Blocked by required conditions
test / test-beta (nightly) (push) Blocked by required conditions
test / test-functional (push) Blocked by required conditions
test / test-build (java, macos-latest) (push) Blocked by required conditions
test / test-build (java, ubuntu-latest) (push) Blocked by required conditions
test / test-build (java, windows-latest) (push) Blocked by required conditions
test / test-build (js, macos-latest) (push) Blocked by required conditions
test / test-build (js, ubuntu-latest) (push) Blocked by required conditions
test / test-build (js, windows-latest) (push) Blocked by required conditions
test / test-build (lua, macos-latest) (push) Blocked by required conditions
test / test-build (lua, ubuntu-latest) (push) Blocked by required conditions
test / test-build (lua, windows-latest) (push) Blocked by required conditions
test / test-build (py, macos-latest) (push) Blocked by required conditions
test / test-build (py, ubuntu-latest) (push) Blocked by required conditions
test / test-build (py, windows-latest) (push) Blocked by required conditions

* chore: changed features layout

now using `dep:` and `crate?/feat` syntaxes (introduced in rust 1.60).
this may mess with lua rockspec
This commit is contained in:
əlemi 2024-11-16 16:28:46 +01:00 committed by GitHub
parent 02a31d7000
commit 4fcab00d34
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 29 additions and 29 deletions

View file

@ -69,7 +69,7 @@ jobs:
- java
- js
- py
- luajit
- lua
steps:
- uses: arduino/setup-protoc@v3
with:

View file

@ -64,20 +64,21 @@ napi-build = { version = "2.1", optional = true }
pyo3-build-config = { version = "0.22", optional = true }
[features]
default = []
default = ["lua-jit", "py-abi3"]
# extra
async-trait = ["dep:async-trait"]
serialize = ["dep:serde", "uuid/serde"]
# special tests which require more setup
test-e2e = []
# ffi
java = ["lazy_static", "jni", "tracing-subscriber", "jni-toolbox"]
js = ["napi-build", "tracing-subscriber", "napi", "napi-derive"]
py-noabi = ["pyo3", "tracing-subscriber", "pyo3-build-config"]
py = ["py-noabi", "pyo3/abi3-py38"]
lua = ["mlua-codemp-patch", "tracing-subscriber", "lazy_static", "serialize"]
lua54 =["lua", "mlua-codemp-patch/lua54"]
luajit = ["lua", "mlua-codemp-patch/luajit"]
java = ["dep:lazy_static", "dep:jni", "dep:tracing-subscriber", "dep:jni-toolbox"]
js = ["dep:napi-build", "dep:tracing-subscriber", "dep:napi", "dep:napi-derive"]
py = ["dep:pyo3", "dep:tracing-subscriber", "dep:pyo3-build-config"]
lua = ["serialize", "dep:mlua-codemp-patch", "dep:tracing-subscriber", "dep:lazy_static"]
# ffi variants
lua-jit = ["mlua-codemp-patch?/luajit"]
lua-54 = ["mlua-codemp-patch?/lua54"]
py-abi3 = ["pyo3?/abi3-py38"]
[package.metadata.docs.rs] # enabled features when building on docs.rs

View file

@ -1,7 +1,7 @@
#[cfg(feature = "js")]
extern crate napi_build;
#[cfg(any(feature = "py", feature = "py-noabi"))]
#[cfg(feature = "py")]
extern crate pyo3_build_config;
/// The main method of the buildscript, required by some glue modules.
@ -11,7 +11,7 @@ fn main() {
napi_build::setup();
}
#[cfg(any(feature = "py", feature = "py-noabi"))]
#[cfg(feature = "py")]
{
pyo3_build_config::add_extension_module_link_args();
}

View file

@ -29,6 +29,8 @@ description = {
build = {
type = "rust-mlua",
modules = { "codemp" },
default_features = false,
features = { "lua" },
target_path = "../..",
include = {
["dist/lua/annotations.lua"] = "codemp-annotations.lua",

View file

@ -9,7 +9,7 @@
/// be provided every time.
#[derive(Clone, Debug, Default)]
#[cfg_attr(feature = "js", napi_derive::napi(object))]
#[cfg_attr(any(feature = "py", feature = "py-noabi"), pyo3::pyclass(get_all))]
#[cfg_attr(feature = "py", pyo3::pyclass(get_all))]
#[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))]
pub struct BufferUpdate {
/// Optional content hash after applying this change.
@ -51,7 +51,7 @@ pub struct BufferUpdate {
/// ```
#[derive(Clone, Debug, Default)]
#[cfg_attr(feature = "js", napi_derive::napi(object))]
#[cfg_attr(any(feature = "py", feature = "py-noabi"), pyo3::pyclass(get_all))]
#[cfg_attr(feature = "py", pyo3::pyclass(get_all))]
#[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))]
pub struct TextChange {
/// Range start of text change, as char indexes in buffer previous state.
@ -69,7 +69,7 @@ impl TextChange {
}
}
#[cfg_attr(any(feature = "py", feature = "py-noabi"), pyo3::pymethods)]
#[cfg_attr(feature = "py", pyo3::pymethods)]
impl TextChange {
/// Returns true if this [`TextChange`] deletes existing text.
///

View file

@ -10,10 +10,7 @@
/// http{tls?'s':''}://{host}:{port}
#[derive(Clone, Debug, Default)]
#[cfg_attr(feature = "js", napi_derive::napi(object))]
#[cfg_attr(
any(feature = "py", feature = "py-noabi"),
pyo3::pyclass(get_all, set_all)
)]
#[cfg_attr(feature = "py", pyo3::pyclass(get_all, set_all))]
#[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))]
pub struct Config {
/// User identifier used to register, possibly your email.

View file

@ -1,13 +1,13 @@
//! ### Cursor
//! Represents the position of a remote user's cursor.
#[cfg(any(feature = "py", feature = "py-noabi"))]
#[cfg(feature = "py")]
use pyo3::prelude::*;
/// An event that occurred about a user's cursor.
#[derive(Clone, Debug, Default)]
#[cfg_attr(feature = "js", napi_derive::napi(object))]
#[cfg_attr(any(feature = "py", feature = "py-noabi"), pyclass)]
#[cfg_attr(feature = "py", pyclass)]
#[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))]
// #[cfg_attr(feature = "py", pyo3(crate = "reexported::pyo3"))]
pub struct Cursor {
@ -20,7 +20,7 @@ pub struct Cursor {
/// A cursor selection span.
#[derive(Clone, Debug, Default)]
#[cfg_attr(feature = "js", napi_derive::napi(object))]
#[cfg_attr(any(feature = "py", feature = "py-noabi"), pyclass)]
#[cfg_attr(feature = "py", pyclass)]
#[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))]
// #[cfg_attr(feature = "py", pyo3(crate = "reexported::pyo3"))]
pub struct Selection {

View file

@ -6,7 +6,7 @@ use codemp_proto::workspace::workspace_event::Event as WorkspaceEventInner;
/// Event in a [crate::Workspace].
#[derive(Debug, Clone)]
#[cfg_attr(any(feature = "py", feature = "py-noabi"), pyo3::pyclass)]
#[cfg_attr(feature = "py", pyo3::pyclass)]
#[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))]
#[cfg_attr(feature = "serialize", serde(tag = "type"))]
pub enum Event {

View file

@ -6,7 +6,7 @@ use uuid::Uuid;
/// Represents a service user
#[derive(Debug, Clone)]
#[cfg_attr(any(feature = "py", feature = "py-noabi"), pyo3::pyclass)]
#[cfg_attr(feature = "py", pyo3::pyclass)]
#[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))]
pub struct User {
/// User unique identifier, should never change.

View file

@ -17,7 +17,7 @@ use crate::ext::IgnorableError;
/// Each buffer controller internally tracks the last acknowledged state, remaining always in sync
/// with the server while allowing to procedurally receive changes while still sending new ones.
#[derive(Debug, Clone)]
#[cfg_attr(any(feature = "py", feature = "py-noabi"), pyo3::pyclass)]
#[cfg_attr(feature = "py", pyo3::pyclass)]
#[cfg_attr(feature = "js", napi_derive::napi)]
pub struct BufferController(pub(crate) Arc<BufferControllerInner>);

View file

@ -22,7 +22,7 @@ use codemp_proto::{
session::{session_client::SessionClient, InviteRequest, WorkspaceRequest},
};
#[cfg(any(feature = "py", feature = "py-noabi"))]
#[cfg(feature = "py")]
use pyo3::prelude::*;
/// A `codemp` client handle.
@ -32,7 +32,7 @@ use pyo3::prelude::*;
/// A new [`Client`] can be obtained with [`Client::connect`].
#[derive(Debug, Clone)]
#[cfg_attr(feature = "js", napi_derive::napi)]
#[cfg_attr(any(feature = "py", feature = "py-noabi"), pyclass)]
#[cfg_attr(feature = "py", pyclass)]
pub struct Client(Arc<ClientInner>);
#[derive(Debug)]

View file

@ -21,7 +21,7 @@ use codemp_proto::{
///
/// An unique [CursorController] exists for each active [crate::Workspace].
#[derive(Debug, Clone)]
#[cfg_attr(any(feature = "py", feature = "py-noabi"), pyo3::pyclass)]
#[cfg_attr(feature = "py", pyo3::pyclass)]
#[cfg_attr(feature = "js", napi_derive::napi)]
pub struct CursorController(pub(crate) Arc<CursorControllerInner>);

View file

@ -210,5 +210,5 @@ pub mod lua;
pub mod js;
/// python bindings, built with [pyo3]
#[cfg(any(feature = "py", feature = "py-noabi"))]
#[cfg(feature = "py")]
pub mod python;

View file

@ -41,7 +41,7 @@ use napi_derive::napi;
/// Using a workspace handle, it's possible to receive events (user join/leave, filetree updates)
/// and create/delete/attach to new buffers.
#[derive(Debug, Clone)]
#[cfg_attr(any(feature = "py", feature = "py-noabi"), pyo3::pyclass)]
#[cfg_attr(feature = "py", pyo3::pyclass)]
#[cfg_attr(feature = "js", napi)]
pub struct Workspace(Arc<WorkspaceInner>);