From d1031fd9285eb75122b7e701d79d60ba2f50d874 Mon Sep 17 00:00:00 2001 From: Ryan Ernst Date: Fri, 21 Aug 2020 16:40:26 -0700 Subject: [PATCH] Move versions convenience property to java plugin (#61438) Access the common versions map is done in a lot of places. While it can be access through an import of VersionProperties, the vast majority of places use it through the provided convenience property added by BuildPlugin. This commit moves that convenience property to the base java plugin, so further reduce dependence on the BuildPlugin. --- .../main/groovy/org/elasticsearch/gradle/BuildPlugin.groovy | 3 +-- .../java/org/elasticsearch/gradle/ElasticsearchJavaPlugin.java | 3 +++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/buildSrc/src/main/groovy/org/elasticsearch/gradle/BuildPlugin.groovy b/buildSrc/src/main/groovy/org/elasticsearch/gradle/BuildPlugin.groovy index 27db5e5535ad5..5ca6e8a8336e4 100644 --- a/buildSrc/src/main/groovy/org/elasticsearch/gradle/BuildPlugin.groovy +++ b/buildSrc/src/main/groovy/org/elasticsearch/gradle/BuildPlugin.groovy @@ -71,8 +71,7 @@ class BuildPlugin implements Plugin { configureLicenseAndNotice(project) project.pluginManager.apply('elasticsearch.publish') project.pluginManager.apply(DependenciesInfoPlugin) - - project.extensions.getByType(ExtraPropertiesExtension).set('versions', VersionProperties.versions) + PrecommitTasks.create(project, true) } diff --git a/buildSrc/src/main/java/org/elasticsearch/gradle/ElasticsearchJavaPlugin.java b/buildSrc/src/main/java/org/elasticsearch/gradle/ElasticsearchJavaPlugin.java index c1ae315353fb4..24f3cd8b04f51 100644 --- a/buildSrc/src/main/java/org/elasticsearch/gradle/ElasticsearchJavaPlugin.java +++ b/buildSrc/src/main/java/org/elasticsearch/gradle/ElasticsearchJavaPlugin.java @@ -74,6 +74,9 @@ public void apply(Project project) { configureJars(project); configureJarManifest(project); configureJavadoc(project); + + // convenience access to common versions used in dependencies + project.getExtensions().getExtraProperties().set("versions", VersionProperties.getVersions()); } /**