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

Invoking resolutionStrategy.force Api too many time can led to dependencies chaos #1086

Open
NickHu150 opened this issue Jul 6, 2021 · 0 comments

Comments

@NickHu150
Copy link

NickHu150 commented Jul 6, 2021

We hope our dependencies in project are uniformly managed. so we read a json file with all of the dependencies that we need. And we defined the following code in the gradle plugin

private fun forceAllDependenciesVersions(p: Project, list: List<RemoteDependenciesModel>) { p.configurations.all { c -> if (!c.name.contains("lintChecks")) { c.resolutionStrategy { rs -> list.forEach { remote -> rs.force("${remote.key}:${remote.value}") } } } } }

Json file example

[ { "dependencies": "", "key": "cn.soul.android.app:cpnt-square", "name": "cpnt-square", "value": "3.90.10" }, { "key": "cn.soul.android.lib:mate-lint-rules", "name": "mate-lint-rules", "value": "1.0.3" } ]

Expected Behavior

we need to insure that all dependencies‘ version are equal with json file .

Current Behavior

we encountered a bug that we build for serveral times. then one of the dependencies' version is wrong, and we need to restart mac to solve the issue

Steps to Reproduce (for bugs)

provide a dependencies source list. and make a foreach loop to invoke force api, then there is a certain probability of triggering the bug

Your Environment

Gradle 6.5
AGP 4.1.0

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

No branches or pull requests

1 participant