Skip to content

Commit

Permalink
Upgrade Gradle and dependencies. Address deprecations.
Browse files Browse the repository at this point in the history
  • Loading branch information
no-preserve-root committed Oct 5, 2023
1 parent 230c79d commit 53d5403
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 34 deletions.
29 changes: 15 additions & 14 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ plugins {
`maven-publish`
signing

id("com.diffplug.spotless") version "6.19.0"
id("com.diffplug.spotless") version "6.22.0"
id("com.dorongold.task-tree") version "2.1.1"
id("com.github.ben-manes.versions") version "0.46.0"
id("de.undercouch.download") version "5.4.0"
id("com.github.ben-manes.versions") version "0.48.0"
id("de.undercouch.download") version "5.5.0"
id("io.github.gradle-nexus.publish-plugin") version "1.3.0"
}

Expand Down Expand Up @@ -78,7 +78,7 @@ val downloadZ3Source by
description = "Download the Z3 source archive."

src("https://github.com/Z3Prover/z3/archive/z3-$z3Version/z3-$z3Version.zip")
dest(buildDir.resolve("source-archive/z3-$z3Version.zip"))
dest(layout.buildDirectory.file("source-archive/z3-$z3Version.zip"))
overwrite(false)
quiet(true)
}
Expand All @@ -88,7 +88,7 @@ val extractZ3Source by
description = "Extract the Z3 source archive."

from(zipTree(downloadZ3Source.map { it.dest }))
into(buildDir.resolve("unpacked-source"))
into(layout.buildDirectory.dir("unpacked-source"))
}

val copyNonGeneratedSources by
Expand All @@ -99,7 +99,7 @@ val copyNonGeneratedSources by
include("**/*.java")
eachFile { path = "$Z3_PACKAGE_PATH/$path" }

into(buildDir.resolve("non-generated-sources"))
into(layout.buildDirectory.dir("non-generated-sources"))
}

val mkConstsFiles by
Expand All @@ -110,7 +110,7 @@ val mkConstsFiles by
layout.dir(extractZ3Source.map { it.destinationDir.resolve("z3-z3-$z3Version") }))
scriptName.set("mk_consts_files")
realOutputPackage.set("$Z3_PACKAGE.enumerations")
outputDir.set(buildDir.resolve("generated-enumerations"))
outputDir.set(layout.buildDirectory.dir("generated-enumerations"))
}

val updateAPI by
Expand All @@ -122,7 +122,7 @@ val updateAPI by
scriptName.set("update_api")
requiresJavaInput.set(true)
realOutputPackage.set(Z3_PACKAGE)
outputDir.set(buildDir.resolve("generated-native"))
outputDir.set(layout.buildDirectory.dir("generated-native"))
}

val rewriteNativeJava by
Expand All @@ -132,7 +132,7 @@ val rewriteNativeJava by
from(updateAPI.flatMap { it.outputDir })
include("$Z3_PACKAGE_PATH/Native.java")
filter(NativeRewriter::class)
into(buildDir.resolve("rewritten-native"))
into(layout.buildDirectory.dir("rewritten-native"))
}

val copyNativeLibs =
Expand All @@ -142,7 +142,7 @@ val copyNativeLibs =
description = "Download the Z3 binary distribution for ${z3.nameInTasks}."

src(z3.downloadURL(z3Version))
dest(buildDir.resolve("binary-archives/z3${z3.nameInTasks}.zip"))
dest(layout.buildDirectory.file("binary-archives/z3${z3.nameInTasks}.zip"))
overwrite(false)
quiet(true)
}
Expand All @@ -157,7 +157,7 @@ val copyNativeLibs =
"${z3.libraryPath(z3Version)}/libz3java.${z3.libraryExtension}")
eachFile { path = name }

into(buildDir.resolve("unpacked-binaries/z3${z3.nameInTasks}"))
into(layout.buildDirectory.dir("unpacked-binaries/z3${z3.nameInTasks}"))
}

val java =
Expand All @@ -176,7 +176,8 @@ val copyNativeLibs =
provider { project.properties["install_name_tool"]?.toString() })
libraryChanges.put(
"libz3.${z3.libraryExtension}", "@loader_path/libz3.${z3.libraryExtension}")
outputDirectory.set(buildDir.resolve("fixed-binaries/z3${z3.nameInTasks}"))
outputDirectory.set(
layout.buildDirectory.dir("fixed-binaries/z3${z3.nameInTasks}"))
}
.flatMap { it.outputDirectory.asFile }
} else {
Expand All @@ -191,7 +192,7 @@ val copyNativeLibs =
extract.map { it.destinationDir.resolve("libz3.${z3.libraryExtension}") },
java.map { it.resolve("libz3java.${z3.libraryExtension}") })
eachFile { path = "native/${z3.operatingSystem}-${z3.cpuArchitecture}/$path" }
into(buildDir.resolve("native-libs/z3${z3.nameInTasks}"))
into(layout.buildDirectory.dir("native-libs/z3${z3.nameInTasks}"))
}
}

Expand All @@ -212,7 +213,7 @@ sourceSets {
repositories { mavenCentral() }

dependencies {
testImplementation(platform("org.junit:junit-bom:5.9.3"))
testImplementation(platform("org.junit:junit-bom:5.10.0"))
testImplementation("org.junit.jupiter", "junit-jupiter")
}

Expand Down
6 changes: 3 additions & 3 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@
* PERFORMANCE OF THIS SOFTWARE.
*/

plugins { kotlin("jvm") version "1.8.21" }
plugins { kotlin("jvm") version "1.9.10" }

repositories {
gradlePluginPortal()
mavenCentral()
}

dependencies {
implementation("commons-io", "commons-io", "2.11.0")
implementation("com.github.javaparser", "javaparser-core", "3.25.3")
implementation("commons-io", "commons-io", "2.14.0")
implementation("com.github.javaparser", "javaparser-core", "3.25.5")
implementation("ru.vyarus", "gradle-use-python-plugin", "3.0.0")
compileOnly(gradleKotlinDsl())
}
11 changes: 5 additions & 6 deletions buildSrc/src/main/kotlin/tools/aqua/InstallNameToolTask.kt
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,8 @@
package tools.aqua

import java.io.StringWriter
import java.nio.charset.Charset.defaultCharset
import javax.inject.Inject
import org.apache.commons.io.output.NullOutputStream.NULL_OUTPUT_STREAM
import org.apache.commons.io.output.NullOutputStream
import org.apache.commons.io.output.WriterOutputStream
import org.gradle.api.DefaultTask
import org.gradle.api.GradleException
Expand Down Expand Up @@ -113,8 +112,8 @@ constructor(private val exec: ExecOperations, private val fs: FileOperations) :
rpathAddCmd +
rpathDelCmd +
copiedFile
it.standardOutput = WriterOutputStream(stdOut, defaultCharset())
it.errorOutput = WriterOutputStream(stdErr, defaultCharset())
it.standardOutput = WriterOutputStream.builder().setWriter(stdOut).get()
it.errorOutput = WriterOutputStream.builder().setWriter(stdErr).get()
}
} finally {
if (stdOut.buffer.isNotBlank()) logger.info("install_name_tool output: {}", stdOut)
Expand All @@ -134,8 +133,8 @@ constructor(private val exec: ExecOperations, private val fs: FileOperations) :
exec.exec {
it.commandLine = listOf(candidate)
it.isIgnoreExitValue = true
it.standardOutput = NULL_OUTPUT_STREAM
it.errorOutput = NULL_OUTPUT_STREAM
it.standardOutput = NullOutputStream.INSTANCE
it.errorOutput = NullOutputStream.INSTANCE
}
logger.info("install_name_tool search: $candidate accepted")
return candidate
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
3 changes: 2 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
22 changes: 13 additions & 9 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ done
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
Expand Down Expand Up @@ -130,26 +131,29 @@ location of your Java installation."
fi
else
JAVACMD=java
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
if ! command -v java >/dev/null 2>&1
then
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
fi

# Increase the maximum file descriptors if we can.
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC2039,SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC2039,SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
Expand Down Expand Up @@ -198,11 +202,11 @@ fi
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'

# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
# double quotes to make sure that they get re-expanded; and
# * put everything else in single quotes, so that it's not re-expanded.
# Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# and any embedded shellness will be escaped.
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# treated as '${Hostname}' itself on the command line.

set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
Expand Down
2 changes: 1 addition & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@

rootProject.name = "z3-turnkey"

plugins { id("org.gradle.toolchains.foojay-resolver-convention") version "0.5.0" }
plugins { id("org.gradle.toolchains.foojay-resolver-convention") version "0.7.0" }

0 comments on commit 53d5403

Please sign in to comment.