Skip to content

Commit aa8fbae

Browse files
Add Shadow jar publication to lang-painless module. (#2681) (#2713)
* 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>
1 parent 9a9f947 commit aa8fbae

File tree

3 files changed

+30
-2
lines changed

3 files changed

+30
-2
lines changed

modules/lang-painless/build.gradle

+29-1
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,11 @@
2929
*/
3030

3131
import org.opensearch.gradle.testclusters.DefaultTestClustersTask;
32+
import com.github.jengelman.gradle.plugins.shadow.ShadowBasePlugin
33+
3234
apply plugin: 'opensearch.validate-rest-spec'
3335
apply plugin: 'opensearch.yaml-rest-test'
36+
apply plugin: 'com.github.johnrengelman.shadow'
3437

3538
opensearchplugin {
3639
description 'An easy, safe and fast scripting language for OpenSearch'
@@ -49,11 +52,36 @@ dependencies {
4952
api 'org.ow2.asm:asm-util:9.2'
5053
api 'org.ow2.asm:asm-tree:7.2'
5154
api 'org.ow2.asm:asm-commons:9.2'
52-
api 'org.ow2.asm:asm-analysis:7.2'
55+
api 'org.ow2.asm:asm-analysis:9.2'
5356
api 'org.ow2.asm:asm:9.2'
5457
api project('spi')
5558
}
5659

60+
test {
61+
doFirst {
62+
test.classpath -= project.files(project.tasks.named('shadowJar'))
63+
test.classpath -= project.configurations.getByName(ShadowBasePlugin.CONFIGURATION_NAME)
64+
test.classpath += project.extensions.getByType(SourceSetContainer).getByName(SourceSet.MAIN_SOURCE_SET_NAME).runtimeClasspath
65+
}
66+
}
67+
68+
shadowJar {
69+
classifier = null
70+
relocate 'org.objectweb', 'org.opensearch.repackage.org.objectweb'
71+
dependencies {
72+
include(dependency('org.ow2.asm:asm:9.2'))
73+
include(dependency('org.ow2.asm:asm-util:9.2'))
74+
include(dependency('org.ow2.asm:asm-tree:9.2'))
75+
include(dependency('org.ow2.asm:asm-commons:9.2'))
76+
include(dependency('org.ow2.asm:asm-analysis:9.2'))
77+
}
78+
}
79+
80+
tasks.validateNebulaPom.dependsOn tasks.generatePomFileForShadowPublication
81+
tasks.validateShadowPom.dependsOn tasks.generatePomFileForNebulaPublication
82+
tasks.publishNebulaPublicationToMavenLocal.dependsOn tasks.generatePomFileForShadowPublication
83+
tasks.publishShadowPublicationToMavenLocal.dependsOn tasks.generatePomFileForNebulaPublication
84+
5785
tasks.named("dependencyLicenses").configure {
5886
mapping from: /asm-.*/, to: 'asm'
5987
}

modules/lang-painless/licenses/asm-analysis-7.2.jar.sha1

-1
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
7487dd756daf96cab9986e44b9d7bcb796a61c10

0 commit comments

Comments
 (0)