THRIFT-2648 cleanup erlang lib
client: erlang
patch: alisdair sullivan (alisdairsullivan@yahoo.ca)
moves tests for the thrift compiler generation of files to /test/erl, properly removes artifacts from test
suite runs, adds module listing to .app.src for better behaviour when using erlang tools like relx and
rebar and modifies .gitignore to not ignore relevant erlang test components
diff --git a/.gitignore b/.gitignore
index a250165..b0b5e65 100644
--- a/.gitignore
+++ b/.gitignore
@@ -156,10 +156,6 @@
/lib/erl/.eunit
/lib/erl/ebin
/lib/erl/deps/
-/lib/erl/src/thrift.app.src
-/lib/erl/test/*.erl
-/lib/erl/test/*.hrl
-/lib/erl/test/*.beam
/lib/hs/dist
/lib/java/build
/lib/js/test/build
diff --git a/configure.ac b/configure.ac
index bccfc69..d97e957 100755
--- a/configure.ac
+++ b/configure.ac
@@ -654,6 +654,7 @@
lib/lua/Makefile
test/Makefile
test/cpp/Makefile
+ test/erl/Makefile
test/go/Makefile
test/hs/Makefile
test/php/Makefile
diff --git a/lib/erl/Makefile.am b/lib/erl/Makefile.am
index c87f998..cdac926 100644
--- a/lib/erl/Makefile.am
+++ b/lib/erl/Makefile.am
@@ -18,8 +18,8 @@
#
THRIFT = ../../compiler/cpp/thrift
-THRIFT_FILES = $(wildcard ../../test/*.thrift) \
- $(wildcard test/*.thrift)
+THRIFT_FILES = $(wildcard test/*.thrift) \
+ ../../test/ThriftTest.thrift
.generated: $(THRIFT_FILES)
for f in $(THRIFT_FILES) ; do \
@@ -47,32 +47,20 @@
rm -rf $(DESTDIR)$(ERLANG_INSTALL_LIB_DIR_thrift)
clean:
- ./rebar clean
rm -f .generated
- rm -f test/secondService_* \
- test/aService_* \
- test/serviceForExceptionWithAMap_* \
- test/annotationTest_* \
- test/service_* \
- test/constantsDemo_* \
- test/smallService_* \
- test/smallTest_* \
- test/debugProtoTest_* \
- test/srv_* \
- test/denseLinkingTest_* \
- test/stressTest_* \
- test/docTest_* \
- test/emptyService_* \
- test/inherited_* \
- test/javaBeansTest_* \
- test/thrift1151_* \
- test/javaBeansTest_* \
- test/manyTypedefs_* \
- test/thriftTest_* \
- test/optionalRequiredTest_* \
- test/yowza_* \
- test/reverseOrderService_* \
- test/manyOptionals_*
+ rm -f test/thrift1151_types.erl \
+ test/thrift1151_types.hrl \
+ test/thrift1151_constants.hrl \
+ test/thrift1475_types.erl \
+ test/thrift1475_types.hrl \
+ test/thrift1475_constants.hrl \
+ test/thriftTest_types.erl \
+ test/thriftTest_types.hrl \
+ test/thriftTest_constants.hrl \
+ test/thriftTest_thrift.erl \
+ test/thriftTest_thrift.hrl \
+ test/secondService_thrift.erl \
+ test/secondService_thrift.hrl
./rebar clean
maintainer-clean-local:
diff --git a/lib/erl/src/thrift.app.src b/lib/erl/src/thrift.app.src
index 90ebc62..28b8cb5 100644
--- a/lib/erl/src/thrift.app.src
+++ b/lib/erl/src/thrift.app.src
@@ -17,8 +17,7 @@
%% under the License.
%%
%%% -*- mode:erlang -*-
-{application, thrift,
- [
+{application, thrift, [
% A quick description of the application.
{description, "Thrift bindings"},
@@ -27,7 +26,28 @@
% All modules used by the application.
{modules, [
- ]},
+ thrift_base64_transport,
+ thrift_binary_protocol,
+ thrift_buffered_transport,
+ thrift_client_util,
+ thrift_client,
+ thrift_disk_log_transport,
+ thrift_file_transport,
+ thrift_framed_transport,
+ thrift_http_transport,
+ thrift_json_parser,
+ thrift_json_protocol,
+ thrift_memory_buffer,
+ thrift_processor,
+ thrift_protocol,
+ thrift_reconnecting_client,
+ thrift_server,
+ thrift_service,
+ thrift_socket_server,
+ thrift_socket_transport,
+ thrift_transport_state_test,
+ thrift_transport
+ ]},
% All of the registered names the application uses. This can be ignored.
{registered, []},
@@ -35,11 +55,7 @@
% Applications that are to be started prior to this one. This can be ignored
% leave it alone unless you understand it well and let the .rel files in
% your release handle this.
- {applications,
- [
- kernel,
- stdlib
- ]},
+ {applications, [kernel, stdlib]},
% OTP application loader will load, but not start, included apps. Again
% this can be ignored as well. To load but not start an application it
@@ -49,10 +65,9 @@
% configuration parameters similar to those in the config file specified
% on the command line. can be fetched with gas:get_env
{env, [
- % If an error/crash occurs during processing of a function,
- % should the TApplicationException serialized back to the client
- % include the erlang backtrace?
- {exceptions_include_traces, true}
+ % If an error/crash occurs during processing of a function,
+ % should the TApplicationException serialized back to the client
+ % include the erlang backtrace?
+ {exceptions_include_traces, true}
]}
- ]
-}.
+]}.
diff --git a/test/Makefile.am b/test/Makefile.am
index dddad11..6f4bb03 100755
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -49,6 +49,10 @@
SUBDIRS += go
endif
+if WITH_ERLANG
+SUBDIRS += erl
+endif
+
#
# generate html for ThriftTest.thrift
#
@@ -61,6 +65,7 @@
test.py \
tests.json \
cpp \
+ erl \
hs \
lua \
ocaml \
diff --git a/test/erl/Makefile.am b/test/erl/Makefile.am
new file mode 100644
index 0000000..911fceb
--- /dev/null
+++ b/test/erl/Makefile.am
@@ -0,0 +1,37 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+THRIFT = $(top_srcdir)/compiler/cpp/thrift
+REBAR = $(top_srcdir)/lib/erl/rebar
+
+THRIFT_FILES = $(wildcard ../*.thrift)
+
+.generated: $(THRIFT_FILES)
+ for f in $(THRIFT_FILES) ; do \
+ $(THRIFT) --gen erl $$f ; \
+ done ; \
+ touch .generated
+
+check: .generated
+ $(REBAR) eunit
+
+clean:
+ rm -f .generated
+ rm -rf gen-erl
+ $(REBAR) clean
diff --git a/test/erl/rebar.config b/test/erl/rebar.config
new file mode 100644
index 0000000..6035849
--- /dev/null
+++ b/test/erl/rebar.config
@@ -0,0 +1,5 @@
+{erl_opts, [
+ debug_info,
+ {i, ["gen-erl"]},
+ {src_dirs, ["gen-erl"]}
+]}.
diff --git a/lib/erl/test/nameConflictTest_test.erl b/test/erl/src/nameConflictTest_test.erl
similarity index 100%
rename from lib/erl/test/nameConflictTest_test.erl
rename to test/erl/src/nameConflictTest_test.erl
diff --git a/test/erl/src/thrift_test.app.src b/test/erl/src/thrift_test.app.src
new file mode 100644
index 0000000..dd04926
--- /dev/null
+++ b/test/erl/src/thrift_test.app.src
@@ -0,0 +1,52 @@
+%%
+%% Licensed to the Apache Software Foundation (ASF) under one
+%% or more contributor license agreements. See the NOTICE file
+%% distributed with this work for additional information
+%% regarding copyright ownership. The ASF licenses this file
+%% to you under the Apache License, Version 2.0 (the
+%% "License"); you may not use this file except in compliance
+%% with the License. You may obtain a copy of the License at
+%%
+%% http://www.apache.org/licenses/LICENSE-2.0
+%%
+%% Unless required by applicable law or agreed to in writing,
+%% software distributed under the License is distributed on an
+%% "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+%% KIND, either express or implied. See the License for the
+%% specific language governing permissions and limitations
+%% under the License.
+%%
+%%% -*- mode:erlang -*-
+{application, thrift_test, [
+ % A quick description of the application.
+ {description, "tests for thrift erlang compiler backend"},
+
+ % The version of the applicaton
+ {vsn, "1.0.0-dev"},
+
+ % All modules used by the application.
+ {modules, [
+ ]},
+
+ % All of the registered names the application uses. This can be ignored.
+ {registered, []},
+
+ % Applications that are to be started prior to this one. This can be ignored
+ % leave it alone unless you understand it well and let the .rel files in
+ % your release handle this.
+ {applications, [kernel, stdlib]},
+
+ % OTP application loader will load, but not start, included apps. Again
+ % this can be ignored as well. To load but not start an application it
+ % is easier to include it in the .rel file followed by the atom 'none'
+ {included_applications, []},
+
+ % configuration parameters similar to those in the config file specified
+ % on the command line. can be fetched with gas:get_env
+ {env, [
+ % If an error/crash occurs during processing of a function,
+ % should the TApplicationException serialized back to the client
+ % include the erlang backtrace?
+ {exceptions_include_traces, true}
+ ]}
+]}.