From 543526cb8593e7cdc15df7f4017ef65d77f5b035 Mon Sep 17 00:00:00 2001 From: Jeremy Soller Date: Tue, 6 Mar 2018 19:55:11 -0700 Subject: [PATCH] Move crt0 and platform into src folder Add cargo fmt script --- Cargo.toml | 4 ++-- fmt.sh | 8 ++++++++ {crt0 => src/crt0}/Cargo.toml | 0 {crt0 => src/crt0}/src/lib.rs | 0 src/ctype/Cargo.toml | 2 +- src/fcntl/Cargo.toml | 2 +- src/grp/Cargo.toml | 2 +- src/mman/Cargo.toml | 2 +- {platform => src/platform}/Cargo.toml | 0 {platform => src/platform}/src/lib.rs | 0 {platform => src/platform}/src/linux/mod.rs | 0 {platform => src/platform}/src/rawfile.rs | 0 {platform => src/platform}/src/redox/mod.rs | 0 {platform => src/platform}/src/types.rs | 0 src/semaphore/Cargo.toml | 2 +- src/stdio/Cargo.toml | 2 +- src/stdlib/Cargo.toml | 2 +- src/string/Cargo.toml | 2 +- src/template/Cargo.toml | 2 +- src/unistd/Cargo.toml | 2 +- test.sh | 2 +- 21 files changed, 21 insertions(+), 13 deletions(-) create mode 100755 fmt.sh rename {crt0 => src/crt0}/Cargo.toml (100%) rename {crt0 => src/crt0}/src/lib.rs (100%) rename {platform => src/platform}/Cargo.toml (100%) rename {platform => src/platform}/src/lib.rs (100%) rename {platform => src/platform}/src/linux/mod.rs (100%) rename {platform => src/platform}/src/rawfile.rs (100%) rename {platform => src/platform}/src/redox/mod.rs (100%) rename {platform => src/platform}/src/types.rs (100%) diff --git a/Cargo.toml b/Cargo.toml index 11148175fe..750853e3d4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,11 +8,11 @@ name = "c" crate-type = ["staticlib"] [workspace] -members = ["crt0"] +members = ["src/crt0"] [dependencies] compiler_builtins = { git = "https://github.com/rust-lang-nursery/compiler-builtins.git", default-features = false, features = ["mem"] } -platform = { path = "platform" } +platform = { path = "src/platform" } ctype = { path = "src/ctype" } fcntl = { path = "src/fcntl" } grp = { path = "src/grp" } diff --git a/fmt.sh b/fmt.sh new file mode 100755 index 0000000000..8e925fc026 --- /dev/null +++ b/fmt.sh @@ -0,0 +1,8 @@ +ARGS=() + +for crate in relibc $(find src -name Cargo.toml | cut -d '/' -f2 | grep -v template) +do + ARGS+=("--package" "$crate") +done + +cargo fmt "${ARGS[@]}" "$@" diff --git a/crt0/Cargo.toml b/src/crt0/Cargo.toml similarity index 100% rename from crt0/Cargo.toml rename to src/crt0/Cargo.toml diff --git a/crt0/src/lib.rs b/src/crt0/src/lib.rs similarity index 100% rename from crt0/src/lib.rs rename to src/crt0/src/lib.rs diff --git a/src/ctype/Cargo.toml b/src/ctype/Cargo.toml index d0ae7b3fb3..f8f98d9295 100644 --- a/src/ctype/Cargo.toml +++ b/src/ctype/Cargo.toml @@ -8,4 +8,4 @@ build = "build.rs" cbindgen = { path = "../../cbindgen" } [dependencies] -platform = { path = "../../platform" } +platform = { path = "../platform" } diff --git a/src/fcntl/Cargo.toml b/src/fcntl/Cargo.toml index 9eb0cb9a70..c2b0198c38 100644 --- a/src/fcntl/Cargo.toml +++ b/src/fcntl/Cargo.toml @@ -8,4 +8,4 @@ build = "build.rs" cbindgen = { path = "../../cbindgen" } [dependencies] -platform = { path = "../../platform" } +platform = { path = "../platform" } diff --git a/src/grp/Cargo.toml b/src/grp/Cargo.toml index d09fdca34c..d9eb91db9e 100644 --- a/src/grp/Cargo.toml +++ b/src/grp/Cargo.toml @@ -8,4 +8,4 @@ build = "build.rs" cbindgen = { path = "../../cbindgen" } [dependencies] -platform = { path = "../../platform" } +platform = { path = "../platform" } diff --git a/src/mman/Cargo.toml b/src/mman/Cargo.toml index e7e1f0d915..9d672ec75f 100644 --- a/src/mman/Cargo.toml +++ b/src/mman/Cargo.toml @@ -8,4 +8,4 @@ build = "build.rs" cbindgen = { path = "../../cbindgen" } [dependencies] -platform = { path = "../../platform" } +platform = { path = "../platform" } diff --git a/platform/Cargo.toml b/src/platform/Cargo.toml similarity index 100% rename from platform/Cargo.toml rename to src/platform/Cargo.toml diff --git a/platform/src/lib.rs b/src/platform/src/lib.rs similarity index 100% rename from platform/src/lib.rs rename to src/platform/src/lib.rs diff --git a/platform/src/linux/mod.rs b/src/platform/src/linux/mod.rs similarity index 100% rename from platform/src/linux/mod.rs rename to src/platform/src/linux/mod.rs diff --git a/platform/src/rawfile.rs b/src/platform/src/rawfile.rs similarity index 100% rename from platform/src/rawfile.rs rename to src/platform/src/rawfile.rs diff --git a/platform/src/redox/mod.rs b/src/platform/src/redox/mod.rs similarity index 100% rename from platform/src/redox/mod.rs rename to src/platform/src/redox/mod.rs diff --git a/platform/src/types.rs b/src/platform/src/types.rs similarity index 100% rename from platform/src/types.rs rename to src/platform/src/types.rs diff --git a/src/semaphore/Cargo.toml b/src/semaphore/Cargo.toml index 5bc1c21584..a4e0960d99 100644 --- a/src/semaphore/Cargo.toml +++ b/src/semaphore/Cargo.toml @@ -8,4 +8,4 @@ build = "build.rs" cbindgen = { path = "../../cbindgen" } [dependencies] -platform = { path = "../../platform" } +platform = { path = "../platform" } diff --git a/src/stdio/Cargo.toml b/src/stdio/Cargo.toml index c74b048852..e64c0df1a5 100644 --- a/src/stdio/Cargo.toml +++ b/src/stdio/Cargo.toml @@ -8,5 +8,5 @@ build = "build.rs" cbindgen = { path = "../../cbindgen" } [dependencies] -platform = { path = "../../platform" } +platform = { path = "../platform" } va_list = { path = "../../va_list", features = ["no_std"] } diff --git a/src/stdlib/Cargo.toml b/src/stdlib/Cargo.toml index ed0dce3f95..bc05d632db 100644 --- a/src/stdlib/Cargo.toml +++ b/src/stdlib/Cargo.toml @@ -8,5 +8,5 @@ build = "build.rs" cbindgen = { path = "../../cbindgen" } [dependencies] -platform = { path = "../../platform" } +platform = { path = "../platform" } ralloc = { path = "../../ralloc", default-features = false } diff --git a/src/string/Cargo.toml b/src/string/Cargo.toml index 9c58c499ca..a5678f9b05 100644 --- a/src/string/Cargo.toml +++ b/src/string/Cargo.toml @@ -8,4 +8,4 @@ build = "build.rs" cbindgen = { path = "../../cbindgen" } [dependencies] -platform = { path = "../../platform" } +platform = { path = "../platform" } diff --git a/src/template/Cargo.toml b/src/template/Cargo.toml index 4021963f1f..844bcb55eb 100644 --- a/src/template/Cargo.toml +++ b/src/template/Cargo.toml @@ -8,4 +8,4 @@ build = "build.rs" cbindgen = { path = "../../cbindgen" } [dependencies] -platform = { path = "../../platform" } +platform = { path = "../platform" } diff --git a/src/unistd/Cargo.toml b/src/unistd/Cargo.toml index e678f3a96b..3edd54a814 100644 --- a/src/unistd/Cargo.toml +++ b/src/unistd/Cargo.toml @@ -8,4 +8,4 @@ build = "build.rs" cbindgen = { path = "../../cbindgen" } [dependencies] -platform = { path = "../../platform" } +platform = { path = "../platform" } diff --git a/test.sh b/test.sh index 1ee02991ca..cb7f9eba96 100755 --- a/test.sh +++ b/test.sh @@ -1,7 +1,7 @@ set -ex cargo build -cargo build --manifest-path crt0/Cargo.toml +cargo build --manifest-path src/crt0/Cargo.toml cd openlibm make