com.autonomousapps.extension.UsagesHandler.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of dependency-analysis-gradle-plugin Show documentation
Show all versions of dependency-analysis-gradle-plugin Show documentation
Analyzes dependency usage in Android and JVM projects
// Copyright (c) 2024. Tony Robalik.
// SPDX-License-Identifier: Apache-2.0
@file:Suppress("unused", "MemberVisibilityCanBePrivate")
package com.autonomousapps.extension
import org.gradle.api.Action
import org.gradle.api.model.ObjectFactory
import org.gradle.kotlin.dsl.newInstance
import org.gradle.kotlin.dsl.setProperty
import org.intellij.lang.annotations.Language
import javax.inject.Inject
/**
* ```
* dependencyAnalysis {
* usages {
* exclusions {
* excludeClasses(".*\\.internal\\..*")
* }
* }
* }
* ```
*/
abstract class UsagesHandler @Inject constructor(objects: ObjectFactory) {
internal val exclusionsHandler: UsagesExclusionsHandler = objects.newInstance()
fun exclusions(action: Action) {
action.execute(exclusionsHandler)
}
}
abstract class UsagesExclusionsHandler @Inject constructor(objects: ObjectFactory) {
internal val classExclusions = objects.setProperty().convention(emptySet())
fun excludeClasses(@Language("RegExp") vararg classRegexes: String) {
classExclusions.addAll(*classRegexes)
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy