From dd0b80e09a0beb7419e686816d932f0265223f1f Mon Sep 17 00:00:00 2001 From: everpcpc Date: Tue, 5 Sep 2023 07:18:08 +0800 Subject: [PATCH] fix(core): remove depend for vergen --- bindings/nodejs/Cargo.toml | 2 +- bindings/nodejs/src/lib.rs | 2 +- cli/Cargo.toml | 4 ++-- cli/src/display.rs | 2 +- cli/src/session.rs | 2 +- core/Cargo.toml | 3 --- core/build.rs | 21 --------------------- core/src/client.rs | 3 +-- 8 files changed, 7 insertions(+), 32 deletions(-) delete mode 100644 core/build.rs diff --git a/bindings/nodejs/Cargo.toml b/bindings/nodejs/Cargo.toml index f4ed1a7a..10d067cd 100644 --- a/bindings/nodejs/Cargo.toml +++ b/bindings/nodejs/Cargo.toml @@ -17,7 +17,6 @@ databend-driver = { workspace = true, features = ["rustls", "flight-sql"] } chrono = { version = "0.4", default-features = false } csv = "1.2" -futures = "0.3" napi = { version = "2.13", default-features = false, features = [ "napi6", "async", @@ -26,6 +25,7 @@ napi = { version = "2.13", default-features = false, features = [ ] } napi-derive = "2.13" serde_json = "1.0" +tokio-stream = "0.1" [build-dependencies] napi-build = "2" diff --git a/bindings/nodejs/src/lib.rs b/bindings/nodejs/src/lib.rs index 3610a2c3..6909d90d 100644 --- a/bindings/nodejs/src/lib.rs +++ b/bindings/nodejs/src/lib.rs @@ -16,8 +16,8 @@ extern crate napi_derive; use chrono::{NaiveDate, NaiveDateTime, NaiveTime}; -use futures::StreamExt; use napi::bindgen_prelude::*; +use tokio_stream::StreamExt; #[napi] pub struct Client(databend_driver::Client); diff --git a/cli/Cargo.toml b/cli/Cargo.toml index e555f0a9..174d5e20 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -19,7 +19,6 @@ chrono = { version = "0.4", default-features = false, features = ["clock"] } clap = { version = "4.3", features = ["derive", "env"] } comfy-table = "7.0" csv = "1.2" -futures = { version = "0.3", default-features = false, features = ["alloc"] } humantime-serde = "1.1" indicatif = "0.17" itertools = "0.11" @@ -40,12 +39,13 @@ tokio = { version = "1.28", features = [ "sync", "parking_lot", ] } +tokio-stream = "0.1" toml = "0.7" unicode-segmentation = "1.10" url = { version = "2.4", default-features = false } [build-dependencies] -vergen = { version = "8.2", features = ["build", "git", "gitcl"] } +vergen = { version = "8.2", features = ["build", "git", "gix"] } [[bin]] name = "bendsql" diff --git a/cli/src/display.rs b/cli/src/display.rs index cbf5e496..5e06d407 100644 --- a/cli/src/display.rs +++ b/cli/src/display.rs @@ -21,9 +21,9 @@ use comfy_table::{Cell, CellAlignment, Table}; use terminal_size::{terminal_size, Width}; use databend_driver::{QueryProgress, Row, RowProgressIterator, RowWithProgress, SchemaRef}; -use futures::StreamExt; use rustyline::highlight::Highlighter; use tokio::time::Instant; +use tokio_stream::StreamExt; use indicatif::{HumanBytes, ProgressBar, ProgressState, ProgressStyle}; diff --git a/cli/src/session.rs b/cli/src/session.rs index 84fcbc65..d1ad8d4e 100644 --- a/cli/src/session.rs +++ b/cli/src/session.rs @@ -21,7 +21,6 @@ use std::sync::Arc; use anyhow::anyhow; use anyhow::Result; use databend_driver::{Client, Connection}; -use futures::StreamExt; use rustyline::config::Builder; use rustyline::error::ReadlineError; use rustyline::history::DefaultHistory; @@ -29,6 +28,7 @@ use rustyline::{CompletionType, Editor}; use tokio::fs::{remove_file, File}; use tokio::io::AsyncWriteExt; use tokio::time::Instant; +use tokio_stream::StreamExt; use crate::ast::{TokenKind, Tokenizer}; use crate::config::Settings; diff --git a/core/Cargo.toml b/core/Cargo.toml index 44cde4be..ce849984 100644 --- a/core/Cargo.toml +++ b/core/Cargo.toml @@ -33,8 +33,5 @@ tower = { version = "0.4", default-features = false } tower-http = { version = "0.4", default-features = false } url = { version = "2.4", default-features = false } -[build-dependencies] -vergen = { version = "8.2", features = ["build", "git", "gitcl"] } - [dev-dependencies] chrono = { version = "0.4", default-features = false, features = ["clock"] } diff --git a/core/build.rs b/core/build.rs deleted file mode 100644 index 1b288266..00000000 --- a/core/build.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2021 Datafuse Labs -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -use std::error::Error; -use vergen::EmitBuilder; - -fn main() -> Result<(), Box> { - let _ = EmitBuilder::builder().fail_on_error().git_sha(true).emit(); - Ok(()) -} diff --git a/core/src/client.rs b/core/src/client.rs index 52fbdc8b..5181d2b1 100644 --- a/core/src/client.rs +++ b/core/src/client.rs @@ -36,8 +36,7 @@ use crate::{ static VERSION: Lazy = Lazy::new(|| { let version = option_env!("CARGO_PKG_VERSION").unwrap_or("unknown"); - let sha = option_env!("VERGEN_GIT_SHA").unwrap_or("dev"); - format!("{}-{}", version, sha) + version.to_string() }); pub struct PresignedResponse {