Merge pull request #4276 from gitbutlerapp/extract-zipper

separate sending zipped logs functionality into gitbutler-feedback crate
This commit is contained in:
Kiril Videlov 2024-07-08 14:07:09 +02:00 committed by GitHub
commit 71af86ef1e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
12 changed files with 46 additions and 11 deletions

13
Cargo.lock generated
View File

@ -2217,6 +2217,18 @@ dependencies = [
"zip",
]
[[package]]
name = "gitbutler-feedback"
version = "0.0.0"
dependencies = [
"anyhow",
"gitbutler-core",
"sha2",
"tempfile",
"walkdir",
"zip",
]
[[package]]
name = "gitbutler-git"
version = "0.0.0"
@ -2318,6 +2330,7 @@ dependencies = [
"gitbutler-branch",
"gitbutler-command-context",
"gitbutler-core",
"gitbutler-feedback",
"gitbutler-oplog",
"gitbutler-repo",
"gitbutler-testsupport",

View File

@ -12,7 +12,8 @@ members = [
"crates/gitbutler-oplog",
"crates/gitbutler-branchstate",
"crates/gitbutler-repo",
"crates/gitbutler-command-context",
"crates/gitbutler-command-context",
"crates/gitbutler-feedback",
]
resolver = "2"
@ -37,6 +38,7 @@ gitbutler-oplog = { path = "crates/gitbutler-oplog" }
gitbutler-branchstate = { path = "crates/gitbutler-branchstate" }
gitbutler-repo = { path = "crates/gitbutler-repo" }
gitbutler-command-context = { path = "crates/gitbutler-command-context" }
gitbutler-feedback = { path = "crates/gitbutler-feedback" }
[profile.release]
codegen-units = 1 # Compile crates one after another so the compiler can optimize better

View File

@ -37,4 +37,3 @@ pub mod virtual_branches;
#[cfg(target_os = "windows")]
pub mod windows;
pub mod writer;
pub mod zip;

View File

@ -6,4 +6,3 @@ mod keys;
mod lock;
mod types;
pub mod virtual_branches;
mod zip;

View File

@ -0,0 +1,20 @@
[package]
name = "gitbutler-feedback"
version = "0.0.0"
edition = "2021"
authors = ["GitButler <gitbutler@gitbutler.com>"]
publish = false
[dependencies]
gitbutler-core.workspace = true
anyhow = "1.0.86"
zip = "0.6.5"
walkdir = "2.5.0"
sha2 = "0.10.8"
[[test]]
name="feedback"
path = "tests/mod.rs"
[dev-dependencies]
tempfile = "3.10"

View File

@ -1,8 +1,9 @@
use anyhow::Result;
use std::path;
use super::Zipper;
use crate::projects::{self, ProjectId};
use gitbutler_core::projects::{self, ProjectId};
use crate::zipper::Zipper;
#[derive(Clone)]
pub struct Controller {

View File

@ -0,0 +1,2 @@
pub mod controller;
pub mod zipper;

View File

@ -1,4 +1,3 @@
pub mod controller;
use std::{
fs,
io::{self, Read, Write},
@ -6,7 +5,6 @@ use std::{
};
use anyhow::{Context, Result};
pub use controller::Controller;
use sha2::{Digest, Sha256};
use walkdir::{DirEntry, WalkDir};
use zip::{result::ZipError, write, CompressionMethod, ZipWriter};

View File

@ -1,6 +1,6 @@
use std::{fs::File, io::Write};
use gitbutler_core::zip::Zipper;
use gitbutler_feedback::zipper::Zipper;
use tempfile::tempdir;
use walkdir::WalkDir;

View File

@ -52,6 +52,7 @@ gitbutler-branch.workspace = true
gitbutler-oplog.workspace = true
gitbutler-repo.workspace = true
gitbutler-command-context.workspace = true
gitbutler-feedback.workspace = true
open = "5"
[dependencies.tauri]

View File

@ -122,10 +122,10 @@ fn main() {
app_handle.manage(assets::Proxy::new(app_cache_dir.join("images")));
let zipper = gitbutler_core::zip::Zipper::new(&app_cache_dir);
let zipper = gitbutler_feedback::zipper::Zipper::new(&app_cache_dir);
app_handle.manage(zipper.clone());
app_handle.manage(gitbutler_core::zip::Controller::new(app_data_dir.clone(), app_log_dir.clone(), zipper.clone(), projects_controller.clone()));
app_handle.manage(gitbutler_feedback::controller::Controller::new(app_data_dir.clone(), app_log_dir.clone(), zipper.clone(), projects_controller.clone()));
let keys_storage_controller = gitbutler_core::keys::storage::Storage::new(storage_controller.clone());
app_handle.manage(keys_storage_controller.clone());

View File

@ -1,11 +1,11 @@
pub mod commands {
#![allow(clippy::used_underscore_binding)]
use anyhow::Context;
use gitbutler_feedback::controller;
use std::path;
use gitbutler_core::error;
use gitbutler_core::error::Code;
use gitbutler_core::zip::controller;
use tauri::{AppHandle, Manager};
use tracing::instrument;