Skip to content

Commit

Permalink
* Updated the Rust version.
Browse files Browse the repository at this point in the history
  • Loading branch information
DobromirM committed Oct 1, 2024
1 parent 81842be commit aa6774d
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,4 @@ A brief description of the most important files and their function:

`utils.rs` - Contains helper methods for running the Swim server and for logging.

`Cargo.toml` - Contains the project name and the project dependencies.
`Cargo.toml` - Contains the project name, the Swim version and the project dependencies.
18 changes: 15 additions & 3 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ use serde::Serialize;
use std::fmt::Debug;
use std::path::Path;

const JAVA_VERSION: &str = "4.3.15";
const RUST_VERSION: &str = "0.1.1";

#[derive(Parser, Debug, Serialize)]
#[command(author, version, about, long_about = None)]
struct Args {
Expand All @@ -18,8 +21,8 @@ struct Args {
/// The port of the Swim application.
#[arg(short, long, default_value_t = 9001)]
port: u16,
/// The version of the Swim server dependencies. Only applicable to the Java based templates.
#[arg(short, long, default_value = "4.3.15")]
/// The version of the Swim server dependencies.
#[arg(short, long, default_value = JAVA_VERSION)]
swim_version: String,
/// The type of the project template.
#[arg(short, long, value_enum, default_value_t = Template::Gradle)]
Expand Down Expand Up @@ -59,7 +62,16 @@ impl Template {
struct TemplatesDir;

fn main() {
let args = Args::parse();
let mut args = Args::parse();

match args.template_type {
Template::Gradle | Template::GradleModule | Template::Maven | Template::MavenModule => {
args.swim_version = JAVA_VERSION.to_string();
}
Template::Rust => {
args.swim_version = RUST_VERSION.to_string();
}
}

if let Err(err) = create_dir(args.name.clone()) {
println!("{}", err);
Expand Down
2 changes: 1 addition & 1 deletion templates/swim-rust-template/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ version = "0.1.0"
edition = "2021"

[dependencies]
swimos = { version = "0.1.1", features = ["server", "agent"] }
swimos = { version = "{{swim_version}}", features = ["server", "agent"] }
tokio = { features = ["rt-multi-thread", "macros", "signal"], version = "1.22" }

0 comments on commit aa6774d

Please sign in to comment.