mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
Import taskchampion-lib into integration-tests as rust symbols
This allows Cargo to handle the linking peculiarities of platforms.
This commit is contained in:
parent
6f7c5c31a9
commit
ccb9a0fdfb
4 changed files with 2 additions and 31 deletions
|
@ -8,6 +8,7 @@ build = "build.rs"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
taskchampion = { path = "../taskchampion" }
|
taskchampion = { path = "../taskchampion" }
|
||||||
|
taskchampion-lib = { path = "../lib" }
|
||||||
taskchampion-sync-server = { path = "../sync-server" }
|
taskchampion-sync-server = { path = "../sync-server" }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
|
@ -22,4 +23,3 @@ lazy_static = "1"
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
cc = "1.0.73"
|
cc = "1.0.73"
|
||||||
taskchampion-lib = { path = "../lib" }
|
|
||||||
|
|
|
@ -2,31 +2,6 @@ use std::env;
|
||||||
use std::fs;
|
use std::fs;
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
|
|
||||||
/// Link to the libtaskchampion library produced by the `taskchampion-lib` crate. This is done as
|
|
||||||
/// a build dependency, rather than a cargo dependency, so that the symbols are available to
|
|
||||||
/// bindings-tests.
|
|
||||||
fn link_libtaskchampion() {
|
|
||||||
// This crate has taskchampion-lib in its build-dependencies, so libtaskchampion.so should be
|
|
||||||
// built already.
|
|
||||||
//
|
|
||||||
// Shared libraries (crate-type=cdylib) appear to be placed in target/$PROFILE/deps.
|
|
||||||
let mut libtc_dir = env::current_dir().unwrap();
|
|
||||||
libtc_dir.pop();
|
|
||||||
libtc_dir.pop();
|
|
||||||
libtc_dir.push("target");
|
|
||||||
libtc_dir.push(env::var("PROFILE").unwrap());
|
|
||||||
libtc_dir.push("deps");
|
|
||||||
|
|
||||||
let libtc_dir = libtc_dir.to_str().expect("path is valid utf-8");
|
|
||||||
println!("cargo:rustc-link-search={}", libtc_dir);
|
|
||||||
println!("cargo:rustc-link-lib=dylib=taskchampion_lib");
|
|
||||||
|
|
||||||
// on windows, it appears that rust std requires BCrypt
|
|
||||||
if cfg!(target_os = "windows") {
|
|
||||||
println!("cargo:rustc-link-lib=dylib=bcrypt");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Build the Unity-based C test suite in `src/bindings_tests`, linking the result with this
|
/// Build the Unity-based C test suite in `src/bindings_tests`, linking the result with this
|
||||||
/// package's library crate.
|
/// package's library crate.
|
||||||
fn build_bindings_tests(suites: &[&'static str]) {
|
fn build_bindings_tests(suites: &[&'static str]) {
|
||||||
|
@ -68,7 +43,6 @@ fn main() {
|
||||||
println!("cargo:rerun-if-changed=build.rs");
|
println!("cargo:rerun-if-changed=build.rs");
|
||||||
|
|
||||||
let suites = &["uuid", "string", "task", "replica"];
|
let suites = &["uuid", "string", "task", "replica"];
|
||||||
link_libtaskchampion();
|
|
||||||
build_bindings_tests(suites);
|
build_bindings_tests(suites);
|
||||||
make_suite_file(suites);
|
make_suite_file(suites);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1 +1,2 @@
|
||||||
pub mod bindings_tests;
|
pub mod bindings_tests;
|
||||||
|
pub use taskchampion_lib::*;
|
||||||
|
|
|
@ -3,10 +3,6 @@ name = "taskchampion-lib"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
|
|
||||||
[lib]
|
|
||||||
# staticlib is used for integration-tests, and is not exported.
|
|
||||||
crate-type = ["cdylib", "lib"]
|
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
libc = "0.2.126"
|
libc = "0.2.126"
|
||||||
taskchampion = { path = "../taskchampion" }
|
taskchampion = { path = "../taskchampion" }
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue