Skip to content

Commit

Permalink
Merge branch 'develop-3.0-lower' into develop-3.0
Browse files Browse the repository at this point in the history
* develop-3.0-lower:
  protobuffs should not be in riak_pb.app.src
  Fix eqc tests and rebar3 plugin
  Adapt code for gpb vs erlang_protobuff differences
  Switch to rebar3 and prepare for OTP20
  update rebar/relnotes for 2.2.5 release
  Add `node_confirms` option to write messages (basho#228)
  Move deps back to branches for develop-2.2
  add gsets support
  • Loading branch information
Thomas Arts committed Mar 18, 2019
2 parents 503480c + fec66b6 commit 8fab334
Show file tree
Hide file tree
Showing 17 changed files with 212 additions and 404 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ priv/*
ebin/*.beam
ebin/riak_pb.app
include/*_pb.hrl
src/*_pb.erl
doc/*
.qc
.eqc-info
Expand All @@ -15,6 +16,9 @@ src/riak_pb_messages.erl
dialyzer_unhandled_warnings
dialyzer_warnings
.rebar/*
.rebar3/
_build/


# Java
target/*
Expand Down
86 changes: 17 additions & 69 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,76 +1,24 @@
.PHONY: deps
.PHONY: compile rel cover test dialyzer
REBAR=./rebar3

all: deps compile_all
compile:
$(REBAR) compile

deps: erl_deps
clean:
rm -rf include/*_pb.hrl
rm -rf src/*_pb.erl
$(REBAR) clean

compile_all: erl_compile
cover: test
$(REBAR) cover

clean: erl_clean
test: compile
$(REBAR) eunit

distclean: clean
rm -rf dist
dialyzer:
$(REBAR) dialyzer

# Erlang-specific build steps
DIALYZER_APPS = kernel stdlib erts crypto compiler hipe syntax_tools
include tools.mk
xref:
$(REBAR) xref

erl_deps:
@${REBAR} get-deps

erl_compile:
@${REBAR} compile

erl_clean:
@${REBAR} clean

compile: erl_compile # Hack for tools.mk

release: compile
ifeq ($(VERSION),)
$(error VERSION must be set to build a release and deploy this package)
endif
ifeq ($(RELEASE_GPG_KEYNAME),)
$(error RELEASE_GPG_KEYNAME must be set to build a release and deploy this package)
endif
@echo "==> Tagging version $(VERSION)"
@bash ./build/publish $(VERSION) validate
@git tag --sign -a "$(VERSION)" -m "riak_pb $(VERSION)" --local-user "$(RELEASE_GPG_KEYNAME)"
@git push --tags
@bash ./build/publish $(VERSION)

# C specific build steps
PROTOC = protoc-c
PROTOS := $(wildcard src/*.proto)
C_DIR = c
C_FILES := $(patsubst src/%.proto,$(C_DIR)/%.pb-c.c,$(PROTOS))
H_FILES := $(patsubst src/%.proto,$(C_DIR)/%.pb-c.h,$(PROTOS))
C_PREFIX := /usr/local/riak_pb_c

c_compile: c_announce c_protoc_check $(C_DIR) $(C_FILES) $(H_FILES)

c_announce:
@echo "==> C (compile)"
@true

c_protoc_check: PROTOC-exists
PROTOC-exists: ; @which $(PROTOC) > /dev/null

$(C_DIR):
@mkdir -p $(C_DIR)

$(C_DIR)/%.pb-c.c $(C_DIR)/%.pb-c.h: src/%.proto
@echo "Generating $@ from $<"
@$(PROTOC) -Isrc $< --c_out=$(C_DIR)

c_clean:
@echo "==> C (clean)"
@rm -rf $(C_DIR)

c_release: c_compile
@echo "==> C (release)"
@echo "Installing in $(C_PREFIX)"
@mkdir -p $(C_PREFIX)
@mkdir -p $(C_PREFIX)/include
@cp -p $(C_DIR)/*.c $(C_PREFIX)
@cp -p $(C_DIR)/*.h $(C_PREFIX)/include
check: test dialyzer xref
5 changes: 4 additions & 1 deletion RELNOTES.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
Release Notes
=============

* `2.2.1.0`
* [add gsets support](https://github.com/basho/riak_pb/pull/229)
* Update `erlang_protobuffs` to `0.9.1`
* Update `erlang_hamcrest` to `0.4.2`
* `2.1.4.2`
* Update `erlang_protobuffs` to `0.9.0`. Supports quoting reserved words in a `R15`-compatible way.
* [`2.1.4.1`](https://github.com/basho/riak_pb/issues?q=milestone%3Ariak_pb-2.1.4.1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
-include_lib("eqc/include/eqc.hrl").
-include_lib("eunit/include/eunit.hrl").

-compile(export_all).
-compile([export_all, nowarn_export_all]).

-define(QC_OUT(P), eqc:on_output(fun(F,TL) ->
io:format(user, F, TL)
Expand All @@ -47,9 +47,10 @@ prop_codec() ->
end,
begin
Props2 = riak_pb_codec:decode_bucket_props(
riak_pb:decode_rpbbucketprops(
iolist_to_binary(riak_pb:encode_rpbbucketprops(
riak_pb_codec:encode_bucket_props(Props))))),
riak_pb:decode_msg(
iolist_to_binary(riak_pb:encode_msg(
riak_pb_codec:encode_bucket_props(Props))),
rpbbucketprops)),
Props =:= lists:sort(Props2)
end)).

Expand Down
143 changes: 0 additions & 143 deletions plugins/riak_pb_msgcodegen.erl

This file was deleted.

Binary file removed rebar
Binary file not shown.
27 changes: 17 additions & 10 deletions rebar.config
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,8 @@
{erl_opts, [
debug_info,
warnings_as_errors,
{platform_define, "^[0-9]+", namespaced_types}
]}.

{deps, [
{protobuffs, "0.9.*", {git, "https://github.com/basho/erlang_protobuffs.git", {tag, "0.9.0"}}},
{hamcrest, "0.3.*", {git, "https://github.com/basho/hamcrest-erlang.git", {tag, "0.3.0-basho"}}}
{platform_define, "^[0-9]+", namespaced_types},
{i, "./_build/default/plugins/gpb/include"}
]}.

{xref_checks, [
Expand All @@ -20,11 +16,22 @@

{eunit_opts, [verbose]}.

{plugins, [riak_pb_msgcodegen]}.
{plugins, [rebar3_gpb_plugin,
{riak_pb_msgcodegen, {git, "git://github.com/tsloughter/riak_pb_msgcodegen",
{branch, "master"}}},
{rebar3_eqc, {git, "https://github.com/Vagabond/rebar3-eqc-plugin", {branch, "master"}}}
]}.

{plugin_dir, "plugins"}.
{gpb_opts, [{module_name_suffix, "_pb"},
{msg_name_to_lower, true},
{i, "src"}]}.

%% Fixes attempted removal of riak_pb directory by rebar_escripter
{escript_name, "doesnothavescript"}.
{provider_hooks, [
{pre, [{compile, {protobuf, compile}},
{compile, riak_pb_msgcodegen}]}
]}.

{edoc_opts, [{preprocess, true}]}.

{xref_checks,[undefined_function_calls,undefined_functions,locals_not_used,
deprecated_function_calls, deprecated_functions]}.
1 change: 1 addition & 0 deletions rebar.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[].
Binary file added rebar3
Binary file not shown.
Loading

0 comments on commit 8fab334

Please sign in to comment.