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

[8.17] [Build] Rework internal build plugin plugin to work with Isolated Projects (#123461) #124995

Merged
merged 1 commit into from
Mar 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,7 @@
import org.elasticsearch.gradle.internal.test.HistoricalFeaturesMetadataPlugin;
import org.elasticsearch.gradle.plugin.PluginBuildPlugin;
import org.elasticsearch.gradle.plugin.PluginPropertiesExtension;
import org.elasticsearch.gradle.testclusters.ElasticsearchCluster;
import org.elasticsearch.gradle.testclusters.TestClustersPlugin;
import org.elasticsearch.gradle.util.GradleUtils;
import org.gradle.api.NamedDomainObjectContainer;
import org.gradle.api.Plugin;
import org.gradle.api.Project;

Expand Down Expand Up @@ -81,29 +78,6 @@ public void doCall() {
if (isModule == false || isXPackModule) {
addNoticeGeneration(project, extension);
}
project.afterEvaluate(p -> {
@SuppressWarnings("unchecked")
NamedDomainObjectContainer<ElasticsearchCluster> testClusters = (NamedDomainObjectContainer<ElasticsearchCluster>) project
.getExtensions()
.getByName(TestClustersPlugin.EXTENSION_NAME);
p.getExtensions().getByType(PluginPropertiesExtension.class).getExtendedPlugins().forEach(pluginName -> {
// Auto add any dependent modules
findModulePath(project, pluginName).ifPresent(
path -> testClusters.configureEach(elasticsearchCluster -> elasticsearchCluster.module(path))
);
});
});
}

Optional<String> findModulePath(Project project, String pluginName) {
return project.getRootProject()
.getAllprojects()
.stream()
.filter(p -> GradleUtils.isModuleProject(p.getPath()))
.filter(p -> p.getPlugins().hasPlugin(PluginBuildPlugin.class))
.filter(p -> p.getExtensions().getByType(PluginPropertiesExtension.class).getName().equals(pluginName))
.findFirst()
.map(Project::getPath);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,6 @@ private static ListMultimap<Class<?>, String> createLegacyRestTestBasePluginUsag
map.put(LegacyRestTestBasePlugin.class, ":plugins:discovery-ec2");
map.put(LegacyRestTestBasePlugin.class, ":plugins:discovery-gce");
map.put(LegacyRestTestBasePlugin.class, ":plugins:mapper-annotated-text");
map.put(LegacyRestTestBasePlugin.class, ":plugins:mapper-murmur3");
map.put(LegacyRestTestBasePlugin.class, ":plugins:repository-hdfs");
map.put(LegacyRestTestBasePlugin.class, ":plugins:store-smb");
map.put(LegacyRestTestBasePlugin.class, ":qa:ccs-rolling-upgrade-remote-cluster");
map.put(LegacyRestTestBasePlugin.class, ":qa:mixed-cluster");
Expand All @@ -74,11 +72,7 @@ private static ListMultimap<Class<?>, String> createLegacyRestTestBasePluginUsag
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:ent-search");
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:fleet");
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:logstash");
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:mapper-constant-keyword");
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:mapper-unsigned-long");
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:mapper-version");
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:vector-tile");
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:wildcard");
map.put(LegacyRestTestBasePlugin.class, ":x-pack:qa:mixed-tier-cluster");
map.put(LegacyRestTestBasePlugin.class, ":x-pack:qa:repository-old-versions");
map.put(LegacyRestTestBasePlugin.class, ":x-pack:qa:rolling-upgrade");
Expand Down