From 58a1bccd57b4341ddc68119c625b7e67b4d1d5e0 Mon Sep 17 00:00:00 2001 From: fdai7381 Date: Fri, 13 Jan 2023 20:30:35 +0100 Subject: [PATCH] Initial commit --- .gitignore | 7 +++++++ Cargo.lock | 7 +++++++ Cargo.toml | 8 ++++++++ README.md | 1 + build-project.sh | 21 +++++++++++++++++++++ prepare-build.sh | 14 ++++++++++++++ src/main.rs | 3 +++ 7 files changed, 61 insertions(+) create mode 100644 .gitignore create mode 100644 Cargo.lock create mode 100644 Cargo.toml create mode 100644 README.md create mode 100755 build-project.sh create mode 100755 prepare-build.sh create mode 100644 src/main.rs diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..37a413c --- /dev/null +++ b/.gitignore @@ -0,0 +1,7 @@ +.idea +.vscode + +/target + +.rustup +.cargo diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..45435f0 --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,7 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "pmuw-project" +version = "0.1.0" diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..8994795 --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,8 @@ +[package] +name = "pmuw-project" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] diff --git a/README.md b/README.md new file mode 100644 index 0000000..0b44a63 --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +# pmuw-project diff --git a/build-project.sh b/build-project.sh new file mode 100755 index 0000000..a4a8d48 --- /dev/null +++ b/build-project.sh @@ -0,0 +1,21 @@ +#!/usr/bin/env bash + +DIR="$(realpath "$(dirname -- "$0")")" + +# set env variables which are requested for rust +export RUSTUP_HOME="$DIR/.rustup" +export CARGO_HOME="$DIR/.cargo" + +source "$DIR/.cargo/env" + +echo "Running tests..." +cargo test +echo "Finished tests" + +echo +echo +echo + +echo "Building binary..." +cargo build --release +echo "Finished building binary. It is available at $DIR/target/release/pmuw-project" diff --git a/prepare-build.sh b/prepare-build.sh new file mode 100755 index 0000000..f56b77a --- /dev/null +++ b/prepare-build.sh @@ -0,0 +1,14 @@ +#!/usr/bin/env bash + +DIR="$(realpath "$(dirname -- "$0")")" + +# set env variables to overwrite the directory where rust is installed into +export RUSTUP_HOME="$DIR/.rustup" +export CARGO_HOME="$DIR/.cargo" + +# download rust +curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --no-modify-path + +# set the default rust version +source "$DIR/.cargo/env" +rustup default stable diff --git a/src/main.rs b/src/main.rs new file mode 100644 index 0000000..e7a11a9 --- /dev/null +++ b/src/main.rs @@ -0,0 +1,3 @@ +fn main() { + println!("Hello, world!"); +}