THRIFT-4547: add swift to bionic build image and run unit tests
diff --git a/.gitignore b/.gitignore
index b7f7b45..b3a5920 100644
--- a/.gitignore
+++ b/.gitignore
@@ -285,6 +285,7 @@
/lib/rs/test/src/ultimate.rs
/lib/rs/*.iml
/lib/rs/**/*.iml
+/lib/swift/.build
/libtool
/ltmain.sh
/missing
diff --git a/build/docker/ubuntu-bionic/Dockerfile b/build/docker/ubuntu-bionic/Dockerfile
index 4f53ca4..5ad4c84 100644
--- a/build/docker/ubuntu-bionic/Dockerfile
+++ b/build/docker/ubuntu-bionic/Dockerfile
@@ -250,6 +250,13 @@
cargo \
rustc
+# Swift on Linux for cross tests
+RUN cd / && \
+ wget --quiet https://swift.org/builds/swift-4.2.1-release/ubuntu1804/swift-4.2.1-RELEASE/swift-4.2.1-RELEASE-ubuntu18.04.tar.gz && \
+ tar xf swift-4.2.1-RELEASE-ubuntu18.04.tar.gz --strip-components=1 && \
+ rm swift-4.2.1-RELEASE-ubuntu18.04.tar.gz && \
+ swift --version
+
# cppcheck-1.82 has a nasty cpp parser bug, so we're using something newer
RUN apt-get install -y --no-install-recommends \
`# Static Code Analysis dependencies` \
diff --git a/configure.ac b/configure.ac
index f53fc3f..4a5fb39 100755
--- a/configure.ac
+++ b/configure.ac
@@ -141,6 +141,7 @@
with_nodets="no"
with_lua="no"
with_rs="no"
+ with_swift="no"
fi
AX_THRIFT_LIB(cpp, [C++], yes)
@@ -445,6 +446,16 @@
AM_CONDITIONAL(WITH_GO, [test "$have_go" = "yes"])
AM_CONDITIONAL([GOVERSION_LT_17], [test "$go_version_lt_17" = "yes"])
+AX_THRIFT_LIB(swift, [Swift], yes)
+have_swift="no"
+if test "$with_swift" = "yes"; then
+ AC_PATH_PROG([SWIFT], [swift])
+ if test "x$SWIFT" != "x" -a "x$SWIFT" != "x"; then
+ have_swift="yes"
+ fi
+fi
+AM_CONDITIONAL([WITH_SWIFT], [test "$have_swift" = "yes"])
+
AX_THRIFT_LIB(rs, [Rust], yes)
have_rs="no"
if test "$with_rs" = "yes"; then
@@ -851,6 +862,7 @@
lib/rs/Makefile
lib/rs/test/Makefile
lib/lua/Makefile
+ lib/swift/Makefile
lib/xml/Makefile
lib/xml/test/Makefile
test/Makefile
@@ -929,6 +941,8 @@
AC_SUBST([MAYBE_LUA])
if test "$have_rs" = "yes" ; then MAYBE_RS="rs" ; else MAYBE_RS="" ; fi
AC_SUBST([MAYBE_RS])
+if test "$have_swift" = "yes" ; then MAYBE_SWIFT="swift" ; else MAYBE_SWIFT="" ; fi
+AC_SUBST([MAYBE_SWIFT])
if test "$have_dotnetcore" = "yes" ; then MAYBE_DOTNETCORE="netcore" ; else MAYBE_DOTNETCORE="" ; fi
AC_SUBST([MAYBE_DOTNETCORE])
if test "$have_cl" = "yes" ; then MAYBE_CL="cl" ; else MAYBE_CL="" ; fi
@@ -961,6 +975,7 @@
echo "Building Py3 Library ......... : $have_py3"
echo "Building Ruby Library ........ : $have_ruby"
echo "Building Rust Library ........ : $have_rs"
+echo "Building Swift Library ....... : $have_swift"
if test "$have_csharp" = "yes" ; then
echo
@@ -1090,6 +1105,12 @@
echo " Using rustc................ : $RUSTC"
echo " Using Rust version......... : $($RUSTC --version)"
fi
+if test "$have_swift" = "yes" ; then
+ echo
+ echo "Swift Library:"
+ echo " Using Swift ............... : $SWIFT"
+ echo " Using Swift version ....... : $($SWIFT --version | head -1)"
+fi
echo
echo "If something is missing that you think should be present,"
echo "please skim the output of configure to find the missing"
diff --git a/lib/Makefile.am b/lib/Makefile.am
index b315609..b6ce20e 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -102,6 +102,10 @@
SUBDIRS += cl
endif
+if WITH_SWIFT
+SUBDIRS += swift
+endif
+
# All of the libs that don't use Automake need to go in here
# so they will end up in our release tarballs.
EXTRA_DIST = \
diff --git a/lib/swift/Makefile.am b/lib/swift/Makefile.am
new file mode 100644
index 0000000..6b88b06
--- /dev/null
+++ b/lib/swift/Makefile.am
@@ -0,0 +1,46 @@
+#
+# 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.
+#
+
+SUBDIRS = .
+
+all-local:
+ swift build --configuration release
+
+install-exec-hook:
+ swift install
+
+clean-local:
+ swift package clean
+ rm -rf .build
+
+precross:
+ swift
+
+check-local:
+ swift test
+
+EXTRA_DIST = \
+ Package.swift \
+ Sources \
+ Tests \
+ README.md
+
+MAINTAINERCLEANFILES = \
+ Makefile \
+ Makefile.in
diff --git a/lib/swift/README.md b/lib/swift/README.md
index 4fdeacf..6f10961 100644
--- a/lib/swift/README.md
+++ b/lib/swift/README.md
@@ -22,7 +22,6 @@
## Build
-
swift build
## Test