From 0dfccda4658038790d3e630d96e2279f9171a224 Mon Sep 17 00:00:00 2001 From: Daniel Alome Date: Sun, 12 Jul 2026 23:29:08 +0100 Subject: [PATCH] ADFA-3678: Remove dead Sonatype OSSRH snapshot version looku --- .../androidide/build/config/ProjectConfig.kt | 4 +- .../androidide/build/config/VersionUtils.kt | 46 ------------------- settings.gradle.kts | 2 - 3 files changed, 1 insertion(+), 51 deletions(-) diff --git a/composite-builds/build-logic/common/src/main/java/com/itsaky/androidide/build/config/ProjectConfig.kt b/composite-builds/build-logic/common/src/main/java/com/itsaky/androidide/build/config/ProjectConfig.kt index 07b31171fc..87ee78efa3 100644 --- a/composite-builds/build-logic/common/src/main/java/com/itsaky/androidide/build/config/ProjectConfig.kt +++ b/composite-builds/build-logic/common/src/main/java/com/itsaky/androidide/build/config/ProjectConfig.kt @@ -149,8 +149,6 @@ val Project.downloadVersion: String return if (CI.isCiBuild || isFDroidBuild) { publishingVersion } else { - // sometimes, when working locally, Gradle fails to download the latest snapshot version - // this may cause issues while initializing the project in AndroidIDE - VersionUtils.getLatestSnapshotVersion("gradle-plugin") + VersionUtils.LATEST_INTEGRATION } } diff --git a/composite-builds/build-logic/common/src/main/java/com/itsaky/androidide/build/config/VersionUtils.kt b/composite-builds/build-logic/common/src/main/java/com/itsaky/androidide/build/config/VersionUtils.kt index b836a7de85..54d2d2e9ad 100644 --- a/composite-builds/build-logic/common/src/main/java/com/itsaky/androidide/build/config/VersionUtils.kt +++ b/composite-builds/build-logic/common/src/main/java/com/itsaky/androidide/build/config/VersionUtils.kt @@ -17,12 +17,6 @@ package com.itsaky.androidide.build.config -import org.gradle.api.GradleException -import java.io.BufferedInputStream -import java.net.URI -import javax.xml.parsers.DocumentBuilderFactory -import javax.xml.xpath.XPathFactory - /** * @author Akash Yadav */ @@ -41,44 +35,4 @@ object VersionUtils { * The latest integration version name. */ const val LATEST_INTEGRATION = "latest.integration" - - /** - * The cached version name. - */ - private var cachedVersion: String? = null - - /** - * Gets the latest snapshot version of the given artifact from the Sonatype snapshots repository. - */ - @JvmStatic - fun getLatestSnapshotVersion(artifact: String): String { - cachedVersion?.also { cached -> - println("Found latest version of artifact '$artifact' : '$cached' (cached)") - return cached - } - - val groupId = BuildConfig.PACKAGE_NAME.replace('.', '/') - val moduleMetadata = "$SONATYPE_SNAPSHOTS_REPO$groupId/$artifact/maven-metadata.xml" - return try { - BufferedInputStream(URI.create(moduleMetadata).toURL().openStream()).use { inputStream -> - val builderFactory = DocumentBuilderFactory.newInstance() - val builder = builderFactory.newDocumentBuilder() - val document = builder.parse(inputStream) - - val xPathFactory = XPathFactory.newInstance() - val xPath = xPathFactory.newXPath() - - val latestVersion = xPath.evaluate("/metadata/versioning/latest", document) - cachedVersion = latestVersion - println("Found latest version of artifact '$artifact' : '$latestVersion'") - return@use latestVersion - } - } catch (err: Throwable) { - if (CI.isCiBuild) { - throw GradleException("Failed to download: $moduleMetadata", err) - } - println("Failed to download $moduleMetadata: ${err.message}") - return LATEST_INTEGRATION - } - } } diff --git a/settings.gradle.kts b/settings.gradle.kts index 9cdf548b86..25ccd95281 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -75,8 +75,6 @@ dependencyResolutionManagement { repositories { google() mavenCentral() - maven { url = uri("https://s01.oss.sonatype.org/content/repositories/snapshots/") } - maven { url = uri("https://s01.oss.sonatype.org/content/groups/public/") } maven { url = uri("https://jitpack.io") } } }