Skip to content

Commit

Permalink
Merge branch 'main' into common-gradle-dependencies-release
Browse files Browse the repository at this point in the history
common-gradle-dependencies v0.7.0-20231111 release
  • Loading branch information
ShreckYe committed Nov 12, 2023
2 parents 9218b90 + b806e22 commit d28c4aa
Show file tree
Hide file tree
Showing 9 changed files with 98 additions and 41 deletions.
2 changes: 1 addition & 1 deletion buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ dependencies {
}
*/
//implementation(kotlin("gradle-plugin", "1.8.10")) // for Compose 1.3.1
implementation("org.gradle.kotlin:gradle-kotlin-dsl-plugins:4.0.7") // This version has to be used for Gradle 8.1.1.
implementation("org.gradle.kotlin:gradle-kotlin-dsl-plugins:4.1.2") // This version has to be used for Gradle 8.4.

implementation("com.gradle.publish:plugin-publish-plugin:1.2.0")

Expand Down
11 changes: 6 additions & 5 deletions buildSrc/src/main/kotlin/VersionsAndDependencies.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,16 @@ import com.huanshankeji.CommonVersions
val commonVersions = CommonVersions()
val commonGradleClasspathDependencies = CommonGradleClasspathDependencies(commonVersions)

val kotlinVersion = "1.8.20" // for Compose 1.4.0
val kotlinVersion = "1.9.20" // for Compose 1.4.0 // TODO remove this comment

val alignedPluginVersion = "0.5.0-SNAPSHOT"

// "x.y.z" indicates the version of the way of organizing the code,
// and the date indicates the version when the dependency versions are updated.
val commonGradleDependenciesVersion = "0.6.0-20230609"
val commonGradleDependenciesVersion = "0.7.0-20231111"

// This is the source dependency version. There is another build source dependency in "buildSrc/build.gradle.kts".
val pluginProjectDependentStableCommonGradleDependenciesVersion = "0.5.0-20230310".apply {
require(!endsWith("SNAPSHOT"))
} // TODO: update
val pluginProjectDependentStableCommonGradleDependenciesVersion = "0.7.0-20231111-SNAPSHOT".apply {
// TODO: temporararily commented out for debugging purposes
//require(!endsWith("SNAPSHOT"))
}
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,17 @@ class CommonDependencies(val versions: CommonVersions = CommonVersions()) {

fun datetime(version: String = versions.kotlinxDatetime) =
kotlinx("datetime", version)

inner class Benchmark internal constructor() {
val defaultVersion = versions.kotlinxBenchmark
fun module(module: String, version: String = defaultVersion) =
kotlinx("benchmark-$module", version)

fun runtime(version: String = defaultVersion) =
module("runtime", version)
}

val benchmark = Benchmark()
}

val kotlinx = Kotlinx()
Expand Down Expand Up @@ -211,4 +222,22 @@ class CommonDependencies(val versions: CommonVersions = CommonVersions()) {
}

val slf4j = Slf4j()

inner class TestContainers internal constructor() {
val defaultVersion = versions.testContainers
fun moduleWithoutVersion(module: String) =
"org.testcontainers:$module"

fun moduleWithVersion(module: String, version: String = defaultVersion) =
"${moduleWithoutVersion(module)}:$version"

fun DependencyHandler.platformBom(version: String = defaultVersion) =
platform(moduleWithVersion("testcontainers-bom", version))

val testContainers = moduleWithoutVersion("testcontainers")
val junitJupiter = moduleWithoutVersion("junit-jupiter")
val postgreSql = moduleWithoutVersion("postgresql")
}

val testContainers = TestContainers()
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,25 @@ class CommonGradleClasspathDependencies(val versions: CommonVersions) {
inner class Kotlin internal constructor() {
val group = "org.jetbrains.kotlin"

inner class SerializationPlugin internal constructor() {
val moduleName = "plugin.serialization"
val defaultVersion get() = versions.kotlin
inner class Plugin internal constructor() {
inner class Serialization internal constructor() {
val moduleName = "plugin.serialization"
val defaultVersion get() = versions.kotlin

fun PluginDependenciesSpec.applyPluginWithoutVersion() =
kotlin(moduleName)
fun PluginDependenciesSpec.applyPluginWithoutVersion() =
kotlin(moduleName)

fun PluginDependenciesSpec.applyPluginWithVersion(version: String = defaultVersion) =
applyPluginWithoutVersion().version(version)
fun PluginDependenciesSpec.applyPluginWithVersion(version: String = defaultVersion) =
applyPluginWithoutVersion().version(version)
}

val serialization = Serialization()
}

val serializationPlugin = SerializationPlugin()
val plugin = Plugin()

@Deprecated("Use `plugin.serialization` instead.")
val serializationPlugin = plugin.serialization
}

val kotlin = Kotlin()
Expand All @@ -41,4 +48,16 @@ class CommonGradleClasspathDependencies(val versions: CommonVersions) {
}

val composeMultiplatform = ComposeMultiplatform()

inner class Kotlinx internal constructor() {
inner class Benchmark {
val defaultVersion = versions.kotlinxBenchmark
fun PluginDependenciesSpec.applyPluginWithVersion(version: String = defaultVersion) =
id("org.jetbrains.kotlinx.benchmark").version(defaultVersion)
}

val benchmark = Benchmark()
}

val kotlinx = Kotlinx()
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,25 @@ package com.huanshankeji

import kotlinVersion

class CommonVersions(
class CommonVersions @JvmOverloads constructor(
val kotlin: String = kotlinVersion,

val kotlinCommon: String = "0.3.0",

val kotlinxCoroutines: String = "1.7.1",
val kotlinxHtml: String = "0.8.0",
val kotlinxSerialization: String = "1.5.1",
val kotlinxDatetime: String = "0.4.0",
val exposed: String = "0.41.1",
val ktor: String = "2.3.1",
val composeMultiplatform: String = "1.4.0",
val kotlinxCoroutines: String = "1.7.3",
val kotlinxHtml: String = "0.9.1",
val kotlinxSerialization: String = "1.6.0",
val kotlinxDatetime: String = "0.4.1",
val kotlinxBenchmark: String = "0.4.9",
val exposed: String = "0.44.1",
val ktor: String = "2.3.6",
val composeMultiplatform: String = "1.5.10", // this is usually only used in classpath dependencies

val vertx: String = "4.4.3",
val arrow: String = "1.2.0-RC",
val orgJunit: String = "5.9.3",
val kotest: String = "5.6.2",
val postgreSql: String = "42.5.4",
val vertx: String = "4.4.6",
val arrow: String = "1.2.1",
val orgJunit: String = "5.10.1",
val kotest: String = "5.8.0",
val postgreSql: String = "42.6.0",
val slf4j: String = "1.7.36", // TODO: consider replacing with kotlin-logging (https://github.com/oshai/kotlin-logging)
val testContainers: String = "1.19.1"
)
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-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-all.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
29 changes: 17 additions & 12 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,8 @@ done
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit

# 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"'
# 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 @@ -133,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 @@ -197,11 +198,15 @@ if "$cygwin" || "$msys" ; then
done
fi

# 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.

# 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, 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
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@ publishing {
}

afterEvaluate {
require(java.toolchain.languageVersion.isPresent) { "Specify an explicit `java.toolchain.languageVersion` when publishing a JVM library." }
require(java.toolchain.languageVersion.isPresent) { "Specify an explicit `java.toolchain.languageVersion` (or via `kotlin.jvmToolchain()`) when publishing a JVM library." }
}

0 comments on commit d28c4aa

Please sign in to comment.