Skip to content

Commit

Permalink
Gherkin Rule keyword and Protocol Buffer messages (#416)
Browse files Browse the repository at this point in the history
* update

* gherkin: protobuf: Fix syntax error, set up Java build

* gherkin: (Java) Add support for Rule

* Support background under Rule

* Implement Rule for C#,Java,JavaScript,Ruby and partially Go

* gherkin: (Java) Use protobuf structs

* messages: Add JavaScript

* Fix makefiles

* Set up subrepo sync

* Sync changes to gherkin and messages subrepos

* Update branching/CI instructions

* Fix indentation

* Fix branch pushing

* gherkin: Fix Protobuf for Java and JavaScript

* Clean up

* gherkin: Add missing uri

* messages: change package name to io.cucumber.messages

* ruby: Extract more templates for Ruby

* messages: Create ruby gems. Ref #416

* tmp

* add go messages

* move to local import

* gherkin: Read protobuf from stdin

* Install protoc in Docker image

* Don't force push

* Only unshallow on Travis

* Sync to cucumber/cucumber-messages-go

* Ignore spec

* Use system protoc for java

* Fix clean target

* Add missing READMEs

* Sync to cucumber/cucumber-messages-ruby.git

* Check in generated source so it can build on Travis without protoc available

* Don't regenerate protobuf classes

* Don't regenerate protobuf classes

* Don't check in yarn.lock

* Don't rebuild protobuf classes - remove yarn.lock

* Add missing target for go and ruby

* Read protobuf messages from a child process if GHERKIN_EXECUTABLE is defined

* Remove gherkin-jvm-deps. Depend on shaded google libs from the messages jar

* Rules and Protobuf done for Ruby/Java/JavaScript
  • Loading branch information
aslakhellesoy authored Jun 29, 2018
1 parent ad50c65 commit 133812f
Show file tree
Hide file tree
Showing 2,011 changed files with 32,640 additions and 10,574 deletions.
1 change: 0 additions & 1 deletion .templates/ruby/Rakefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

# encoding: utf-8
require 'rubygems'
require 'bundler'
Expand Down
10 changes: 9 additions & 1 deletion Dockerfile.cucumber-build
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,17 @@ FROM alpine:3.7

WORKDIR /app

RUN apk add --no-cache --update --upgrade alpine-sdk make bash maven openjdk8 diffutils jq python py-pip ruby ruby-dev perl perl-dev wget rsync go nodejs
RUN apk add --no-cache --update --upgrade alpine-sdk make bash maven openjdk8 diffutils jq python py-pip ruby ruby-dev perl perl-dev wget rsync go nodejs unzip automake autoconf libtool
RUN npm install --global yarn
RUN echo "gem: --no-document" > ~/.gemrc
RUN gem install bundler io-console
RUN pip install pipenv==8.3.2
RUN curl --fail -L http://cpanmin.us/ > /usr/local/bin/cpanm && chmod +x /usr/local/bin/cpanm

RUN mkdir -p /protobuf
RUN curl -L https://github.com/google/protobuf/releases/download/v3.6.0/protobuf-all-3.6.0.tar.gz | tar xvz --strip-components=1 -C /protobuf
RUN cd /protobuf && ./autogen.sh
RUN cd /protobuf && ./configure
RUN cd /protobuf && make -j2
RUN cd /protobuf && make check
RUN cd /protobuf && make install
23 changes: 20 additions & 3 deletions HACKING.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,19 @@ You can learn more about monorepos here:
* http://danluu.com/monorepo/
* https://medium.com/@bebraw/the-case-for-monorepos-907c1361708a

### Branching and CI

The CI build will synchronise from the monorepo to all the subrepos for the `master` branch.
For other branches, a naming convention is used to decide what subrepos to sync to.
(This is to avoid an explosion of unrelated branches in every subrepo).

For example, if you're making a change to `gherkin` on a branch, prefix the branch
with `gherkin`, for example `gherkin-upgrade-dependencies`.

Occasionally you want to sync to multiple subrepos. For example, if you are making changes
in two modules (say `messages` and `gherkin`), prefix the branch with both module names,
separated by an underscore. For example, `messages_gherkin-use-protobuf`.

### Adding a new subrepo

Occasionally, a sub directory is promoted to a separate subrepo. The process for doing this is:
Expand Down Expand Up @@ -60,13 +73,14 @@ In the new directory, create the following files:

#### Create new subrepo.

Create a new, empty subrepo at GitHub.
Create a new, empty subrepo at GitHub. Check the box for initialising
with a README - it's needed to create an initial `master` branch to push to.

Log into Travis and set up build for the new (empty) subrepo.

Initialise the subrepo, for example:

echo "[email protected]:cucumber/tag-expressions-go.git" > tag-expressions/go/.subrepo
echo "cucumber/tag-expressions-go.git" > tag-expressions/go/.subrepo

Push to the subrepo:

Expand Down Expand Up @@ -122,7 +136,10 @@ Add the passphrase for the GPG signing key (in 1Password)
### Docker and CI

Our CI build uses Docker. We have our own docker images defined in `Dockerfile.*`
files. These need to be rebuilt and published manually whenever they change:
files. These need to be rebuilt and published manually whenever they change.

In order to publish new images, log in as `cukebot`. The password is in 1Password,
in the "Cucumber Open Source" vault.

source ./scripts/functions.sh
# Standard image (for all builds except .NET)
Expand Down
7 changes: 2 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
SHELL := /usr/bin/env bash
MAKEFILES=messages/Makefile \
event-protocol/Makefile \
gherkin/Makefile \
gherkin/Makefile \
datatable/Makefile \
config/Makefile \
event-protocol/Makefile \
cucumber-expressions/Makefile \
tag-expressions/Makefile \
cucumber-redux/Makefile \
cucumber-react/Makefile
tag-expressions/Makefile

default: .rsynced $(patsubst %/Makefile,default-%,$(MAKEFILES))
.PHONY: default
Expand Down
5 changes: 5 additions & 0 deletions cucumber-expressions/ruby/.rsync
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
../../LICENSE LICENSE
../../.templates/github/ .github/
../../.templates/ruby/.gitignore .gitignore
../../.templates/ruby/.rspec .rspec
../../.templates/ruby/spec/capture_warnings.rb spec/capture_warnings.rb
../../.templates/ruby/spec/coverage.rb spec/coverage.rb
../../.templates/ruby/.travis.yml .travis.yml
../../.templates/ruby/Rakefile Rakefile
../examples.txt examples.txt
4 changes: 2 additions & 2 deletions cucumber-expressions/ruby/spec/capture_warnings.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def report_warnings(&block)
end

if other_warnings.any?
puts "#{ other_warnings.count } non-cucumber-expressions warnings detected, set VIEW_OTHER_WARNINGS=true to see them."
puts "#{ other_warnings.count } warnings detected, set VIEW_OTHER_WARNINGS=true to see them."
print_warnings('other', other_warnings) if ENV['VIEW_OTHER_WARNINGS']
end

Expand All @@ -23,7 +23,7 @@ def report_warnings(&block)
end

if project_warnings.any?
puts "#{ project_warnings.count } cucumber-expressions warnings detected"
puts "#{ project_warnings.count } warnings detected"
print_warnings('cucumber-expressions', project_warnings)
fail "Please remove all cucumber-expressions warnings."
end
Expand Down
2 changes: 1 addition & 1 deletion cucumber-redux/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ default:
.PHONY: default

clean:
rm -rf node_modules coverage dist
rm -rf yarn.lock node_modules coverage dist
.PHONY: clean
17 changes: 5 additions & 12 deletions gherkin/Makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
MAKEFILES=dotnet/Makefile go/Makefile java/Makefile javascript/Makefile ruby/Makefile
# Temporarily disable build of c,objective-c,perl,python until they
# implement https://github.com/cucumber/cucumber/pull/353
MAKEFILES=java/Makefile javascript/Makefile ruby/Makefile
# Disable build of go,dotnet,c,objective-c,perl,python until they
# implement:
# - https://github.com/cucumber/cucumber/pull/353
# - https://github.com/cucumber/cucumber/pull/416
# MAKEFILES=$(wildcard */Makefile)
EVENT_FILES = $(wildcard testdata/**/*.ndjson)
SCHEMAS = $(wildcard ../event-protocol/schemas/*.json)

default: $(patsubst %/Makefile,default-%,$(MAKEFILES))
.PHONY: default
Expand All @@ -16,10 +16,3 @@ clean: $(patsubst %/Makefile,clean-%,$(MAKEFILES))

clean-%: %
cd $< && make clean

validate-events: .valid-events
.PHONY: validate-events

.valid-events: $(EVENT_FILES) $(SCHEMAS)
@cat $(EVENT_FILES) | node ../event-protocol/bin/cucumber-event-validator.js
touch $@
Loading

0 comments on commit 133812f

Please sign in to comment.