Skip to content

Commit

Permalink
Upgrade kotlin, gradle etc..
Browse files Browse the repository at this point in the history
  • Loading branch information
daviddenton committed Jul 3, 2024
1 parent dac8d1c commit 921567b
Show file tree
Hide file tree
Showing 10 changed files with 51 additions and 42 deletions.
1 change: 1 addition & 0 deletions .java-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
21
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
This list is not intended to be all-encompassing - it will document major and breaking API changes with their rationale
when appropriate:

### v2.19.0.0
- **all** : Upgrade of dependencies including Kotlin to v2 and gradle.
- **result4k** : Add fold and bidimap functions

- **data4k** [Fix] Problem with deserialisation of numeric value types (due to int/long coercion by Jackson

### v2.18.0.1
- **data4k** [Fix] Problem with deserialisation of numeric value types (due to int/long coercion by Jackson

Expand Down
16 changes: 5 additions & 11 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import groovy.namespace.QName
import groovy.util.Node
import org.gradle.api.JavaVersion.VERSION_1_8
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_1_8
import org.jetbrains.kotlin.gradle.tasks.KotlinJvmCompile
import java.net.URI

plugins {
Expand Down Expand Up @@ -49,9 +50,9 @@ allprojects {
}

tasks {
withType<KotlinCompile> {
kotlinOptions {
jvmTarget = "1.8"
withType<KotlinJvmCompile>().configureEach {
compilerOptions {
jvmTarget.set(JVM_1_8)
}
}

Expand Down Expand Up @@ -228,13 +229,6 @@ fun Node.childrenCalled(wanted: String) = children()
(name is QName) && name.localPart == wanted
}

tasks.named<KotlinCompile>("compileTestKotlin") {
kotlinOptions {
jvmTarget = "1.8"
freeCompilerArgs += listOf("-Xjvm-default=all")
}
}

fun hasCodeCoverage(project: Project) = project.name != "forkhandles-bom" &&
!project.name.endsWith("generator")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,19 @@ class InstanceFabricator(private val fabrikate: Fabrikate) {
type: KType,
): List<Pair<KFunction<Any>, (KParameter) -> Any?>> {
val allConstructors = classRef.constructors
val hiddenConstructors = allConstructors.filter { constructor -> constructor.annotations.isNotEmpty() &&
(constructor.annotations.filterIsInstance<Deprecated>().first().level == DeprecationLevel.HIDDEN) }
val nonHidden = allConstructors.filterNot { hiddenConstructors.contains(it) }
val selectedConstructors = if (nonHidden.isNotEmpty()) {nonHidden} else{hiddenConstructors}
val hiddenConstructors = allConstructors.filter { constructor ->
constructor.annotations.isNotEmpty() &&
(constructor.annotations.filterIsInstance<Deprecated>().first().level == DeprecationLevel.HIDDEN)
}
val nonHidden = allConstructors.filterNot(hiddenConstructors::contains).filterNot(::isNotKotlinXSerialisation)

val selectedConstructors = nonHidden.ifEmpty { hiddenConstructors }
return selectedConstructors.shuffled(config.random)
.map { it to { param: KParameter -> makeRandomInstanceForParam(param.type, classRef, type) } }
}

private fun isNotKotlinXSerialisation(it: KFunction<Any>) = it.toString().contains("SerializationConstructorMarker")

private fun makeRandomInstanceForParam(
paramType: KType,
classRef: KClass<*>,
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
14 changes: 7 additions & 7 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -145,15 +145,15 @@ 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 @@ -202,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
20 changes: 10 additions & 10 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute

echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2

goto fail

Expand All @@ -57,11 +57,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe

if exist "%JAVA_EXE%" goto execute

echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2

goto fail

Expand Down
9 changes: 5 additions & 4 deletions values4k/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import org.jetbrains.kotlin.gradle.tasks.KotlinJvmCompile

description = "ForkHandles Value-types library"

dependencies {
implementation(project(":result4k"))
}

tasks.named<KotlinCompile>("compileTestKotlin") {
kotlinOptions {
freeCompilerArgs += listOf("-Xinline-classes")

tasks.withType<KotlinJvmCompile>().configureEach {
compilerOptions {
freeCompilerArgs.set(freeCompilerArgs.get() + "-Xinline-classes")
}
}
12 changes: 7 additions & 5 deletions versions.properties
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ plugin.me.champeau.jmh=0.7.2

version.com.oneeyedmen..okeydoke=2.0.3

version.com.fasterxml.jackson.core..jackson-databind=2.17.0
version.com.fasterxml.jackson.core..jackson-databind=2.17.1

version.com.natpryce..hamkrest=1.8.0.1

version.junit.jupiter=5.10.2
version.junit.jupiter=5.10.3

## [Blocked] Fails result4k kotest module
version.kotest=5.6.2
Expand All @@ -34,11 +34,13 @@ version.kotest=5.6.2
## # available=5.7.2
## # available=5.8.0
## # available=5.8.1
## # available=5.9.0
## # available=5.9.1

version.kotlin=1.9.23
version.kotlin=2.0.0

version.kotlinx.coroutines=1.8.0
version.kotlinx.coroutines=1.8.1

version.kotlinx.serialization=1.6.3
version.kotlinx.serialization=1.7.1

version.strikt=0.34.1

0 comments on commit 921567b

Please sign in to comment.