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

Add support for predeclared dependencies. #1039

Merged
merged 13 commits into from
Dec 23, 2021
Merged

Add support for predeclared dependencies. #1039

merged 13 commits into from
Dec 23, 2021

Conversation

nedtwigg
Copy link
Member

@nedtwigg nedtwigg commented Dec 16, 2021

Starting in 6.0, dependencies are now resolved from project repositories rather than buildscript repositories. That fixed some things, but broke other things. In this PR, we add the ability to fix everything by predeclaring your formatters in the root project.

spotless {
  ...
  predeclareDeps()
}
spotlessPredeclare {
  java { eclipse() }
  kotlin { ktfmt('0.28') }
}

Alternatively, you can also use predeclareDepsFromBuildscript() to resolve the dependencies from the buildscript repositories rather than the project repositories.

If you use this feature, you will get an error if you use a formatter in a subproject which is not declared in the spotlessPredeclare block.

Fixes #1026, #1027, #1028, #1032, #1034, and #1042, by implementing #984

@JavierSegoviaCordoba
Copy link
Contributor

What about repositories being set in dependencyResolutionManagement in settings file?

@nedtwigg
Copy link
Member Author

That's a good question. I think they get hit by predeclareDepsFromBuildscript, which works like so.

static Provisioner forRootProjectBuildscript(Project project) {
Project rootProject = project.getRootProject();
ScriptHandler buildscript = rootProject.getBuildscript();
return forConfigurationContainer(rootProject, buildscript.getConfigurations(), buildscript.getDependencies());
}

If they don't get hit, I'm not sure how to hit them, but I'm open to a PR to add another mode or have them get included in the predeclareDepsFromBuildscript mode.

@nedtwigg nedtwigg merged commit 804a73a into main Dec 23, 2021
@nedtwigg nedtwigg deleted the feat/dep-fixup branch December 23, 2021 20:47
@nedtwigg
Copy link
Member Author

Published in plugin-gradle 6.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

Successfully merging this pull request may close these issues.

6.0.2 -> 6.0.4: Not building project
2 participants