Skip to content

Commit

Permalink
Apply com.gradle.develocity plugin when the conventions are applied
Browse files Browse the repository at this point in the history
Closes gh-92
  • Loading branch information
wilkinsona committed Sep 11, 2024
1 parent 0e8f00f commit 6e5f3a1
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 7 deletions.
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,12 +118,11 @@ pluginManagement {

In the example above, `gradlePluginPortal()` is declared to allow other plugins to continue to be resolved from the portal.

Now apply the plugin in `settings.gradle`, alongside the `com.gradle.develocity` plugin:
Now apply the plugin in `settings.gradle`:

```groovy
plugins {
// …
id "com.gradle.develocity" version "<<version>>"
id "io.spring.develocity.conventions" version "<<version>>"
// …
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ public DevelocityConventionsPlugin(ProcessOperations processOperations) {

@Override
public void apply(Settings settings) {
settings.getPlugins().apply(DevelocityPlugin.class);
DevelocityConfiguration extension = settings.getExtensions().getByType(DevelocityConfiguration.class);
settings.getPlugins()
.withType(DevelocityPlugin.class, (plugin) -> configureBuildScanConventions(extension,
extension.getBuildScan(), settings.getStartParameter(), settings.getRootDir()));
configureBuildScanConventions(extension, extension.getBuildScan(), settings.getStartParameter(),
settings.getRootDir());
if (settings.getStartParameter().isBuildCacheEnabled()) {
settings.buildCache((buildCacheConfiguration) -> new BuildCacheConventions()
.execute(new GradleConfigurableBuildCache(extension.getBuildCache(), buildCacheConfiguration)));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ private void prepareProject(File projectDir) {
write(new File(projectDir, "gradle.properties"), (writer) -> writer.println("org.gradle.caching=true"));
write(new File(projectDir, "settings.gradle"), (writer) -> {
writer.println("plugins {");
writer.println(" id 'com.gradle.develocity'");
writer.println(" id 'io.spring.develocity.conventions' version '" + version() + "'");
writer.println("}");
writer.println("gradle.afterProject { project -> project.ext['settings'] = settings }");
Expand All @@ -129,7 +128,6 @@ private void prepareMultiModuleProject(File projectDir) {
write(new File(projectDir, "gradle.properties"), (writer) -> writer.println("org.gradle.caching=true"));
write(new File(projectDir, "settings.gradle"), (writer) -> {
writer.println("plugins {");
writer.println(" id 'com.gradle.develocity'");
writer.println(" id 'io.spring.develocity.conventions' version '" + version() + "'");
writer.println("}");
writer.println("include 'sub'");
Expand Down

0 comments on commit 6e5f3a1

Please sign in to comment.