List of commits:
Subject Hash Author Date (UTC)
Resolve dep-tree by building project recursively. f53e38d790ec67d99ec8204af97273a53b73a9dc Jan Allersma 2018-12-19 14:54:07
Improve `dep-tree` command. 90bfa0340b7b874d65c08dc05c3d711abda1c469 Jan Allersma 2018-12-17 20:10:14
Implement experimental `dep-tree` command. 45d9dfdbfc99c59174e7c587621276b78ab7a4e9 Jan Allersma 2018-12-14 16:11:53
Implement `add` command. bbb2544bd06f29866465d651c32ca4d6e017f5e9 Jan Allersma 2018-12-11 15:43:10
Implement `exe` command. 1eaa36242201cf7ade5f23a14340e630c267db07 Jan Allersma 2018-12-11 13:23:32
Implement `run` and `build` commands. 14e9e25b6a06f587c1a50829e72c829ae59a87c2 Jan Allersma 2018-12-10 20:57:08
Implement non-recursive dependency check. 5ffd40604755d1c2dde9353c74f06a006deea33c Jan Allersma 2018-12-07 20:50:42
Restructure project. c2d98caf7897e87284fb2891e1d4b92d14cf37e1 Jan Allersma 2018-12-06 16:20:46
Initial commit. 4c152d55edc20ac55fd749a2b32b204134a664e3 Jan Allersma 2018-12-05 17:03:08
Commit f53e38d790ec67d99ec8204af97273a53b73a9dc - Resolve dep-tree by building project recursively.
Author: Jan Allersma
Author date (UTC): 2018-12-19 14:54
Committer name: Jan Allersma
Committer date (UTC): 2018-12-19 14:54
Parent(s): 90bfa0340b7b874d65c08dc05c3d711abda1c469
Signing key:
Tree: e697505ddf5405421d6ac04dbdca4cffe2890675
File Lines added Lines deleted
src/backend/build.rs 31 3
src/backend/dep.rs 0 2
src/backend/deptree.rs 4 6
src/backend/project.rs 16 6
src/main.rs 1 1
File src/backend/build.rs changed (mode: 100644) (index 5c8a4db..c2d4f6c)
... ... pub fn build(config_file: PathBuf) -> Result<String, String> {
25 25 Ok(String::from("Build succeeded!")) Ok(String::from("Build succeeded!"))
26 26 } }
27 27
28 pub fn build_rec(config_file: PathBuf) -> Result<String, String> {
29 let dep_tree = super::deptree::print(&super::system::OS::current(), config_file);
30
31 // Inconventient, should be changed later
32 match &dep_tree {
33 Ok(result) => println!("{}", result),
34 Err(e) => return Err(e.to_string())
35 }
36
37 let dep_tree = dep_tree.unwrap();
38
39 for node in &dep_tree.depends_on {
40 println!("Building module '{}'..", &node.dep_name);
41 match build_rec(node.path.clone()) {
42 Ok(_) => {},
43 Err(e) => return Err(e)
44 }
45 }
46
47 println!("Building current project '{}'..", &dep_tree.dep_name);
48 match build(dep_tree.path) {
49 Ok(result) => println!("{}", result),
50 Err(e) => return Err(e)
51 }
52
53 Ok(String::from("Project built!"))
54 }
55
28 56 #[cfg(target_os="linux")] #[cfg(target_os="linux")]
29 57 fn build_module(config: serde_json::Value) -> Result<String, String> { fn build_module(config: serde_json::Value) -> Result<String, String> {
30 println!("Building project..");
58 println!("Building module..");
31 59
32 60 let build_cmd = &config["build"]["linux"]; let build_cmd = &config["build"]["linux"];
33 61
 
... ... fn build_module(config: serde_json::Value) -> Result<String, String> {
40 68
41 69 #[cfg(target_os="macos")] #[cfg(target_os="macos")]
42 70 fn build_module(config: serde_json::Value) -> Result<String, String> { fn build_module(config: serde_json::Value) -> Result<String, String> {
43 println!("Building project..");
71 println!("Building module..");
44 72
45 73 let build_cmd = &config["build"]["os-x"]; let build_cmd = &config["build"]["os-x"];
46 74
 
... ... fn build_module(config: serde_json::Value) -> Result<String, String> {
53 81
54 82 #[cfg(target_os="windows")] #[cfg(target_os="windows")]
55 83 fn build_module(config: serde_json::Value) -> Result<String, String> { fn build_module(config: serde_json::Value) -> Result<String, String> {
56 println!("Building project..");
84 println!("Building module..");
57 85
58 86 let build_cmd = &config["build"]["windows"]; let build_cmd = &config["build"]["windows"];
59 87
File src/backend/dep.rs changed (mode: 100644) (index e3662f2..7643de3)
... ... use super::system::OS;
6 6 pub fn json(config: String) -> Result<serde_json::Value, String> { pub fn json(config: String) -> Result<serde_json::Value, String> {
7 7 let config_json: serde_json::Value; let config_json: serde_json::Value;
8 8
9 println!("Reading module configuration..");
10
11 9 match serde_json::from_str(&config) { match serde_json::from_str(&config) {
12 10 Ok(json) => config_json = json, Ok(json) => config_json = json,
13 11 Err(e) => { Err(e) => {
File src/backend/deptree.rs changed (mode: 100644) (index d3c6076..d38bc6a)
... ... use std::path::PathBuf;
6 6 use std::fmt; use std::fmt;
7 7
8 8 pub struct Node { pub struct Node {
9 dep_name: String,
10 path: PathBuf,
11 depends_on: Vec<Node>
9 pub dep_name: String,
10 pub path: PathBuf,
11 pub depends_on: Vec<Node>
12 12 } }
13 13
14 14 impl fmt::Display for Node { impl fmt::Display for Node {
 
... ... impl fmt::Display for Node {
31 31 } }
32 32 } }
33 33
34 dependency = self.clone();
35
36 34 try!(write!(f, "{}", string)); try!(write!(f, "{}", string));
37 35 Ok(()) Ok(())
38 36 } }
 
... ... pub fn print(os: &OS, path: PathBuf) -> Result<Node, String> {
71 69
72 70 let root = Node { let root = Node {
73 71 dep_name: String::from(path.file_name().unwrap().to_str().unwrap()), dep_name: String::from(path.file_name().unwrap().to_str().unwrap()),
74 path: super::filesystem::get_module_root().unwrap(),
72 path: path,
75 73 depends_on: nodes depends_on: nodes
76 74 }; };
77 75
File src/backend/project.rs changed (mode: 100644) (index 9e611da..5333f3f)
... ... pub fn init(args: &mut env::Args) {
16 16 } }
17 17 } }
18 18
19 pub fn build() -> Result<String, String> {
20 match super::filesystem::get_project_root() {
21 Some(dir) => super::build::build(dir),
22 None => Err(String::from("not in a project (sub)directory."))
19 pub fn build(args: &mut env::Args) -> Result<String, String> {
20 match args.next() {
21 Some(ref module) if module.as_str() == "--module" => {
22 match super::filesystem::get_module_root() {
23 Some(dir) => super::build::build(dir),
24 None => Err(String::from("not in a project (sub)directory."))
25 }
26 },
27 Some(_) | None => {
28 match super::filesystem::get_project_root() {
29 Some(dir) => super::build::build_rec(dir),
30 None => Err(String::from("not in a project (sub)directory."))
31 }
32 }
23 33 } }
24 34 } }
25 35
 
... ... pub fn exe(args: &mut env::Args) -> Result<String, String> {
76 86 pub fn run(args: &mut env::Args) -> Result<String, String> { pub fn run(args: &mut env::Args) -> Result<String, String> {
77 87 println!("Building project.."); println!("Building project..");
78 88
79 match build() {
89 match build(args) {
80 90 Ok(output) => println!("{}", output), Ok(output) => println!("{}", output),
81 91 Err(e) => return Err(e) Err(e) => return Err(e)
82 92 } }
 
... ... pub fn help() {
109 119 println!(""); println!("");
110 120
111 121 println!("init [DIRECTORY]\t\t Initialize new project in specified directory. Defaults to current directory."); println!("init [DIRECTORY]\t\t Initialize new project in specified directory. Defaults to current directory.");
112 println!("build\t\t\t\t Build current project.");
122 println!("build [--module]\t\t Build current project if module flag is not specified, otherwise only the module will be built.");
113 123 println!("run [ARGUMENTS]\t\t\t Build and run current project with ARGUMENTS to run project with."); println!("run [ARGUMENTS]\t\t\t Build and run current project with ARGUMENTS to run project with.");
114 124 println!("exe [ARGUMENTS]\t\t\t Run current project with ARGUMENTS. The project won't be built."); println!("exe [ARGUMENTS]\t\t\t Run current project with ARGUMENTS. The project won't be built.");
115 125 println!("add NAME COMMAND [ARGUMENTS]\t Add dependency with NAME to module and is built through COMMAND with ARGUMENTS."); println!("add NAME COMMAND [ARGUMENTS]\t Add dependency with NAME to module and is built through COMMAND with ARGUMENTS.");
File src/main.rs changed (mode: 100644) (index 6dcd39b..b4b1b95)
... ... fn parse() {
27 27 backend::project::init(&mut argv); backend::project::init(&mut argv);
28 28 } }
29 29 else if &argument == "build" { else if &argument == "build" {
30 match backend::project::build() {
30 match backend::project::build(&mut argv) {
31 31 Ok(result) => println!("{}", result), Ok(result) => println!("{}", result),
32 32 Err(e) => println!("Build failed: {}", e) Err(e) => println!("Build failed: {}", e)
33 33 } }
Hints:
Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://rocketgit.com/user/kapstok/NHL-Beheer

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@ssh.rocketgit.com/user/kapstok/NHL-Beheer

Clone this repository using git:
git clone git://git.rocketgit.com/user/kapstok/NHL-Beheer

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a merge request:
... clone the repository ...
... make some changes and some commits ...
git push origin main