Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GH-15772 upgrade to gradle 8.4 #16141

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ buildscript {
//noinspection GroovyAssignabilityCheck
dependencies {
classpath 'org.ow2.asm:asm:5.1'
classpath 'gradle.plugin.com.github.jengelman.gradle.plugins:shadow:7.0.0'
classpath 'com.github.johnrengelman:shadow:8.1.1'
classpath 'org.gradle.api.plugins:gradle-nexus-plugin:0.7.1'
classpath 'org.testng:testng:6.8'
classpath 'me.champeau.gradle:jmh-gradle-plugin:0.5.2'
Expand Down
10 changes: 5 additions & 5 deletions gradle/copyJars.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
tasks.withType(Jar) { Jar t ->
t.doLast {
copy {
from t.archivePath
into t.destinationDir
from t.archiveFile
into t.destinationDirectory
// Here we expected standard JAR file archive name:
// [baseName]-[appendix]-[version]-[classifier].[extension]
if (t.classifier!=null) {
rename("(.*)-${t.version}(.*)", '$1$2')
if (t.archiveClassifier!=null) {
rename("(.*)-${t.archiveVersion.get()}(.*)", '$1$2')
} else {
rename("(.*)${t.version}-?(.*)", '$1$2')
rename("(.*)${t.archiveVersion.get()}-?(.*)", '$1$2')
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion gradle/java.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ compileJava {
}

task testJar(type: Jar, dependsOn: testClasses, group: "build") {
classifier = 'test'
archiveClassifier.set('test')
from sourceSets.test.output
}

Expand Down
12 changes: 11 additions & 1 deletion gradle/javaIgnoreSymbolFile.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
import org.apache.tools.ant.taskdefs.condition.Os

compileJava {
// This only works when forking and passing 'javac' as an executable
options.compilerArgs << '-XDignore.symbol.file'
options.fork = true
options.forkOptions.executable = 'javac'
if (System.env.JAVA_HOME != null) {
if (Os.isFamily(Os.FAMILY_WINDOWS))
options.forkOptions.executable = "${System.env.JAVA_HOME}/bin/javac.exe"
else
options.forkOptions.executable = "${System.env.JAVA_HOME}/bin/javac"
} else {
// JAVA_HOME is not set. Using expected javac location
options.forkOptions.executable = "/usr/bin/javac"
}
}
2 changes: 1 addition & 1 deletion gradle/publish.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ apply plugin: 'signing'

// Default task to bundle sources code as jar
task sourcesJar(type: Jar) {
classifier = 'sources'
archiveClassifier.set('sources')
from sourceSets.main.allSource
}

Expand Down
2 changes: 1 addition & 1 deletion gradle/ubench.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ task jmhPostProcess(dependsOn: "jmh") {
}

task jmhFatJar(type: ShadowJar) {
classifier = "jmh"
archiveClassifier.set('jmh')
manifest {
attributes "Main-Class": "org.openjdk.jmh.Main"
}
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
2 changes: 1 addition & 1 deletion h2o-assemblies/genmodel/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ for (comp in optionalComponents) {

shadowJar {
mergeServiceFiles()
classifier = ''
archiveClassifier.set('')
relocate 'com.google.gson', 'ai.h2o.com.google.gson' // Should be eventually removed: https://github.com/h2oai/h2o-3/issues/12372
relocate 'org.apache.commons.text', 'ai.h2o.org.apache.commons.text'
relocate 'org.apache.commons.lang3', 'ai.h2o.org.apache.commons.lang3'
Expand Down
2 changes: 1 addition & 1 deletion h2o-assemblies/main/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ dependencies {
shadowJar {
zip64 true
mergeServiceFiles()
classifier = ''
archiveClassifier.set('')
// CDH 5.3.0 provides joda-time v1.6 which is too old, shadow the library instead
if (!project.hasProperty("jacocoCoverage")) {
relocate 'org.joda.time', 'ai.h2o.org.joda.time'
Expand Down
2 changes: 1 addition & 1 deletion h2o-assemblies/minimal/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ dependencies {

shadowJar {
mergeServiceFiles()
classifier = ''
archiveClassifier.set('')
exclude 'META-INF/*.DSA'
exclude 'META-INF/*.SF'
exclude 'synchronize.properties'
Expand Down
2 changes: 1 addition & 1 deletion h2o-assemblies/steam/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ dependencies {

shadowJar {
mergeServiceFiles()
classifier = ''
archiveClassifier.set('')
exclude 'META-INF/*.DSA'
exclude 'META-INF/*.SF'
exclude 'synchronize.properties'
Expand Down
20 changes: 11 additions & 9 deletions h2o-hadoop-2/assemblyjar.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ if (hasCustomHdfsDep) {
}

dependencies {
api("org.apache.hadoop:hadoop-client:$hadoopMavenArtifactVersion") {
force = true
api("org.apache.hadoop:hadoop-client") {
version { strictly hadoopMavenArtifactVersion }
}
api("org.apache.hadoop:hadoop-common:$hadoopMavenArtifactVersion") {
force = true
api("org.apache.hadoop:hadoop-common") {
version { strictly hadoopMavenArtifactVersion }
}
if (hasCustomHdfsDep) {
api("org.apache.hadoop:${hdfsDependency}:$hadoopMavenArtifactVersion") {
force = true
api("org.apache.hadoop:${hdfsDependency}") {
version { strictly hadoopMavenArtifactVersion }
}
}
api(project(":h2o-mapreduce-generic")) {
Expand All @@ -36,7 +36,9 @@ dependencies {
api project(":h2o-security")
api project(":h2o-ext-steam")
// Libraries need for Google Cloud Storage strongly require this Guava version
api('com.google.guava:guava:20.0') {force = true}
api('com.google.guava:guava') {
version { strictly '20.0' }
}
api(project(':h2o-app')) {
exclude module: "${defaultWebserverModule}"
}
Expand Down Expand Up @@ -127,8 +129,8 @@ shadowJar {
relocate 'org.apache.http', 'ai.h2o.org.apache.http'
exclude hadoopShadowJarExcludes
relocate 'com.google.common', 'ai.h2o.com.google.common'
baseName = 'h2odriver'
classifier = ''
archiveBaseName.set('h2odriver')
archiveClassifier.set('')
manifest {
attributes 'Main-Class': 'water.hadoop.h2odriver'
}
Expand Down
4 changes: 3 additions & 1 deletion h2o-hadoop-3/assemblyjar.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ dependencies {
api "org.apache.hadoop:hadoop-mapreduce-client-app:$hadoopMavenArtifactVersion"
api "org.apache.hadoop:hadoop-aws:$hadoopMavenArtifactVersion"
// Libraries need for Google Cloud Storage strongly require this Guava version
api('com.google.guava:guava:20.0') { force = true }
api('com.google.guava:guava') {
version { strictly '20.0' }
}
api(project(':h2o-app')) {
exclude module: "${defaultWebserverModule}"
}
Expand Down
4 changes: 3 additions & 1 deletion h2o-hadoop-3/assemblyjar_cdp.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ dependencies {
compileOnly "org.apache.hadoop:hadoop-client:$hadoopMavenArtifactVersion"
compileOnly "org.apache.hadoop:hadoop-mapreduce-client-app:$hadoopMavenArtifactVersion"
// Libraries need for Google Cloud Storage strongly require this Guava version
api('com.google.guava:guava:20.0') { force = true }
api('com.google.guava:guava') {
version { strictly '20.0' }
}
api(project(':h2o-app')) {
exclude module: "${defaultWebserverModule}"
exclude module: "h2o-ext-krbstandalone" // exclude here to avoid pulling all transitive dependencies
Expand Down
4 changes: 2 additions & 2 deletions h2o-hadoop-3/assemblyjar_common.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ shadowJar {
exclude hadoopShadowJarExcludes
relocate 'com.google.common', 'ai.h2o.com.google.common'
relocate 'org.eclipse.jetty', 'ai.h2o.org.eclipse.jetty'
baseName = 'h2odriver'
classifier = ''
archiveBaseName.set('h2odriver')
archiveClassifier.set('')
manifest {
attributes 'Main-Class': 'water.hadoop.h2odriver'
}
Expand Down
2 changes: 1 addition & 1 deletion h2o-k8s-comp/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ dependencies {

shadowJar {
mergeServiceFiles()
classifier = ''
archiveClassifier.set('')
exclude 'META-INF/*.DSA'
exclude 'META-INF/*.SF'
exclude 'synchronize.properties'
Expand Down
21 changes: 8 additions & 13 deletions h2o-py-cloud-extensions/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,7 @@ ext {
testsPath = file("tests")
}

//
// Create a file with version for Python dist task
//
task createVersionFiles() {
doLast {
file("${buildDir}/h2o_cloud_extensions/").mkdirs()
File version_file = new File("${buildDir}/h2o_cloud_extensions/", "version.txt")
version_file.write(PROJECT_VERSION)

File build_file = new File("${buildDir}/h2o_cloud_extensions/", "buildinfo.txt")
build_file.write(buildVersion.toString())
}
}


task copySrcFiles(type: Copy) {
Expand All @@ -41,9 +29,15 @@ task copySrcFiles(type: Copy) {
into "${buildDir}"
}

task buildDist(type: Exec, dependsOn: [createVersionFiles, copySrcFiles]) {
task buildDist(type: Exec, dependsOn: copySrcFiles) {
workingDir buildDir
doFirst {
file("${buildDir}/h2o_cloud_extensions/").mkdirs()
File version_file = new File("${buildDir}/h2o_cloud_extensions/", "version.txt")
version_file.write(PROJECT_VERSION)

File build_file = new File("${buildDir}/h2o_cloud_extensions/", "buildinfo.txt")
build_file.write(buildVersion.toString())
file("${buildDir}/tmp").mkdirs()
standardOutput = new FileOutputStream(file("${buildDir}/tmp/h2o-py_buildDist.out"))
}
Expand Down Expand Up @@ -84,5 +78,6 @@ task cleanBuild(type: Delete) {
//
// Define the dependencies
//
jar.dependsOn copySrcFiles
clean.dependsOn cleanBuild, cleanUpTestResults
build.dependsOn copyMainDist
1 change: 1 addition & 0 deletions h2o-py-mlflow-flavor/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -59,5 +59,6 @@ task cleanBuild(type: Delete) {
//
// Define the dependencies
//
jar.dependsOn copySrcFiles
clean.dependsOn cleanBuild
build.dependsOn copyMainDist
14 changes: 10 additions & 4 deletions h2o-py/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,17 @@ task buildDist(type: Exec, dependsOn: [verifyDependencies, createVersionFiles, c
commandLine getOsSpecificCommandLine([pythonexe, "setup.py", "bdist_wheel"])
}

task copyMainDist(type: Copy, dependsOn: [buildDist]) {
from ("${buildDir}/main/") {
include "dist/**"
// I don't know why the task with type: Copy doesn't run after buildDist for gradle 8 even though its working for other projects (e.g. h2o-py-cloud-extension)
// I was able to properly copy the wheel only this way.
task copyMainDist(dependsOn: [buildDist]) {
doLast{
copy {
from("${buildDir}/main/") {
include "dist/**"
}
into "${buildDir}"
}
}
into "${buildDir}"
}

task buildClientDist(type: Exec, dependsOn: [verifyDependencies, createVersionFiles, copyClientSrcFiles]) {
Expand Down