-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathbuild
executable file
·196 lines (157 loc) · 8.39 KB
/
build
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
#!/bin/csh
# Please see https://10xgenomics.github.io/enclone/pages/auto/dev.html.
# Note the following special workflow if you are modifying things in enclone_vars:
#
# cargo b --bin export_code
# export_code
# cargo b
#
# This is needed to circumvent broken compilation of auto-generated files, that could result
# if you make a mistake.
# ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
# Build script for enclone. The only thing missing from this is to run
# target/debug/merge_html BUILD,
# however you should only need to do that rarely,
# and if you do need to, "./test" will catch the problem and should tell you what to do.
# WARNING: note harcoding of version15!
# ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
# make sure we're at the top level
if !(-f Cargo.lock) then
echo "You need to run this from the top level of enclone.\n"
exit 1
endif
# ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
# partially check prerequisites
foreach pkg (sweep fmt license depgraph)
cargo $pkg --help >& /dev/null
if ( $status != 0 ) then
echo "looks like the prereq cargo $pkg is missing; try cargo install cargo-$pkg"
exit 1
endif
end
foreach prog (samtools)
if (`where $prog` == "") then
echo "Please run brew install $prog or equivalent."
exit 1
endif
end
foreach prog (dot)
if (`where $prog` == "") then
echo "Please run brew install graphviz or equivalent."
exit 1
endif
end
# ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
# import and update enclone-data
#
# The procedure to update enclone-data is to first make changes to that repo, then change the
# enclone file stamps/data_version to the new version, and then run this script to do the actual
# update.
set begin = `date +%s`
if ( !(-d enclone-data) ) then
git clone --depth=1 https://github.com/10XGenomics/enclone-data.git
if ( $status != 0 ) then
exit 1
endif
endif
if !(-f stamps/data_version_in_use) then
echo none > stamps/data_version_in_use
endif
if ( `cat stamps/data_version` != `cat stamps/data_version_in_use` ) then
echo "starting data update, interrupt not recommended"
set begin_fetch = `date +%s`
git -C enclone-data fetch --depth=1 origin `cat stamps/data_version`
set end_fetch = `date +%s`
set elapsed_fetch = `expr $end_fetch - $begin_fetch`
echo "fetch took $elapsed_fetch seconds"
git -C enclone-data switch --detach FETCH_HEAD
cat stamps/data_version > stamps/data_version_in_use
echo "data update complete"
endif
# ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
# make outputs
echo "making outputs"
mkdir -p enclone_exec/testx/outputs
# ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
# cargo update once a week
#
# One reason we do this is that we don't want to accidentally get to a state where cargo update
# is impossible.
#
# Note that this includes fidgety down-versioning of crates.
#
# If running this causes problems, you can just "git checkout Cargo.lock" to undo the change.
# echo "updating"
# set last = `cat stamps/last_cargo_update`
# set now = `date +%s`
# set elapsed = `expr $now - $last`
# if ( $elapsed > 604800 ) then
# echo "\nrunning cargo update, as it has been more than one week since it was last done"
# echo "this could cause problems\n"
# echo "INTERRUPTING THE UPDATE IS PROBABLY NOT A GOOD IDEA"
# ./scripts/update_enclone
# if ( $status != 0 ) then
# exit 1
# endif
# echo $now > stamps/last_cargo_update
# echo "UPDATE COMPLETE"
# endif
# ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
# compile rust code
cargo b
if ( $status != 0 ) then
exit 1
endif
rehash
# ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
# build help pages
target/debug/build_help_pages
if ( $status != 0 ) then
exit 1
endif
# ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
# merge html pages
target/debug/merge_html
if ( $status != 0 ) then
exit 1
endif
# ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
# update dataset checksums
git -C enclone-data write-tree --prefix=big_inputs/version15/123085 > datasets_small_checksum
git -C enclone-data write-tree --prefix=big_inputs/version15 > datasets_medium_checksum
# ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
# make dependency graph
#
# Note that crates.png can vary (although perhaps not visibly), depending on the environment.
# This might be due to different versions of graphviz. Therefore we keep crates.dot under source
# code control, but not crates.png.
cargo depgraph --focus enclone* > crates.dot
cat crates.dot | dot -Tpng > crates.png
# ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
# sweep, to prevent target from becoming gigantic over time
#
# The cap is set at about 25 GB. The sweep is run at most once per week.
#
# There is a file stamps/last_sweep that is NOT under git control, and should not be, because
# each user needs to have their own file.
set start = `date +%s`
if !( -f stamps/last_sweep) then
echo 0 > stamps/last_sweep
endif
set last_sweep = `cat stamps/last_sweep`
set elapsed_sweep = `expr $start - $last_sweep`
if ( $elapsed_sweep > 604800 ) then
cargo sweep --maxsize 25000 > /dev/null
if ( $status != 0 ) then
echo "sweep failed, please try rerunning by hand"
echo "or perhaps you need to \"cargo install cargo-sweep\""
exit 1
endif
set stop = `date +%s`
set sweep_time = `expr $stop - $start`
echo "sweep took $sweep_time seconds"
echo $stop > stamps/last_sweep
endif
set end = `date +%s`
set used = `expr $end - $begin`
echo "build used $used seconds in total"