-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make dependency rake account for all version catalogs #435
Conversation
- constructor(objects: ObjectFactory, providers: ProviderFactory) : AbstractPostProcessingTask() {
+ constructor(objects: ObjectFactory, providers: ProviderFactory) : AbstractPostProcessingTask() {
+ if (identifierMap.get().isEmpty()) {
+ logger.warn("No identifier map found. Skipping rake.")
+ enabled = false
+ return
+ }
// Rest of the constructor code
internal fun Project.getVersionsCatalog(name: String = "libs"): VersionCatalog {
return try {
project.extensions.getByType<VersionCatalogsExtension>().named(name)
} catch (ignored: Exception) {
error("No versions catalog found!")
}
}
internal class StandardProjectConfigurations(
private val project: Project,
private val slackProperties: SlackProperties,
private val slackConfigurations: SlackConfigurations,
private val logger: Logger
) {
init {
// Rest of the init code
// Configure rake
project.plugins.withId("com.autonomousapps.dependency-analysis") {
configureRakeDependenciesTask()
}
}
private fun configureRakeDependenciesTask() {
val isNoApi = slackProperties.rakeNoApi
val catalogNames = project.extensions.findByType<VersionCatalogsExtension>()?.catalogNames ?: return
project.tasks.register<RakeDependencies>("rakeDependencies") {
// Rest of the task configuration
}
}
// Rest of the class code
} These changes improve the code by reducing unnecessary checks and simplifying the code structure. |
} | ||
|
||
internal fun Project.getVersionsCatalogOrNull(): VersionCatalog? { | ||
internal fun Project.getVersionsCatalogOrNull(name: String = "libs"): VersionCatalog? { | ||
return try { | ||
project.extensions.getByType<VersionCatalogsExtension>().named("libs") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use "name" instead of hard coded "libs"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
derp
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Resolves #406