dropbox / dropbox/dependency-guard

Support "allowedFilter" without a baseline file

Open
#78 2 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Kotlin
Stars
493
Forks
19
PR merge metrics
No merged PRs in 30d

Description

One of the possible use cases of the `dependencyGuard` plugin is to restrict particular dependencies between modules of a multi-module project. For example, to restrict a feature-module as a dependency of a core-module in an Android project.

Such use case can easily be done via `allowedFilter` parameter of the `dependencyGuard` configuration. `dependencyGuard` plugin can be applied in the core-module with `allowedFilter = { !it.startsWith("feature-") }`. But a baseline file will also be created in such case, though it is not needed. For core-module we don't need to guard against dependencies changes, but only against particular dependencies themselves.

From this follows that there may be some configuration of the `dependencyGuard` plugin, that allows to specify `allowedFilter` without a baseline file creation.

One possible solution may be adding special function `noBaseline()`, that can be assigned to `baselineMap` to explicitly specify, that a baseline file is not needed. (using `baselineMap = { null }` for that is less explicit)

```kotlin
dependencyGuard {
configuration("releaseRuntimeClasspath") {
modules = true
allowedFilter = { !it.startsWith("feature-") }
baselineMap = noBaseline()
}
}
```

Another possible solution may be adding parameter `guardDiff` or `baselineFile` (default to `true`), that will control whether a baseline file will be created or not. But this solution has drawbacks:
- such parameter can be messed with parameter `baselineMap`
- it's easy to break guarding against dependencies changes by assigning `baselineFile = false`

```kotlin
dependencyGuard {
configuration("releaseRuntimeClasspath") {
modules = true
allowedFilter = { !it.startsWith("feature-") }
guardDiff = false
}
}
```

IMHO, the first solution is preferred, because it is more explicit.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.