This repository has been archived by the owner on Sep 10, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
/
dodo.py
54 lines (47 loc) · 1.73 KB
/
dodo.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
from doit import create_after
from pathlib import Path
ref = Path('ref')
def task_cargo_build():
return {
'actions': ['cargo build'],
'targets': ['target/debug/electrolysis'],
}
def task_electrolysis_thys():
for crate in ['core', 'alloc', 'collections', 'fixedbitset']:
p = Path('thys') / crate
yield {
'name': str(crate),
'actions': [['cargo', 'run', crate]],
'file_dep': [p / 'config.toml', 'target/debug/electrolysis'],
'targets': [p / 'generated.lean'],
}
def task_linja_thys():
# relies on ninja dependency management
return {
'task_dep': ['electrolysis_thys'],
'actions': ['(cd thys; linja)'],
}
def task_electrolysis_ref():
for p in list(ref.rglob('lib.rs')):
yield {
'name': str(p),
'actions': [['cargo', 'run', p],
'rustc --crate-type lib -Z unstable-options --unpretty mir "{}" > "{}"'.format(p, p.with_name('mir'))] +
([['mv', p.with_name('generated.lean'), p.with_name('broken.lean')]]
if '!' in str(p) else []),
'file_dep': [p, 'target/debug/electrolysis'],
'task_dep': ['electrolysis_thys'],
#'targets': [p.with_name('generated.lean')],
}
@create_after(executed='electrolysis_ref', target_regex=r'ref/index\.html')
def task_ref():
return {
'actions': ['(cd ref; ./make_ref.py)'],
'file_dep': ['ref/make_ref.py'] + [p for p in list(ref.rglob('*')) if p.suffix in ['.rs', '.lean', '.md']],
'targets': ['ref/index.html'],
}
def task_linja_ref():
return {
'task_dep': ['linja_thys', 'electrolysis_ref'],
'actions': ['(cd ref; linja)'],
}