Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support dinghy #114

Merged
merged 1 commit into from
Mar 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

[workspace]
members = ["ezlogcli", "ezlog-core", "examples/android_preview", "examples/nest_log", "examples/hello_world"]
members = ["ezlogcli", "ezlog-core", "examples/android_preview", "examples/nest_log", "examples/hello_world", "test-compat"]
resolver = "2"

# https://github.com/johnthagen/min-sized-rust
Expand Down
4 changes: 4 additions & 0 deletions bump.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ find . -path "$EXCLUDE_DIR" -prune -o -type f \( -name "*.toml" -o -name "*.kt"
# clippy check
cargo clippy --all --all-features -- -D warnings

# dinghy test
cargo dinghy -vvv -d android test -p ezlog
cargo dinghy -vvv -d ios test -p ezlog

# build iOS
pushd ios
sh b_ios.sh
Expand Down
3 changes: 2 additions & 1 deletion examples/hello_world/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ log = "0.4"
env_logger = "0"
dirs = "5.0"
time = { version = "0.3", default-features = false, features = ["macros"] }
rand = "0.8"
rand = "0.8"
test-compat = { path = "../../test-compat" }
3 changes: 1 addition & 2 deletions examples/hello_world/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,7 @@ fn get_config() -> EZLogConfig {
EZLogConfigBuilder::new()
.level(Level::Trace)
.dir_path(
dirs::cache_dir()
.unwrap()
test_compat::test_path()
.into_os_string()
.into_string()
.expect("dir path error"),
Expand Down
3 changes: 2 additions & 1 deletion ezlog-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,5 @@ windows-sys = { version = "0.45", features = ["Win32_System_Threading", "Win32_F

[dev-dependencies]
dirs = "5.0"
time = { version = "0.3", default-features = false, features = ["macros"] }
time = { version = "0.3", default-features = false, features = ["macros"] }
test-compat = { path = "../test-compat" }
9 changes: 3 additions & 6 deletions ezlog-core/src/appender.rs
Original file line number Diff line number Diff line change
Expand Up @@ -472,8 +472,7 @@ mod tests {
let nonce = b"unique nonce";
EZLogConfigBuilder::new()
.dir_path(
dirs::cache_dir()
.unwrap()
test_compat::test_path()
.into_os_string()
.into_string()
.unwrap(),
Expand Down Expand Up @@ -543,8 +542,7 @@ mod tests {

let c = EZLogConfigBuilder::new()
.dir_path(
dirs::cache_dir()
.unwrap()
test_compat::test_path()
.into_os_string()
.into_string()
.unwrap(),
Expand Down Expand Up @@ -576,8 +574,7 @@ mod tests {

let c = EZLogConfigBuilder::new()
.dir_path(
dirs::cache_dir()
.unwrap()
test_compat::test_path()
.into_os_string()
.into_string()
.unwrap(),
Expand Down
2 changes: 1 addition & 1 deletion ezlog-core/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -680,7 +680,7 @@ mod tests {

#[test]
fn test_query_log_files() {
let temp = dirs::cache_dir().unwrap().join("ezlog_test_config");
let temp = test_compat::test_path().join("ezlog_test_config");
if temp.exists() {
fs::remove_dir_all(&temp).unwrap();
}
Expand Down
3 changes: 1 addition & 2 deletions ezlog-core/src/decode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -311,8 +311,7 @@ mod tests {
let nonce = b"unique nonce";
crate::EZLogConfigBuilder::new()
.dir_path(
dirs::cache_dir()
.unwrap()
test_compat::test_path()
.join(path)
.into_os_string()
.into_string()
Expand Down
2 changes: 1 addition & 1 deletion ezlog-core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -903,7 +903,7 @@ mod tests {

#[test]
fn test_request_logs() {
let mut cache_dir = dirs::cache_dir().unwrap();
let mut cache_dir = test_compat::test_path();
cache_dir.push("test");
std::fs::create_dir_all(&cache_dir).unwrap();
let dir_clone = cache_dir.clone();
Expand Down
3 changes: 1 addition & 2 deletions ezlog-core/tests/integration_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,7 @@ fn test_logger_create() {
ezlog::InitBuilder::new().debug(true).init();
let config = EZLogConfigBuilder::new()
.dir_path(
dirs::cache_dir()
.unwrap()
test_compat::test_path()
.into_os_string()
.into_string()
.expect("dir path error"),
Expand Down
9 changes: 9 additions & 0 deletions test-compat/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[package]
name = "test-compat"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
dirs = "5.0"
9 changes: 9 additions & 0 deletions test-compat/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
use std::path::PathBuf;

pub fn test_path() -> PathBuf {
if cfg!(target_os = "android") {
std::env::current_dir().unwrap()
} else {
dirs::cache_dir().unwrap()
}
}
Loading