Skip to content

Commit 6316cf0

Browse files
[POC] Use okhttp for Android network layer
This allows us to enable HTTP/2 support Relates-To: DATASDK-66 Signed-off-by: Andrey Kashcheev <[email protected]>
1 parent ac33d9f commit 6316cf0

File tree

5 files changed

+451
-633
lines changed

5 files changed

+451
-633
lines changed

olp-cpp-sdk-core/cmake/android.cmake

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,28 @@ get_android_jar_path(CMAKE_JAVA_INCLUDE_PATH ANDROID_SDK_ROOT ANDROID_PLATFORM)
4141
set(OLP_SDK_NETWORK_VERSION 0.0.1)
4242
set(OLP_SDK_ANDROID_HTTP_CLIENT_JAR OlpHttpClient)
4343

44+
set(MAVEN_DEPS_OUTPUT ${CMAKE_BINARY_DIR}/maven-deps)
45+
set(ALL_MAVEN_PACKAGES
46+
${MAVEN_DEPS_OUTPUT}/okhttp-4.12.0.jar
47+
${MAVEN_DEPS_OUTPUT}/okio-3.10.2.jar
48+
)
49+
50+
add_custom_command(
51+
OUTPUT ${ALL_MAVEN_PACKAGES}
52+
COMMAND mvn -f ${CMAKE_CURRENT_LIST_DIR}/pom.xml dependency:copy-dependencies -DoutputDirectory=${MAVEN_DEPS_OUTPUT}
53+
COMMENT "Downloading Maven packages"
54+
)
55+
56+
add_custom_target(olp-cpp-sdk-core.maven DEPENDS ${ALL_MAVEN_PACKAGES})
57+
4458
add_jar(${OLP_SDK_ANDROID_HTTP_CLIENT_JAR}
45-
SOURCES ${CMAKE_CURRENT_LIST_DIR}/../src/http/android/HttpClient.java
59+
SOURCES ${CMAKE_CURRENT_LIST_DIR}/../src/http/android/OlpHttpClient.java
4660
VERSION ${OLP_SDK_NETWORK_VERSION}
61+
INCLUDE_JARS ${ALL_MAVEN_PACKAGES}
4762
)
4863

64+
add_dependencies(${OLP_SDK_ANDROID_HTTP_CLIENT_JAR} olp-cpp-sdk-core.maven)
65+
4966
# add_jar() doesn't add the symlink to the version automatically under Windows
5067
if (WIN32)
5168
include(SymlinkHelpers)

olp-cpp-sdk-core/cmake/pom.xml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
3+
<modelVersion>4.0.0</modelVersion>
4+
<groupId>com.here.olp</groupId>
5+
<artifactId>download-jars</artifactId>
6+
<version>1.0-SNAPSHOT</version>
7+
<dependencies>
8+
<dependency>
9+
<groupId>com.squareup.okhttp3</groupId>
10+
<artifactId>okhttp</artifactId>
11+
<version>4.12.0</version>
12+
</dependency>
13+
<dependency>
14+
<groupId>com.squareup.okio</groupId>
15+
<artifactId>okio</artifactId>
16+
<version>3.10.2</version>
17+
</dependency>
18+
</dependencies>
19+
</project>

0 commit comments

Comments
 (0)