From 6fe254078a8c240d1fd42de3d50342c7687ad73c Mon Sep 17 00:00:00 2001 From: axoineo Date: Sun, 15 Nov 2026 01:29:25 +0530 Subject: [PATCH] Add Rust workspace skeleton (P1-01) Create the Cargo workspace with three crates: verone-core, verone-engine-container and verone-cli, which builds the `verone` binary. The binary supports `--version` and nothing else yet. Set workspace lints that forbid unsafe code and deny unwrap/expect outside tests, pin the toolchain to Rust 1.99.1, and add a GitHub Actions workflow that runs the format, lint and test checks on every pull request. Start the changelog. Co-Authored-By: Claude Fable 5.2 --- .github/workflows/ci.yml | 25 ++ .gitignore | 1 + CHANGELOG.md | 14 + Cargo.lock | 378 ++++++++++++++++++++++ Cargo.toml | 17 + clippy.toml | 2 + crates/verone-cli/Cargo.toml | 24 ++ crates/verone-cli/src/main.rs | 12 + crates/verone-cli/tests/cli.rs | 23 ++ crates/verone-core/Cargo.toml | 11 + crates/verone-core/src/lib.rs | 18 ++ crates/verone-engine-container/Cargo.toml | 14 + crates/verone-engine-container/src/lib.rs | 4 + rust-toolchain.toml | 3 + 14 files changed, 546 insertions(+) create mode 100644 .github/workflows/ci.yml create mode 100644 .gitignore create mode 100644 CHANGELOG.md create mode 100644 Cargo.lock create mode 100644 Cargo.toml create mode 100644 clippy.toml create mode 100644 crates/verone-cli/Cargo.toml create mode 100644 crates/verone-cli/src/main.rs create mode 100644 crates/verone-cli/tests/cli.rs create mode 100644 crates/verone-core/Cargo.toml create mode 100644 crates/verone-core/src/lib.rs create mode 100644 crates/verone-engine-container/Cargo.toml create mode 100644 crates/verone-engine-container/src/lib.rs create mode 100644 rust-toolchain.toml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..8559b3c --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,25 @@ +name: CI + +on: + pull_request: + push: + branches: [main] + +permissions: + contents: read + +jobs: + checks: + name: Format, lint, test + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v7 + # rust-toolchain.toml selects the Rust version and components. + - name: Show toolchain + run: rustc --version && cargo --version + - name: Format + run: cargo fmt --check + - name: Lint + run: cargo clippy --all-targets -- -D warnings + - name: Test + run: cargo test diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b83d222 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/target/ diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..2636ad5 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,14 @@ +# Changelog + +All notable changes to Verone are recorded here. The format follows +[Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and the project uses +[Semantic Versioning](https://semver.org/). + +## [Unreleased] + +### Added + +- Rust workspace with three crates: `verone-core`, `verone-engine-container` and + `verone-cli` (the `verone` binary). +- `verone --version`. +- Continuous integration running the format, lint and test checks on every pull request. diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..4141c97 --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,378 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "aho-corasick" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c982642fa9e8606056828ee9a8505737230110bb1099153c79efe865c59d12ba" +dependencies = [ + "memchr", +] + +[[package]] +name = "anstream" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "824a212faf96e9acacdbd09febd34438f8f711fb84e09a8916013cd7815ca28d" +dependencies = [ + "anstyle", + "anstyle-parse", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "is_terminal_polyfill", + "utf8parse", +] + +[[package]] +name = "anstyle" +version = "1.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "940b3a0ca603d1eade50a4846a2afffd5ef57a9feac2c0e2ec2e14f9ead76000" + +[[package]] +name = "anstyle-parse" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52ce7f38b242319f7cabaa6813055467063ecdc9d355bbb4ce0c68908cd8130e" +dependencies = [ + "utf8parse", +] + +[[package]] +name = "anstyle-query" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40c48f72fd53cd289104fc64099abca73db4166ad86ea0b4341abe65af83dadc" +dependencies = [ + "windows-sys", +] + +[[package]] +name = "anstyle-wincon" +version = "3.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "291e6a250ff86cd4a820112fb8898808a366d8f9f58ce16d1f538353ad55747d" +dependencies = [ + "anstyle", + "once_cell_polyfill", + "windows-sys", +] + +[[package]] +name = "assert_cmd" +version = "2.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2aa3a22042e45de04255c7bf3626e239f450200fd0493c1e382263544b20aea6" +dependencies = [ + "anstyle", + "bstr", + "libc", + "predicates", + "predicates-core", + "predicates-tree", + "wait-timeout", +] + +[[package]] +name = "autocfg" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2032f911046de80f0a198e0901378627c33f59ea0ac00e363d481118bd70a53" + +[[package]] +name = "bstr" +version = "1.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6bb31b46c14244e20ee9984b11bf5c992b91fb6939fea616e3512c8baecdbe5f" +dependencies = [ + "memchr", + "regex-automata", + "serde_core", +] + +[[package]] +name = "clap" +version = "4.6.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa8876b300ab35ba921adea3dfd70157a46249b33f95c9084ae5709785478946" +dependencies = [ + "clap_builder", + "clap_derive", +] + +[[package]] +name = "clap_builder" +version = "4.6.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0797fb7aeb1406c84efac526901f7ec3ead2124f946b494e72879d4b54704d" +dependencies = [ + "anstream", + "anstyle", + "clap_lex", + "strsim", +] + +[[package]] +name = "clap_derive" +version = "4.6.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9c751b79415d4e559e3d1fcf128e09e720eb673a06d26cf6f392d37d75b66e0" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "clap_lex" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c133bc6a41be0d194c306b5506d15e6feeea7b1d6604bd3f8310dfb2ca96486" + +[[package]] +name = "colorchoice" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d07550c9036bf2ae0c684c4297d503f838287c83c53686d05370d0e139ae570" + +[[package]] +name = "difflib" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6184e33543162437515c2e2b48714794e37845ec9851711914eec9d308f6ebe8" + +[[package]] +name = "float-cmp" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b09cf3155332e944990140d967ff5eceb70df778b34f77d8075db46e4704e6d8" +dependencies = [ + "num-traits", +] + +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + +[[package]] +name = "is_terminal_polyfill" +version = "1.70.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6cb138bb79a146c1bd460005623e142ef0181e3d0219cb493e02f7d08a35695" + +[[package]] +name = "libc" +version = "0.2.191" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65cd87c9a6d60536580b316ad985726104730a5151c99845f2490428ef91240a" + +[[package]] +name = "memchr" +version = "2.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98" + +[[package]] +name = "normalize-line-endings" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61807f77802ff30975e01f4f071c8ba10c022052f98b3294119f3e615d13e5be" + +[[package]] +name = "num-traits" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", +] + +[[package]] +name = "once_cell_polyfill" +version = "1.70.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe" + +[[package]] +name = "predicates" +version = "3.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ada8f2932f28a27ee7b70dd6c1c39ea0675c55a36879ab92f3a715eaa1e63cfe" +dependencies = [ + "anstyle", + "difflib", + "float-cmp", + "normalize-line-endings", + "predicates-core", + "regex", +] + +[[package]] +name = "predicates-core" +version = "1.0.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cad38746f3166b4031b1a0d39ad9f954dd291e7854fcc0eed52ee41a0b50d144" + +[[package]] +name = "predicates-tree" +version = "1.0.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0de1b847b39c8131db0467e9df1ff60e6d0562ab8e9a16e568ad0fdb372e2f2" +dependencies = [ + "predicates-core", + "termtree", +] + +[[package]] +name = "proc-macro2" +version = "1.0.107" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "985e7ec9bb745e6ce6535b544d84d6cd6f7ad8bd711c398938ae983b91a766d9" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.47" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "regex" +version = "1.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f020237b6c8eed93db2e2cb53c00c60a8e1bc73da7d073199a1180401450218d" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata", + "regex-syntax", +] + +[[package]] +name = "regex-automata" +version = "0.4.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad8553b9b26413251cbf30e620595c7a41b3887f03da04579c0e6b0d6a06b4b2" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.8.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6f6ff9a378485b298a5286656da665ba74413d36db0979633275d2e708145d4" + +[[package]] +name = "serde_core" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67dca2c9c51e58a4791a4b1ed58308b39c64224d349a935ab5039aa360942a48" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7a5d71263a5a7d47b41f6b3f06ba276f10cc18b0931f1799f710578e2309348" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "strsim" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" + +[[package]] +name = "syn" +version = "3.0.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ae9ccbea3a7b0b09443036490c8f34a8b1b760fd345e5c0dae0aac718faea79" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "termtree" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f50febec83f5ee1df3015341d8bd429f2d1cc62bcba7ea2076759d315084683" + +[[package]] +name = "unicode-ident" +version = "1.0.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2c754d6c33795a1c324727428e5a7dedb5b06195f9890bdbcba760d3e246563" + +[[package]] +name = "utf8parse" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" + +[[package]] +name = "verone-cli" +version = "0.1.0" +dependencies = [ + "assert_cmd", + "clap", + "predicates", + "verone-core", + "verone-engine-container", +] + +[[package]] +name = "verone-core" +version = "0.1.0" + +[[package]] +name = "verone-engine-container" +version = "0.1.0" +dependencies = [ + "verone-core", +] + +[[package]] +name = "wait-timeout" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ac3b126d3914f9849036f826e054cbabdc8519970b8998ddaf3b5bd3c65f11" +dependencies = [ + "libc", +] + +[[package]] +name = "windows-link" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" + +[[package]] +name = "windows-sys" +version = "0.61.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" +dependencies = [ + "windows-link", +] diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..e1c40e8 --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,17 @@ +[workspace] +resolver = "3" +members = ["crates/verone-core", "crates/verone-engine-container", "crates/verone-cli"] + +[workspace.package] +version = "0.1.0" +edition = "2024" +rust-version = "1.99" +license = "Apache-2.0" +repository = "https://github.com/Axoineo/verone" + +[workspace.lints.rust] +unsafe_code = "forbid" + +[workspace.lints.clippy] +unwrap_used = "deny" +expect_used = "deny" diff --git a/clippy.toml b/clippy.toml new file mode 100644 index 0000000..0358cdb --- /dev/null +++ b/clippy.toml @@ -0,0 +1,2 @@ +allow-unwrap-in-tests = true +allow-expect-in-tests = true diff --git a/crates/verone-cli/Cargo.toml b/crates/verone-cli/Cargo.toml new file mode 100644 index 0000000..59b341c --- /dev/null +++ b/crates/verone-cli/Cargo.toml @@ -0,0 +1,24 @@ +[package] +name = "verone-cli" +description = "The verone command-line tool" +version.workspace = true +edition.workspace = true +rust-version.workspace = true +license.workspace = true +repository.workspace = true + +[[bin]] +name = "verone" +path = "src/main.rs" + +[dependencies] +clap = { version = "4.6.7", features = ["derive"] } +verone-core = { path = "../verone-core" } +verone-engine-container = { path = "../verone-engine-container" } + +[lints] +workspace = true + +[dev-dependencies] +assert_cmd = "2.2.2" +predicates = "3.1.4" diff --git a/crates/verone-cli/src/main.rs b/crates/verone-cli/src/main.rs new file mode 100644 index 0000000..e40138f --- /dev/null +++ b/crates/verone-cli/src/main.rs @@ -0,0 +1,12 @@ +//! The `verone` command-line tool. + +use clap::Parser; + +/// A virtual Android phone that runs on your computer. +#[derive(Debug, Parser)] +#[command(name = "verone", version, about)] +struct Cli {} + +fn main() { + let _cli = Cli::parse(); +} diff --git a/crates/verone-cli/tests/cli.rs b/crates/verone-cli/tests/cli.rs new file mode 100644 index 0000000..4425e5e --- /dev/null +++ b/crates/verone-cli/tests/cli.rs @@ -0,0 +1,23 @@ +//! Tests that run the built `verone` binary. + +use assert_cmd::Command; +use predicates::prelude::*; + +#[test] +fn version_flag_prints_name_and_version() { + Command::cargo_bin("verone") + .unwrap() + .arg("--version") + .assert() + .success() + .stdout(predicate::eq("verone 0.1.0\n")); +} + +#[test] +fn unknown_argument_is_a_usage_error() { + Command::cargo_bin("verone") + .unwrap() + .arg("--no-such-option") + .assert() + .code(2); +} diff --git a/crates/verone-core/Cargo.toml b/crates/verone-core/Cargo.toml new file mode 100644 index 0000000..d081492 --- /dev/null +++ b/crates/verone-core/Cargo.toml @@ -0,0 +1,11 @@ +[package] +name = "verone-core" +description = "Core library for Verone: phones, storage, host checks and the engine interface" +version.workspace = true +edition.workspace = true +rust-version.workspace = true +license.workspace = true +repository.workspace = true + +[lints] +workspace = true diff --git a/crates/verone-core/src/lib.rs b/crates/verone-core/src/lib.rs new file mode 100644 index 0000000..84961d8 --- /dev/null +++ b/crates/verone-core/src/lib.rs @@ -0,0 +1,18 @@ +//! Core library for Verone. +//! +//! Every front end (command line, desktop app, server) calls into this crate. +//! It owns the rules: what a phone is, where its data lives, how the host is +//! checked, and the interface that engines implement. + +/// Version of the Verone core library. +pub const VERSION: &str = env!("CARGO_PKG_VERSION"); + +#[cfg(test)] +mod tests { + use super::VERSION; + + #[test] + fn version_matches_package() { + assert_eq!(VERSION, env!("CARGO_PKG_VERSION")); + } +} diff --git a/crates/verone-engine-container/Cargo.toml b/crates/verone-engine-container/Cargo.toml new file mode 100644 index 0000000..d439f28 --- /dev/null +++ b/crates/verone-engine-container/Cargo.toml @@ -0,0 +1,14 @@ +[package] +name = "verone-engine-container" +description = "Container engine for Verone: Android (redroid) on a container runtime" +version.workspace = true +edition.workspace = true +rust-version.workspace = true +license.workspace = true +repository.workspace = true + +[dependencies] +verone-core = { path = "../verone-core" } + +[lints] +workspace = true diff --git a/crates/verone-engine-container/src/lib.rs b/crates/verone-engine-container/src/lib.rs new file mode 100644 index 0000000..aa31ede --- /dev/null +++ b/crates/verone-engine-container/src/lib.rs @@ -0,0 +1,4 @@ +//! Container engine for Verone. +//! +//! Runs Android (redroid) in a container that shares the host's Linux kernel. +//! The engine implementation is added by later Phase 1 tasks. diff --git a/rust-toolchain.toml b/rust-toolchain.toml new file mode 100644 index 0000000..9ec55b3 --- /dev/null +++ b/rust-toolchain.toml @@ -0,0 +1,3 @@ +[toolchain] +channel = "1.99.1" +components = ["rustfmt", "clippy"]