Skip to content

Commit

Permalink
[Build] Cache spotless p2 dependencies when baking ci image (elastic…
Browse files Browse the repository at this point in the history
…#118523)

The eclipse formatter used by spotless is resolved at runtime and not declared as
gradle dependency. Therefore we need to run the spotless task to ensure we have
the dependencies resolved as part of our ci image baking.

This should avoid issues with connecting to p2 repos we have experienced lately
in our ci environment

* Revert "[Build] Declare mirror for eclipse p2 repository (elastic#117732)"

This reverts commit c35777a.
  • Loading branch information
breskeby authored Dec 12, 2024
1 parent 555ff55 commit 9503afc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
import org.gradle.api.Project;

import java.io.File;
import java.util.Arrays;
import java.util.Map;

/**
* This plugin configures formatting for Java source using Spotless
Expand Down Expand Up @@ -66,8 +64,7 @@ public void apply(Project project) {
java.importOrderFile(new File(elasticsearchWorkspace, importOrderPath));

// Most formatting is done through the Eclipse formatter
java.eclipse().withP2Mirrors(Map.of("https://download.eclipse.org/", "https://mirror.umd.edu/eclipse/"))
.configFile(new File(elasticsearchWorkspace, formatterConfigPath));
java.eclipse().configFile(new File(elasticsearchWorkspace, formatterConfigPath));

// Ensure blank lines are actually empty. Since formatters are applied in
// order, apply this one last, otherwise non-empty blank lines can creep
Expand Down
5 changes: 4 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,10 @@ allprojects {
if (project.path.contains(":distribution:docker")) {
enabled = false
}

if (project.path.contains(":libs:cli")) {
// ensure we resolve p2 dependencies for the spotless eclipse formatter
dependsOn "spotlessJavaCheck"
}
}

plugins.withId('lifecycle-base') {
Expand Down

0 comments on commit 9503afc

Please sign in to comment.