Skip to content

Commit

Permalink
Hadoop gradle version harmonization.
Browse files Browse the repository at this point in the history
  • Loading branch information
lbooker42 committed Jun 3, 2024
1 parent 35861c1 commit e51cf7c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
11 changes: 10 additions & 1 deletion buildSrc/src/main/groovy/Classpaths.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,9 @@ class Classpaths {
static final String GUAVA_NAME = 'guava'
static final String GUAVA_VERSION = '33.2.0-jre'

static final String HADOOP_GROUP = 'org.apache.hadoop'
static final String HADOOP_VERSION = '3.4.0'

static boolean addDependency(Configuration conf, String group, String name, String version, Action<? super DefaultExternalModuleDependency> configure = Actions.doNothing()) {
if (!conf.dependencies.find { it.name == name && it.group == group}) {
DefaultExternalModuleDependency dep = dependency group, name, version
Expand Down Expand Up @@ -292,10 +295,16 @@ class Classpaths {
addDependency(config, 'org.apache.parquet', 'parquet-hadoop', '1.14.0')
}

static void inheritIcebergHadoop(Project p, String configName = JavaPlugin.IMPLEMENTATION_CONFIGURATION_NAME) {
Configuration config = p.configurations.getByName(configName)
addDependency(config, HADOOP_GROUP, 'hadoop-common', HADOOP_VERSION)
addDependency(config, HADOOP_GROUP, 'hadoop-hdfs-client', HADOOP_VERSION)
}

/** configName controls only the Configuration's classpath, all transitive dependencies are runtimeOnly */
static void inheritParquetHadoopConfiguration(Project p, String configName = JavaPlugin.IMPLEMENTATION_CONFIGURATION_NAME) {
Configuration config = p.configurations.getByName(configName)
addDependency(config, 'org.apache.hadoop', 'hadoop-common', '3.4.0') {
addDependency(config, HADOOP_GROUP, 'hadoop-common', HADOOP_VERSION) {
it.setTransitive(false)
// Do not take any extra dependencies of this project transitively. We just want a few classes for
// configuration and compression codecs. For any additional required dependencies, add them separately, as
Expand Down
3 changes: 1 addition & 2 deletions extensions/iceberg/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,7 @@ dependencies {
implementation "org.apache.iceberg:iceberg-bundled-guava"
runtimeOnly "org.apache.iceberg:iceberg-aws-bundle"

implementation "org.apache.hadoop:hadoop-common:${hadoopVersion}"
implementation "org.apache.hadoop:hadoop-hdfs-client:${hadoopVersion}"
Classpaths.inheritIcebergHadoop(project)

// could be downstream configurable ?? testRuntimeOnly might be better
// The following lines can be uncommented when we enable support for Azure and GCP
Expand Down

0 comments on commit e51cf7c

Please sign in to comment.