Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[elixir] Convert proto-based messages to json schema based messages #29

Open
wants to merge 27 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
902a012
[messages - elixir] create proof of concept writer for module generation
WannesFransen1994 Apr 14, 2022
0e3ca9b
[messages - elixir] remove unused dependencies in
WannesFransen1994 Apr 14, 2022
58a1342
Merge branch 'main' into messages-elixir-proto-to-jsonschema
WannesFransen1994 Apr 14, 2022
3977a94
[messages - elixir] remove unnecessary compile time struct dependency…
WannesFransen1994 Apr 14, 2022
0bc4b32
[messages-elixir + gherkin-elixir] resolve compile-time issues with n…
WannesFransen1994 May 13, 2022
d664e56
adjusted gherkin parser so that tests pass
WannesFransen1994 May 19, 2022
cbfa63c
[elixir] Makefile + circleci conf attempt
WannesFransen1994 May 20, 2022
0c32335
Merge branch 'main' into messages-elixir-proto-to-jsonschema
WannesFransen1994 May 20, 2022
9d15c6c
[elixir messages] manually copy json schema files (assuming that ther…
WannesFransen1994 May 23, 2022
5600630
[elixir] attempt to avoid rsync conflict
WannesFransen1994 May 23, 2022
7433c74
Merge branch 'main' into messages-elixir-proto-to-jsonschema
WannesFransen1994 May 23, 2022
438e201
Merge branch 'main' into messages-elixir-proto-to-jsonschema
aurelien-reeves Jun 17, 2022
9f86654
Merge remote-tracking branch 'origin/main' into messages-elixir-proto…
aurelien-reeves Aug 17, 2022
19946e7
Unignore generated messages
aurelien-reeves Aug 17, 2022
7ceaa9f
Update code generation and makefile to match new repository
aurelien-reeves Aug 17, 2022
fa49894
Add generated code to the repo
aurelien-reeves Aug 17, 2022
64f526d
Update test-elixir workflow
aurelien-reeves Aug 17, 2022
38f8684
Update root Makefile and test-codegen workflow
aurelien-reeves Aug 17, 2022
82045d7
Fix test-codegen/Set-up elixir job
aurelien-reeves Aug 17, 2022
d272709
Merge branch 'main' into messages-elixir-proto-to-jsonschema
mattwynne Sep 22, 2022
5f2b261
[elixir messages] changed codegen to ruby script + add test for messa…
WannesFransen1994 Oct 20, 2022
a73599a
[elixir] add elixir template
WannesFransen1994 Oct 20, 2022
eb650e7
[messages - elixir] fixed tests and generated code. Corrected makefil…
WannesFransen1994 Oct 27, 2022
637d157
resolve merge conflict
WannesFransen1994 Nov 17, 2022
70ad748
[elixir messages] - resolve elixir version workflow
WannesFransen1994 Nov 17, 2022
7445619
[elixir messages] - resolve elixir version workflow
WannesFransen1994 Nov 17, 2022
5319ab9
[elixir messages] resolve bug
WannesFransen1994 Dec 15, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .github/workflows/test-codegen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,17 @@ jobs:
- run: composer install
working-directory: php


- name: Set up Elixir
uses: erlef/setup-beam@v1
with:
otp-version: '25.1'
elixir-version: '1.14.x'

- name: Install Protoc
uses: arduino/setup-protoc@v1


- name: generate code for all languages
run: |
make clean-all
Expand Down
8 changes: 2 additions & 6 deletions .github/workflows/test-elixir.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ jobs:
- uses: actions/checkout@v3
- uses: erlef/setup-beam@v1
with:
otp-version: '22.2'
elixir-version: '1.10.x'
otp-version: '25.1'
elixir-version: '1.14.x'

- name: Install Protoc
uses: arduino/setup-protoc@v1
Expand All @@ -29,9 +29,5 @@ jobs:
mix deps.get
working-directory: elixir

- name: compile messages
run: MIX_ENV=prod mix protox.generate --multiple-files --output-path=lib/cucumber_messages/generated messages.proto
working-directory: elixir

- run: mix test
working-directory: elixir
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ schemas = \
./jsonschema/UndefinedParameterType.json \
./jsonschema/Envelope.json

languages = go java javascript perl php ruby
languages = go java javascript perl php ruby elixir

.DEFAULT_GOAL = help

Expand Down
3 changes: 3 additions & 0 deletions elixir/.formatter.exs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[
inputs: ["{mix,.formatter}.exs", "{config,lib,test}/**/*.{ex,exs}"]
]
Empty file modified elixir/.gitignore
100644 → 100755
Empty file.
Empty file modified elixir/LICENSE
100644 → 100755
Empty file.
34 changes: 15 additions & 19 deletions elixir/Makefile
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,25 +1,21 @@
include default.mk
schemas = $(shell find ../jsonschema -name "*.json")

clean:
rm -rf _build deps .deps .tested
rm -rf lib/cucumber_messages/generated/*
.DEFAULT_GOAL = help

.deps: setup_mix_and_get_dependencies update_proto_file compile_messages revert_proto_file
touch .deps
help: ## Show this help
@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)

setup_mix_and_get_dependencies:
mix local.hex --force
mix deps.get
.PHONY: setup_mix_and_get_dependencies
generate: require lib/cucumber_messages/generated/messages.ex ## Generate elixir code based on the schemas found in ../jsonschema and using `mix generate_json_structs` for the generation

update_proto_file: messages.proto
mv $< $<.bak
cat $<.bak | sed "s/package io.cucumber.messages/package cucumber_messages/" > $<
require: ## Check requirements for the code generation (elixir/mix is required)
@mix --version >/dev/null 2>&1 || (echo "ERROR: elixir/mix is required."; exit 1)

compile_messages:
MIX_ENV=prod mix protox.generate --multiple-files --output-path=lib/cucumber_messages/generated messages.proto
.PHONY: compile_messages
clean: ## Remove automatically generated files and related artifacts
rm -rf lib/cucumber_messages/generated/messages.ex

revert_proto_file: messages.proto.bak
mv messages.proto.bak messages.proto
.PHONY: revert_proto_file
lib/cucumber_messages/generated/messages.ex: $(schemas) ../jsonschema/scripts/templates/elixir.erb
ruby ../jsonschema/scripts/codegen.rb Ruby ../jsonschema elixir.erb > $@
mix local.hex --force
mix deps.get
mix compile
mix format
Empty file modified elixir/README.md
100644 → 100755
Empty file.
79 changes: 0 additions & 79 deletions elixir/default.mk

This file was deleted.

1 change: 0 additions & 1 deletion elixir/lib/cucumber_message.ex
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ defmodule CucumberMessages do
"""
def convert_envelopes_to(envelopes, :ndjson) do
Enum.map(envelopes, &CucumberMessages.Writer.envelope_to_ndjson!/1)
|> Enum.map(&Jason.encode!(&1))
|> Enum.join("\n")
|> case do
"" -> ""
Expand Down
1 change: 0 additions & 1 deletion elixir/lib/cucumber_messages/generated/.gitignore

This file was deleted.

Loading