Skip to content

Commit 40dad5c

Browse files
authored
Update vcpkg and boost on Android (microsoft#1334)
* websocketpp appears a lost cause, disable websockets for Android Also fixes microsoft#1333 as a drive-by :)
1 parent 96e7d20 commit 40dad5c

16 files changed

+213
-165
lines changed

Build_android/configure.sh

+14-12
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ DO_OPENSSL=1
2525
DO_CMAKE=1
2626
DO_CPPRESTSDK=1
2727

28-
BOOSTVER=1.69.0
28+
BOOSTVER=1.70.0
2929
OPENSSLVER=1.1.0j
3030
CMAKEVER=3.14.0
3131

@@ -54,8 +54,8 @@ do
5454
DO_OPENSSL=0
5555
;;
5656
"--skip-cmake")
57-
DO_CMAKE=0
58-
;;
57+
DO_CMAKE=0
58+
;;
5959
"--skip-cpprestsdk")
6060
DO_CPPRESTSDK=0
6161
;;
@@ -104,10 +104,10 @@ NDK_DIR=`cd "${ANDROID_NDK}" && pwd`
104104
SRC_DIR=`pwd`
105105

106106
if [ -z "$NCPU" ]; then
107-
NCPU=4
108-
if uname -s | grep -i "linux" > /dev/null ; then
109-
NCPU=`cat /proc/cpuinfo | grep -c -i processor`
110-
fi
107+
NCPU=4
108+
if uname -s | grep -i "linux" > /dev/null ; then
109+
NCPU=`cat /proc/cpuinfo | grep -c -i processor`
110+
fi
111111
fi
112112

113113
# -----------------------
@@ -151,11 +151,12 @@ if [ "${DO_OPENSSL}" == "1" ]; then (
151151
# -----
152152
# Uses the build script from Moritz Wundke (formerly MysticTreeGames)
153153
# https://github.com/moritz-wundke/Boost-for-Android
154+
# (plus the patch https://github.com/o01eg/Boost-for-Android/tree/ndk-bump-21)
154155

155156
if [ "${DO_BOOST}" == "1" ]; then (
156-
if [ ! -d 'Boost-for-Android' ]; then git clone https://github.com/moritz-wundke/Boost-for-Android; fi
157+
if [ ! -d 'Boost-for-Android' ]; then git clone https://github.com/o01eg/Boost-for-Android/; fi
157158
cd Boost-for-Android
158-
git checkout 245ea53385a55742a9ab08a8bd32c6a2dc0bbea4
159+
git checkout 7626dd6f7cab7866dce20e685d4a1b11194366a7
159160
PATH="$PATH:$NDK_DIR" \
160161
CXXFLAGS="-std=gnu++11" \
161162
./build-android.sh \
@@ -186,16 +187,17 @@ if [ "${DO_CMAKE}" == "1" ]; then (
186187
if [ "${DO_CPPRESTSDK}" == "1" ]; then
187188
# Use the builtin CMake toolchain configuration that comes with the NDK
188189
function build_cpprestsdk { (
189-
rm -rf $1
190+
rm -rf $1
190191
./cmake-${CMAKEVER}/bin/cmake \
191192
-DCMAKE_TOOLCHAIN_FILE="${ANDROID_NDK}/build/cmake/android.toolchain.cmake" \
192193
-DANDROID_NDK="${ANDROID_NDK}" \
193194
-DANDROID_TOOLCHAIN=clang \
194195
-DANDROID_ABI=$2 \
195196
-DBOOST_VERSION="${BOOSTVER}" \
197+
-DCPPREST_EXCLUDE_WEBSOCKETS=ON \
196198
-DCMAKE_BUILD_TYPE=$3 \
197-
-S "${DIR}/.." \
198-
-B $1
199+
-S "${DIR}/.." \
200+
-B $1
199201
make -j $NCPU -C $1
200202
) }
201203

Release/tests/functional/http/client/outside_tests.cpp

-71
Original file line numberDiff line numberDiff line change
@@ -290,77 +290,6 @@ SUITE(outside_tests)
290290
});
291291
}
292292
#endif // !defined(__cplusplus_winrt)
293-
294-
TEST_FIXTURE(uri_address, outside_ssl_json)
295-
{
296-
// Create URI for:
297-
// https://www.googleapis.com/youtube/v3/playlistItems?part=snippet&playlistId=UUF1hMUVwlrvlVMjUGOZExgg&key=AIzaSyAviHxf_y0SzNoAq3iKqvWVE4KQ0yylsnk
298-
uri_builder playlistUri(U("https://www.googleapis.com/youtube/v3/playlistItems?"));
299-
playlistUri.append_query(U("part"), U("snippet"));
300-
playlistUri.append_query(U("playlistId"), U("UUF1hMUVwlrvlVMjUGOZExgg"));
301-
playlistUri.append_query(U("key"), U("AIzaSyAviHxf_y0SzNoAq3iKqvWVE4KQ0yylsnk"));
302-
303-
// Send request
304-
web::http::client::http_client playlistClient(playlistUri.to_uri());
305-
306-
handle_timeout([&] {
307-
// Retry up to 4 times.
308-
for (int i = 0; i < 4; ++i)
309-
{
310-
try
311-
{
312-
playlistClient.request(methods::GET)
313-
.then([=](http_response playlistResponse) -> pplx::task<json::value> {
314-
return playlistResponse.extract_json();
315-
})
316-
.then([=](json::value v) {
317-
int count = 0;
318-
auto& obj = v.as_object();
319-
320-
VERIFY_ARE_NOT_EQUAL(obj.find(U("pageInfo")), obj.end());
321-
VERIFY_ARE_NOT_EQUAL(obj.find(U("items")), obj.end());
322-
323-
auto& items = obj[U("items")];
324-
325-
for (auto iter = items.as_array().cbegin(); iter != items.as_array().cend(); ++iter)
326-
{
327-
const auto& item = *iter;
328-
auto iSnippet = item.as_object().find(U("snippet"));
329-
if (iSnippet == item.as_object().end())
330-
{
331-
throw std::runtime_error("snippet key not found");
332-
}
333-
auto iTitle = iSnippet->second.as_object().find(U("title"));
334-
if (iTitle == iSnippet->second.as_object().end())
335-
{
336-
throw std::runtime_error("title key not found");
337-
}
338-
auto name = iTitle->second.serialize();
339-
count++;
340-
}
341-
VERIFY_ARE_EQUAL(3, count); // Update this accordingly, if the number of items changes
342-
})
343-
.wait();
344-
break;
345-
}
346-
catch (web::http::http_exception const& e)
347-
{
348-
#if defined(_MSC_VER) && !defined(__cplusplus_winrt)
349-
if (e.error_code().value() != API_QUERY_DATA_AVAILABLE || i == 3)
350-
{
351-
// If we didn't get a "connection broken" error (or we are on the last retry), rethrow it
352-
throw;
353-
}
354-
#else
355-
(void)e;
356-
throw;
357-
#endif
358-
os_utilities::sleep(1000);
359-
}
360-
}
361-
});
362-
}
363-
364293
} // SUITE(outside_tests)
365294

366295
} // namespace client

Release/tests/functional/json/CMakeLists.txt

-2
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,3 @@ if(UNIX AND NOT APPLE)
1515
cpprest_find_boost()
1616
target_link_libraries(json_test PRIVATE cpprestsdk_boost_internal)
1717
endif()
18-
19-
configure_pch(json_test stdafx.h stdafx.cpp)

Release/tests/functional/json/construction_tests.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
* =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
1212
****/
1313

14-
#include "stdafx.h"
14+
#include "cpprest/json.h"
15+
#include "unittestpp.h"
1516

1617
using namespace web;
1718
using namespace utility;

Release/tests/functional/json/fuzz_tests.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010
* =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
1111
****/
1212

13-
#include "stdafx.h"
14-
13+
#include "cpprest/json.h"
1514
#include "cpprest/containerstream.h"
1615
#include "cpprest/filestream.h"
16+
#include "unittestpp.h"
1717

1818
using namespace web;
1919

Release/tests/functional/json/iterator_tests.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
* =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
1212
****/
1313

14-
#include "stdafx.h"
15-
14+
#include "cpprest/json.h"
15+
#include "unittestpp.h"
1616
#include <algorithm>
1717

1818
using namespace web;

Release/tests/functional/json/json_numbers_tests.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
* =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
1212
****/
1313

14-
#include "stdafx.h"
15-
14+
#include "cpprest/json.h"
15+
#include "unittestpp.h"
1616
#include <clocale>
1717
#include <iomanip>
1818

Release/tests/functional/json/json_tests.h

-25
This file was deleted.

Release/tests/functional/json/negative_parsing_tests.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
* =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
1111
****/
1212

13-
#include "stdafx.h"
13+
#include "cpprest/json.h"
14+
#include "unittestpp.h"
1415

1516
using namespace web;
1617
using namespace utility;

0 commit comments

Comments
 (0)