Skip to content

Commit

Permalink
Release 3.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
quanshousio committed Jul 31, 2021
1 parent fb8cefb commit 8f0ebd9
Show file tree
Hide file tree
Showing 12 changed files with 717 additions and 526 deletions.
25 changes: 25 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ All notable changes to this project will be documented in this file. `cargo-comp

#### 3.x Releases

- `3.2.x` Releases - [3.2.0](#320)
- `3.1.x` Releases - [3.1.0](#310)
- `3.0.x` Releases - [3.0.0](#300) | [3.0.1](#301)

Expand All @@ -18,6 +19,30 @@ All notable changes to this project will be documented in this file. `cargo-comp

---

## [3.2.0](https://github.com/bitslab/cargo-compiler-interrupts/releases/tag/3.2.0)

Released on 2021-07-31.

#### Added

- `cargo-build-ci`
- Support integration for `examples` target by passing `--example` option.
- `cargo-run-ci`
- Ability to pass arguments to the binary by passing `--args` option.

#### Updated

- Various path-related helper functions are renamed.
- `cargo-build-ci`
- Fix a race condition between integration threads and progress indicator threads when integration thread failed unexpectedly.
- Failed integration can now be run again without using `cargo clean`.
- `cargo-lib-ci`
- Fix wrong output formatting while the progress indicator is showing.

#### Removed

- `deps-ci` folder has been removed. All CI-integrated artifacts are now resided in the same directory as the original one.

## [3.1.0](https://github.com/bitslab/cargo-compiler-interrupts/releases/tag/3.1.0)

Released on 2021-07-24.
Expand Down
7 changes: 4 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ license = "MIT"
name = "cargo-compiler-interrupts"
readme = "README.md"
repository = "https://github.com/bitslab/cargo-compiler-interrupts"
version = "3.1.0"
version = "3.2.0"

[dependencies]
anyhow = "1.0"
Expand All @@ -20,12 +20,13 @@ cargo_metadata = "0.13"
chrono = "0.4"
clap = "3.0.0-beta.2"
colored = "2"
crossbeam-utils = "0.8"
dirs = "3.0"
faccess = "0.2"
indicatif = "0.16"
md5 = "0.7"
rayon = "1.5"
serde = {version = "1.0", features = ["derive"]}
num_cpus = "1.13"
serde = "1.0"
term_size = "1.0.0-beta.2"
thiserror = "1.0"
toml = "0.5"
Expand Down
8 changes: 5 additions & 3 deletions DOCUMENTATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ FLAGS:
-V, --version Prints version information

OPTIONS:
-e, --example <BINARY> Build an example artifact
-s, --skip-crates <CRATES>... Crates to skip the integration (space-delimited)
-t, --target <TRIPLE> Build for the target triple
```
Expand All @@ -68,6 +69,7 @@ FLAGS:
-V, --version Prints version information

OPTIONS:
-a, --args <ARGS>... Arguments for the binary
-b, --bin <BINARY> Name of the binary
-t, --target <TRIPLE> Target triple for the binary
```
Expand All @@ -88,9 +90,9 @@ FLAGS:
-V, --version Prints version information

OPTIONS:
-a, --args <args>... Default arguments for the library (space-delimited)
-p, --path <path> Destination path for the library when installing
--url <url> URL to the source code of the library when installing
-a, --args <ARGS>... Default arguments for the library (space-delimited)
-p, --path <PATH> Destination path for the library when installing
--url <URL> Remote URL to the source code of the library when installing
```

## Project structure
Expand Down
59 changes: 43 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,25 @@
# cargo-compiler-interrupts

[![crates.io](https://img.shields.io/crates/v/cargo-compiler-interrupts.svg)](https://crates.io/crates/cargo-compiler-interrupts)
[![docs.rs](https://docs.rs/cargo-compiler-interrupts/badge.svg)](https://docs.rs/cargo-compiler-interrupts)
[![license](https://img.shields.io/crates/l/cargo-compiler-interrupts.svg)](LICENSE)
[![crates.io](https://img.shields.io/crates/v/cargo-compiler-interrupts.svg)][crates.io]
[![docs.rs](https://docs.rs/cargo-compiler-interrupts/badge.svg)][docs.rs]
[![license](https://img.shields.io/crates/l/cargo-compiler-interrupts.svg)][license]

`cargo-compiler-interrupts` provides you a seamless way to integrate the [Compiler Interrupts](https://dl.acm.org/doi/10.1145/3453483.3454107) to any Rust packages. Check out the Compiler Interrupts [main repository](https://github.com/bitslab/CompilerInterrupts) for more info.
`cargo-compiler-interrupts` provides you a seamless way to integrate the
[Compiler Interrupts][compiler-interrupts-paper] to any Rust packages.
Check out the Compiler Interrupts [main repository][compiler-interrupts] for more info.

## Requirements

* [Rust 1.45.0](https://www.rust-lang.org/tools/install) or later and [LLVM 9](https://releases.llvm.org/) or later are required. Both must have the same LLVM version.
* You can check the LLVM version from Rust toolchain and LLVM toolchain by running `rustc -vV` and `llvm-config --version` respectively.
* x86-64 architecture with Linux or macOS is highly recommended. Other architectures and platforms have not been tested.
* [Rust 1.45.0][rust] or later and [LLVM 9][llvm] or later are required.
Both must have the same LLVM version.
* You can check the LLVM version from Rust toolchain and LLVM toolchain by running `rustc -vV`
and `llvm-config --version` respectively.
* x86-64 architecture with Linux or macOS is highly recommended.
Other architectures and platforms have not been tested.

## Installation

`cargo-compiler-interrupts` is a Cargo package and can be installed via `cargo install`.
`cargo-compiler-interrupts` can be installed via `cargo install`.

``` sh
cargo install cargo-compiler-interrupts
Expand All @@ -39,9 +44,14 @@ cargo run-ci # run the CI-integrated binary

* `cargo lib-ci` — manage the Compiler Interrupts library.
* `cargo build-ci` — build and integrate the Compiler Interrupts to the package.
* `cargo run-ci` — run the integrated binary. You can specify which binary to run by passing `--bin <BINARY>`.
* `cargo run-ci` — run the integrated binary.
You can specify which binary to run by passing `--bin <BINARY>`.

Make sure your program registers the Compiler Interrupts handler before running `cargo build-ci`. Compiler Interrupts APIs are provided through the [`compiler-interrupts`](https://github.com/bitslab/compiler-interrupts-rs) package.
Run `cargo lib-ci --install` to install the Compiler Interrupts library first.
Before running `cargo build-ci`, add the Compiler Interrupts API package as the dependency for
your Cargo package and registers the Compiler Interrupts handler in your program.
Compiler Interrupts API is provided through the [`compiler-interrupts`][compiler-interrupts-rs]
package.

``` rust
fn interrupt_handler(ic: i64) {
Expand All @@ -53,21 +63,38 @@ unsafe {
}
```

For more detailed usages and internals, run the command with `--help` option and check out the **[documentation](DOCUMENTATION.md)**.
For more detailed usages and internals, run the command with `--help` option and
check out the **[documentation]**.

## Contribution

All issue reports, feature requests, pull requests and GitHub stars are welcomed and much appreciated. Issues relating to the Compiler Interrupts integration should be reported to the [main repository](https://github.com/bitslab/CompilerInterrupts).
All issue reports, feature requests, pull requests and GitHub stars are welcomed
and much appreciated. Issues relating to the Compiler Interrupts library
should be reported to the [main repository][compiler-interrupts].

## Author

Quan Tran ([@quanshousio](https://quanshousio.com))
Quan Tran ([@quanshousio][quanshousio])

## Acknowledgements

* My advisor [Jakob Eriksson](https://www.linkedin.com/in/erikssonjakob) for the enormous support for this project.
* [Nilanjana Basu](https://www.linkedin.com/in/nilanjana-basu-99027959) for implementing the Compiler Interrupts.
* My advisor [Jakob Eriksson][jakob] for the enormous support for this project.
* [Nilanjana Basu][nilanjana] for implementing the Compiler Interrupts.

## License

`cargo-compiler-interrupts` is available under the MIT license. See the [LICENSE](LICENSE) file for more info.
`cargo-compiler-interrupts` is available under the MIT license.
See the [LICENSE][license] file for more info.

[crates.io]: https://crates.io/crates/cargo-compiler-interrupts
[docs.rs]: https://docs.rs/cargo-compiler-interrupts
[license]: https://github.com/bitslab/cargo-compiler-interrupts/blob/main/LICENSE
[documentation]: https://github.com/bitslab/cargo-compiler-interrupts/blob/main/DOCUMENTATION.md
[compiler-interrupts]: https://github.com/bitslab/CompilerInterrupts
[compiler-interrupts-rs]: https://github.com/bitslab/compiler-interrupts-rs
[compiler-interrupts-paper]: https://dl.acm.org/doi/10.1145/3453483.3454107
[rust]: https://www.rust-lang.org/tools/install
[llvm]: https://releases.llvm.org
[quanshousio]: https://quanshousio.com
[jakob]: https://www.linkedin.com/in/erikssonjakob
[nilanjana]: https://www.linkedin.com/in/nilanjana-basu-99027959
15 changes: 5 additions & 10 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,54 +11,49 @@ use crate::{util, CIResult};
pub struct Config {
/// Path to the library.
pub library_path: String,

/// Path to the debug-enabled library.
pub library_path_dbg: String,

/// LLVM version used to compile the library.
pub llvm_version: String,

/// Default arguments.
pub default_args: Vec<String>,

/// Checksum of the source code.
pub checksum: String,

/// Remote URL for the source code.
pub url: String,
}

impl Config {
/// Load the configuration.
pub fn load() -> CIResult<Config> {
pub fn load() -> CIResult<Self> {
let mut path = util::config_path()?;
path.push("default.cfg");
let file = match paths::read(&path) {
Ok(file) => file,
Err(e) => {
info!("config file not available, default config loaded");
debug!("error: {}", e);
return Ok(Config::default());
return Ok(Self::default());
}
};
match toml::from_str(&file) {
Ok(cfg) => Ok(cfg),
Err(e) => {
let old_path = util::append_suffix(&path, "old");
paths::copy(&path, &old_path)?;
Config::save(&Config::default())?;
Self::save(&Self::default())?;

eprintln!("Incompatible config file found, replaced with default config");
eprintln!("Old config file can be found at: {}", old_path.display());
debug!("error: {}", e);

Config::load()
Self::load()
}
}
}

/// Save the configuration.
pub fn save(config: &Config) -> CIResult<()> {
pub fn save(config: &Self) -> CIResult<()> {
let mut path = util::config_path()?;
path.push("default.cfg");
let s = toml::to_string_pretty(config)?;
Expand Down
2 changes: 1 addition & 1 deletion src/error.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//! Errors related to Compiler Interrupts integration.
//! Errors related to the Compiler Interrupts integration.
// thiserror's bug
#![allow(clippy::nonstandard_macro_braces)]
Expand Down
79 changes: 61 additions & 18 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,20 +1,29 @@
//! `cargo-compiler-interrupts` provides you a simple way to integrate the [Compiler Interrupts](https://dl.acm.org/doi/10.1145/3453483.3454107) to any Rust packages. Check out the Compiler Interrupts [main repository](https://github.com/bitslab/CompilerInterrupts) for more documentation.
//! [![crates.io](https://img.shields.io/crates/v/cargo-compiler-interrupts.svg)][crates.io]
//! [![docs.rs](https://docs.rs/cargo-compiler-interrupts/badge.svg)][docs.rs]
//! [![license](https://img.shields.io/crates/l/cargo-compiler-interrupts.svg)][license]
//!
//! `cargo-compiler-interrupts` provides you a seamless way to integrate the
//! [Compiler Interrupts][compiler-interrupts-paper] to any Rust packages.
//! Check out the Compiler Interrupts [main repository][compiler-interrupts] for more info.
//!
//! ## Requirements
//!
//! * [Rust 1.45.0](https://www.rust-lang.org/tools/install) or later and [LLVM 9](https://releases.llvm.org/) or later are required. Both must have the same LLVM version.
//! * You can check the LLVM version from Rust toolchain and LLVM toolchain by running `rustc -vV` and `llvm-config --version` respectively.
//! * x86-64 architecture with Linux or macOS is highly recommended. Other architectures and platforms have not been tested.
//! * [Rust 1.45.0][rust] or later and [LLVM 9][llvm] or later are required.
//! Both must have the same LLVM version.
//! * You can check the LLVM version from Rust toolchain and LLVM toolchain by running `rustc -vV`
//! and `llvm-config --version` respectively.
//! * x86-64 architecture with Linux or macOS is highly recommended.
//! Other architectures and platforms have not been tested.
//!
//! ## Installation
//!
//! `cargo-compiler-interrupts` is a Cargo package and can be installed via `cargo install`.
//! `cargo-compiler-interrupts` can be installed via `cargo install`.
//!
//! ``` sh
//! cargo install cargo-compiler-interrupts
//! ```
//!
//! You can also fetch the repo and install using `--path`.
//! You can also fetch the repo and install using `--path`.
//!
//! ``` sh
//! git clone https://github.com/bitslab/cargo-compiler-interrupts
Expand All @@ -31,29 +40,62 @@
//! cargo run-ci # run the CI-integrated binary
//! ```
//!
//! * `cargo lib-ci` — install or uninstall the Compiler Interrupts library.
//! * `cargo build-ci` — build and integrate the Compiler Interrupts to the binary.
//! * `cargo run-ci` — run the integrated binary. You can specify which binary to run by passing `--bin <BINARY_NAME>`.
//! * `cargo lib-ci` — manage the Compiler Interrupts library.
//! * `cargo build-ci` — build and integrate the Compiler Interrupts to the package.
//! * `cargo run-ci` — run the integrated binary.
//! You can specify which binary to run by passing `--bin <BINARY>`.
//!
//! Run `cargo lib-ci --install` to install the Compiler Interrupts library first.
//! Before running `cargo build-ci`, add the Compiler Interrupts API package as the dependency for
//! your Cargo package and registers the Compiler Interrupts handler in your program.
//! Compiler Interrupts API is provided through the [`compiler-interrupts`][compiler-interrupts-rs]
//! package.
//!
//! ``` rust
//! fn interrupt_handler(ic: i64) {
//! println!("Compiler interrupt called with instruction count: {}", ic);
//! }
//!
//! unsafe {
//! compiler_interrupts::register(1000, 1000, interrupt_handler);
//! }
//! ```
//!
//! For more detailed usage and internals, please run the command with `--help` option and check out the **[documentation](https://github.com/bitslab/cargo-compiler-interrupts/blob/main/DOCUMENTATION.md)**.
//! For more detailed usages and internals, run the command with `--help` option and
//! check out the **[documentation]**.
//!
//! ## Contribution
//!
//! All issue reports, feature requests, pull requests and GitHub stars are welcomed and much appreciated.
//! All issue reports, feature requests, pull requests and GitHub stars are welcomed
//! and much appreciated. Issues relating to the Compiler Interrupts library
//! should be reported to the [main repository][compiler-interrupts].
//!
//! ## Author
//!
//! Quan Tran ([@quanshousio](https://quanshousio.com))
//! Quan Tran ([@quanshousio][quanshousio])
//!
//! ## Acknowledgements
//!
//! * My advisor [Jakob Eriksson](https://www.linkedin.com/in/erikssonjakob) for the enormous support for this project.
//! * [Nilanjana Basu](https://www.linkedin.com/in/nilanjana-basu-99027959) for implementing the Compiler Interrupts.
//! * My advisor [Jakob Eriksson][jakob] for the enormous support for this project.
//! * [Nilanjana Basu][nilanjana] for implementing the Compiler Interrupts.
//!
//! ## License
//!
//! `cargo-compiler-interrupts` is available under the MIT license. See the [LICENSE](https://github.com/bitslab/cargo-compiler-interrupts/blob/main/LICENSE) file for more info.
//!
//! `cargo-compiler-interrupts` is available under the MIT license.
//! See the [LICENSE][license] file for more info.
//!
//! [crates.io]: https://crates.io/crates/cargo-compiler-interrupts
//! [docs.rs]: https://docs.rs/cargo-compiler-interrupts
//! [license]: https://github.com/bitslab/cargo-compiler-interrupts/blob/main/LICENSE
//! [documentation]: https://github.com/bitslab/cargo-compiler-interrupts/blob/main/DOCUMENTATION.md
//! [compiler-interrupts]: https://github.com/bitslab/CompilerInterrupts
//! [compiler-interrupts-rs]: https://github.com/bitslab/compiler-interrupts-rs
//! [compiler-interrupts-paper]: https://dl.acm.org/doi/10.1145/3453483.3454107
//! [rust]: https://www.rust-lang.org/tools/install
//! [llvm]: https://releases.llvm.org
//! [quanshousio]: https://quanshousio.com
//! [jakob]: https://www.linkedin.com/in/erikssonjakob
//! [nilanjana]: https://www.linkedin.com/in/nilanjana-basu-99027959
#![warn(
missing_copy_implementations,
Expand All @@ -70,11 +112,12 @@
clippy::cast_possible_wrap,
clippy::cast_precision_loss,
clippy::cast_sign_loss,
clippy::clone_on_ref_ptr,
clippy::missing_docs_in_private_items,
clippy::mut_mut,
clippy::print_stdout,
clippy::unwrap_used,
clippy::unseparated_literal_suffix
clippy::unseparated_literal_suffix,
clippy::unwrap_used
)]

/// Compiler Interrupts result.
Expand Down
Loading

0 comments on commit 8f0ebd9

Please sign in to comment.