Skip to content

Commit

Permalink
Add Shadow jar publication to lang-painless module. (#2681) (#2712)
Browse files Browse the repository at this point in the history
* Add Shadow jar publication to lang-painless module.

This change creates a shadow jar for asm dependencies so
that they do not conflict with direct asm dependencies from log4j AL2 patch.

Signed-off-by: Marc Handalian <handalm@amazon.com>

* Remove security.manager systemProperty that is not required.

Signed-off-by: Marc Handalian <handalm@amazon.com>

* Add explicit task dependency for publishing to maven local required by gradle.

Signed-off-by: Marc Handalian <handalm@amazon.com>

* Move asm dependencies back to api scope.

Signed-off-by: Marc Handalian <handalm@amazon.com>
(cherry picked from commit d7d4108)

Co-authored-by: Marc Handalian <handalm@amazon.com>
  • Loading branch information
opensearch-trigger-bot[bot] and mch2 committed Apr 1, 2022
1 parent eb58fa6 commit 3984dff
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 2 deletions.
30 changes: 29 additions & 1 deletion modules/lang-painless/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,11 @@
*/

import org.opensearch.gradle.testclusters.DefaultTestClustersTask;
import com.github.jengelman.gradle.plugins.shadow.ShadowBasePlugin

apply plugin: 'opensearch.validate-rest-spec'
apply plugin: 'opensearch.yaml-rest-test'
apply plugin: 'com.github.johnrengelman.shadow'

opensearchplugin {
description 'An easy, safe and fast scripting language for OpenSearch'
Expand All @@ -49,11 +52,36 @@ dependencies {
api 'org.ow2.asm:asm-util:9.2'
api 'org.ow2.asm:asm-tree:9.2'
api 'org.ow2.asm:asm-commons:9.2'
api 'org.ow2.asm:asm-analysis:7.2'
api 'org.ow2.asm:asm-analysis:9.2'
api 'org.ow2.asm:asm:9.2'
api project('spi')
}

test {
doFirst {
test.classpath -= project.files(project.tasks.named('shadowJar'))
test.classpath -= project.configurations.getByName(ShadowBasePlugin.CONFIGURATION_NAME)
test.classpath += project.extensions.getByType(SourceSetContainer).getByName(SourceSet.MAIN_SOURCE_SET_NAME).runtimeClasspath
}
}

shadowJar {
classifier = null
relocate 'org.objectweb', 'org.opensearch.repackage.org.objectweb'
dependencies {
include(dependency('org.ow2.asm:asm:9.2'))
include(dependency('org.ow2.asm:asm-util:9.2'))
include(dependency('org.ow2.asm:asm-tree:9.2'))
include(dependency('org.ow2.asm:asm-commons:9.2'))
include(dependency('org.ow2.asm:asm-analysis:9.2'))
}
}

tasks.validateNebulaPom.dependsOn tasks.generatePomFileForShadowPublication
tasks.validateShadowPom.dependsOn tasks.generatePomFileForNebulaPublication
tasks.publishNebulaPublicationToMavenLocal.dependsOn tasks.generatePomFileForShadowPublication
tasks.publishShadowPublicationToMavenLocal.dependsOn tasks.generatePomFileForNebulaPublication

tasks.named("dependencyLicenses").configure {
mapping from: /asm-.*/, to: 'asm'
}
Expand Down
1 change: 0 additions & 1 deletion modules/lang-painless/licenses/asm-analysis-7.2.jar.sha1

This file was deleted.

1 change: 1 addition & 0 deletions modules/lang-painless/licenses/asm-analysis-9.2.jar.sha1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
7487dd756daf96cab9986e44b9d7bcb796a61c10

0 comments on commit 3984dff

Please sign in to comment.