Skip to content

Commit c36967c

Browse files
authored
[Build] Reapply updating to Gradle 8.11.1 (#117394) (#117427)
This reverts commit b5c6d92. * Simplify and fix dynamic project dependency handling (cherry picked from commit d2b3dc5)
1 parent cd316cb commit c36967c

File tree

3 files changed

+6
-13
lines changed

3 files changed

+6
-13
lines changed

build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/ElasticsearchJavadocPlugin.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
import org.gradle.api.artifacts.Configuration;
1919
import org.gradle.api.artifacts.Dependency;
2020
import org.gradle.api.artifacts.ProjectDependency;
21-
import org.gradle.api.internal.artifacts.dependencies.ProjectDependencyInternal;
2221
import org.gradle.api.plugins.BasePluginExtension;
2322
import org.gradle.api.plugins.JavaPlugin;
2423
import org.gradle.api.tasks.javadoc.Javadoc;
@@ -88,7 +87,7 @@ private void configureJavadocForConfiguration(Project project, boolean shadow, C
8887

8988
private void configureDependency(Project project, boolean shadowed, ProjectDependency dep) {
9089
// we should use variant aware dependency management to resolve artifacts required for javadoc here
91-
Project upstreamProject = project.project(((ProjectDependencyInternal) dep).getIdentityPath().getPath());
90+
Project upstreamProject = project.project(dep.getPath());
9291
if (upstreamProject == null) {
9392
return;
9493
}

build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/test/TestWithDependenciesPlugin.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
import org.gradle.api.artifacts.dsl.DependencyHandler;
1919
import org.gradle.api.attributes.Attribute;
2020
import org.gradle.api.attributes.LibraryElements;
21-
import org.gradle.api.internal.artifacts.dependencies.ProjectDependencyInternal;
2221
import org.gradle.api.plugins.ExtraPropertiesExtension;
2322
import org.gradle.api.tasks.Copy;
2423
import org.gradle.api.tasks.SourceSetContainer;
@@ -69,10 +68,7 @@ private static void addPluginResources(final Project project, final ProjectDepen
6968
project.getObjects().named(LibraryElements.class, LibraryElements.RESOURCES)
7069
);
7170
DependencyHandler dependencyHandler = project.getDependencies();
72-
ProjectDependencyInternal pluginProject = (ProjectDependencyInternal) projectDependency;
73-
74-
String path = pluginProject.getIdentityPath().getPath();
75-
Dependency pluginMetadataDependency = dependencyHandler.project(Map.of("path", path));
71+
Dependency pluginMetadataDependency = dependencyHandler.project(Map.of("path", projectDependency.getPath()));
7672
dependencyHandler.add(metadataConfiguration, pluginMetadataDependency);
7773
project.getTasks().register(taskName, Copy.class, copy -> {
7874
copy.into(outputDir);

build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/test/rest/RestTestBasePlugin.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ private void copyDependencies(Project project, DependencySet dependencies, Confi
246246
configuration.getDependencies()
247247
.stream()
248248
.filter(d -> d instanceof ProjectDependency)
249-
.map(d -> project.getDependencies().project(Map.of("path", ((ProjectDependencyInternal) d).getIdentityPath().getPath())))
249+
.map(d -> project.getDependencies().project(Map.of("path", ((ProjectDependencyInternal) d).getPath())))
250250
.forEach(dependencies::add);
251251
}
252252

@@ -325,9 +325,7 @@ private Configuration createPluginConfiguration(Project project, String name, bo
325325
Dependency dependency = iterator.next();
326326
// this logic of relying on other projects metadata should probably live in a build service
327327
if (dependency instanceof ProjectDependency projectDependency) {
328-
Project dependencyProject = project.project(
329-
((ProjectDependencyInternal) projectDependency).getIdentityPath().getPath()
330-
);
328+
Project dependencyProject = project.project(projectDependency.getPath());
331329
List<String> extendedPlugins = dependencyProject.getExtensions()
332330
.getByType(PluginPropertiesExtension.class)
333331
.getExtendedPlugins();
@@ -337,8 +335,8 @@ private Configuration createPluginConfiguration(Project project, String name, bo
337335
iterator.remove();
338336
additionalDependencies.add(
339337
useExploded
340-
? getExplodedBundleDependency(project, dependencyProject.getPath())
341-
: getBundleZipTaskDependency(project, dependencyProject.getPath())
338+
? getExplodedBundleDependency(project, projectDependency.getPath())
339+
: getBundleZipTaskDependency(project, projectDependency.getPath())
342340
);
343341
}
344342

0 commit comments

Comments
 (0)