mirror of
https://github.com/urbit/ares.git
synced 2024-11-22 06:32:47 +03:00
build, docs: restyle flake and add commands to docs
This commit is contained in:
parent
a78ff5426c
commit
cc7821dc41
@ -12,6 +12,8 @@ in `rust/` or any subdirectory, and you will be dropped into a BASH shell with t
|
||||
|
||||
## Rust
|
||||
|
||||
### Build
|
||||
|
||||
To build Ares, start a nix development shell as above. Within the shell, in the `rust/ares` directory, you can run:
|
||||
|
||||
```bash
|
||||
@ -22,6 +24,30 @@ to build the Ares executable. This will place the built executable at `target/de
|
||||
|
||||
Ares is made to run as an urbit "serf", meaning it is intended to be invoked by a "king" which sends it commands and performs side-effects specified by its output. We use the vere king. Special instructions for building the vere king to invoke Ares are forthcoming.
|
||||
|
||||
### Test
|
||||
|
||||
The command to run the Ares suite of unit tests is:
|
||||
|
||||
```bash
|
||||
cargo test --verbose -- --test-threads=1
|
||||
```
|
||||
|
||||
The tests must be run with `-- --test-threads=1` because Rust does not have any way to specify test setup / teardown functions, nor does it have any way to
|
||||
specify ordered test dependencies. Therefore, the only way to ensure that tests that share resources don't clobber each other **and** that tests setup / teardown in the right order is to force all unit tests to be single-threaded.
|
||||
|
||||
### Style
|
||||
|
||||
Ares uses the default Rust formatting and style. The CI jobs are configured to reject any code which produces linter or style warnings. Therefore, as a final step before uploading code changes to GitHub, it's recommended to run the following commands:
|
||||
|
||||
```bash
|
||||
cargo fmt
|
||||
cargo clippy --all-targets --no-deps -- -D warnings -A clippy::missing_safety_doc
|
||||
```
|
||||
|
||||
This will auto-format your code and check for linter warnings.
|
||||
|
||||
### Watch
|
||||
|
||||
To watch rust and check for errors, run
|
||||
|
||||
```bash
|
||||
|
@ -1,20 +1,25 @@
|
||||
{
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
nixpkgs.url = "nixpkgs/nixos-unstable";
|
||||
fenix = {
|
||||
url = "github:nix-community/fenix";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
flake-utils.url = "github:numtide/flake-utils";
|
||||
flake-utils.url = "flake-utils";
|
||||
};
|
||||
|
||||
outputs = {self, fenix, flake-utils, nixpkgs}:
|
||||
let supportedSystems = ["x86_64-linux" "x86_64-darwin" "aarch64-darwin"];
|
||||
in flake-utils.lib.eachSystem supportedSystems
|
||||
(system:
|
||||
let pkgs = import nixpkgs { inherit system; overlays = [(import ./nix/overlay.nix)]; };
|
||||
parsedSystem = pkgs.lib.systems.parse.mkSystemFromString system;
|
||||
in { devShells.default = pkgs.mkShell {
|
||||
let
|
||||
supportedSystems = ["x86_64-linux" "x86_64-darwin" "aarch64-darwin"];
|
||||
in flake-utils.lib.eachSystem supportedSystems (system:
|
||||
let
|
||||
pkgs = import nixpkgs {
|
||||
inherit system;
|
||||
overlays = [(import ./nix/overlay.nix)];
|
||||
};
|
||||
parsedSystem = pkgs.lib.systems.parse.mkSystemFromString system;
|
||||
in {
|
||||
devShells.default = pkgs.mkShell {
|
||||
LIBCLANG_PATH = "${pkgs.llvmPackages.libclang.lib}/lib";
|
||||
buildInputs = [
|
||||
(fenix.packages.${system}.complete.withComponents [
|
||||
@ -24,14 +29,12 @@
|
||||
"rustfmt"
|
||||
"rust-src"
|
||||
])
|
||||
pkgs.autoconf-archive
|
||||
pkgs.cargo-watch
|
||||
pkgs.iconv
|
||||
pkgs.pkg-config
|
||||
pkgs.urcrypt
|
||||
pkgs.llvmPackages.clang
|
||||
] ++
|
||||
(nixpkgs.lib.lists.optional (parsedSystem.kernel.name != "darwin") pkgs.gdb); # nixpkgs won't build gdb for darwin
|
||||
(nixpkgs.lib.lists.optional (parsedSystem.kernel.name != "darwin") pkgs.gdb); # nixpkgs won't build gdb for darwin
|
||||
};
|
||||
}
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user