forked from h2oai/h2o-2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
463 lines (408 loc) · 13.1 KB
/
Makefile
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
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
BUILD=build
DIST=$(BUILD)/dist
DEPLOY=../lib/resources/steam
LIB=lib
MODULES=node_modules
BIN=$(MODULES)/.bin
BUILD_DIRS=\
$(BUILD)/scripts \
$(BUILD)/tests \
$(BUILD)/coverage \
$(BUILD)/doc \
$(BUILD)/spec \
$(DIST) \
$(DEPLOY)
# Common javascript files that go into both the browser and node targets.
COMMON_SCRIPTS=\
$(BUILD)/scripts/prelude.global.js \
$(BUILD)/scripts/typedef.global.js \
$(BUILD)/scripts/hypergraph.global.js \
$(BUILD)/scripts/geyser.global.js \
$(BUILD)/scripts/util.global.js
# Javascript files that go into the browser target.
BROWSER_SCRIPTS=\
$(BUILD)/scripts/knockout.js \
$(BUILD)/scripts/application.js \
$(BUILD)/scripts/application-context.js \
$(BUILD)/scripts/timers.js \
$(BUILD)/scripts/router.js \
$(BUILD)/scripts/routes.js \
$(BUILD)/scripts/error-monitor.js \
$(BUILD)/scripts/event-log.js \
$(BUILD)/scripts/cache.js \
$(BUILD)/scripts/localStorage.js \
$(BUILD)/scripts/xhr.js \
$(BUILD)/scripts/h2o-proxy.js \
$(BUILD)/scripts/help-server.js \
$(BUILD)/scripts/text-metrics.js \
$(BUILD)/scripts/help.js \
$(BUILD)/scripts/dialog-manager.js \
$(BUILD)/scripts/alert-dialog.js \
$(BUILD)/scripts/error-dialog.js \
$(BUILD)/scripts/confirm-dialog.js \
$(BUILD)/scripts/select-frame-dialog.js \
$(BUILD)/scripts/configure-strip-plot-dialog.js \
$(BUILD)/scripts/scoring-visualization-dialog.js \
$(BUILD)/scripts/scoring-filter-dialog.js \
$(BUILD)/scripts/topic-list-view.js \
$(BUILD)/scripts/frame-list-view.js \
$(BUILD)/scripts/model-list-view.js \
$(BUILD)/scripts/scoring-list-view.js \
$(BUILD)/scripts/notification-list-view.js \
$(BUILD)/scripts/frame-view.js \
$(BUILD)/scripts/model-view.js \
$(BUILD)/scripts/frame-inspection-view.js \
$(BUILD)/scripts/model-inspection-view.js \
$(BUILD)/scripts/model-selection-view.js \
$(BUILD)/scripts/scoring-view.js \
$(BUILD)/scripts/scoring-sheet-view.js \
$(BUILD)/scripts/notification-view.js \
$(BUILD)/scripts/scoring-selection-view.js \
$(BUILD)/scripts/main-view.js \
$(BUILD)/scripts/steam.js
# Javascript files that go into the node target.
# All test scripts go at the bottom of this list.
TEST_SCRIPTS=\
$(BUILD)/scripts/application-context.js \
$(BUILD)/scripts/xhr.js \
$(BUILD)/scripts/h2o-proxy.js \
$(BUILD)/scripts/help-server.js \
$(BUILD)/scripts/text-metrics.js \
$(BUILD)/scripts/help.js \
$(BUILD)/scripts/alert-dialog.js \
$(BUILD)/scripts/error-dialog.js \
$(BUILD)/scripts/confirm-dialog.js \
$(BUILD)/scripts/select-frame-dialog.js \
$(BUILD)/scripts/configure-strip-plot-dialog.js \
$(BUILD)/scripts/scoring-visualization-dialog.js \
$(BUILD)/scripts/scoring-filter-dialog.js \
$(BUILD)/scripts/topic-list-view.js \
$(BUILD)/scripts/frame-list-view.js \
$(BUILD)/scripts/model-list-view.js \
$(BUILD)/scripts/scoring-list-view.js \
$(BUILD)/scripts/notification-list-view.js \
$(BUILD)/scripts/frame-view.js \
$(BUILD)/scripts/model-view.js \
$(BUILD)/scripts/frame-inspection-view.js \
$(BUILD)/scripts/model-inspection-view.js \
$(BUILD)/scripts/model-selection-view.js \
$(BUILD)/scripts/scoring-view.js \
$(BUILD)/scripts/scoring-sheet-view.js \
$(BUILD)/scripts/notification-view.js \
$(BUILD)/scripts/scoring-selection-view.js \
$(BUILD)/scripts/main-view.js \
$(BUILD)/tests/test.global.js \
$(BUILD)/tests/prelude.tests.js \
$(BUILD)/tests/typedef.tests.js \
$(BUILD)/tests/hypergraph.tests.js \
$(BUILD)/tests/geyser.tests.js \
$(BUILD)/tests/base.tests.js \
$(BUILD)/tests/h2o-proxy.tests.js \
$(BUILD)/tests/frame-list-view.tests.js \
$(BUILD)/tests/frame-view.tests.js
# Lib javascript files that go into the browser target.
BROWSER_LIB_SCRIPTS=\
$(LIB)/stacktrace/stacktrace.js \
$(LIB)/jquery/dist/jquery.js \
$(LIB)/lodash/dist/lodash.js \
$(LIB)/momentjs/min/moment.min.js \
$(LIB)/js-signals/dist/signals.js \
$(LIB)/crossroads/dist/crossroads.js \
$(LIB)/hasher/dist/js/hasher.js \
$(LIB)/bootstrap/dist/js/bootstrap.js \
$(LIB)/d3/d3.js \
$(LIB)/knockout/knockout.js
# Lib javascript files that go into the browser target.
TEST_LIB_SCRIPTS=\
$(LIB)/jquery/dist/jquery.js \
$(LIB)/lodash/dist/lodash.js \
$(LIB)/knockout/knockout.js
TEMPLATES=\
src/templates/main-view.jade \
src/templates/help.jade \
src/templates/geyser.jade \
src/templates/alert-dialog.jade \
src/templates/error-dialog.jade \
src/templates/confirm-dialog.jade \
src/templates/select-frame-dialog.jade \
src/templates/configure-strip-plot-dialog.jade \
src/templates/scoring-visualization-dialog.jade \
src/templates/scoring-filter-dialog.jade \
src/templates/topic-list-view.jade \
src/templates/frame-list-view.jade \
src/templates/model-list-view.jade \
src/templates/scoring-list-view.jade \
src/templates/notification-list-view.jade \
src/templates/empty-view.jade \
src/templates/frame-view.jade \
src/templates/model-view.jade \
src/templates/model-selection-view.jade \
src/templates/frame-inspection-view.jade \
src/templates/model-inspection-view.jade \
src/templates/scoring-view.jade \
src/templates/notification-view.jade \
src/templates/scoring-selection-view.jade
STYLES=\
src/styles/variables.styl \
src/styles/mixins.styl \
src/styles/fonts.styl \
src/styles/bootstrap.styl \
src/styles/global.styl \
src/styles/main-view.styl \
src/styles/topic-list-view.styl \
src/styles/frame-list-view.styl \
src/styles/model-list-view.styl \
src/styles/scoring-list-view.styl \
src/styles/notification-list-view.styl \
src/styles/empty-view.styl \
src/styles/frame-view.styl \
src/styles/model-view.styl \
src/styles/model-selection-view.styl \
src/styles/scoring-view.styl \
src/styles/notification-view.styl \
src/styles/scoring-selection-view.styl
LIB_STYLES=\
$(LIB)/fontawesome/css/font-awesome.css \
$(LIB)/bootstrap/dist/css/bootstrap.css
ifeq ($(shell which node),)
default:
@echo Dependency node not found. Skipping UI build... Try: brew install node for MacOS or look at h2o/client/README.md for other platforms. 1>&2
else
ifeq ($(shell which npm),)
default:
@echo Dependency npm not found. Skipping UI build... Try: brew install node for MacOS or look at h2o/client/README.md for other platforms. 1>&2
else
ifeq ($(shell which bower),)
default:
@echo Dependency bower not found. Skipping UI build... Try: npm install -g bower 1>&2
else
default: build
endif
endif
endif
setup: check
@echo Prerequisites OK. Installing dependencies...
npm install
bower --config.interactive=false install
@echo Done!
really_build: \
$(DEPLOY)/index.html \
$(DEPLOY)/fonts/glyphicons-halflings-regular.eot \
$(DEPLOY)/fonts/glyphicons-halflings-regular.svg \
$(DEPLOY)/fonts/glyphicons-halflings-regular.ttf \
$(DEPLOY)/fonts/glyphicons-halflings-regular.woff \
$(DEPLOY)/fonts/Roboto-Bold-webfont.eot \
$(DEPLOY)/fonts/Roboto-Bold-webfont.svg \
$(DEPLOY)/fonts/Roboto-Bold-webfont.ttf \
$(DEPLOY)/fonts/Roboto-Bold-webfont.woff \
$(DEPLOY)/fonts/Roboto-Light-webfont.eot \
$(DEPLOY)/fonts/Roboto-Light-webfont.svg \
$(DEPLOY)/fonts/Roboto-Light-webfont.ttf \
$(DEPLOY)/fonts/Roboto-Light-webfont.woff \
$(DEPLOY)/fonts/Roboto-Regular-webfont.eot \
$(DEPLOY)/fonts/Roboto-Regular-webfont.svg \
$(DEPLOY)/fonts/Roboto-Regular-webfont.ttf \
$(DEPLOY)/fonts/Roboto-Regular-webfont.woff \
$(DEPLOY)/fonts/fontawesome-webfont.eot \
$(DEPLOY)/fonts/fontawesome-webfont.svg \
$(DEPLOY)/fonts/fontawesome-webfont.ttf \
$(DEPLOY)/fonts/fontawesome-webfont.woff \
$(DEPLOY)/img/h2o.png \
$(DEPLOY)/img/h2o-spin-16.gif \
$(DEPLOY)/img/h2o-spin-32.gif \
$(DEPLOY)/img/h2o-spin-48.gif \
$(DEPLOY)/img/h2o-spin-64.gif \
$(DEPLOY)/css/bootstrap.css.map \
$(DEPLOY)/css/lib.css \
$(DEPLOY)/css/steam.css \
$(DEPLOY)/js/lib.js \
$(DEPLOY)/js/steam.js
build: setup
$(MAKE) really_build
unit: \
$(DEPLOY)/tests/tape.js \
$(DEPLOY)/tests/lib.test.js \
$(DEPLOY)/tests/steam.test.js \
$(DEPLOY)/tests/index.html
node: \
$(DIST)/steam.node.js
watch:
$(BIN)/watchy --watch src -- make build
lint:
# Sort of pointless running this.
# Pretty much all errors thrown point to coffeescript-generated code.
# TODO revisit better way to lint coffeescript.
(BIN)/jshint $(DEPLOY)/js/steam.js
preload:
Rscript src/util/h2o-R/preload.R
help:
@echo "Please use \`make <target>' where <target> is one of -"
@echo ""
@echo "Setup tasks:"
@echo " make check Check prerequisites"
@echo " make setup Set up dev dependencies"
@echo " make reset Clean up dev dependencies"
@echo " make preload Preload a few frames and models into H2O (requires R)"
@echo ""
@echo "Development tasks:"
@echo " make build Build and deploy to ../lib/resources/steam/index.html"
@echo " make unit Build browser test suite and deploy to ../lib/resources/steam/tests/index.html"
@echo " make test Run all tests"
@echo " make debug Run tests in debug mode"
@echo " make coverage Compile test coverage"
@echo " make doc Compile code documentation"
@echo " make clean Clean up build directories"
@echo " make watch Watch for changes and run `make build test`"
# This runs all tests by default.
# To run specific tests, run:
# make ARGS="-g foobar" test
# where foobar is a regexp
really_test: node
@node $(DIST)/steam.node.js
test: setup
$(MAKE) really_test
faucet: node
@node $(DIST)/steam.node.js | $(BIN)/faucet
debug: node
@node --debug-brk $(DIST)/steam.node.js
pytest: node
(cd ../py && python testdir_multi_jvm/test_model_management.py -ccj localhost.json ApiTestCase.test_steam)
coverage: node
@mkdir -p $(BUILD)/coverage
@$(BIN)/istanbul \
cover \
--dir $(BUILD)/coverage \
-x "**/lib/**" \
$(DIST)/steam.node.js
@echo Coverage generated at $(BUILD)/coverage
tags:
(cd src/scripts && ctags -R .)
doc:
@mkdir -p $(BUILD)/doc
$(BIN)/groc \
--out $(BUILD)/doc \
--index src/README.md \
--index-page-title "index" \
src/scripts/**/*.coffee
@echo Docs generated at $(BUILD)/doc
clean:
rm -rf $(BUILD_DIRS)
@echo Cleaned!
check:
@echo Checking prerequisites...
reset: clean
rm -rf \
$(MODULES) \
$(LIB)
@echo Done! To set up your dev environment again, run: make setup
$(BUILD)/scripts/%.global.js: src/scripts/%.global.coffee
@mkdir -p $(@D)
@$(BIN)/coffee --bare --output $(@D) --compile $<
@echo Built $@
$(BUILD)/tests/%.global.js: src/tests/%.global.coffee
@mkdir -p $(@D)
@$(BIN)/coffee --bare --output $(@D) --compile $<
@echo Built $@
$(BUILD)/scripts/%.js: src/scripts/%.coffee
@mkdir -p $(@D)
@$(BIN)/coffee --output $(@D) --compile $<
@echo Built $@
$(BUILD)/tests/%.js: src/tests/%.coffee
@mkdir -p $(@D)
@$(BIN)/coffee --output $(@D) --compile $<
@echo Built $@
$(DEPLOY)/index.html: src/templates/index.jade $(TEMPLATES)
@mkdir -p $(@D)
@$(BIN)/jade --pretty --out $(@D) $<
@echo Built $@
$(DEPLOY)/css/steam.css: src/styles/steam.styl $(STYLES)
@mkdir -p $(@D)
@$(BIN)/stylus --use nib --out $(@D) $<
@echo Built $@
$(DEPLOY)/js/steam.js: $(COMMON_SCRIPTS) $(BROWSER_SCRIPTS)
@mkdir -p $(@D)
@echo '"use strict";' > $@
@echo '(function(){' >> $@
@cat $^ >> $@
@echo '}).call(this);' >> $@
@echo Built $@
$(DIST)/steam.node.js: $(BUILD)/tests/node.global.js $(COMMON_SCRIPTS) $(TEST_SCRIPTS)
@mkdir -p $(@D)
@echo '"use strict";' > $@
@echo '(function(){' >> $@
@cat $^ >> $@
@echo '}).call(this);' >> $@
@echo Built $@
$(DEPLOY)/tests/steam.test.js: $(COMMON_SCRIPTS) $(TEST_SCRIPTS)
@mkdir -p $(@D)
@echo '"use strict";' > $@
@echo '(function(){' >> $@
@cat $^ >> $@
@echo '}).call(this);' >> $@
@echo Built $@
$(DEPLOY)/img/%.png: src/images/%.png
@mkdir -p $(@D)
cp $< $@
$(DEPLOY)/img/%.gif: src/images/%.gif
@mkdir -p $(@D)
cp $< $@
$(DEPLOY)/fonts/%.eot: src/fonts/%.eot
@mkdir -p $(@D)
cp $< $@
$(DEPLOY)/fonts/%.svg: src/fonts/%.svg
@mkdir -p $(@D)
cp $< $@
$(DEPLOY)/fonts/%.ttf: src/fonts/%.ttf
@mkdir -p $(@D)
cp $< $@
$(DEPLOY)/fonts/%.woff: src/fonts/%.woff
@mkdir -p $(@D)
cp $< $@
$(DEPLOY)/fonts/%.eot: $(LIB)/bootstrap/dist/fonts/%.eot
@mkdir -p $(@D)
cp $< $@
$(DEPLOY)/fonts/%.svg: $(LIB)/bootstrap/dist/fonts/%.svg
@mkdir -p $(@D)
cp $< $@
$(DEPLOY)/fonts/%.ttf: $(LIB)/bootstrap/dist/fonts/%.ttf
@mkdir -p $(@D)
cp $< $@
$(DEPLOY)/fonts/%.woff: $(LIB)/bootstrap/dist/fonts/%.woff
@mkdir -p $(@D)
cp $< $@
$(DEPLOY)/fonts/%.eot: $(LIB)/fontawesome/fonts/%.eot
@mkdir -p $(@D)
cp $< $@
$(DEPLOY)/fonts/%.svg: $(LIB)/fontawesome/fonts/%.svg
@mkdir -p $(@D)
cp $< $@
$(DEPLOY)/fonts/%.ttf: $(LIB)/fontawesome/fonts/%.ttf
@mkdir -p $(@D)
cp $< $@
$(DEPLOY)/fonts/%.woff: $(LIB)/fontawesome/fonts/%.woff
@mkdir -p $(@D)
cp $< $@
$(DEPLOY)/css/%.map: $(LIB)/bootstrap/dist/css/%.map
@mkdir -p $(@D)
cp $< $@
$(DEPLOY)/css/lib.css: $(LIB_STYLES)
@mkdir -p $(@D)
@cat $^ > $@
@echo Built $@
$(DEPLOY)/js/lib.js: $(BROWSER_LIB_SCRIPTS)
@mkdir -p $(@D)
@cat $^ > $@
@echo Built $@
$(DEPLOY)/tests/lib.test.js: $(TEST_LIB_SCRIPTS)
@mkdir -p $(@D)
@cat $^ > $@
@echo Built $@
$(DEPLOY)/tests/tape.js: node_modules/tape/index.js
@mkdir -p $(@D)
@$(BIN)/browserify $< -s test -o $@
@echo Built $@
$(DEPLOY)/tests/index.html: src/tests/index.html
@mkdir -p $(@D)
cp $< $@
@echo Built $@
.PHONY: default really_build build node unit smoke test really_test debug report spec coverage doc clean setup reset watch help preload pytest tags