Skip to content

Default Android vcpkg builds to Java HTTP#1510

Open
bmehta001 wants to merge 2 commits into
microsoft:mainfrom
bmehta001:bhamehta/android-http-client-option
Open

Default Android vcpkg builds to Java HTTP#1510
bmehta001 wants to merge 2 commits into
microsoft:mainfrom
bmehta001:bhamehta/android-http-client-option

Conversation

@bmehta001

@bmehta001 bmehta001 commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Problem

Android vcpkg builds should not use MATSDK_USE_VCPKG_DEPS to 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

  • Add MATSDK_ANDROID_HTTP_CLIENT=AUTO|JAVA|CURL.
    • On Android, AUTO now resolves to JAVA.
    • CURL remains available as an explicit override.
  • Make Android vcpkg builds default to HttpClient_Android instead of curl.
  • Add explicit Android curl override features:
    • android-curl-openssl
    • android-curl-mbedtls
  • Install the Android Java HTTP bridge sources for vcpkg consumers:
    • HttpClient.java
    • HttpClientRequest.java
  • Export Android HTTP transport metadata from the CMake package config.
  • Update vcpkg documentation for the Java default, Java bridge packaging, AndroidX annotation dependency, and curl escape hatch.
  • Fix Android PAL initializer-order warnings that current NDK Clang reports under -Werror.

Validation

  • Android vcpkg default Java path:
    • vcpkg install cpp-client-telemetry[core,system-sqlite] --triplet arm64-android --overlay-ports=tools/ports
    • Verified the install did not include curl and MATSDK_ANDROID_HTTP_CLIENT=AUTO configured successfully.
  • Android explicit curl override:
    • vcpkg install cpp-client-telemetry[core,android-curl-openssl,system-sqlite] --triplet arm64-android --overlay-ports=tools/ports
    • Verified the configure cache used MATSDK_ANDROID_HTTP_CLIENT=CURL.
  • vcpkg format-manifest tools/ports/cpp-client-telemetry/vcpkg.json
  • Final material code review completed.

Note

The in-repo overlay port now builds the checkout source by default. When publishing this feature to the registry, bump the port REF/SHA512 to a release that contains MATSDK_ANDROID_HTTP_CLIENT.

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
@bmehta001
bmehta001 requested a review from a team as a code owner July 22, 2026 08:04
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
@bmehta001 bmehta001 self-assigned this Jul 22, 2026
@bmehta001 bmehta001 changed the title Add Android HTTP transport selection for vcpkg Default Android vcpkg builds to Java HTTP Jul 22, 2026
@bmehta001
bmehta001 requested a review from Copilot July 22, 2026 22:56

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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|CURL and makes AUTO resolve to JAVA on 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 -Werror warnings.

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")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants