-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
84 lines (61 loc) · 2.65 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
#/* This Source Code Form is subject to the terms of the Mozilla Public
# * License, v. 2.0. If a copy of the MPL was not distributed with this
# * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
# Makefile for Test Pilot 2
VERSION ?= $(shell python -c "import json;print json.load(open('package.json'))['version']")
TOP ?= $(shell pwd)
FOX=Aurora
# see http://stackoverflow.com/questions/649246/is-it-possible-to-create-a-multi-line-string-variable-in-a-makefile
define HELPDOC
test - run tests with `covered` files.
use `cfx test` if you want no-coverage.
options:
OPTS="-v -f test-" (options for cfx text)
FOX=Aurora, "", 17, etc. (osx bundle name)
testmobile - same as test, but for mobile (android), FOX disallowed
cover - create `fakey` dir with covered files.
docs - create coverage and api docs, place in `gh-pages`
version - print micropilot version (according to `package.json`)
fixtures - builds xpis for testing
help - this help.
(others)
test-code-only - cover without the shell tests
test-shell - bash related (non-js) tests.
Note: some targets are in the make file, some stuff is in `cfx`
endef
export HELPDOC
version:
@echo $(VERSION)
help:
@echo "$$HELPDOC"
fixtures-self-destruct:
cd $(TOP) &&\
cd test/fixtures/self-destruct &&\
cfx xpi --package-path ../../.. --
fixtures-persist:
cd $(TOP) &&\
cd test/fixtures/persist &&\
cfx xpi --package-path ../../.. --
.phony fixtures: fixtures-self-destruct fixtures-persist
cover: fixtures
cd $(TOP) &&\
rm -rf fakey &&\
mkdir -p fakey/lib && cp -r data doc test package.json fakey &&\
(find lib -name '*js' -print0 | while IFS="" read -r -d "" file ; \
do ./node_modules/coverjs-moz/bin/coverjs -o fakey/`dirname "$$file"` \
--escodegen-options '{"moz":{"starlessGenerator":true,"parenthesizedComprehensionBlock":true}}' "$$file"; \
done )
test-shell:
cd $(TOP)/test && bash test-persist-over-restarts.sh
test: test-shell test-code-only
test-code-only: cover
cd $(TOP) &&\
(cfx test $(OPTS) --pkgdir=fakey -b /Applications/Firefox$(FOX).app/Contents/MacOS/firefox ;\
node coverreport.js < [email protected] > gh-pages/coverreport.html )
docs:
# needs prep to set up right, alas.
cd $(TOP) &&\
./node_modules/dox/bin/dox < lib/micropilot.js | ./node_modules/dox-template/bin/dox-template -n Micropilot -r "$(VERSION)" > gh-pages/index.html
testmobile: test-shell cover
cd $(TOP) &&\
cfx test $(OPTS) --pkgdir=fakey -a fennec-on-device --mobile-app fennec --force-mobile -b /Users/glind/Downloads/android-sdk-macosx/platform-tools/adb