diff --git a/Cargo.lock b/Cargo.lock index 6a3659a775..9369ce0884 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -323,15 +323,6 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "476e9cd489f9e121e02ffa6014a8ef220ecb15c05ed23fc34cca13925dc283fb" -[[package]] -name = "built" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fa7899958f4aa3c40edc1b033d0e956763319e398924abb80a0034dda5bb198" -dependencies = [ - "cargo-lock", -] - [[package]] name = "bumpalo" version = "3.4.0" @@ -366,18 +357,6 @@ version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0e4cec68f03f32e44924783795810fa50a7035d8c8ebe78580ad7e6c703fba38" -[[package]] -name = "cargo-lock" -version = "4.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8504b63dd1249fd1745b7b4ef9b6f7b107ddeb3c95370043c7dbcc38653a2679" -dependencies = [ - "semver", - "serde", - "toml", - "url 2.1.1", -] - [[package]] name = "cc" version = "1.0.59" @@ -430,7 +409,6 @@ dependencies = [ name = "client-core" version = "0.8.0-dev" dependencies = [ - "built", "config", "crypto", "directory-client", @@ -1740,7 +1718,6 @@ dependencies = [ name = "nym-client" version = "0.9.0-dev" dependencies = [ - "built", "clap", "client-core", "config", @@ -1771,7 +1748,6 @@ dependencies = [ name = "nym-client-wasm" version = "0.9.0-dev" dependencies = [ - "built", "console_error_panic_hook", "crypto", "directory-client", @@ -1793,7 +1769,6 @@ dependencies = [ name = "nym-gateway" version = "0.9.0-dev" dependencies = [ - "built", "clap", "config", "crypto", @@ -1824,7 +1799,6 @@ name = "nym-mixnode" version = "0.9.0-dev" dependencies = [ "bs58", - "built", "clap", "config", "crypto", @@ -1850,7 +1824,6 @@ dependencies = [ name = "nym-socks5-client" version = "0.9.0-dev" dependencies = [ - "built", "clap", "client-core", "config", @@ -1882,7 +1855,6 @@ version = "0.9.0-dev" dependencies = [ "abci", "bodyparser", - "built", "byteorder", "clap", "config", @@ -2830,7 +2802,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" dependencies = [ "semver-parser", - "serde", ] [[package]] diff --git a/clients/client-core/Cargo.toml b/clients/client-core/Cargo.toml index e27d6b8057..ed803f3db8 100644 --- a/clients/client-core/Cargo.toml +++ b/clients/client-core/Cargo.toml @@ -1,5 +1,4 @@ [package] -build = "build.rs" name = "client-core" version = "0.8.0-dev" authors = ["Dave Hrycyszyn "] @@ -27,8 +26,5 @@ nymsphinx = { path = "../../common/nymsphinx" } pemstore = { path = "../../common/pemstore" } topology = { path = "../../common/topology" } -[build-dependencies] -built = "0.4.3" - [dev-dependencies] tempfile = "3.1.0" \ No newline at end of file diff --git a/clients/client-core/build.rs b/clients/client-core/build.rs deleted file mode 100644 index 56d753472c..0000000000 --- a/clients/client-core/build.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2020 Nym Technologies SA -// -// 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 built; - -fn main() { - built::write_built_file().expect("Failed to acquire build-time information"); -} diff --git a/clients/client-core/src/built_info.rs b/clients/client-core/src/built_info.rs deleted file mode 100644 index 38b46d59e6..0000000000 --- a/clients/client-core/src/built_info.rs +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2020 Nym Technologies SA -// -// 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. - -// The file has been placed there by the build script. -include!(concat!(env!("OUT_DIR"), "/built.rs")); diff --git a/clients/client-core/src/client/topology_control.rs b/clients/client-core/src/client/topology_control.rs index b39297bc17..87d3686964 100644 --- a/clients/client-core/src/client/topology_control.rs +++ b/clients/client-core/src/client/topology_control.rs @@ -12,7 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -use crate::built_info; use directory_client::DirectoryClient; use log::*; use nymsphinx::addressing::clients::Recipient; @@ -175,7 +174,7 @@ impl TopologyRefresher { } Ok(topology) => { let nym_topology: NymTopology = topology.try_into().ok()?; - Some(nym_topology.filter_system_version(built_info::PKG_VERSION)) + Some(nym_topology.filter_system_version(env!("CARGO_PKG_VERSION"))) } } } diff --git a/clients/client-core/src/config/mod.rs b/clients/client-core/src/config/mod.rs index 1189f77670..1e04d21964 100644 --- a/clients/client-core/src/config/mod.rs +++ b/clients/client-core/src/config/mod.rs @@ -266,6 +266,9 @@ impl Default for Config { #[derive(Debug, Deserialize, PartialEq, Serialize)] #[serde(deny_unknown_fields)] pub struct Client { + /// Version of the client for which this configuration was created. + version: String, + /// ID specifies the human readable ID of this particular client. id: String, @@ -313,13 +316,14 @@ pub struct Client { nym_root_directory: PathBuf, #[serde(skip)] - super_struct: PhantomData, + super_struct: PhantomData<*const T>, } impl Default for Client { fn default() -> Self { // there must be explicit checks for whether id is not empty later Client { + version: env!("CARGO_PKG_VERSION").to_string(), id: "".to_string(), directory_server: DEFAULT_DIRECTORY_SERVER.to_string(), vpn_mode: false, diff --git a/clients/client-core/src/lib.rs b/clients/client-core/src/lib.rs index a557c4a3b9..9dfb96a5d0 100644 --- a/clients/client-core/src/lib.rs +++ b/clients/client-core/src/lib.rs @@ -1,3 +1,2 @@ -pub mod built_info; pub mod client; pub mod config; diff --git a/clients/native/Cargo.toml b/clients/native/Cargo.toml index c70ac64473..f8d24a72a0 100644 --- a/clients/native/Cargo.toml +++ b/clients/native/Cargo.toml @@ -1,5 +1,4 @@ [package] -build = "build.rs" name = "nym-client" version = "0.9.0-dev" authors = ["Dave Hrycyszyn ", "Jędrzej Stuczyński "] @@ -42,9 +41,6 @@ pemstore = { path = "../../common/pemstore" } topology = { path = "../../common/topology" } websocket-requests = { path = "websocket-requests" } -[build-dependencies] -built = "0.4.3" - [dev-dependencies] tempfile = "3.1.0" serde_json = "1.0" # for the "textsend" example \ No newline at end of file diff --git a/clients/native/build.rs b/clients/native/build.rs deleted file mode 100644 index 56d753472c..0000000000 --- a/clients/native/build.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2020 Nym Technologies SA -// -// 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 built; - -fn main() { - built::write_built_file().expect("Failed to acquire build-time information"); -} diff --git a/clients/native/src/built_info.rs b/clients/native/src/built_info.rs deleted file mode 100644 index 38b46d59e6..0000000000 --- a/clients/native/src/built_info.rs +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2020 Nym Technologies SA -// -// 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. - -// The file has been placed there by the build script. -include!(concat!(env!("OUT_DIR"), "/built.rs")); diff --git a/clients/native/src/client/config/template.rs b/clients/native/src/client/config/template.rs index b4185891a2..72b3531126 100644 --- a/clients/native/src/client/config/template.rs +++ b/clients/native/src/client/config/template.rs @@ -24,6 +24,9 @@ pub(crate) fn config_template() -> &'static str { ##### main base client config options ##### [client] +# Version of the client for which this configuration was created. +version = '{{ client.version }}' + # Human readable ID of this particular client. id = '{{ client.id }}' diff --git a/clients/native/src/commands/init.rs b/clients/native/src/commands/init.rs index 1f99d0f4d2..c8f3edb707 100644 --- a/clients/native/src/commands/init.rs +++ b/clients/native/src/commands/init.rs @@ -12,7 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -use crate::built_info; use crate::client::config::Config; use crate::commands::override_config; use clap::{App, Arg, ArgMatches}; @@ -108,7 +107,7 @@ async fn gateway_details(directory_server: &str, gateway_id: &str) -> gateway::N let directory_client = directory_client::Client::new(directory_client_config); let topology = directory_client.get_topology().await.unwrap(); let nym_topology: NymTopology = topology.try_into().expect("Invalid topology data!"); - let version_filtered_topology = nym_topology.filter_system_version(built_info::PKG_VERSION); + let version_filtered_topology = nym_topology.filter_system_version(env!("CARGO_PKG_VERSION")); version_filtered_topology .gateways() diff --git a/clients/native/src/lib.rs b/clients/native/src/lib.rs index 0934a2e435..c38ba57566 100644 --- a/clients/native/src/lib.rs +++ b/clients/native/src/lib.rs @@ -12,6 +12,5 @@ // See the License for the specific language governing permissions and // limitations under the License. -pub mod built_info; pub mod client; pub mod websocket; diff --git a/clients/native/src/main.rs b/clients/native/src/main.rs index 04e74a88c3..21f5cfc601 100644 --- a/clients/native/src/main.rs +++ b/clients/native/src/main.rs @@ -14,7 +14,6 @@ use clap::{App, ArgMatches}; -pub mod built_info; pub mod client; pub mod commands; pub mod websocket; @@ -25,7 +24,7 @@ fn main() { println!("{}", banner()); let arg_matches = App::new("Nym Client") - .version(built_info::PKG_VERSION) + .version(env!("CARGO_PKG_VERSION")) .author("Nymtech") .about("Implementation of the Nym Client") .subcommand(commands::init::command_args()) @@ -60,7 +59,7 @@ fn banner() -> String { (client - version {:}) "#, - built_info::PKG_VERSION + env!("CARGO_PKG_VERSION") ) } diff --git a/clients/socks5/Cargo.toml b/clients/socks5/Cargo.toml index c65f894a94..ceed6abfce 100644 --- a/clients/socks5/Cargo.toml +++ b/clients/socks5/Cargo.toml @@ -1,5 +1,4 @@ [package] -build = "build.rs" name = "nym-socks5-client" version = "0.9.0-dev" authors = ["Dave Hrycyszyn "] @@ -35,8 +34,5 @@ socks5-requests = { path = "../../common/socks5/requests" } topology = { path = "../../common/topology" } proxy-helpers = { path = "../../common/socks5/proxy-helpers" } -[build-dependencies] -built = "0.4.3" - [dev-dependencies] tempfile = "3.1.0" \ No newline at end of file diff --git a/clients/socks5/build.rs b/clients/socks5/build.rs deleted file mode 100644 index 56d753472c..0000000000 --- a/clients/socks5/build.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2020 Nym Technologies SA -// -// 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 built; - -fn main() { - built::write_built_file().expect("Failed to acquire build-time information"); -} diff --git a/clients/socks5/src/built_info.rs b/clients/socks5/src/built_info.rs deleted file mode 100644 index 38b46d59e6..0000000000 --- a/clients/socks5/src/built_info.rs +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2020 Nym Technologies SA -// -// 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. - -// The file has been placed there by the build script. -include!(concat!(env!("OUT_DIR"), "/built.rs")); diff --git a/clients/socks5/src/client/config/template.rs b/clients/socks5/src/client/config/template.rs index ece793154b..c0af36207a 100644 --- a/clients/socks5/src/client/config/template.rs +++ b/clients/socks5/src/client/config/template.rs @@ -24,6 +24,9 @@ pub(crate) fn config_template() -> &'static str { ##### main base client config options ##### [client] +# Version of the client for which this configuration was created. +version = '{{ client.version }}' + # Human readable ID of this particular client. id = '{{ client.id }}' diff --git a/clients/socks5/src/commands/init.rs b/clients/socks5/src/commands/init.rs index 1f0c43b9d1..66c8358adb 100644 --- a/clients/socks5/src/commands/init.rs +++ b/clients/socks5/src/commands/init.rs @@ -12,7 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -use crate::built_info; use crate::client::config::Config; use crate::commands::override_config; use clap::{App, Arg, ArgMatches}; @@ -109,7 +108,7 @@ async fn gateway_details(directory_server: &str, gateway_id: &str) -> gateway::N let directory_client = directory_client::Client::new(directory_client_config); let topology = directory_client.get_topology().await.unwrap(); let nym_topology: NymTopology = topology.try_into().expect("Invalid topology data!"); - let version_filtered_topology = nym_topology.filter_system_version(built_info::PKG_VERSION); + let version_filtered_topology = nym_topology.filter_system_version(env!("CARGO_PKG_VERSION")); version_filtered_topology .gateways() diff --git a/clients/socks5/src/lib.rs b/clients/socks5/src/lib.rs index 694607032a..c200a3501e 100644 --- a/clients/socks5/src/lib.rs +++ b/clients/socks5/src/lib.rs @@ -11,6 +11,5 @@ // 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. -pub mod built_info; pub mod client; pub mod socks; diff --git a/clients/socks5/src/main.rs b/clients/socks5/src/main.rs index dfcbc72f15..76bc756136 100644 --- a/clients/socks5/src/main.rs +++ b/clients/socks5/src/main.rs @@ -14,7 +14,6 @@ use clap::{App, ArgMatches}; -pub mod built_info; pub mod client; mod commands; pub mod socks; @@ -25,7 +24,7 @@ fn main() { println!("{}", banner()); let arg_matches = App::new("Nym Socks5 Proxy") - .version(built_info::PKG_VERSION) + .version(env!("CARGO_PKG_VERSION")) .author("Nymtech") .about("A Socks5 localhost proxy that converts incoming messages to Sphinx and sends them to a Nym address") .subcommand(commands::init::command_args()) @@ -60,7 +59,7 @@ fn banner() -> String { (socks5 proxy - version {:}) "#, - built_info::PKG_VERSION + env!("CARGO_PKG_VERSION") ) } diff --git a/clients/webassembly/Cargo.toml b/clients/webassembly/Cargo.toml index 39915e7b65..a7c7a99a29 100644 --- a/clients/webassembly/Cargo.toml +++ b/clients/webassembly/Cargo.toml @@ -1,5 +1,4 @@ [package] -build = "build.rs" name = "nym-client-wasm" authors = ["Dave Hrycyszyn ", "Jedrzej Stuczynski "] version = "0.9.0-dev" @@ -45,9 +44,6 @@ console_error_panic_hook = { version = "0.1", optional = true } # Unfortunately, `wee_alloc` requires nightly Rust when targeting wasm for now. wee_alloc = { version = "0.4", optional = true } -[build-dependencies] -built = "0.4.3" - [dev-dependencies] wasm-bindgen-test = "0.2" diff --git a/clients/webassembly/build.rs b/clients/webassembly/build.rs deleted file mode 100644 index 56d753472c..0000000000 --- a/clients/webassembly/build.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2020 Nym Technologies SA -// -// 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 built; - -fn main() { - built::write_built_file().expect("Failed to acquire build-time information"); -} diff --git a/clients/webassembly/src/built_info.rs b/clients/webassembly/src/built_info.rs deleted file mode 100644 index 6a73d39ca8..0000000000 --- a/clients/webassembly/src/built_info.rs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2020 Nym Technologies SA -// -// 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. - -// The file has been placed there by the build script. - -#![allow(dead_code)] -include!(concat!(env!("OUT_DIR"), "/built.rs")); diff --git a/clients/webassembly/src/client/mod.rs b/clients/webassembly/src/client/mod.rs index 50507c1758..4f9ebb71a2 100644 --- a/clients/webassembly/src/client/mod.rs +++ b/clients/webassembly/src/client/mod.rs @@ -12,7 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -use crate::built_info; use crypto::asymmetric::{encryption, identity}; use directory_client::DirectoryClient; use futures::channel::mpsc; @@ -255,8 +254,8 @@ impl NymClient { .try_into() .ok() .expect("this is not a NYM topology!"); - let version = built_info::PKG_VERSION; - nym_topology.filter_system_version(&version) + let version = env!("CARGO_PKG_VERSION"); + nym_topology.filter_system_version(version) } } } diff --git a/clients/webassembly/src/lib.rs b/clients/webassembly/src/lib.rs index da772b60c9..3c9a70fcd9 100644 --- a/clients/webassembly/src/lib.rs +++ b/clients/webassembly/src/lib.rs @@ -14,7 +14,6 @@ use wasm_bindgen::prelude::*; -pub(crate) mod built_info; #[cfg(target_arch = "wasm32")] mod client; diff --git a/gateway/Cargo.toml b/gateway/Cargo.toml index 48d063c72b..1c58b7c036 100644 --- a/gateway/Cargo.toml +++ b/gateway/Cargo.toml @@ -1,5 +1,4 @@ [package] -build = "build.rs" name = "nym-gateway" version = "0.9.0-dev" authors = ["Dave Hrycyszyn ", "Jędrzej Stuczyński "] @@ -37,8 +36,5 @@ pemstore = { path = "../common/pemstore" } version = "0.11" default-features = false -[build-dependencies] -built = "0.4.3" - [dev-dependencies] tempfile = "3.1.0" \ No newline at end of file diff --git a/gateway/build.rs b/gateway/build.rs deleted file mode 100644 index 56d753472c..0000000000 --- a/gateway/build.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2020 Nym Technologies SA -// -// 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 built; - -fn main() { - built::write_built_file().expect("Failed to acquire build-time information"); -} diff --git a/gateway/src/built_info.rs b/gateway/src/built_info.rs deleted file mode 100644 index 38b46d59e6..0000000000 --- a/gateway/src/built_info.rs +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2020 Nym Technologies SA -// -// 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. - -// The file has been placed there by the build script. -include!(concat!(env!("OUT_DIR"), "/built.rs")); diff --git a/gateway/src/config/mod.rs b/gateway/src/config/mod.rs index 9a7157ebe0..276c5ae6df 100644 --- a/gateway/src/config/mod.rs +++ b/gateway/src/config/mod.rs @@ -407,6 +407,9 @@ impl Config { #[derive(Debug, Deserialize, PartialEq, Serialize)] #[serde(deny_unknown_fields)] pub struct Gateway { + /// Version of the gateway for which this configuration was created. + version: String, + /// ID specifies the human readable ID of this particular gateway. id: String, @@ -461,6 +464,7 @@ impl Gateway { impl Default for Gateway { fn default() -> Self { Gateway { + version: env!("CARGO_PKG_VERSION").to_string(), id: "".to_string(), location: Self::default_location(), private_identity_key_file: Default::default(), diff --git a/gateway/src/config/template.rs b/gateway/src/config/template.rs index 55e2c230a0..6eea057e35 100644 --- a/gateway/src/config/template.rs +++ b/gateway/src/config/template.rs @@ -24,6 +24,9 @@ pub(crate) fn config_template() -> &'static str { ##### main base mixnode config options ##### [gateway] +# Version of the gateway for which this configuration was created. +version = '{{ gateway.version }}' + # Human readable ID of this particular gateway. id = '{{ gateway.id }}' diff --git a/gateway/src/main.rs b/gateway/src/main.rs index c921aaa100..3adbae7295 100644 --- a/gateway/src/main.rs +++ b/gateway/src/main.rs @@ -14,7 +14,6 @@ use clap::{App, ArgMatches}; -pub mod built_info; mod commands; mod config; mod node; @@ -25,7 +24,7 @@ fn main() { println!("{}", banner()); let arg_matches = App::new("Nym Mixnet Gateway") - .version(built_info::PKG_VERSION) + .version(env!("CARGO_PKG_VERSION")) .author("Nymtech") .about("Implementation of the Nym Mixnet Gateway") .subcommand(commands::init::command_args()) @@ -60,7 +59,7 @@ fn banner() -> String { (gateway - version {:}) "#, - built_info::PKG_VERSION + env!("CARGO_PKG_VERSION") ) } diff --git a/gateway/src/node/presence/mod.rs b/gateway/src/node/presence/mod.rs index 7a6e32a453..8014fa24c3 100644 --- a/gateway/src/node/presence/mod.rs +++ b/gateway/src/node/presence/mod.rs @@ -12,7 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -use crate::built_info; use directory_client::presence::gateways::GatewayPresence; use directory_client::DirectoryClient; use log::{error, trace}; @@ -87,7 +86,7 @@ impl Notifier { identity_key: self.identity.clone(), sphinx_key: self.sphinx_key.clone(), last_seen: 0, - version: built_info::PKG_VERSION.to_string(), + version: env!("CARGO_PKG_VERSION").to_string(), } } diff --git a/mixnode/Cargo.toml b/mixnode/Cargo.toml index d85e211efe..13bae1ad74 100644 --- a/mixnode/Cargo.toml +++ b/mixnode/Cargo.toml @@ -1,5 +1,4 @@ [package] -build = "build.rs" name = "nym-mixnode" version = "0.9.0-dev" authors = ["Dave Hrycyszyn ", "Jędrzej Stuczyński "] @@ -30,8 +29,5 @@ nymsphinx = {path = "../common/nymsphinx" } pemstore = {path = "../common/pemstore"} topology = {path = "../common/topology"} -[build-dependencies] -built = "0.4.3" - [dev-dependencies] tempfile = "3.1.0" \ No newline at end of file diff --git a/mixnode/build.rs b/mixnode/build.rs deleted file mode 100644 index 56d753472c..0000000000 --- a/mixnode/build.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2020 Nym Technologies SA -// -// 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 built; - -fn main() { - built::write_built_file().expect("Failed to acquire build-time information"); -} diff --git a/mixnode/src/built_info.rs b/mixnode/src/built_info.rs deleted file mode 100644 index 38b46d59e6..0000000000 --- a/mixnode/src/built_info.rs +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2020 Nym Technologies SA -// -// 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. - -// The file has been placed there by the build script. -include!(concat!(env!("OUT_DIR"), "/built.rs")); diff --git a/mixnode/src/config/mod.rs b/mixnode/src/config/mod.rs index ed9af6b40e..0b088507e4 100644 --- a/mixnode/src/config/mod.rs +++ b/mixnode/src/config/mod.rs @@ -267,6 +267,9 @@ impl Config { #[derive(Debug, Deserialize, PartialEq, Serialize)] #[serde(deny_unknown_fields)] pub struct MixNode { + /// Version of the mixnode for which this configuration was created. + version: String, + /// ID specifies the human readable ID of this particular mixnode. id: String, @@ -326,6 +329,7 @@ impl MixNode { impl Default for MixNode { fn default() -> Self { MixNode { + version: env!("CARGO_PKG_VERSION").to_string(), id: "".to_string(), location: Self::default_location(), layer: 0, diff --git a/mixnode/src/config/template.rs b/mixnode/src/config/template.rs index 3dbce83b0b..ff0f1a1728 100644 --- a/mixnode/src/config/template.rs +++ b/mixnode/src/config/template.rs @@ -24,6 +24,9 @@ pub(crate) fn config_template() -> &'static str { ##### main base mixnode config options ##### [mixnode] +# Version of the mixnode for which this configuration was created. +version = '{{ mixnode.version }}' + # Human readable ID of this particular mixnode. id = '{{ mixnode.id }}' diff --git a/mixnode/src/main.rs b/mixnode/src/main.rs index 1907aaa641..7b5dc96631 100644 --- a/mixnode/src/main.rs +++ b/mixnode/src/main.rs @@ -14,7 +14,6 @@ use clap::{App, ArgMatches}; -pub mod built_info; mod commands; mod config; mod node; @@ -25,7 +24,7 @@ fn main() { println!("{}", banner()); let arg_matches = App::new("Nym Mixnode") - .version(built_info::PKG_VERSION) + .version(env!("CARGO_PKG_VERSION")) .author("Nymtech") .about("Implementation of the Loopix-based Mixnode") .subcommand(commands::init::command_args()) @@ -60,7 +59,7 @@ fn banner() -> String { (mixnode - version {:}) "#, - built_info::PKG_VERSION + env!("CARGO_PKG_VERSION") ) } diff --git a/mixnode/src/node/presence.rs b/mixnode/src/node/presence.rs index 0067a494b0..3920d12a9e 100644 --- a/mixnode/src/node/presence.rs +++ b/mixnode/src/node/presence.rs @@ -12,7 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -use crate::built_info; use directory_client::presence::mixnodes::MixNodePresence; use directory_client::DirectoryClient; use log::{error, trace}; @@ -66,7 +65,7 @@ impl Notifier { pub_key: config.pub_key_string, layer: config.layer, last_seen: 0, - version: built_info::PKG_VERSION.to_string(), + version: env!("CARGO_PKG_VERSION").to_string(), }; Notifier { net_client, diff --git a/validator/Cargo.toml b/validator/Cargo.toml index cefe4c7ef4..dfae7e6705 100644 --- a/validator/Cargo.toml +++ b/validator/Cargo.toml @@ -1,5 +1,4 @@ [package] -build = "build.rs" name = "nym-validator" version = "0.9.0-dev" authors = ["Dave Hrycyszyn ", "Jedrzej Stuczynski "] @@ -26,8 +25,5 @@ tokio = { version = "0.2", features = ["full"] } ## internal config = { path = "../common/config" } -[build-dependencies] -built = "0.4.3" - [dev-dependencies] tempfile = "3.1.0" \ No newline at end of file diff --git a/validator/build.rs b/validator/build.rs deleted file mode 100644 index 56d753472c..0000000000 --- a/validator/build.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2020 Nym Technologies SA -// -// 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 built; - -fn main() { - built::write_built_file().expect("Failed to acquire build-time information"); -} diff --git a/validator/src/built_info.rs b/validator/src/built_info.rs deleted file mode 100644 index 38b46d59e6..0000000000 --- a/validator/src/built_info.rs +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2020 Nym Technologies SA -// -// 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. - -// The file has been placed there by the build script. -include!(concat!(env!("OUT_DIR"), "/built.rs")); diff --git a/validator/src/main.rs b/validator/src/main.rs index 4ce74cc169..55acc93523 100644 --- a/validator/src/main.rs +++ b/validator/src/main.rs @@ -14,7 +14,6 @@ use clap::{App, ArgMatches}; -pub mod built_info; mod commands; mod config; mod network; @@ -27,7 +26,7 @@ fn main() { println!("{}", banner()); let arg_matches = App::new("Nym Validator") - .version(built_info::PKG_VERSION) + .version(env!("CARGO_PKG_VERSION")) .author("Nymtech") .about("Implementation of Nym Validator") .subcommand(commands::init::command_args()) @@ -62,7 +61,7 @@ fn banner() -> String { (validator - version {:}) "#, - built_info::PKG_VERSION + env!("CARGO_PKG_VERSION") ) }