forked from berkeleybop/bbop-js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
185 lines (151 loc) · 4.86 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
####
#### Testing, benchmarking, and release procedures for BBOP-JS.
####
#### See README.org in this directory for more detail.
####
#### A report-mistakes-only testing ("fail"s?) run can be done as:
#### make test | grep -c -i fail; test $? -ne 0
####
TESTS = \
$(wildcard lib/bbop/*.js.tests) \
$(wildcard lib/bbop/html/*.js.tests) \
$(wildcard lib/bbop/model/*.js.tests) \
$(wildcard lib/bbop/golr/*.js.tests) \
$(wildcard lib/bbop/golr/manager/*.js.tests) \
$(wildcard lib/bbop/rest/*.js.tests) \
$(wildcard lib/bbop/rest/response/*.js.tests) \
$(wildcard lib/bbop/rest/manager/*.js.tests) \
$(wildcard lib/bbop/widget/display/*.js.tests) \
$(wildcard lib/bbop/widget/*.js.tests) \
##
## $(wildcard lib/bbop/contrib/go/*.js.tests)
## $(wildcard lib/bbop/parse/*.js.tests) \
#BENCHMARKS = $(wildcard _benchmark/*.js)
## Test JS environment.
TEST_JS = rhino
## Some tests require things like "-opt -1" in some cases (big GO tests).
## rhino needs this for the big GO tree in model.tests.go.js.
## Java BUG, so interpretation is forced.
## See: http://coachwei.sys-con.com/node/676073/mobile
#TEST_JS_FLAGS = -modules staging/bbop.js -opt -1 -w -strict
TEST_JS_FLAGS = -modules staging/bbop.js -opt -1
## Other JS environments.
NODE_JS ?= /usr/bin/node
#NODE_JS ?= /home/sjcarbon/local/src/tarballs/node-v0.8.18-linux-x64/bin/node
RHINO_JS ?= /usr/bin/rhino
RINGO_JS ?= /usr/bin/ringo
## Handle versioning. The patch level is automatically incremented on
## after every release.
BBOP_JS_BASE_VERSION = 2.4
BBOP_JS_PATCH_LEVEL = `cat version-patch.lvl`
BBOP_JS_VERSION_TAG = "" # e.g. -alpha
BBOP_JS_VERSION ?= $(BBOP_JS_BASE_VERSION).$(BBOP_JS_PATCH_LEVEL)$(BBOP_JS_VERSION_TAG)
all:
@echo "Using JS engine: $(TEST_JS)"
# @echo "All JS engines: $(JSENGINES)"
@echo "Tests defined: $(TESTS)"
@echo "See README.org in the directory for more details."
# @echo "Benchmarks defined: $(BENCHMARKS)"
###
### Tests.
###
.PHONY: test $(TESTS)
test: $(TESTS)
$(TESTS): bundle
echo "trying: $@"
$(TEST_JS) $(TEST_JS_FLAGS) -f $(@D)/$(@F)
# cd $(@D) && $(TEST_JS) $(TEST_JS_FLAGS) -f $(@F)
###
### Just the exit code results of the tests.
###
.PHONY: pass
pass:
make test | grep -i fail; test $$? -ne 0
###
### Documentation.
###
.PHONY: docs
docs:
naturaldocs --rebuild-output --input lib/bbop/ --project docs/.naturaldocs_project/ --output html docs/
# naturaldocs --rebuild-output --input lib/bbop/ --input bin/ --project docs/.naturaldocs_project/ --output html docs/
###
### Create exportable JS bundle.
###
.PHONY: bundle
bundle:
./scripts/release-js.pl -v -i scripts/release-file-map.txt -o staging/bbop.js -n bbop -d lib/bbop -r $(BBOP_JS_VERSION)
###
### Create exportable JS bundle, but skip minifying.
###
.PHONY: bundle-uncompressed
bundle-uncompressed:
./scripts/release-js.pl -v -u -i scripts/release-file-map.txt -o staging/bbop.js -n bbop -d lib/bbop -r $(BBOP_JS_VERSION)
###
### Build version control.
###
.PHONY: version
version:
@echo Current version: $(BBOP_JS_VERSION)
.PHONY: patch-reset
patch-reset:
echo 0 > version-patch.lvl
.PHONY: patch-incr
patch-incr:
echo $$(( $(BBOP_JS_PATCH_LEVEL) + 1 )) > version-patch.lvl
###
### Create exportable JS NPM directory.
###
## Steps forward the patch level after every release--this is required
## to really use npm.
.PHONY: npm
npm: bundle
./scripts/release-npm.pl -v -i staging/bbop.js -o npm/bbop -r $(BBOP_JS_VERSION)
npm publish npm/bbop
make patch-incr
## Was before npm publish, no longer used: https://www.npmjs.org/doc/cli/npm-unpublish.html
# npm unpublish bbop@$(BBOP_JS_VERSION)
###
### Release: docs and bundle.
###
.PHONY: release
release: bundle npm docs
# s3cmd -P put staging/bbop*.js s3://bbop/jsapi/
# s3cmd -P put demo/index.html s3://bbop/jsapi/bbop-js/demo/
# s3cmd -P put demo/golr.js s3://bbop/jsapi/bbop-js/demo/
# s3cmd --recursive -P put docs/ s3://bbop/jsapi/bbop-js/docs/
# ###
# ### Refresh some temporary developer stuff consistently.
# ### The main purpose right now is to provide some temporary testing
# ### for CommonJS support of BBOP.
# ###
# .PHONY: commonjs-test
# commonjs-test: bundle
# cp ./staging/bbop.js ./bin/bbop-commonjs.js
# echo "\n" >> ./bin/bbop-commonjs.js
# echo "exports.bbop = bbop;" >> ./bin/bbop-commonjs.js
# echo "\n" >> ./bin/bbop-commonjs.js
# ###
# ### Benchmarks.
# ###
# .PHONY: benchmark $(BENCHMARKS)
# benchmark: $(BENCHMARKS)
# $(BENCHMARKS):
# for e in $(JSENGINES); do \
# echo "Trying engine: $$e"; \
# $$e -f $@; \
# done
###
### Start various environments the right way for experimentation.
### Should all be able to use CommonJS require in the expected way:
### var bbop = require('bbop').bbop;
### bbop.version.revision;
###
.PHONY: start-node
start-node:
NODE_PATH="staging" $(NODE_JS) -i
.PHONY: start-rhino
start-rhino:
$(RHINO_JS) -modules staging/bbop.js -f -
.PHONY: start-ringo
start-ringo:
RINGO_MODULE_PATH="staging" $(RINGO_JS) -i