# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements.  See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership.  The ASF licenses this file
# to you 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.

[package]
name = "arrow-flight"
description = "Apache Arrow Flight"
version = { workspace = true }
edition = { workspace = true }
rust-version = { workspace = true }
authors = { workspace = true }
homepage = { workspace = true }
repository = { workspace = true }
license = { workspace = true }

[dependencies]
arrow-arith = { workspace = true, optional = true }
arrow-array = { workspace = true }
arrow-buffer = { workspace = true }
# Cast is needed to work around https://github.com/apache/arrow-rs/issues/3389
arrow-cast = { workspace = true }
arrow-data = { workspace = true }
arrow-ipc = { workspace = true }
arrow-ord = { workspace = true, optional = true }
arrow-row = { workspace = true, optional = true }
arrow-select = { workspace = true, optional = true }
arrow-schema = { workspace = true }
arrow-string = { workspace = true, optional = true }
base64 = { version = "0.22", default-features = false, features = ["std"] }
bytes = { version = "1", default-features = false }
futures = { version = "0.3", default-features = false, features = ["alloc"] }
once_cell = { version = "1", optional = true }
paste = { version = "1.0" , optional = true }
prost = { version = "0.14.1", default-features = false, features = ["derive"] }
# For Timestamp type
prost-types = { version = "0.14.1", default-features = false }
tokio = { version = "1.0", default-features = false, features = ["macros", "rt", "rt-multi-thread"], optional = true }
tonic = { version = "0.14.1", default-features = false, features = ["transport", "codegen", "router"] }
tonic-prost = { version = "0.14.1", default-features = false }

# CLI-related dependencies
anyhow = { version = "1.0", optional = true }
clap = { version = "4.4.6", default-features = false, features = ["std", "derive", "env", "help", "error-context", "usage", "wrap_help", "color", "suggestions"], optional = true }
tracing-log = { version = "0.2", optional = true }
tracing-subscriber = { version = "0.3.1", default-features = false, features = ["ansi", "env-filter", "fmt"], optional = true }

[package.metadata.docs.rs]
all-features = true

[features]
default = []
flight-sql = ["dep:arrow-arith", "dep:arrow-ord", "dep:arrow-row", "dep:arrow-select", "dep:arrow-string", "dep:once_cell", "dep:paste"]
# TODO: Remove in the next release
flight-sql-experimental = ["flight-sql"]
tls-aws-lc= ["tonic/tls-aws-lc"]
tls-native-roots = ["tonic/tls-native-roots"]
tls-ring = ["tonic/tls-ring"]
tls-webpki-roots = ["tonic/tls-webpki-roots"]

# Enable CLI tools
cli = ["arrow-array/chrono-tz", "arrow-cast/prettyprint", "tonic/tls-webpki-roots", "tonic/gzip", "tonic/deflate", "tonic/zstd", "dep:anyhow", "dep:clap", "dep:tracing-log", "dep:tracing-subscriber", "dep:tokio"]

[dev-dependencies]
arrow-cast = { workspace = true, features = ["prettyprint"] }
# Enable the IPC compression codecs so tests can exercise compressed Flight encoding
arrow-ipc = { workspace = true, features = ["lz4", "zstd"] }
assert_cmd = "2.0.8"
criterion = { workspace = true, default-features = false, features = ["async_tokio"] }
http = "1.1.0"
http-body = "1.0.0"
hyper-util = "0.1"
pin-project-lite = "0.2"
tempfile = "3.3"
tracing-log = { version = "0.2" }
tracing-subscriber = { version = "0.3.1", default-features = false, features = ["ansi", "env-filter", "fmt"] }
tokio = { version = "1.0", default-features = false, features = ["macros", "rt", "rt-multi-thread"] }
tokio-stream = { version = "0.1", features = ["net"] }
tower = { version = "0.5.0", features = ["util"] }
uuid = { version = "1.10.0", features = ["v4"] }

[[example]]
name = "flight_sql_server"
required-features = ["flight-sql", "tls-ring"]

[[bin]]
name = "flight_sql_client"
required-features = ["cli", "flight-sql", "tls-ring"]

[[test]]
name = "flight_sql_client"
path = "tests/flight_sql_client.rs"
required-features = ["flight-sql", "tls-ring"]

[[test]]
name = "flight_sql_client_cli"
path = "tests/flight_sql_client_cli.rs"
required-features = ["cli", "flight-sql", "tls-ring"]

[[bench]]
name = "flight"
path = "benches/flight.rs"
harness = false