Skip to content

Commit

Permalink
Build: Move Hive builds to build.gradle files (apache#3311)
Browse files Browse the repository at this point in the history
Using the expected structure automatically loads builds when they are enabled in settings.gradle.
  • Loading branch information
rdblue authored Oct 19, 2021
1 parent f3e6770 commit e873051
Show file tree
Hide file tree
Showing 5 changed files with 167 additions and 141 deletions.
12 changes: 0 additions & 12 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -429,18 +429,6 @@ project(':iceberg-hive-metastore') {
}
}

// add enabled Hive version modules to the build
def hiveVersions = (System.getProperty("hiveVersions") != null ? System.getProperty("hiveVersions") : System.getProperty("defaultHiveVersions")).split(",")

// hive 3 depends on hive 2, so always add hive 2 if hive3 is enabled
if (hiveVersions.contains("2") || hiveVersions.contains("3")) {
apply from: file("$projectDir/hive2.gradle")
}

if (jdkVersion == '8' && hiveVersions.contains("3")) {
apply from: file("$projectDir/hive3.gradle")
}

project(':iceberg-orc') {
dependencies {
implementation project(path: ':iceberg-bundled-guava', configuration: 'shadow')
Expand Down
82 changes: 82 additions & 0 deletions hive-runtime/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF 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.
*/

def hiveVersions = (System.getProperty("hiveVersions") != null ? System.getProperty("hiveVersions") : System.getProperty("defaultHiveVersions")).split(",")

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

tasks.jar.dependsOn tasks.shadowJar

configurations {
implementation {
exclude group: 'com.github.stephenc.findbugs'
exclude group: 'commons-pool'
exclude group: 'javax.annotation'
exclude group: 'javax.xml.bind'
exclude group: 'org.apache.commons'
exclude group: 'org.slf4j'
exclude group: 'org.xerial.snappy'
}
}

dependencies {
implementation project(':iceberg-mr')
if (jdkVersion == '8' && hiveVersions.contains("3")) {
implementation project(':iceberg-hive3')
}
implementation(project(':iceberg-nessie')) {
exclude group: 'com.google.code.findbugs', module: 'jsr305'
}
implementation project(':iceberg-aws')
}

shadowJar {
configurations = [project.configurations.runtimeClasspath]

zip64 true

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

// Relocate dependencies to avoid conflicts
relocate 'org.apache.avro', 'org.apache.iceberg.shaded.org.apache.avro'
relocate 'org.apache.parquet', 'org.apache.iceberg.shaded.org.apache.parquet'
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 'shaded.parquet', 'org.apache.iceberg.shaded.org.apache.parquet.shaded'
relocate 'org.apache.orc', 'org.apache.iceberg.shaded.org.apache.orc'
relocate 'io.airlift', 'org.apache.iceberg.shaded.io.airlift'
relocate 'org.threeten.extra', 'org.apache.iceberg.shaded.org.threeten.extra'
// relocate OrcSplit in order to avoid the conflict from Hive's OrcSplit
relocate 'org.apache.hadoop.hive.ql.io.orc.OrcSplit', 'org.apache.iceberg.shaded.org.apache.hadoop.hive.ql.io.orc.OrcSplit'

classifier null
}

jar {
enabled = false
}
}

85 changes: 85 additions & 0 deletions hive3-orc-bundle/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF 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.
*/

// The purpose of this module is to re-shade org.apache.orc.storage to the original org.apache.hadoop.hive package
// name. This is to be used by Hive3 for features including e.g. vectorization.
project(':iceberg-hive3-orc-bundle') {

apply plugin: 'com.github.johnrengelman.shadow'

tasks.jar.dependsOn tasks.shadowJar

configurations {
implementation {
exclude group: 'com.github.luben'
}
}

dependencies {
implementation project(':iceberg-data')
implementation project(':iceberg-orc')

testCompileOnly project(path: ':iceberg-data', configuration: 'testArtifacts')
testCompileOnly project(path: ':iceberg-orc', configuration: 'testArtifacts')
}

shadowJar {
configurations = [project.configurations.compileClasspath, project.configurations.runtimeClasspath]

zip64 true

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

// Relocate dependencies to avoid conflicts
relocate 'org.apache.orc.storage', 'org.apache.hadoop.hive'

// We really only need Iceberg and Orc classes, but with relocated references for storage-api classes (see above)
// Unfortunately the include list feature of this shader plugin doesn't work as expected
dependencies {
exclude 'com/**/*'
exclude 'edu/**/*'
exclude 'io/**'
exclude 'javax/**'
exclude 'org/apache/avro/**/*'
exclude 'org/apache/commons/**/*'
exclude 'org/checkerframework/**/*'
exclude 'org/codehaus/**/*'
exclude 'org/intellij/**/*'
exclude 'org/jetbrains/**/*'
exclude 'org/slf4j/**/*'
exclude 'org/threeten/**/*'
exclude 'org/xerial/**/*'
exclude 'org/apache/parquet/**/*'
exclude 'org/apache/yetus/**/*'
exclude 'shaded/parquet/**/*'
}

classifier null
}

jar {
enabled = false
}

}

66 changes: 0 additions & 66 deletions hive3.gradle → hive3/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,72 +17,6 @@
* under the License.
*/

// The purpose of this module is to re-shade org.apache.orc.storage to the original org.apache.hadoop.hive package
// name. This is to be used by Hive3 for features including e.g. vectorization.
project(':iceberg-hive3-orc-bundle') {

apply plugin: 'com.github.johnrengelman.shadow'

tasks.jar.dependsOn tasks.shadowJar

configurations {
implementation {
exclude group: 'com.github.luben'
}
}

dependencies {
implementation project(':iceberg-data')
implementation project(':iceberg-orc')

testCompileOnly project(path: ':iceberg-data', configuration: 'testArtifacts')
testCompileOnly project(path: ':iceberg-orc', configuration: 'testArtifacts')
}

shadowJar {
configurations = [project.configurations.compileClasspath, project.configurations.runtimeClasspath]

zip64 true

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

// Relocate dependencies to avoid conflicts
relocate 'org.apache.orc.storage', 'org.apache.hadoop.hive'

// We really only need Iceberg and Orc classes, but with relocated references for storage-api classes (see above)
// Unfortunately the include list feature of this shader plugin doesn't work as expected
dependencies {
exclude 'com/**/*'
exclude 'edu/**/*'
exclude 'io/**'
exclude 'javax/**'
exclude 'org/apache/avro/**/*'
exclude 'org/apache/commons/**/*'
exclude 'org/checkerframework/**/*'
exclude 'org/codehaus/**/*'
exclude 'org/intellij/**/*'
exclude 'org/jetbrains/**/*'
exclude 'org/slf4j/**/*'
exclude 'org/threeten/**/*'
exclude 'org/xerial/**/*'
exclude 'org/apache/parquet/**/*'
exclude 'org/apache/yetus/**/*'
exclude 'shaded/parquet/**/*'
}

classifier null
}

jar {
enabled = false
}

}

project(':iceberg-hive3') {

// run the tests in iceberg-mr with Hive3 dependencies
Expand Down
63 changes: 0 additions & 63 deletions hive2.gradle → mr/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
* under the License.
*/

def hiveVersions = (System.getProperty("hiveVersions") != null ? System.getProperty("hiveVersions") : System.getProperty("defaultHiveVersions")).split(",")

project(':iceberg-mr') {
configurations {
testImplementation {
Expand Down Expand Up @@ -81,64 +79,3 @@ project(':iceberg-mr') {
}
}

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

tasks.jar.dependsOn tasks.shadowJar

configurations {
implementation {
exclude group: 'com.github.stephenc.findbugs'
exclude group: 'commons-pool'
exclude group: 'javax.annotation'
exclude group: 'javax.xml.bind'
exclude group: 'org.apache.commons'
exclude group: 'org.slf4j'
exclude group: 'org.xerial.snappy'
}
}

dependencies {
implementation project(':iceberg-mr')
if (jdkVersion == '8' && hiveVersions.contains("3")) {
implementation project(':iceberg-hive3')
}
implementation(project(':iceberg-nessie')) {
exclude group: 'com.google.code.findbugs', module: 'jsr305'
}
implementation project(':iceberg-aws')
}

shadowJar {
configurations = [project.configurations.runtimeClasspath]

zip64 true

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

// Relocate dependencies to avoid conflicts
relocate 'org.apache.avro', 'org.apache.iceberg.shaded.org.apache.avro'
relocate 'org.apache.parquet', 'org.apache.iceberg.shaded.org.apache.parquet'
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 'shaded.parquet', 'org.apache.iceberg.shaded.org.apache.parquet.shaded'
relocate 'org.apache.orc', 'org.apache.iceberg.shaded.org.apache.orc'
relocate 'io.airlift', 'org.apache.iceberg.shaded.io.airlift'
relocate 'org.threeten.extra', 'org.apache.iceberg.shaded.org.threeten.extra'
// relocate OrcSplit in order to avoid the conflict from Hive's OrcSplit
relocate 'org.apache.hadoop.hive.ql.io.orc.OrcSplit', 'org.apache.iceberg.shaded.org.apache.hadoop.hive.ql.io.orc.OrcSplit'

classifier null
}

jar {
enabled = false
}
}

0 comments on commit e873051

Please sign in to comment.