Default Android vcpkg builds to Java HTTP#1510
Open
bmehta001 wants to merge 2 commits into
Open
Conversation
Decouple Android HTTP transport choice from MATSDK_USE_VCPKG_DEPS so consumers can use vcpkg-provided native dependencies while still packaging the Java/JNI transport. Files changed: - CMakeLists.txt, lib/CMakeLists.txt, cmake/MSTelemetryConfig.cmake.in: add MATSDK_ANDROID_HTTP_CLIENT and export Android Java source metadata. - tools/ports/cpp-client-telemetry/*, docs/building-with-vcpkg.md: add android-java-http feature, source guard, and consumer documentation. - lib/pal/posix/*_Android.cpp: align initializer order for current NDK Clang builds. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: b12c5862-01e3-45e4-bf91-6389c20cae41
Make Android AUTO select the Java/JNI HTTP transport regardless of dependency sourcing, and require explicit android-curl-* features for native curl. Files changed: - CMakeLists.txt: resolve Android AUTO to JAVA. - tools/ports/cpp-client-telemetry/portfile.cmake: use the in-repo checkout for overlay builds and add explicit Android curl feature handling. - tools/ports/cpp-client-telemetry/vcpkg.json: move Android curl to explicit android-curl-openssl/android-curl-mbedtls features. - docs/building-with-vcpkg.md: document Java default and curl escape hatch. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: b12c5862-01e3-45e4-bf91-6389c20cae41
Contributor
There was a problem hiding this comment.
Pull request overview
This pull request updates the Android vcpkg build defaults to use the Java/JNI HTTP transport (instead of implicitly selecting curl based on vcpkg dependency mode), while keeping native curl available as an explicit Android-only escape hatch.
Changes:
- Introduces
MATSDK_ANDROID_HTTP_CLIENT=AUTO|JAVA|CURLand makesAUTOresolve toJAVAon Android, wiring this through both CMake and the vcpkg port. - Splits Android curl selection into explicit vcpkg features (
android-curl-openssl,android-curl-mbedtls) and installs the Java bridge sources for vcpkg consumers when Java transport is selected. - Updates vcpkg documentation and fixes Android PAL constructor initializer ordering to address new
-Werrorwarnings.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| tools/ports/cpp-client-telemetry/vcpkg.json | Adds Android-specific curl override features; refines Linux curl feature platform scoping; keeps defaults oriented to Linux. |
| tools/ports/cpp-client-telemetry/portfile.cmake | Selects MATSDK_ANDROID_HTTP_CLIENT for Android vcpkg builds and validates feature combinations (Linux vs Android curl features). |
| lib/pal/posix/SystemInformationImpl_Android.cpp | Reorders initializer list to match member declaration order (avoids -Wreorder warnings). |
| lib/pal/posix/NetworkInformationImpl_Android.cpp | Reorders initializer list for -Wreorder (and touches Android network cost initialization). |
| lib/pal/posix/DeviceInformationImpl_Android.cpp | Reorders initializer list for -Wreorder. |
| lib/CMakeLists.txt | Switches Android source selection between HttpClient_Android and curl based on the resolved Android transport; installs Java bridge sources for vcpkg Java transport. |
| docs/building-with-vcpkg.md | Documents Android Java default, curl escape hatch, installed Java bridge source location, and AndroidX annotation dependency. |
| CMakeLists.txt | Adds the MATSDK_ANDROID_HTTP_CLIENT option, resolves AUTO to JAVA on Android, and updates curl-need logic to depend on the resolved Android transport. |
| cmake/MSTelemetryConfig.cmake.in | Exports Android HTTP transport metadata and Java source directory from the installed CMake package config. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
44
to
47
| NetworkInformationImpl::NetworkInformationImpl(IRuntimeConfig& configuration) : | ||
| m_info_helper(), | ||
| m_cost(NetworkCost_Unknown), | ||
| m_info_helper(), | ||
| m_isNetDetectEnabled(configuration[CFG_BOOL_ENABLE_NET_DETECT]){}; |
Comment on lines
54
to
57
| DeviceInformationImpl::DeviceInformationImpl(IRuntimeConfig& configuration) : | ||
| m_info_helper(), | ||
| m_powerSource(PowerSource_Battery) | ||
| m_powerSource(PowerSource_Battery), | ||
| m_info_helper() | ||
| {} |
Comment on lines
+30
to
+33
| set(MSTelemetry_ANDROID_HTTP_CLIENT "@MATSDK_ANDROID_HTTP_CLIENT_RESOLVED@") | ||
| set(MSTelemetry_ANDROID_JAVA_SOURCE_DIR | ||
| "${PACKAGE_PREFIX_DIR}/@CMAKE_INSTALL_DATADIR@/cpp-client-telemetry/android/java") | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Android vcpkg builds should not use
MATSDK_USE_VCPKG_DEPSto decide the HTTP transport. Dependency sourcing and transport selection are separate concerns.Android apps already package Java/JNI integration for platform context, device/system/network/power state, cache path, and lifecycle. The Android Java HTTP bridge is therefore the right default transport. Native curl is still useful as an explicit escape hatch for unusual native-only Android consumers.
Changes
MATSDK_ANDROID_HTTP_CLIENT=AUTO|JAVA|CURL.AUTOnow resolves toJAVA.CURLremains available as an explicit override.HttpClient_Androidinstead of curl.android-curl-opensslandroid-curl-mbedtlsHttpClient.javaHttpClientRequest.java-Werror.Validation
vcpkg install cpp-client-telemetry[core,system-sqlite] --triplet arm64-android --overlay-ports=tools/portsMATSDK_ANDROID_HTTP_CLIENT=AUTOconfigured successfully.vcpkg install cpp-client-telemetry[core,android-curl-openssl,system-sqlite] --triplet arm64-android --overlay-ports=tools/portsMATSDK_ANDROID_HTTP_CLIENT=CURL.vcpkg format-manifest tools/ports/cpp-client-telemetry/vcpkg.jsonNote
The in-repo overlay port now builds the checkout source by default. When publishing this feature to the registry, bump the port
REF/SHA512to a release that containsMATSDK_ANDROID_HTTP_CLIENT.