Browse Source

Painless: Add spi jar that will be published for extending whitelists (#28302)

In order to build a plugin that extends the painless whitelist, the spi
classes must be available to the plugin at compile time. This commit
moves the spi classes into a separate jar which will be published. Any
plugin authors whiching to extend painless through spi would then add a
compileOnly dependency on this jar.
Ryan Ernst 7 years ago
parent
commit
ba9c9e08e7

+ 1 - 1
distribution/build.gradle

@@ -83,7 +83,7 @@ ext.restTestExpansions = [
 // we create the buildModules task above so the distribution subprojects can
 // depend on it, but we don't actually configure it until here so we can do a single
 // loop over modules to also setup cross task dependencies and increment our modules counter
-project.rootProject.subprojects.findAll { it.path.startsWith(':modules:') }.each { Project module ->
+project.rootProject.subprojects.findAll { it.parent.path == ':modules' }.each { Project module ->
   buildFullNotice {
     def defaultLicensesDir = new File(module.projectDir, 'licenses')
     if (defaultLicensesDir.exists()) {

+ 1 - 1
modules/build.gradle

@@ -17,7 +17,7 @@
  * under the License.
  */
 
-subprojects {
+configure(subprojects.findAll { it.parent.path == project.path }) {
   group = 'org.elasticsearch.plugin' // for modules which publish client jars
   apply plugin: 'elasticsearch.esplugin'
 

+ 1 - 0
modules/lang-painless/build.gradle

@@ -31,6 +31,7 @@ integTestCluster {
 dependencies {
   compile 'org.antlr:antlr4-runtime:4.5.3'
   compile 'org.ow2.asm:asm-debug-all:5.1'
+  compile project('spi')
 }
 
 dependencyLicenses {

+ 40 - 0
modules/lang-painless/spi/build.gradle

@@ -0,0 +1,40 @@
+/*
+ * Licensed to Elasticsearch under one or more contributor
+ * license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright
+ * ownership. Elasticsearch licenses this file to you under
+ * the Apache License, Version 2.0 (the "License"); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+apply plugin: 'elasticsearch.build'
+apply plugin: 'nebula.maven-base-publish'
+apply plugin: 'nebula.maven-scm'
+
+group = 'org.elasticsearch.plugin'
+archivesBaseName = 'elasticsearch-scripting-painless-spi'
+
+publishing {
+  publications {
+    nebula {
+      artifactId = archivesBaseName
+    }
+  }
+}
+
+dependencies {
+  compile "org.elasticsearch:elasticsearch:${version}"
+}
+
+// no tests...yet?
+test.enabled = false

+ 0 - 0
modules/lang-painless/src/main/java/org/elasticsearch/painless/spi/PainlessExtension.java → modules/lang-painless/spi/src/main/java/org/elasticsearch/painless/spi/PainlessExtension.java


+ 0 - 0
modules/lang-painless/src/main/java/org/elasticsearch/painless/spi/Whitelist.java → modules/lang-painless/spi/src/main/java/org/elasticsearch/painless/spi/Whitelist.java


+ 0 - 0
modules/lang-painless/src/main/java/org/elasticsearch/painless/spi/WhitelistLoader.java → modules/lang-painless/spi/src/main/java/org/elasticsearch/painless/spi/WhitelistLoader.java