Skip to content

Commit

Permalink
Merge pull request #59 from Yelp/fix-58-plugin-discovery-script
Browse files Browse the repository at this point in the history
Fix Gradle Portal URL in settings.gradle.kts breaking Gradle syncs
  • Loading branch information
Benoit Vermont authored Aug 1, 2019
2 parents 14a4279 + b8f78b9 commit ed70186
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,16 @@ fun pluginIsInstalled(): Boolean {
.filterIsInstance<MavenArtifactRepository>()
.any {
try {
URL("${it.url}$path").openStream().use { stream ->
// Gradle portal is exposing a wrong URL:
// https://plugins.gradle.org/m2
// The trailing slash is missing and this is breaking
// URL composition and plugin discovery.
var baseUrlString = it.url.toString()
if (!baseUrlString.endsWith("/")) {
baseUrlString = baseUrlString.plus("/")
}
val baseUrl = URL(baseUrlString)
URL(baseUrl, path).openStream().use { stream ->
return@any stream.read() >= 0
}
} catch (ignored: java.io.IOException) {
Expand Down

0 comments on commit ed70186

Please sign in to comment.