Skip to content

Commit

Permalink
Add intellijRepository to the beginning of the repositories list wh…
Browse files Browse the repository at this point in the history
…en resolving dependencies #615
  • Loading branch information
hsz committed May 16, 2022
1 parent ae70e23 commit 1232366
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
- Set `-Djdk.module.illegalAccess.silent=true` flag by default to mute `WARNING: An illegal reflective access operation has occurred`
- `instrumentCode` task – incremental instrumentation [#459](../../issues/459)
- Release `plugin.xml` file after reading it [IDEA-291836](https://youtrack.jetbrains.com/issue/IDEA-291836)
- Add `intellijRepository` to the beginning of the repositories list when resolving dependencies [#615](../../issues/615)

## 1.5.3
- Updated dependencies marked as vulnerable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ interface MavenRepository : PluginsRepository {

fun postResolve(project: Project, func: () -> Unit) {
if (resolvedDependency) {
return func.invoke()
return func()
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,15 @@ open class DependenciesDownloader @Inject constructor(
repositoriesBlock: RepositoryHandler.() -> List<ArtifactRepository>,
silent: Boolean = false,
): List<File> {
val dependency = dependenciesBlock.invoke(dependencyHandler)
val repositories = repositoriesBlock.invoke(repositoryHandler) + repositoryHandler.mavenCentral()
val dependency = dependenciesBlock(dependencyHandler)
val baseRepositories = with (repositoryHandler) {
toList().also {
clear()
repositoriesBlock(this)
mavenCentral()
addAll(it)
}
}

try {
return configurationContainer.detachedConfiguration(dependency).files.toList()
Expand All @@ -44,7 +51,10 @@ open class DependenciesDownloader @Inject constructor(
}
throw e
} finally {
repositoryHandler.removeAll(repositories.toSet())
with (repositoryHandler) {
clear()
addAll(baseRepositories)
}
}
}
}
Expand Down

0 comments on commit 1232366

Please sign in to comment.