Skip to content

Commit a48c976

Browse files
committed
Ditch old docs and clean up repo
1 parent e5b84a8 commit a48c976

File tree

20 files changed

+56
-1097
lines changed

20 files changed

+56
-1097
lines changed

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2024 aappleby
3+
Copyright (c) 2024 Austin Appleby (aappleby@gmail.com)
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 47 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# ![Logo](https://github.com/aappleby/hancho/blob/main/docs/hancho_small.png?raw=true) Hancho
1+
# ![Logo](assets/hancho_small.png) Hancho
22

33
"班長, hanchō - "Squad leader”, from 19th c. Mandarin 班長 (bānzhǎng, “team leader”)"
44

@@ -10,19 +10,16 @@ Hancho is inspired by Ninja (for speed and simplicity) and Bazel (for syntax and
1010

1111
Like Ninja, it knows nothing about your build tools and is only trying to assemble and run commands as fast as possible.
1212

13-
Unlike Ninja, you can use glob("*.cpp") and such to make things far less verbose.
13+
Unlike Ninja, Hancho's build scripts are vastly less verbose.
1414

15-
Like Bazel, you invoke build rules by calling them as if they were functions with keyword arguments.
15+
Like Bazel, the build synax is simple and Pythonesque.
1616

17-
Unlike Bazel, you can create build rules that call arbitary Python code (for better or worse).
17+
Unlike Bazel, your build can call arbitrary Python code (for better or worse).
1818

1919
Hancho should suffice for small to medium sized projects.
2020

21-
[Tutorial Here](tutorial)
22-
23-
[Some Additional Documentation Here](docs)
24-
2521
## Updates
22+
- 2024-11-02 - We're now on version v040 and the API has (hopefully) stabilized. Working on docs and tutorials now.
2623
- 2024-10-06 - The main branch has been updated to v020, which is what I've been using for personal projects all year. It changes a _lot_ of stuff compared to v010 and previous, and the documentation and tutorials are currently outdated.
2724

2825
## Installation
@@ -31,24 +28,28 @@ Hancho should suffice for small to medium sized projects.
3128
user@host:~$ wget https://raw.githubusercontent.com/aappleby/hancho/main/hancho.py
3229
user@host:~$ chmod +x hancho.py
3330
user@host:~$ ./hancho.py --help
34-
usage: hancho.py [-h] [-f ROOT_NAME] [-C ROOT_PATH] [-j JOBS] [-v] [-q] [-n] [-d] [--force] [-s] [-t] [target]
31+
usage: hancho.py [-h] [-f ROOT_FILE] [-C ROOT_DIR] [-v] [-d] [--force] [--trace] [-j JOBS] [-q] [-n] [-s]
32+
[--use_color]
33+
[target]
3534

3635
positional arguments:
3736
target A regex that selects the targets to build. Defaults to all targets.
3837

3938
options:
4039
-h, --help show this help message and exit
41-
-f FILE, --file FILE The name of the .hancho file(s) to build
42-
-C ROOT_PATH, --chdir ROOT_PATH
40+
-f ROOT_FILE, --root_file ROOT_FILE
41+
The name of the .hancho file(s) to build
42+
-C ROOT_DIR, --root_dir ROOT_DIR
4343
Change directory before starting the build
44-
-j JOBS, --jobs JOBS Run N jobs in parallel (default = cpu_count)
4544
-v, --verbose Print verbose build info
46-
-q, --quiet Mute all output
47-
-n, --dry_run Do not run commands
4845
-d, --debug Print debugging information
4946
--force Force rebuild of everything
47+
--trace Trace all text expansion
48+
-j JOBS, --jobs JOBS Run N jobs in parallel (default = cpu_count)
49+
-q, --quiet Mute all output
50+
-n, --dry_run Do not run commands
5051
-s, --shuffle Shuffle task order to shake out dependency issues
51-
-t, --trace Trace all text expansion
52+
--use_color Use color in the console output
5253
```
5354

5455
## Simple Example
@@ -57,62 +58,51 @@ options:
5758
# examples/hello_world/build.hancho
5859

5960
compile_cpp = hancho.Config(
60-
desc = "Compiling C++ {in_src} -> {out_obj}",
61-
command = "g++ -c {in_src} -o {out_obj}",
62-
in_src = None,
63-
out_obj = "{swap_ext(in_src, '.o')}",
64-
in_depfile = "{swap_ext(in_src, '.d')}",
61+
desc = "Compiling C++ {in_src} -> {out_obj}",
62+
command = "g++ -c {in_src} -o {out_obj}",
63+
out_obj = "{swap_ext(in_src, '.o')}",
64+
in_depfile = "{swap_ext(in_src, '.d')}",
6565
)
6666

67+
main_o = hancho(compile_cpp, in_src = "main.cpp")
68+
util_o = hancho(compile_cpp, in_src = "util.cpp")
69+
6770
link_cpp_bin = hancho.Config(
68-
desc = "Linking C++ bin {out_bin}",
69-
command = "g++ {in_objs} -o {out_bin}",
70-
in_objs = None,
71-
out_bin = None,
71+
desc = "Linking C++ bin {out_bin}",
72+
command = "g++ {in_objs} -o {out_bin}",
7273
)
7374

74-
main_o = compile_cpp(in_src = "main.cpp")
75-
util_o = compile_cpp(in_src = "util.cpp")
76-
77-
main_app = link_cpp_bin(
78-
in_objs = [main_o, util_o],
79-
out_bin = "hello_world",
75+
main_app = hancho(
76+
link_cpp_bin,
77+
in_objs = [main_o, util_o],
78+
out_bin = "hello_world",
8079
)
8180
```
8281

83-
```cpp
84-
// examples/hello_world/main.cpp
85-
86-
#include <stdio.h>
87-
88-
int blah();
89-
90-
int main(int argc, char** argv) {
91-
printf("Hello World %d\n", blah());
92-
return 0;
93-
}
94-
```
95-
9682
```sh
9783
user@host:~/hancho/examples/hello_world$ ../../hancho.py --verbose
98-
Loading module /home/user/hancho/examples/hello_world/build.hancho
84+
Loading /home/user/hancho/examples/hello_world/build.hancho
9985
Loading .hancho files took 0.000 seconds
100-
[1/3] Compiling C++ /home/user/hancho/examples/hello_world/main.cpp -> /home/user/hancho/examples/hello_world/build/hello_world/main.o
101-
Reason: Rebuilding because /home/user/hancho/examples/hello_world/build/hello_world/main.o is missing
102-
.$ g++ -c /home/user/hancho/examples/hello_world/main.cpp -o /home/user/hancho/examples/hello_world/build/hello_world/main.o
103-
[2/3] Compiling C++ /home/user/hancho/examples/hello_world/util.cpp -> /home/user/hancho/examples/hello_world/build/hello_world/util.o
104-
Reason: Rebuilding because /home/user/hancho/examples/hello_world/build/hello_world/util.o is missing
105-
.$ g++ -c /home/user/hancho/examples/hello_world/util.cpp -o /home/user/hancho/examples/hello_world/build/hello_world/util.o
106-
[3/3] Linking C++ bin /home/user/hancho/examples/hello_world/build/hello_world/hello_world
107-
Reason: Rebuilding because /home/user/hancho/examples/hello_world/build/hello_world/hello_world is missing
108-
.$ g++ /home/user/hancho/examples/hello_world/build/hello_world/main.o /home/user/hancho/examples/hello_world/build/hello_world/util.o -o /home/user/hancho/examples/hello_world/build/hello_world/hello_world
109-
110-
Running 3 tasks took 0.042 seconds
111-
tasks total: 3
112-
tasks passed: 3
86+
Queueing 3 tasks took 0.000 seconds
87+
Reason: Rebuilding because /home/user/hancho/examples/hello_world/build/main.o is missing
88+
[1/3] Compiling C++ /home/user/hancho/examples/hello_world/main.cpp -> /home/user/hancho/examples/hello_world/build/main.o
89+
.$ g++ -c /home/user/hancho/examples/hello_world/main.cpp -o /home/user/hancho/examples/hello_world/build/main.o
90+
Reason: Rebuilding because /home/user/hancho/examples/hello_world/build/util.o is missing
91+
[2/3] Compiling C++ /home/user/hancho/examples/hello_world/util.cpp -> /home/user/hancho/examples/hello_world/build/util.o
92+
.$ g++ -c /home/user/hancho/examples/hello_world/util.cpp -o /home/user/hancho/examples/hello_world/build/util.o
93+
[2/3] Task passed - 'Compiling C++ /home/user/hancho/examples/hello_world/util.cpp -> /home/user/hancho/examples/hello_world/build/util.o'
94+
[1/3] Task passed - 'Compiling C++ /home/user/hancho/examples/hello_world/main.cpp -> /home/user/hancho/examples/hello_world/build/main.o'
95+
Reason: Rebuilding because /home/user/hancho/examples/hello_world/build/hello_world is missing
96+
[3/3] Linking C++ bin /home/user/hancho/examples/hello_world/build/hello_world
97+
.$ g++ /home/user/hancho/examples/hello_world/build/main.o /home/user/hancho/examples/hello_world/build/util.o -o /home/user/hancho/examples/hello_world/build/hello_world
98+
[3/3] Task passed - 'Linking C++ bin /home/user/hancho/examples/hello_world/build/hello_world'
99+
Running 3 tasks took 0.043 seconds
100+
tasks started: 3
101+
tasks finished: 3
113102
tasks failed: 0
114103
tasks skipped: 0
115104
tasks cancelled: 0
105+
tasks broken: 0
116106
mtime calls: 0
117107
hancho: BUILD PASSED
118108
```
File renamed without changes.
File renamed without changes.

examples/examples.hancho

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ hancho.load("hello_world/build.hancho")
44
hancho.load("hello_gtk/build.hancho")
55
hancho.load("subrepos/build.hancho")
66
hancho.load("dynamic_dependencies/build.hancho")
7+
hancho.load("bazel-cpp-tutorial/build.hancho")

examples/hello_world/build.hancho

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
compile_cpp = hancho.Config(
44
desc = "Compiling C++ {in_src} -> {out_obj}",
55
command = "g++ -c {in_src} -o {out_obj}",
6-
in_src = None,
76
out_obj = "{swap_ext(in_src, '.o')}",
87
in_depfile = "{swap_ext(in_src, '.d')}",
98
)
@@ -14,8 +13,6 @@ util_o = hancho(compile_cpp, in_src = "util.cpp")
1413
link_cpp_bin = hancho.Config(
1514
desc = "Linking C++ bin {out_bin}",
1615
command = "g++ {in_objs} -o {out_bin}",
17-
in_objs = None,
18-
out_bin = None,
1916
)
2017

2118
main_app = hancho(

examples/windows/build.hancho

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,19 @@
11
# hancho/examples/windows/build.hancho - Builds a trivial Win32 app.
22

3-
hancho.depformat = "msvc"
3+
hancho.config.depformat = "msvc"
44

5-
compile = hancho.Config(
6-
command = "cl.exe /nologo /c {in_src} /sourceDependencies {in_depfile} /Fo:{out_obj} > NUL",
5+
compile_cpp = hancho.Config(
76
desc = "Compile {in_src} -> {out_obj}",
8-
in_src = None,
7+
command = "cl.exe /nologo /c {in_src} /sourceDependencies {in_depfile} /Fo:{out_obj}",
98
out_obj = "{swap_ext(in_src, '.o')}",
109
in_depfile = "{swap_ext(in_src, '.d')}",
1110
)
1211

13-
link = hancho.Config(
14-
command = "link.exe /nologo {libs} {in_objs} /out:{out_bin} > NUL",
12+
link_cpp = hancho.Config(
1513
desc = "Link {in_objs} -> {out_bin}",
16-
in_objs = None,
17-
out_bin = None,
14+
command = "link.exe /nologo {libs} {in_objs} /out:{out_bin} > NUL",
1815
libs = "user32.lib"
1916
)
2017

21-
main_o = hancho(compile, "src/main.cpp")
22-
hancho(link, main_o, "app.exe")
18+
main_o = hancho(compile_cpp, in_src = "src/main.cpp")
19+
hancho(link_cpp, in_objs = main_o, out_bin = "app.exe")

old_docs/README.md

Lines changed: 0 additions & 96 deletions
This file was deleted.

0 commit comments

Comments
 (0)