From 575c39b87312886e88b02ecb4283d8f376ef203b Mon Sep 17 00:00:00 2001 From: Jason Newcomb Date: Fri, 24 Jan 2020 15:39:17 -0500 Subject: [PATCH] Prepare for crates.io upload --- Cargo.toml | 9 +++++++-- README.md | 5 ++++- src/lib.rs | 4 ++-- test-self-as-cdylib/tests/tests.rs | 2 +- 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 29bd708..2195e51 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,7 +4,12 @@ version = "1.0.0" authors = ["Jason Newcomb "] edition = "2018" license = "MIT OR Apache-2.0" -repository = "https://github.com/Jarcho/test-cdylib-rs" +repository = "https://github.com/Jarcho/test-cdylib" +description = "Library for dynamically linking to cdylib projects from test code." +exclude = [ + "test-self-as-cdylib/*", + ".github/*", +] readme = "README.md" [workspace] @@ -14,7 +19,7 @@ members = ["test-self-as-cdylib"] serde = { version = "1.0.103", features = ["derive"] } serde_json = "1.0" toml = "0.5.2" -cargo_metadata = "0.9" +cargo_metadata = "0.9.0" [dev-dependencies] dlopen = "0.1.8" diff --git a/README.md b/README.md index d98db03..acbb57a 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,8 @@ # test-cdylib +![Build Status](https://github.com/Jarcho/test-cdylib/workflows/Continuous%20integration/badge.svg?branch=master&event=push) +[![Rustc Version 1.31+](https://img.shields.io/badge/rustc-1.31+-lightgray.svg)](https://blog.rust-lang.org/2018/12/06/Rust-1.31-and-rust-2018.html) + test-cdylib is a library for dynamically linking to cdylib projects from test code. This allows testing for the existence of exported items. @@ -13,7 +16,7 @@ A cdylib project can be tested like this: ```rust #[test] fn api_test() { - let dylib_path = test_cdylib::build_project(); + let dylib_path = test_cdylib::build_current_project(); // Or load the shared library using any other method of your choice. let dylib = dlopen::symbor::Library::open(&dylib_path).unwrap(); diff --git a/src/lib.rs b/src/lib.rs index a3ca8e5..645603b 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -8,7 +8,7 @@ //! ```no_run //! #[test] //! fn api_test() { -//! let dylib_path = test_cdylib::build_project(); +//! let dylib_path = test_cdylib::build_current_project(); //! //! // Or load the shared library using any other method of your choice. //! let dylib = dlopen::symbor::Library::open(&dylib_path).unwrap(); @@ -61,6 +61,6 @@ pub fn build_file>(path: P) -> PathBuf { } /// Builds the current project as a cdylib and returns the path to the compiled object. -pub fn build_project() -> PathBuf { +pub fn build_current_project() -> PathBuf { cargo::build_self_cdylib().unwrap() } diff --git a/test-self-as-cdylib/tests/tests.rs b/test-self-as-cdylib/tests/tests.rs index a01d185..47e4798 100644 --- a/test-self-as-cdylib/tests/tests.rs +++ b/test-self-as-cdylib/tests/tests.rs @@ -1,6 +1,6 @@ #[test] pub fn load_lib() { - let dylib = test_cdylib::build_project(); + let dylib = test_cdylib::build_current_project(); let dylib = dlopen::symbor::Library::open(&dylib) .expect(&format!("failed to open library: {}", dylib.display())); let identity = unsafe {