Skip to content

Commit 0343ac3

Browse files
committed
remove shadow jar
Signed-off-by: xinyual <xinyual@amazon.com>
1 parent bcfcd00 commit 0343ac3

1 file changed

Lines changed: 1 addition & 67 deletions

File tree

plugin/build.gradle

Lines changed: 1 addition & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ plugins {
3131
id 'jacoco'
3232
id 'opensearch.opensearchplugin'
3333
id 'com.diffplug.spotless'
34-
id 'com.gradleup.shadow'
34+
//id 'com.gradleup.shadow'
3535
}
3636

3737
apply plugin: 'opensearch.pluginzip'
@@ -227,57 +227,10 @@ testingConventions.enabled = false
227227
// TODO: need to verify the thirdPartyAudit
228228
// currently it complains missing classes like ibatis, mysql etc, should not be a problem
229229
thirdPartyAudit.enabled = false
230-
tasks.named("publishShadowPublicationToMavenLocal") {
231-
dependsOn tasks.named("generatePomFileForNebulaPublication")
232-
}
233230
apply plugin: 'com.netflix.nebula.ospackage'
234231
validateNebulaPom.enabled = false
235-
generatePomFileForShadowPublication.enabled = false
236-
validateShadowPom.enabled = false
237-
//generatePomFileForShadowPublication.enabled = false
238232
// This is afterEvaluate because the bundlePlugin ZIP task is updated afterEvaluate and changes the ZIP name to match the plugin name
239233
afterEvaluate {
240-
tasks.named("bundlePlugin", Zip).configure { zipTask ->
241-
zipTask.doLast {
242-
def zipFile = zipTask.archiveFile.get().asFile
243-
println "Original bundlePlugin ZIP: ${zipFile.absolutePath}"
244-
245-
// Create a temporary directory for processing
246-
def tempDir = file("$buildDir/tempBundle")
247-
delete(tempDir)
248-
tempDir.mkdirs()
249-
250-
// Extract the ZIP into the temporary directory
251-
copy {
252-
from zipTree(zipFile)
253-
into tempDir
254-
}
255-
println "Extracted ZIP to: ${tempDir.absolutePath}"
256-
257-
// Determine the relocated jar produced by shadowJar.
258-
def relocatedJar = shadowJar.archiveFile.get().asFile
259-
def jarName = relocatedJar.getName()
260-
println "Relocated jar to keep: ${jarName}"
261-
262-
// Delete all jar files (files ending with .jar) that are not the relocated jar.
263-
fileTree(dir: tempDir, includes: ['**/*.jar']).each { File jarFile ->
264-
if (!jarFile.getName().equals(jarName)) {
265-
println "Deleting jar file: ${jarFile.absolutePath}"
266-
jarFile.delete()
267-
}
268-
}
269-
270-
// Reassemble the ZIP using the remaining files
271-
ant.zip(destfile: zipFile) {
272-
fileset(dir: tempDir)
273-
}
274-
println "Final bundlePlugin ZIP updated: ${zipFile.absolutePath}"
275-
276-
// Clean up the temporary directory
277-
delete(tempDir)
278-
}
279-
}
280-
281234
ospackage {
282235
packageName = "${rootProject.name}"
283236
release = isSnapshot ? "0.1" : '1'
@@ -369,22 +322,3 @@ run {
369322
useCluster testClusters.integTest
370323
}
371324

372-
def compileOnlyResolveableFiles = project.configurations.getByName(CompileOnlyResolvePlugin.RESOLVEABLE_COMPILE_ONLY_CONFIGURATION_NAME).files
373-
shadowJar {
374-
configurations = [project.configurations.runtimeClasspath]
375-
exclude { details ->
376-
def file = details.file
377-
return compileOnlyResolveableFiles.contains(file)
378-
}
379-
380-
destinationDirectory = file("${project.buildDir}/distributions")
381-
archiveClassifier.set(null)
382-
383-
exclude 'META-INF/maven/com.google.guava/**'
384-
exclude 'com/google/thirdparty/**'
385-
exclude 'org/opensearch/jobscheduler/**'
386-
exclude 'org/apache/lucene/**'
387-
388-
relocate 'com.google.common', 'shaded.com.google.common'
389-
relocate 'org.joda.time', 'shaded.org.joda.time'
390-
}

0 commit comments

Comments
 (0)