1
1
SHELL := /usr/bin/env bash
2
2
3
3
GHERKIN_PARSER = lib/Gherkin/Generated/Parser.pm
4
+ GHERKIN_LANGUAGES = lib/Generated/Languages.pm
4
5
GHERKIN_RAZOR = gherkin-perl.razor
5
- SOURCE_FILES = $(shell find . -name "* .pm" | grep -v $(GHERKIN_PARSER ) )
6
+ SOURCE_FILES = $(shell find lib -name "* .pm" | grep -v $(GHERKIN_PARSER ) | grep -v $( GHERKIN_LANGUAGES ) )
6
7
7
8
GHERKIN = bin/gherkin
8
9
GHERKIN_GENERATE_TOKENS = bin/gherkin-generate-tokens
@@ -17,6 +18,11 @@ SOURCES = $(patsubst ../testdata/%,acceptance/testdata/%.source.ndjson,$(GO
17
18
ERRORS = $(patsubst ../testdata/% ,acceptance/testdata/% .errors.ndjson,$(BAD_FEATURE_FILES ) )
18
19
19
20
.DEFAULT_GOAL = help
21
+
22
+ ARTIFACT_DIR = Gherkin-latest
23
+ ARTIFACT_DIR_VERSIONED = Gherkin-$(shell cat VERSION)
24
+ ARTIFACT_TAR_GZ = Gherkin-$(shell cat VERSION) .tar.gz
25
+
20
26
PERL5LIB = $$PWD/perl5/lib/perl5
21
27
GHERKIN = PERL5LIB=${PERL5LIB} bin/gherkin
22
28
GHERKIN_GENERATE_TOKENS = PERL5LIB=${PERL5LIB} bin/gherkin-generate-tokens
@@ -29,30 +35,36 @@ generate: $(GHERKIN_PARSER) ## Generate gherkin parser files
29
35
clean-generate : # # Remove generated Gherkin parser files ## Generate gherkin parser files
30
36
rm -f $(GHERKIN_PARSER )
31
37
32
- copy-gherkin-languages : # lib/Gherkin/Generated/Languages.pm ## Copy gherkin-languages.json and/or generate derived files
33
- echo " TODO: Depends on perl, this task should only depend on jq "
38
+ copy-gherkin-languages :
39
+ echo " Nothing to do "
34
40
35
41
clean-gherkin-languages : # # Remove gherkin-languages.json and any derived files
36
- # rm -f lib/Gherkin/Generated/Languages.pm
37
- echo " TODO: Depends on perl, this task should only depend on jq"
42
+ echo " Nothing to do"
38
43
39
44
clean : # # Remove all build artifacts and files generated by the acceptance tests
40
- rm -f .built
45
+ rm -rf $(ARTIFACT_DIR_VERSIONED )
46
+ rm -rf $(ARTIFACT_DIR )
47
+ rm -f $(ARTIFACT_TAR_GZ )
41
48
rm -rf acceptance
42
49
rm -rf perl5
43
50
44
51
.DELETE_ON_ERROR :
45
52
46
- acceptance : .built $(TOKENS ) $(ASTS ) $(PICKLES ) $(SOURCES ) $(ERRORS ) # # Build acceptance test dir and compare results with reference
53
+ .PHONY : test
54
+ test : perl5 # # Runs dzil test
55
+ PATH=$$ PATH:perl5/bin PERL5LIB=${PERL5LIB} dzil test
56
+
57
+ acceptance : $(ARTIFACT_DIR ) $(TOKENS ) $(ASTS ) $(PICKLES ) $(ERRORS ) $(SOURCES ) # # Build acceptance test dir and compare results with reference
47
58
48
- .built : perl5 $(SOURCE_FILES )
49
- touch $@
59
+ $(ARTIFACT_DIR ) : $(ARTIFACT_DIR_VERSIONED )
60
+ cp -r $(ARTIFACT_DIR_VERSIONED ) $@
61
+
62
+ $(ARTIFACT_DIR_VERSIONED ) : perl5 $(SOURCE_FILES )
63
+ PATH=$$ PATH:perl5/bin PERL5LIB=${PERL5LIB} dzil build
50
64
51
65
perl5 :
52
66
cpanm --notest --local-lib ./perl5 --installdeps --with-develop .
53
-
54
- lib/Gherkin/Generated/Languages.pm :
55
- perl helper-scripts/build_languages.pl > $@
67
+ PATH=$$ PATH:perl5/bin PERL5LIB=${PERL5LIB} dzil authordeps --missing | cpanm --notest --local-lib ./perl5
56
68
57
69
$(GHERKIN_PARSER ) : $(GHERKIN_RAZOR ) ../gherkin.berp
58
70
berp -g ../gherkin.berp -t $< -o $@ --noBOM
0 commit comments