add "built" crate
This commit is contained in:
parent
8ebb3f7aef
commit
768a608b02
6 changed files with 49 additions and 10 deletions
34
Cargo.lock
generated
34
Cargo.lock
generated
|
@ -530,6 +530,15 @@ dependencies = [
|
|||
"bytes 0.5.6",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "built"
|
||||
version = "0.5.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4f346b6890a0dfa7266974910e7df2d5088120dd54721b9b0e5aae1ae5e05715"
|
||||
dependencies = [
|
||||
"cargo-lock",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "bumpalo"
|
||||
version = "3.8.0"
|
||||
|
@ -575,6 +584,18 @@ dependencies = [
|
|||
"bytes 1.1.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cargo-lock"
|
||||
version = "7.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7fb04b88bd5b2036e30704f95c6ee16f3b5ca3b4ca307da2889d9006648e5c88"
|
||||
dependencies = [
|
||||
"semver 1.0.4",
|
||||
"serde",
|
||||
"toml",
|
||||
"url",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cc"
|
||||
version = "1.0.72"
|
||||
|
@ -2066,6 +2087,9 @@ name = "semver"
|
|||
version = "1.0.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "568a8e6258aa33c13358f81fd834adb854c6f7c9468520910a9b1e8fac068012"
|
||||
dependencies = [
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "semver-parser"
|
||||
|
@ -2437,6 +2461,15 @@ dependencies = [
|
|||
"tokio 0.2.25",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "toml"
|
||||
version = "0.5.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a31142970826733df8241ef35dc040ef98c679ab14d7c3e54d827099b3acecaa"
|
||||
dependencies = [
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tracing"
|
||||
version = "0.1.29"
|
||||
|
@ -2603,6 +2636,7 @@ dependencies = [
|
|||
"actix_derive",
|
||||
"anyhow",
|
||||
"bs58",
|
||||
"built",
|
||||
"chrono",
|
||||
"clap",
|
||||
"diesel",
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
[package]
|
||||
name = "upend"
|
||||
description = "A user-oriented all-purpose graph database."
|
||||
version = "0.0.24"
|
||||
homepage = "https://upendproject.net/"
|
||||
repository = "https://gitlab.com/tmladek/upend/"
|
||||
authors = ["Tomáš Mládek <t@mldk.cz>"]
|
||||
license = "AGPL-3.0-or-later"
|
||||
edition = "2018"
|
||||
version = "0.0.24"
|
||||
build = "build.rs"
|
||||
|
||||
[dependencies]
|
||||
clap = "2.33.0"
|
||||
|
@ -67,6 +68,9 @@ actix-multipart = "0.3.0"
|
|||
image = { version = "0.23.14", optional = true }
|
||||
webp = { version = "0.2.0", optional = true }
|
||||
|
||||
[build-dependencies]
|
||||
built = "0.5.1"
|
||||
|
||||
[features]
|
||||
default = ["desktop", "previews", "previews-image"]
|
||||
desktop = ["webbrowser", "opener", "is_executable"]
|
||||
|
|
3
build.rs
Normal file
3
build.rs
Normal file
|
@ -0,0 +1,3 @@
|
|||
fn main() {
|
||||
built::write_built_file().expect("Failed to acquire build-time information");
|
||||
}
|
1
src/common.rs
Normal file
1
src/common.rs
Normal file
|
@ -0,0 +1 @@
|
|||
include!(concat!(env!("OUT_DIR"), "/built.rs"));
|
11
src/main.rs
11
src/main.rs
|
@ -15,23 +15,22 @@ use clap::{App as ClapApp, Arg};
|
|||
use log::{info, warn};
|
||||
use std::sync::{Arc, RwLock};
|
||||
|
||||
use crate::database::UpEndDatabase;
|
||||
use crate::{common::PKG_VERSION, database::UpEndDatabase};
|
||||
|
||||
mod addressing;
|
||||
mod common;
|
||||
mod database;
|
||||
mod filesystem;
|
||||
mod previews;
|
||||
mod routes;
|
||||
mod util;
|
||||
|
||||
const VERSION: &str = env!("CARGO_PKG_VERSION");
|
||||
|
||||
fn main() -> Result<()> {
|
||||
let env = env_logger::Env::default().filter_or(env_logger::DEFAULT_FILTER_ENV, "info");
|
||||
env_logger::init_from_env(env);
|
||||
|
||||
let app = ClapApp::new("upend")
|
||||
.version(VERSION)
|
||||
.version(PKG_VERSION)
|
||||
.author("Tomáš Mládek <t@mldk.cz>")
|
||||
.arg(Arg::with_name("DIRECTORY").required(true).index(1))
|
||||
.arg(
|
||||
|
@ -45,7 +44,7 @@ fn main() -> Result<()> {
|
|||
Arg::with_name("DB_PATH")
|
||||
.long("db-path")
|
||||
.takes_value(true)
|
||||
.help("path to sqlite db file (\"$VAULT_PATH/upend.sqlite\" by default)"),
|
||||
.help("path to sqlite db file (\"$VAULT_PATH/.upend\" by default)"),
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("NO_BROWSER")
|
||||
|
@ -81,7 +80,7 @@ fn main() -> Result<()> {
|
|||
|
||||
let matches = app.get_matches();
|
||||
|
||||
info!("Starting UpEnd {}...", VERSION);
|
||||
info!("Starting UpEnd {}...", PKG_VERSION);
|
||||
let sys = actix::System::new("upend");
|
||||
|
||||
let job_container = Arc::new(RwLock::new(util::jobs::JobContainer::default()));
|
||||
|
|
|
@ -29,8 +29,6 @@ use tempfile::NamedTempFile;
|
|||
#[cfg(feature = "desktop")]
|
||||
use is_executable::IsExecutable;
|
||||
|
||||
const VERSION: &str = env!("CARGO_PKG_VERSION");
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct State {
|
||||
pub upend: Arc<UpEndDatabase>,
|
||||
|
@ -416,7 +414,7 @@ pub async fn get_info(state: web::Data<State>) -> Result<HttpResponse, Error> {
|
|||
Ok(HttpResponse::Ok().json(json!({
|
||||
"name": state.vault_name,
|
||||
"location": &*state.upend.vault_path,
|
||||
"version": VERSION
|
||||
"version": crate::common::PKG_VERSION
|
||||
})))
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue