THRIFT-3133 Allow "make cross" and "make precross" to run without building all languages
diff --git a/Makefile.am b/Makefile.am
index d0c813b..e6a965a 100755
--- a/Makefile.am
+++ b/Makefile.am
@@ -43,8 +43,17 @@
precross: all precross-test precross-lib
# TODO: generate --server and --client switches from "--with(out)-..." build flags
+
+
+empty :=
+space := $(empty) $(empty)
+comma := ,
+
+CROSS_LANGS = @MAYBE_CPP@ @MAYBE_C_GLIB@ @MAYBE_JAVA@ @MAYBE_CSHARP@ @MAYBE_PYTHON@ @MAYBE_RUBY@ @MAYBE_HASKELL@ @MAYBE_PERL@ @MAYBE_PHP@ @MAYBE_GO@ @MAYBE_NODEJS@
+CROSS_LANGS_COMMA_SEPARATED = $(subst $(space),$(comma),$(CROSS_LANGS))
+
cross: precross
- $(PYTHON) test/test.py -s
+ $(PYTHON) test/test.py -s --server $(CROSS_LANGS_COMMA_SEPARATED) --client $(CROSS_LANGS_COMMA_SEPARATED)
TIMES = 1 2 3
fail: precross
@@ -72,10 +81,6 @@
rebar \
thrift
-empty :=
-space := $(empty) $(empty)
-comma := ,
-
skipped_files = $(subst $(space),$(comma),$(codespell_skip_files))
style-local:
diff --git a/configure.ac b/configure.ac
index 791eead..83189c3 100755
--- a/configure.ac
+++ b/configure.ac
@@ -743,6 +743,29 @@
tutorial/rb/Makefile
])
+if test "$have_cpp" = "yes" ; then MAYBE_CPP="cpp" ; else MAYBE_CPP="" ; fi
+AC_SUBST([MAYBE_CPP])
+if test "$have_c_glib" = "yes" ; then MAYBE_C_GLIB="c_glib" ; else MAYBE_C_GLIB="" ; fi
+AC_SUBST([MAYBE_C_GLIB])
+if test "$have_java" = "yes" ; then MAYBE_JAVA="java" ; else MAYBE_JAVA="" ; fi
+AC_SUBST([MAYBE_JAVA])
+if test "$have_csharp" = "yes" ; then MAYBE_CSHARP="csharp" ; else MAYBE_CSHARP="" ; fi
+AC_SUBST([MAYBE_CSHARP])
+if test "$have_python" = "yes" ; then MAYBE_PYTHON="python" ; else MAYBE_PYTHON="" ; fi
+AC_SUBST([MAYBE_PYTHON])
+if test "$have_ruby" = "yes" ; then MAYBE_RUBY="rb" ; else MAYBE_RUBY="" ; fi
+AC_SUBST([MAYBE_RUBY])
+if test "$have_haskell" = "yes" ; then MAYBE_HASKELL="haskell" ; else MAYBE_HASKELL="" ; fi
+AC_SUBST([MAYBE_HASKELL])
+if test "$have_perl" = "yes" ; then MAYBE_PERL="perl" ; else MAYBE_PERL="" ; fi
+AC_SUBST([MAYBE_PERL])
+if test "$have_php" = "yes" ; then MAYBE_PHP="php" ; else MAYBE_PHP="" ; fi
+AC_SUBST([MAYBE_PHP])
+if test "$have_go" = "yes" ; then MAYBE_GO="go" ; else MAYBE_GO="" ; fi
+AC_SUBST([MAYBE_GO])
+if test "$have_nodejs" = "yes" ; then MAYBE_NODEJS="nodejs" ; else MAYBE_NODEJS="" ; fi
+AC_SUBST([MAYBE_NODEJS])
+
AC_OUTPUT
diff --git a/lib/Makefile.am b/lib/Makefile.am
index aa8b159..5066a00 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -18,6 +18,7 @@
#
SUBDIRS =
+PRECROSS_TARGET =
if WITH_CPP
SUBDIRS += cpp
@@ -29,10 +30,12 @@
if WITH_MONO
SUBDIRS += csharp
+PRECROSS_TARGET += precross-csharp
endif
if WITH_JAVA
SUBDIRS += java
+PRECROSS_TARGET += precross-java
# JavaScript unit test depends on java
# so test only if java, ant & co is available
SUBDIRS += js/test
@@ -72,6 +75,7 @@
if WITH_NODEJS
SUBDIRS += nodejs
+PRECROSS_TARGET += precross-nodejs
endif
if WITH_LUA
@@ -94,4 +98,4 @@
precross-%:
$(MAKE) -C $* precross
-precross: precross-nodejs precross-csharp precross-java
+precross: $(PRECROSS_TARGET)
diff --git a/test/Makefile.am b/test/Makefile.am
index 7b2e180..4c90995 100755
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -18,31 +18,38 @@
#
SUBDIRS =
+PRECROSS_TARGET =
if WITH_C_GLIB
SUBDIRS += c_glib
+PRECROSS_TARGET += precross-c_glib
endif
if WITH_CPP
SUBDIRS += cpp
+PRECROSS_TARGET += precross-cpp
endif
if WITH_PERL
SUBDIRS += perl
+PRECROSS_TARGET += precross-perl
endif
if WITH_PHP
SUBDIRS += php
+PRECROSS_TARGET += precross-php
endif
if WITH_PYTHON
SUBDIRS += py
+PRECROSS_TARGET += precross-py
SUBDIRS += py.twisted
SUBDIRS += py.tornado
endif
if WITH_RUBY
SUBDIRS += rb
+PRECROSS_TARGET += precross-rb
endif
if WITH_HASKELL
@@ -55,6 +62,7 @@
if WITH_GO
SUBDIRS += go
+PRECROSS_TARGET += precross-go
endif
if WITH_ERLANG
@@ -106,4 +114,4 @@
precross-%:
$(MAKE) -C $* precross
-precross: precross-py precross-rb precross-c_glib precross-cpp precross-perl precross-php precross-go
+precross: $(PRECROSS_TARGET)
diff --git a/test/README.md b/test/README.md
index 91e4c26..c1a73ec 100755
--- a/test/README.md
+++ b/test/README.md
@@ -13,9 +13,9 @@
This starts the [test.py](test.py) script which does the real cross test with
different transports, protocols and languages.
-Note that this requires basically everything to be built, otherwise test cases
-for missing languages will fail. If you skip building some languages, or simply
-need more control, read following section.
+Note that this skips any language that is not built locally. It also skips
+tests that are known to be failing. If you need more control over which tests
+to run, read following section.
### B. Using test script directly