Skip to content

Commit

Permalink
Shading: Add a iceberg-runtime shaded module (apache#12)
Browse files Browse the repository at this point in the history
  • Loading branch information
rdsr authored and shardulm94 committed Nov 18, 2020
1 parent 6578106 commit f17188b
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 1 deletion.
64 changes: 63 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -972,6 +972,69 @@ project(':iceberg-pig') {
}
}

project(':iceberg-runtime') {
apply plugin: 'com.github.johnrengelman.shadow'

tasks.jar.dependsOn tasks.shadowJar

configurations {
compile {
exclude group: 'org.apache.spark'
// included in Spark
exclude group: 'org.slf4j'
exclude group: 'org.apache.commons'
exclude group: 'commons-pool'
exclude group: 'commons-codec'
exclude group: 'org.xerial.snappy'
exclude group: 'javax.xml.bind'
exclude group: 'javax.annotation'
}
}

dependencies {
compile project(':iceberg-core')
compile project(':iceberg-orc')
compile project(':iceberg-hive-metastore')
}

shadowJar {
configurations = [project.configurations.compile]

zip64 true

// include the LICENSE and NOTICE files for the shaded Jar
from(projectDir) {
include 'LICENSE'
include 'NOTICE'
}

// Relocate dependencies to avoid conflicts
relocate 'com.google', 'org.apache.iceberg.shaded.com.google'
relocate 'com.fasterxml', 'org.apache.iceberg.shaded.com.fasterxml'
relocate 'com.github.benmanes', 'org.apache.iceberg.shaded.com.github.benmanes'
relocate 'org.checkerframework', 'org.apache.iceberg.shaded.org.checkerframework'
relocate 'org.apache.avro', 'org.apache.iceberg.shaded.org.apache.avro'
relocate 'avro.shaded', 'org.apache.iceberg.shaded.org.apache.avro.shaded'
relocate 'com.thoughtworks.paranamer', 'org.apache.iceberg.shaded.com.thoughtworks.paranamer'
relocate 'org.apache.parquet', 'org.apache.iceberg.shaded.org.apache.parquet'
relocate 'shaded.parquet', 'org.apache.iceberg.shaded.org.apache.parquet.shaded'
// relocate Avro's jackson dependency to share parquet-jackson locations
relocate 'org.codehaus.jackson', 'org.apache.iceberg.shaded.org.apache.parquet.shaded.org.codehaus.jackson'
relocate 'org.apache.orc', 'org.apache.iceberg.shaded.org.apache.orc'
relocate 'io.airlift', 'org.apache.iceberg.shaded.io.airlift'
// relocate Arrow and related deps to shade Iceberg specific version
relocate 'io.netty.buffer', 'org.apache.iceberg.shaded.io.netty.buffer'
relocate 'org.apache.arrow', 'org.apache.iceberg.shaded.org.apache.arrow'
relocate 'com.carrotsearch', 'org.apache.iceberg.shaded.com.carrotsearch'

classifier null
}

jar {
classifier = 'empty'
}
}

@Memoized
boolean isVersionFileExists() {
return file('version.txt').exists()
Expand Down Expand Up @@ -1010,4 +1073,3 @@ String getJavadocVersion() {
apply from: 'baseline.gradle'
apply from: 'deploy.gradle'
apply from: 'tasks.gradle'

2 changes: 2 additions & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ include 'spark3'
include 'spark3-runtime'
include 'pig'
include 'hive-metastore'
include 'runtime'

project(':api').name = 'iceberg-api'
project(':common').name = 'iceberg-common'
Expand All @@ -53,6 +54,7 @@ project(':spark3').name = 'iceberg-spark3'
project(':spark3-runtime').name = 'iceberg-spark3-runtime'
project(':pig').name = 'iceberg-pig'
project(':hive-metastore').name = 'iceberg-hive-metastore'
project(':runtime').name = 'iceberg-runtime'

if (JavaVersion.current() == JavaVersion.VERSION_1_8) {
include 'spark2'
Expand Down

0 comments on commit f17188b

Please sign in to comment.