Skip to content

Commit 0dfccda

Browse files
committed
ADFA-3678: Remove dead Sonatype OSSRH snapshot version looku
1 parent 232cec2 commit 0dfccda

3 files changed

Lines changed: 1 addition & 51 deletions

File tree

‎composite-builds/build-logic/common/src/main/java/com/itsaky/androidide/build/config/ProjectConfig.kt‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -149,8 +149,6 @@ val Project.downloadVersion: String
149149
return if (CI.isCiBuild || isFDroidBuild) {
150150
publishingVersion
151151
} else {
152-
// sometimes, when working locally, Gradle fails to download the latest snapshot version
153-
// this may cause issues while initializing the project in AndroidIDE
154-
VersionUtils.getLatestSnapshotVersion("gradle-plugin")
152+
VersionUtils.LATEST_INTEGRATION
155153
}
156154
}

‎composite-builds/build-logic/common/src/main/java/com/itsaky/androidide/build/config/VersionUtils.kt‎

Lines changed: 0 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,6 @@
1717

1818
package com.itsaky.androidide.build.config
1919

20-
import org.gradle.api.GradleException
21-
import java.io.BufferedInputStream
22-
import java.net.URI
23-
import javax.xml.parsers.DocumentBuilderFactory
24-
import javax.xml.xpath.XPathFactory
25-
2620
/**
2721
* @author Akash Yadav
2822
*/
@@ -41,44 +35,4 @@ object VersionUtils {
4135
* The latest integration version name.
4236
*/
4337
const val LATEST_INTEGRATION = "latest.integration"
44-
45-
/**
46-
* The cached version name.
47-
*/
48-
private var cachedVersion: String? = null
49-
50-
/**
51-
* Gets the latest snapshot version of the given artifact from the Sonatype snapshots repository.
52-
*/
53-
@JvmStatic
54-
fun getLatestSnapshotVersion(artifact: String): String {
55-
cachedVersion?.also { cached ->
56-
println("Found latest version of artifact '$artifact' : '$cached' (cached)")
57-
return cached
58-
}
59-
60-
val groupId = BuildConfig.PACKAGE_NAME.replace('.', '/')
61-
val moduleMetadata = "$SONATYPE_SNAPSHOTS_REPO$groupId/$artifact/maven-metadata.xml"
62-
return try {
63-
BufferedInputStream(URI.create(moduleMetadata).toURL().openStream()).use { inputStream ->
64-
val builderFactory = DocumentBuilderFactory.newInstance()
65-
val builder = builderFactory.newDocumentBuilder()
66-
val document = builder.parse(inputStream)
67-
68-
val xPathFactory = XPathFactory.newInstance()
69-
val xPath = xPathFactory.newXPath()
70-
71-
val latestVersion = xPath.evaluate("/metadata/versioning/latest", document)
72-
cachedVersion = latestVersion
73-
println("Found latest version of artifact '$artifact' : '$latestVersion'")
74-
return@use latestVersion
75-
}
76-
} catch (err: Throwable) {
77-
if (CI.isCiBuild) {
78-
throw GradleException("Failed to download: $moduleMetadata", err)
79-
}
80-
println("Failed to download $moduleMetadata: ${err.message}")
81-
return LATEST_INTEGRATION
82-
}
83-
}
8438
}

‎settings.gradle.kts‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,6 @@ dependencyResolutionManagement {
7575
repositories {
7676
google()
7777
mavenCentral()
78-
maven { url = uri("https://s01.oss.sonatype.org/content/repositories/snapshots/") }
79-
maven { url = uri("https://s01.oss.sonatype.org/content/groups/public/") }
8078
maven { url = uri("https://jitpack.io") }
8179
}
8280
}

0 commit comments

Comments
 (0)