1 | GOOD_FEATURE_FILES = $(shell find ../testdata/good -name "*.feature")
|
2 | BAD_FEATURE_FILES = $(shell find ../testdata/bad -name "*.feature")
|
3 |
|
4 | TOKENS = $(patsubst ../testdata/%.feature,acceptance/testdata/%.feature.tokens,$(GOOD_FEATURE_FILES))
|
5 | ASTS = $(patsubst ../testdata/%.feature,acceptance/testdata/%.feature.ast.json,$(GOOD_FEATURE_FILES))
|
6 | PICKLES = $(patsubst ../testdata/%.feature,acceptance/testdata/%.feature.pickles.json,$(GOOD_FEATURE_FILES))
|
7 | ERRORS = $(patsubst ../testdata/%.feature,acceptance/testdata/%.feature.errors,$(BAD_FEATURE_FILES))
|
8 |
|
9 | JAVASCRIPT_FILES = $(shell find lib -name "*.js") index.js
|
10 |
|
11 | all: .compared
|
12 | .PHONY: all
|
13 |
|
14 | .compared: .built $(TOKENS) $(ASTS) $(PICKLES) $(ERRORS)
|
15 | touch $@
|
16 |
|
17 | .built: lib/gherkin/parser.js lib/gherkin/gherkin-languages.json $(JAVASCRIPT_FILES) dist/gherkin.js dist/gherkin.min.js node_modules/.fetched LICENSE
|
18 | ./node_modules/.bin/mocha
|
19 | touch $@
|
20 |
|
21 | node_modules/.fetched: package.json
|
22 | npm install
|
23 | touch $@
|
24 |
|
25 | acceptance/testdata/%.feature.tokens: ../testdata/%.feature ../testdata/%.feature.tokens .built
|
26 | mkdir -p `dirname $@`
|
27 | bin/gherkin-generate-tokens $< > $@
|
28 | diff --unified $<.tokens $@
|
29 | .DELETE_ON_ERROR: acceptance/testdata/%.feature.tokens
|
30 |
|
31 | acceptance/testdata/%.feature.ast.json: ../testdata/%.feature ../testdata/%.feature.ast.json .built
|
32 | mkdir -p `dirname $@`
|
33 | bin/gherkin-generate-ast $< | jq --sort-keys "." > $@
|
34 | diff --unified $<.ast.json $@
|
35 | .DELETE_ON_ERROR: acceptance/testdata/%.feature.ast.json
|
36 |
|
37 | # acceptance/testdata/%.feature.pickles.json: ../testdata/%.feature .built
|
38 | # mkdir -p `dirname $@`
|
39 | # bin/gherkin-generate-pickles $< | jq --sort-keys "." > $<.pickles.json
|
40 | # .DELETE_ON_ERROR: ../testdata/%.feature.pickles.json
|
41 |
|
42 | acceptance/testdata/%.feature.pickles.json: ../testdata/%.feature ../testdata/%.feature.pickles.json .built
|
43 | mkdir -p `dirname $@`
|
44 | bin/gherkin-generate-pickles $< | jq --sort-keys "." > $@
|
45 | diff --unified $<.pickles.json $@
|
46 | .DELETE_ON_ERROR: acceptance/testdata/%.feature.pickles.json
|
47 |
|
48 | acceptance/testdata/%.feature.errors: ../testdata/%.feature ../testdata/%.feature.errors .built
|
49 | mkdir -p `dirname $@`
|
50 | ! bin/gherkin-generate-ast $< 2> $@
|
51 | diff --unified $<.errors $@
|
52 | .DELETE_ON_ERROR: acceptance/testdata/%.feature.errors
|
53 |
|
54 | lib/gherkin/parser.js: ../gherkin.berp gherkin-javascript.razor ../bin/berp.exe
|
55 | mono ../bin/berp.exe -g ../gherkin.berp -t gherkin-javascript.razor -o $@
|
56 | # Remove BOM
|
57 | tail -c +4 $@ > $@.nobom
|
58 | mv $@.nobom $@
|
59 |
|
60 | lib/gherkin/gherkin-languages.json: ../gherkin-languages.json
|
61 | cp $^ $@
|
62 |
|
63 | dist/gherkin.js: lib/gherkin/parser.js LICENSE node_modules/.fetched
|
64 | mkdir -p `dirname $@`
|
65 | echo '/*' > $@
|
66 | cat LICENSE >> $@
|
67 | echo '*/' >> $@
|
68 | ./node_modules/.bin/browserify index.js >> $@
|
69 |
|
70 | dist/gherkin.min.js: dist/gherkin.js node_modules/.fetched
|
71 | mkdir -p `dirname $@`
|
72 | echo '/*' > $@
|
73 | cat LICENSE >> $@
|
74 | echo '*/' >> $@
|
75 | ./node_modules/.bin/uglifyjs $^ >> $@
|
76 |
|
77 | LICENSE: ../LICENSE
|
78 | cp $< $@
|
79 |
|
80 | clean:
|
81 | rm -rf .compared .built acceptance lib/gherkin/parser.js lib/gherkin/gherkin-languages.json dist
|
82 | .PHONY: clean
|
83 |
|
84 | update-gherkin-languages: lib/gherkin/gherkin-languages.json
|
85 | .PHONY: update-gherkin-languages
|