diff --git a/.github/workflows/ci_test.yml b/.github/workflows/ci_test.yml index fcc344a49..f32695787 100644 --- a/.github/workflows/ci_test.yml +++ b/.github/workflows/ci_test.yml @@ -37,6 +37,11 @@ jobs: - os: 'ubuntu-22.04-arm' - os: 'ubuntu-22.04' features: 'sync' + - os: 'ubuntu-22.04' + features: 'compat-all' + - os: 'ubuntu-22.04' + features: 'polling,ring,compat-all' + no_default_features: true - os: 'ubuntu-22.04' features: 'polling' # fusion - os: 'ubuntu-22.04' @@ -66,13 +71,13 @@ jobs: features: 'iocp-wait-packet' - os: 'windows-latest' target: 'x86_64-pc-windows-msvc' - features: 'native-tls,ring,py-dynamic-openssl' + features: 'native-tls,ring,py-dynamic-openssl,compat-all' - os: 'windows-11-arm' target: 'aarch64-pc-windows-msvc' - os: 'macos-14' - os: 'macos-15' - os: 'macos-15' - features: 'native-tls,ring,py-dynamic-openssl' + features: 'native-tls,ring,py-dynamic-openssl,compat-all' steps: - uses: actions/checkout@v6 - name: Setup Rust Toolchain diff --git a/Cargo.toml b/Cargo.toml index 4aeafeb29..17a5963c9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,6 +16,7 @@ members = [ "compio-signal", "compio-tls", "compio-ws", + "compio-compat", ] resolver = "3" @@ -40,7 +41,9 @@ compio-tls = { path = "./compio-tls", version = "0.10.0-rc.1", default-features compio-process = { path = "./compio-process", version = "0.9.0-rc.1" } compio-quic = { path = "./compio-quic", version = "0.8.0-rc.1", default-features = false } compio-ws = { path = "./compio-ws", version = "0.4.0-rc.1", default-features = false } +compio-compat = { path = "./compio-compat", version = "0.1.0-rc.1" } +async-io = "2.6.0" bytes = "1.7.1" bytemuck = "1.25.0" cfg_aliases = "0.2.1" @@ -54,6 +57,7 @@ futures-executor = "0.3.30" futures-rustls = { version = "0.26.0", default-features = false } futures-util = "0.3.29" libc = "0.2.175" +mod_use = "0.2.3" native-tls = "0.2.13" compio-py-dynamic-openssl = "0.5.0" nix = "0.31.1" diff --git a/compio-compat/Cargo.toml b/compio-compat/Cargo.toml new file mode 100644 index 000000000..f65cfcf87 --- /dev/null +++ b/compio-compat/Cargo.toml @@ -0,0 +1,57 @@ +[package] +name = "compio-compat" +version = "0.1.0-rc.1" +description = "Compatibility layer for compio to work with various async runtimes." +categories = ["asynchronous", "filesystem", "network-programming"] +keywords = ["async", "fs", "iocp", "io-uring", "net"] +readme = "README.md" +edition = { workspace = true } +license = { workspace = true } +repository = { workspace = true } + +[dependencies] +compio-runtime = { workspace = true } +compio-log = { workspace = true } + +cfg-if = { workspace = true } +mod_use = { workspace = true } + +[target.'cfg(windows)'.dependencies] +compio-driver = { workspace = true } + +futures-channel = { workspace = true } +windows-sys = { workspace = true, features = ["Win32_System_Threading"] } +windows-threading = "0.2.1" + +[target.'cfg(target_os = "linux")'.dependencies] +rustix = { workspace = true, features = ["event", "io_uring"] } + +[target.'cfg(unix)'.dependencies] +tokio = { workspace = true, optional = true, features = ["net", "time"] } + +async-io = { workspace = true, optional = true } +futures-util = { workspace = true, optional = true } + +[dev-dependencies] +compio-fs = { workspace = true } +compio-net = { workspace = true } +compio-io = { workspace = true } + +tokio = { workspace = true, features = [ + "rt", + "macros", + "fs", + "net", + "io-util", +] } +futures-executor = { workspace = true } + +futures-util = { workspace = true } + +[features] +tokio = ["dep:tokio"] +futures = ["dep:async-io", "dep:futures-util"] + +[[test]] +name = "net" +required-features = ["tokio"] diff --git a/compio-compat/README.md b/compio-compat/README.md new file mode 100644 index 000000000..1a2216626 --- /dev/null +++ b/compio-compat/README.md @@ -0,0 +1,37 @@ +