Skip to content
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

Provide a dependency mutual exclusion check #150

Open
plaird opened this issue Jun 17, 2022 · 1 comment
Open

Provide a dependency mutual exclusion check #150

plaird opened this issue Jun 17, 2022 · 1 comment

Comments

@plaird
Copy link
Contributor

plaird commented Jun 17, 2022

We have found internally that the springboot rule is a good enforcement chokepoint for catching errors in the dependency graph. the dupe class checker gets a lot of mileage and has caught a number of mistakes for us.

Another check we would like to have is fail if mutually exclusive dependencies are on the classpath (configurable in the workspace as per #78). The reason is we have seen cases where the service owner ended up with mutually exclusive libraries in their spring boot jar. This is often due to transitive dependencies and thus hidden from the service owner.

For example, an internal API had a V1 and V2 versions, and a service should only use one of the other. But in one case both jars were in the service jar by mistake. While it didn't break anything, it surfaced a dependency graph error coming from poor hygiene.

Something like:

springboot(
...
    check_deps_mutualexclusive = [
        # case where external maven jars are brought in, and have different artifactIds
        [ "@maven//:com_acme_anvil_api_v1", "@maven//:com_acme_anvil_api_v2" ],

        # case where workspace packages are exclusive, for example persistence layers
        [ "//projects/acme/relationaldb", "//projects/acme/graphdb", "//projects/acme/csv" ],
    ]
)
@plaird
Copy link
Contributor Author

plaird commented Dec 23, 2024

A major use case of this is the Boot2/Javax/Spring5 to Boot3/Jakarta/Spring6 transitions. We maintain two entire ecosystems of deps (legacy, and modern) while we transition services across. The dupe class checker actually does a pretty good job of detecting cross overs, since base libs like slf4j are different in the ecosystems.

See https://github.com/salesforce/rules_spring/blob/main/springboot/javax.md for additional features built for this use case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant