Skip to content

Commit e94d45e

Browse files
committed
Fix macOS compatibility: make lib_c_type=glibc conditional for Linux only
- Add conditional logic to only include lib_c_type=glibc parameter on Linux platforms - macOS doesn't use glibc, so this parameter would cause API queries to return no results - This fixes the two integration test failures that would occur on macOS - Linux systems still get the glibc preference for better compatibility over musl
1 parent d8de275 commit e94d45e

1 file changed

Lines changed: 12 additions & 4 deletions

File tree

  • maven-wrapper-distribution/src/resources

maven-wrapper-distribution/src/resources/only-mvnw

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -195,9 +195,13 @@ resolve_jdk_url() {
195195
fi
196196

197197
# Build Disco API URL for package information (more reliable than direct URI)
198-
# Prefer glibc over musl for better compatibility
199198
# Only get directly downloadable packages to avoid redirect-only entries
200-
_resolve_disco_api_url="${DISCO_API_BASE_URL}/packages?distro=${_resolve_distribution}&javafx_bundled=false&archive_type=${_resolve_archive_type}&operating_system=${_resolve_platform}&package_type=jdk&${_resolve_version_param}&architecture=${_resolve_architecture}&latest=available&release_status=ga&lib_c_type=glibc&directly_downloadable=true"
199+
# Add lib_c_type=glibc only for Linux to prefer glibc over musl
200+
_resolve_lib_c_param=""
201+
if [ "${_resolve_platform}" = "linux" ]; then
202+
_resolve_lib_c_param="&lib_c_type=glibc"
203+
fi
204+
_resolve_disco_api_url="${DISCO_API_BASE_URL}/packages?distro=${_resolve_distribution}&javafx_bundled=false&archive_type=${_resolve_archive_type}&operating_system=${_resolve_platform}&package_type=jdk&${_resolve_version_param}&architecture=${_resolve_architecture}&latest=available&release_status=ga${_resolve_lib_c_param}&directly_downloadable=true"
201205

202206
verbose "Resolving JDK download URL from Disco API: $_resolve_disco_api_url"
203207

@@ -340,9 +344,13 @@ get_latest_version_from_disco() {
340344
esac
341345

342346
# Query Disco API for the latest version
343-
# Prefer glibc over musl for better compatibility
344347
# Only get directly downloadable packages to avoid redirect-only entries
345-
disco_api_url="${DISCO_API_BASE_URL}/packages?distro=${distribution}&package_type=jdk&jdk_version=${major_version}&operating_system=${platform}&architecture=${architecture}&archive_type=${archive_type}&latest=available&release_status=ga&lib_c_type=glibc&directly_downloadable=true"
348+
# Add lib_c_type=glibc only for Linux to prefer glibc over musl
349+
lib_c_param=""
350+
if [ "${platform}" = "linux" ]; then
351+
lib_c_param="&lib_c_type=glibc"
352+
fi
353+
disco_api_url="${DISCO_API_BASE_URL}/packages?distro=${distribution}&package_type=jdk&jdk_version=${major_version}&operating_system=${platform}&architecture=${architecture}&archive_type=${archive_type}&latest=available&release_status=ga${lib_c_param}&directly_downloadable=true"
346354

347355
verbose "Querying Disco API for JDK versions: $disco_api_url"
348356

0 commit comments

Comments
 (0)