-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
/
Makefile
43 lines (34 loc) · 1.94 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
MONOREPO_PATH ?= ../../cucumber
# https://stackoverflow.com/questions/2483182/recursive-wildcards-in-gnu-make
rwildcard=$(foreach d,$(wildcard $(1:=/*)),$(call rwildcard,$d,$2) $(filter $(subst *,%,$2),$d))
RUBY_FILES=$(call rwildcard,../lib ../../cucumber-ruby-core/lib/,*.rb)
FEATURES = $(sort $(wildcard features/docs/**.feature))
GOLDEN_JSONS = $(patsubst features/docs/%.feature,acceptance/%-golden.json,$(FEATURES))
GENERATED_JSONS = $(patsubst features/docs/%.feature,acceptance/%-generated.json,$(FEATURES))
TESTED = $(patsubst features/docs/%.feature,acceptance/%.tested,$(FEATURES))
OS := $(shell [[ "$$(uname)" == "Darwin" ]] && echo "darwin" || echo "linux")
# Determine if we're on 386 or amd64 (ignoring other processors as we're not building on them)
ARCH := $(shell [[ "$$(uname -m)" == "x86_64" ]] && echo "amd64" || echo "386")
default: $(GOLDEN_JSONS) $(GENERATED_JSONS) $(TESTED)
.PHONY: default
acceptance/%.tested: acceptance/%-golden.json acceptance/%-generated.json
mkdir -p $$(dirname $@)
diff --unified $^
.PHONY: acceptance/%.tested
acceptance/%-golden.json: features/docs/%.feature $(MONOREPO_PATH)/compatibility-kit/ruby/scripts/neutralize-json $(RUBY_FILES)
mkdir -p $$(dirname $@)
bundle exec cucumber --format=json $< | \
jq --sort-keys "." | \
$(MONOREPO_PATH)/compatibility-kit/ruby/scripts/neutralize-json > $@
acceptance/%-generated.json: features/docs/%.feature $(RUBY_FILES) bin/json-formatter $(MONOREPO_PATH)/compatibility-kit/ruby/scripts/neutralize-json
mkdir -p $$(dirname $@)
bundle exec cucumber --format=message $< | \
bin/json-formatter --format ndjson | \
jq --sort-keys "." | \
$(MONOREPO_PATH)/compatibility-kit/ruby/scripts/neutralize-json > $@
bin/json-formatter: $(MONOREPO_PATH)/json-formatter/go/dist/cucumber-json-formatter-$(OS)-$(ARCH)
cp $(MONOREPO_PATH)/json-formatter/go/dist/cucumber-json-formatter-$(OS)-$(ARCH) $@
chmod +x $@
clean:
rm -rf acceptance/*.json bin/json-formatter
.PHONY: clean