Skip to content

Commit 1d50591

Browse files
Rework code generation for Perl
The part regarding the README which was copied from the parent folder will be managed later. It is part of the TODO list here: cucumber/common#2029
1 parent c08ab3e commit 1d50591

File tree

2 files changed

+10
-111
lines changed

2 files changed

+10
-111
lines changed

perl/Makefile

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,17 @@
1-
include default.mk
1+
schemas = $(shell find ../jsonschema -name "*.json")
22

3-
PERL5LIB = $$PWD/perl5/lib/perl5
4-
PERL5PATH = $$PWD/perl5/bin
3+
.DEFAULT_GOAL = help
54

5+
help: ## Show this help
6+
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make <target>\n\nWhere <target> is one of:\n"} /^[$$()% a-zA-Z_-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)
67

8+
generate: require lib/Cucumber/Messages.pm ## Generate perl code based on the schemas found in ../jsonschema and using the scripts in ../jsonschema/scripts for the generation
79

8-
JSONSCHEMAS = $(shell find ../jsonschema -name "*.json")
10+
require: ## Check requirements for the code generation (ruby is required)
11+
@ruby --version >/dev/null 2>&1 || (echo "ERROR: ruby is required."; exit 1)
912

10-
test: lib/Cucumber/Messages.pm .cpanfile_dependencies
11-
PERL5LIB=${PERL5LIB} AUTHOR_TESTS=1 prove -l
12-
.PHONY: test clean clobber
13+
clean: ## Remove automatically generated files and related artifacts
14+
rm -f lib/Cucumber/Messages.pm
1315

14-
lib/Cucumber/Messages.pm: $(JSONSCHEMAS) ../jsonschema/scripts/codegen.rb ../jsonschema/scripts/templates/perl.pm.erb
16+
lib/Cucumber/Messages.pm: $(schemas) ../jsonschema/scripts/codegen.rb ../jsonschema/scripts/templates/perl.pm.erb
1517
ruby ../jsonschema/scripts/codegen.rb Perl ../jsonschema perl.pm.erb > $@
16-
17-
clean:
18-
rm -rf .built CHANGELOG.md
19-
20-
clobber: clean
21-
rm -f lib/Cucumber/Messages.pm

perl/default.mk

Lines changed: 0 additions & 97 deletions
This file was deleted.

0 commit comments

Comments
 (0)