move id module to its own crate

This commit is contained in:
Kiril Videlov 2024-07-09 12:39:18 +02:00
parent b0440ce989
commit 55b8a0357b
No known key found for this signature in database
GPG Key ID: A4C733025427C471
19 changed files with 42 additions and 9 deletions

14
Cargo.lock generated
View File

@ -2100,6 +2100,7 @@ dependencies = [
"bstr", "bstr",
"git2", "git2",
"gitbutler-core", "gitbutler-core",
"gitbutler-id",
"gitbutler-reference", "gitbutler-reference",
"gitbutler-serde", "gitbutler-serde",
"hex", "hex",
@ -2246,6 +2247,14 @@ dependencies = [
"windows 0.57.0", "windows 0.57.0",
] ]
[[package]]
name = "gitbutler-id"
version = "0.0.0"
dependencies = [
"serde",
"uuid",
]
[[package]] [[package]]
name = "gitbutler-notify-debouncer" name = "gitbutler-notify-debouncer"
version = "0.0.0" version = "0.0.0"
@ -2295,6 +2304,7 @@ dependencies = [
"git2", "git2",
"gitbutler-core", "gitbutler-core",
"gitbutler-error", "gitbutler-error",
"gitbutler-id",
"gitbutler-serde", "gitbutler-serde",
"gitbutler-testsupport", "gitbutler-testsupport",
"gix", "gix",
@ -2331,6 +2341,7 @@ dependencies = [
"gitbutler-core", "gitbutler-core",
"gitbutler-error", "gitbutler-error",
"gitbutler-git", "gitbutler-git",
"gitbutler-id",
"gitbutler-project", "gitbutler-project",
"gitbutler-reference", "gitbutler-reference",
"gitbutler-testsupport", "gitbutler-testsupport",
@ -2377,6 +2388,7 @@ dependencies = [
"gitbutler-command-context", "gitbutler-command-context",
"gitbutler-core", "gitbutler-core",
"gitbutler-error", "gitbutler-error",
"gitbutler-id",
"gitbutler-oplog", "gitbutler-oplog",
"gitbutler-project", "gitbutler-project",
"gitbutler-reference", "gitbutler-reference",
@ -2402,6 +2414,7 @@ dependencies = [
"gitbutler-core", "gitbutler-core",
"gitbutler-error", "gitbutler-error",
"gitbutler-feedback", "gitbutler-feedback",
"gitbutler-id",
"gitbutler-oplog", "gitbutler-oplog",
"gitbutler-project", "gitbutler-project",
"gitbutler-reference", "gitbutler-reference",
@ -2486,6 +2499,7 @@ dependencies = [
"gitbutler-core", "gitbutler-core",
"gitbutler-error", "gitbutler-error",
"gitbutler-git", "gitbutler-git",
"gitbutler-id",
"gitbutler-oplog", "gitbutler-oplog",
"gitbutler-project", "gitbutler-project",
"gitbutler-reference", "gitbutler-reference",

View File

@ -21,7 +21,8 @@ members = [
"crates/gitbutler-reference", "crates/gitbutler-reference",
"crates/gitbutler-error", "crates/gitbutler-error",
"crates/gitbutler-serde", "crates/gitbutler-serde",
"crates/gitbutler-secret", "crates/gitbutler-secret",
"crates/gitbutler-id",
] ]
resolver = "2" resolver = "2"
@ -55,6 +56,7 @@ gitbutler-reference = { path = "crates/gitbutler-reference" }
gitbutler-error = { path = "crates/gitbutler-error" } gitbutler-error = { path = "crates/gitbutler-error" }
gitbutler-serde = { path = "crates/gitbutler-serde" } gitbutler-serde = { path = "crates/gitbutler-serde" }
gitbutler-secret = { path = "crates/gitbutler-secret" } gitbutler-secret = { path = "crates/gitbutler-secret" }
gitbutler-id = { path = "crates/gitbutler-id" }
[profile.release] [profile.release]
codegen-units = 1 # Compile crates one after another so the compiler can optimize better codegen-units = 1 # Compile crates one after another so the compiler can optimize better

View File

@ -11,6 +11,7 @@ git2.workspace = true
gitbutler-core.workspace = true gitbutler-core.workspace = true
gitbutler-reference.workspace = true gitbutler-reference.workspace = true
gitbutler-serde.workspace = true gitbutler-serde.workspace = true
gitbutler-id.workspace = true
itertools = "0.13" itertools = "0.13"
serde = { workspace = true, features = ["std"]} serde = { workspace = true, features = ["std"]}
bstr = "1.9.1" bstr = "1.9.1"

View File

@ -2,7 +2,7 @@ use anyhow::Result;
use gitbutler_reference::{normalize_branch_name, Refname, RemoteRefname, VirtualRefname}; use gitbutler_reference::{normalize_branch_name, Refname, RemoteRefname, VirtualRefname};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use gitbutler_core::id::Id; use gitbutler_id::id::Id;
use crate::ownership::BranchOwnershipClaims; use crate::ownership::BranchOwnershipClaims;

View File

@ -7,7 +7,7 @@ use bstr::{BStr, BString, ByteSlice, ByteVec};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use tracing::instrument; use tracing::instrument;
use gitbutler_core::id::Id; use gitbutler_id::id::Id;
use crate::branch::Branch; use crate::branch::Branch;

View File

@ -15,7 +15,6 @@
pub mod fs; pub mod fs;
pub mod git; pub mod git;
pub mod id;
pub mod path; pub mod path;
pub mod storage; pub mod storage;
pub mod time; pub mod time;

View File

@ -0,0 +1,10 @@
[package]
name = "gitbutler-id"
version = "0.0.0"
edition = "2021"
authors = ["GitButler <gitbutler@gitbutler.com>"]
publish = false
[dependencies]
serde = { workspace = true, features = ["std"]}
uuid.workspace = true

View File

@ -0,0 +1 @@
pub mod id;

View File

@ -12,6 +12,7 @@ serde_json = { version = "1.0", features = [ "std", "arbitrary_precision" ] }
gitbutler-core.workspace = true gitbutler-core.workspace = true
gitbutler-error.workspace = true gitbutler-error.workspace = true
gitbutler-serde.workspace = true gitbutler-serde.workspace = true
gitbutler-id.workspace = true
git2.workspace = true git2.workspace = true
async-trait = "0.1.80" async-trait = "0.1.80"
gix = { workspace = true, features = ["dirwalk", "credentials", "parallel"] } gix = { workspace = true, features = ["dirwalk", "credentials", "parallel"] }

View File

@ -5,7 +5,8 @@ use std::{
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use gitbutler_core::{id::Id, types::default_true::DefaultTrue}; use gitbutler_core::types::default_true::DefaultTrue;
use gitbutler_id::id::Id;
#[derive(Debug, Clone, Default, Serialize, Deserialize, PartialEq)] #[derive(Debug, Clone, Default, Serialize, Deserialize, PartialEq)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]

View File

@ -25,6 +25,7 @@ gitbutler-project.workspace = true
gitbutler-branch.workspace = true gitbutler-branch.workspace = true
gitbutler-reference.workspace = true gitbutler-reference.workspace = true
gitbutler-error.workspace = true gitbutler-error.workspace = true
gitbutler-id.workspace = true
[[test]] [[test]]
name="repo" name="repo"

View File

@ -4,7 +4,7 @@ use gitbutler_branch::branch::BranchId;
use serde::Serialize; use serde::Serialize;
use tokio::sync::{oneshot, Mutex}; use tokio::sync::{oneshot, Mutex};
use gitbutler_core::id::Id; use gitbutler_id::id::Id;
static mut GLOBAL_ASKPASS_BROKER: Option<AskpassBroker> = None; static mut GLOBAL_ASKPASS_BROKER: Option<AskpassBroker> = None;

View File

@ -19,3 +19,4 @@ gitbutler-user.workspace = true
gitbutler-branch.workspace = true gitbutler-branch.workspace = true
gitbutler-reference.workspace = true gitbutler-reference.workspace = true
gitbutler-error.workspace = true gitbutler-error.workspace = true
gitbutler-id.workspace = true

View File

@ -7,8 +7,8 @@ use gitbutler_branch::target::Target;
use gitbutler_branchstate::VirtualBranchesAccess; use gitbutler_branchstate::VirtualBranchesAccess;
use gitbutler_command_context::ProjectRepo; use gitbutler_command_context::ProjectRepo;
use gitbutler_core::git::Url; use gitbutler_core::git::Url;
use gitbutler_core::id::Id;
use gitbutler_error::error::Code; use gitbutler_error::error::Code;
use gitbutler_id::id::Id;
use gitbutler_oplog::oplog::Oplog; use gitbutler_oplog::oplog::Oplog;
use gitbutler_project as projects; use gitbutler_project as projects;
use gitbutler_project::{CodePushState, Project}; use gitbutler_project::{CodePushState, Project};

View File

@ -60,6 +60,7 @@ gitbutler-branch.workspace = true
gitbutler-reference.workspace = true gitbutler-reference.workspace = true
gitbutler-error.workspace = true gitbutler-error.workspace = true
gitbutler-secret.workspace = true gitbutler-secret.workspace = true
gitbutler-id.workspace = true
open = "5" open = "5"
[dependencies.tauri] [dependencies.tauri]

View File

@ -1,5 +1,5 @@
pub mod commands { pub mod commands {
use gitbutler_core::id::Id; use gitbutler_id::id::Id;
use gitbutler_repo::askpass::{self, AskpassRequest}; use gitbutler_repo::askpass::{self, AskpassRequest};
#[tauri::command(async)] #[tauri::command(async)]

View File

@ -19,6 +19,7 @@ gitbutler-branch.workspace = true
gitbutler-reference.workspace = true gitbutler-reference.workspace = true
gitbutler-error.workspace = true gitbutler-error.workspace = true
gitbutler-serde.workspace = true gitbutler-serde.workspace = true
gitbutler-id.workspace = true
serde = { workspace = true, features = ["std"]} serde = { workspace = true, features = ["std"]}
bstr = "1.9.1" bstr = "1.9.1"
diffy = "0.3.0" diffy = "0.3.0"

View File

@ -1,5 +1,5 @@
use gitbutler_branch::branch::Branch; use gitbutler_branch::branch::Branch;
use gitbutler_core::id::Id; use gitbutler_id::id::Id;
use gitbutler_virtual::VirtualBranch; use gitbutler_virtual::VirtualBranch;
use super::*; use super::*;