Skip to content

Commit

Permalink
GH-2275 Fix plugin loader after recent changes in file api (Fix #2275)
Browse files Browse the repository at this point in the history
  • Loading branch information
dzikoysk committed Nov 22, 2024
1 parent 3f97269 commit 2bf2753
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
11 changes: 7 additions & 4 deletions reposilite-backend/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -115,12 +115,12 @@ dependencies {
val httpClient = "1.45.1"
implementation("com.google.http-client:google-http-client:$httpClient") {
exclude(group = "commons-codec", module = "commons-codec")
exclude(group = "com.google.guava", module = "guava")
}
api("commons-codec:commons-codec:1.17.1")
api("com.google.guava:guava:33.3.1-android")
testImplementation("com.google.http-client:google-http-client-jackson2:$httpClient")

val commonsCoded = "1.17.1"
api("commons-codec:commons-codec:$commonsCoded")

val jansi = "2.4.1"
implementation("org.fusesource.jansi:jansi:$jansi")

Expand All @@ -135,12 +135,15 @@ dependencies {
implementation("org.tinylog:tinylog-impl:$tinylog")

val testcontainers = "1.20.4"
testImplementation("org.testcontainers:postgresql:$testcontainers")
testImplementation("org.testcontainers:mariadb:$testcontainers")
testImplementation("org.testcontainers:testcontainers:$testcontainers")
testImplementation("org.testcontainers:junit-jupiter:$testcontainers")
testImplementation("org.testcontainers:localstack:$testcontainers")
testImplementation("org.testcontainers:mysql:$testcontainers")
testImplementation("org.testcontainers:postgresql:$testcontainers") {
exclude(group = "org.apache.commons", module = "commons-compress")
}
testImplementation("org.apache.commons:commons-compress:1.27.1")

val ldap = "7.0.1"
testImplementation("com.unboundid:unboundid-ldapsdk:$ldap")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,9 @@ class Extensions(private val journalist: Journalist) : Journalist {

@Suppress("UNCHECKED_CAST")
fun <F : Facade> facade(type: Class<F>): F =
getFacades().find { type.isInstance(it) }!! as F
getFacades()
.find { type.isInstance(it) } as? F
?: throw IllegalStateException("Facade ${type.name} not found")

fun getFacades(): Collection<Facade> =
facades.toList()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ class PluginLoader(
extensions.logger.debug("Plugins directory: ${pluginsDirectory.absolute()}")

pluginsDirectory.useDirectoryEntries { pluginDirectoryStream ->
pluginDirectoryStream.filter { it.extension == ".jar" }
pluginDirectoryStream
.filter { it.extension == "jar" }
.filter { isValidJarFile(it.toFile()) }
.map { it.toUri().toURL() }
.toList()
Expand Down

0 comments on commit 2bf2753

Please sign in to comment.