Introduces three crates: - quicnprotochat-bindings: shared Rust API returning structured data instead of printing to stdout; explicit per-call auth (no global OnceLock); QPCE state files fully interoperable with the CLI. - quicnprotochat-python: PyO3 0.22 extension; GIL released during all blocking QUIC calls via py.allow_threads. - quicnprotochat-ruby: Magnus 0.7 extension; Rakefile build task. Core/proto crates referenced via git dep on the main repo.
40 lines
1.1 KiB
Ruby
40 lines
1.1 KiB
Ruby
require "fileutils"
|
|
|
|
WORKSPACE_ROOT = File.expand_path("../..", __dir__)
|
|
TARGET_DIR = File.join(WORKSPACE_ROOT, "target")
|
|
LIB_DIR = File.join(__dir__, "lib")
|
|
|
|
# Detect the shared library extension for the current platform.
|
|
SO_EXT = case RUBY_PLATFORM
|
|
when /darwin/ then "dylib"
|
|
when /mingw|mswin/ then "dll"
|
|
else "so"
|
|
end
|
|
|
|
LIB_SRC = File.join(TARGET_DIR, "release", "libquicnprotochat_ruby.#{SO_EXT}")
|
|
LIB_DEST = File.join(LIB_DIR, "quicnprotochat_ruby.#{SO_EXT}")
|
|
|
|
desc "Build the native extension (release)"
|
|
task :build do
|
|
sh "cargo build --release --manifest-path #{File.join(__dir__, "Cargo.toml")}"
|
|
FileUtils.mkdir_p(LIB_DIR)
|
|
FileUtils.cp(LIB_SRC, LIB_DEST)
|
|
puts "Copied #{LIB_DEST}"
|
|
end
|
|
|
|
desc "Build the native extension (debug)"
|
|
task :build_dev do
|
|
sh "cargo build --manifest-path #{File.join(__dir__, "Cargo.toml")}"
|
|
lib_src = File.join(TARGET_DIR, "debug", "libquicnprotochat_ruby.#{SO_EXT}")
|
|
FileUtils.mkdir_p(LIB_DIR)
|
|
FileUtils.cp(lib_src, LIB_DEST)
|
|
puts "Copied #{LIB_DEST} (debug)"
|
|
end
|
|
|
|
desc "Remove build artefacts"
|
|
task :clean do
|
|
FileUtils.rm_f(LIB_DEST)
|
|
end
|
|
|
|
task default: :build
|