Skip to content

Commit 5251d4a

Browse files
author
Dylan Storey
committed
Add angreal task automation for dev workflows
Replace Makefile-based dev commands with angreal tasks while keeping Make for compilation. Provides cleaner CLI experience: - angreal build {extension|app|all} [--release] - angreal test {unit|rust|python|bindings|functional|constraints|all} - angreal perf {quick|standard|full} [--iterations N] - angreal dev {clean|coverage|setup} Shared utils.py module provides common helpers for project root detection, make invocation, and extension build verification.
1 parent 2a4d002 commit 5251d4a

File tree

5 files changed

+973
-0
lines changed

5 files changed

+973
-0
lines changed

.angreal/task_build.py

Lines changed: 178 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,178 @@
1+
"""Build commands for GraphQLite.
2+
3+
Orchestrates compilation by delegating to Make for the actual build work.
4+
Make handles dependency tracking and compilation; angreal provides the dev UX.
5+
"""
6+
7+
import angreal
8+
from utils import run_make
9+
10+
build = angreal.command_group(name="build", about="Build GraphQLite components")
11+
12+
13+
@build()
14+
@angreal.command(
15+
name="extension",
16+
about="Build the SQLite extension",
17+
tool=angreal.ToolDescription(
18+
"""
19+
Build the GraphQLite SQLite extension (.dylib on macOS, .so on Linux, .dll on Windows).
20+
21+
## When to use
22+
- Before running tests that use the extension
23+
- Before deploying or distributing the extension
24+
- After making changes to C source files
25+
26+
## Examples
27+
```
28+
angreal build extension # Debug build
29+
angreal build extension --release # Optimized build
30+
```
31+
32+
## Output
33+
Creates `build/graphqlite.dylib` (or platform equivalent)
34+
""",
35+
risk_level="safe"
36+
)
37+
)
38+
@angreal.argument(
39+
name="release",
40+
long="release",
41+
short="r",
42+
is_flag=True,
43+
takes_value=False,
44+
help="Build optimized release version (default: debug)"
45+
)
46+
@angreal.argument(
47+
name="verbose",
48+
long="verbose",
49+
short="v",
50+
is_flag=True,
51+
takes_value=False,
52+
help="Show build commands"
53+
)
54+
def build_extension(release: bool = False, verbose: bool = False) -> int:
55+
"""Build the SQLite extension."""
56+
mode = "release" if release else "debug"
57+
print(f"Building extension ({mode})...")
58+
59+
result = run_make("extension", release=release, verbose=verbose)
60+
61+
if result == 0:
62+
print("Extension built successfully!")
63+
else:
64+
print("Build failed!")
65+
66+
return result
67+
68+
69+
@build()
70+
@angreal.command(
71+
name="app",
72+
about="Build the main gqlite application",
73+
tool=angreal.ToolDescription(
74+
"""
75+
Build the main GraphQLite interactive application (gqlite).
76+
77+
## When to use
78+
- When you need the standalone CLI tool
79+
- For interactive Cypher query testing
80+
81+
## Examples
82+
```
83+
angreal build app # Debug build
84+
angreal build app --release # Optimized build
85+
```
86+
87+
## Output
88+
Creates `build/gqlite` executable
89+
""",
90+
risk_level="safe"
91+
)
92+
)
93+
@angreal.argument(
94+
name="release",
95+
long="release",
96+
short="r",
97+
is_flag=True,
98+
takes_value=False,
99+
help="Build optimized release version"
100+
)
101+
@angreal.argument(
102+
name="verbose",
103+
long="verbose",
104+
short="v",
105+
is_flag=True,
106+
takes_value=False,
107+
help="Show build commands"
108+
)
109+
def build_app(release: bool = False, verbose: bool = False) -> int:
110+
"""Build the main application."""
111+
mode = "release" if release else "debug"
112+
print(f"Building gqlite application ({mode})...")
113+
114+
result = run_make("graphqlite", release=release, verbose=verbose)
115+
116+
if result == 0:
117+
print("Application built successfully!")
118+
else:
119+
print("Build failed!")
120+
121+
return result
122+
123+
124+
@build()
125+
@angreal.command(
126+
name="all",
127+
about="Build all components",
128+
tool=angreal.ToolDescription(
129+
"""
130+
Build all GraphQLite components (extension and application).
131+
132+
## When to use
133+
- Full project build
134+
- CI/CD pipelines
135+
- After fresh clone or major changes
136+
137+
## Examples
138+
```
139+
angreal build all
140+
angreal build all --release
141+
```
142+
""",
143+
risk_level="safe"
144+
)
145+
)
146+
@angreal.argument(
147+
name="release",
148+
long="release",
149+
short="r",
150+
is_flag=True,
151+
takes_value=False,
152+
help="Build optimized release versions"
153+
)
154+
@angreal.argument(
155+
name="verbose",
156+
long="verbose",
157+
short="v",
158+
is_flag=True,
159+
takes_value=False,
160+
help="Show build commands"
161+
)
162+
def build_all(release: bool = False, verbose: bool = False) -> int:
163+
"""Build all components."""
164+
mode = "release" if release else "debug"
165+
print(f"Building all components ({mode})...")
166+
167+
result = run_make("extension", release=release, verbose=verbose)
168+
if result != 0:
169+
print("Extension build failed!")
170+
return result
171+
172+
result = run_make("graphqlite", release=release, verbose=verbose)
173+
if result != 0:
174+
print("Application build failed!")
175+
return result
176+
177+
print("All components built successfully!")
178+
return 0

0 commit comments

Comments
 (0)