ubuntudroid
05/02/2023, 3:23 PM/bin/sh -c /Users/ubuntudroid/Library/Developer/Xcode/DerivedData/Clear-exiyzzachjfrvmbualscrdesogez/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/shared.build/Script-46EB2E00010940.sh
REPO_ROOT="$PODS_TARGET_SRCROOT"
"$REPO_ROOT/../gradlew" -p "$REPO_ROOT" $KOTLIN_PROJECT_PATH:syncFramework -Pkotlin.native.cocoapods.platform=$PLATFORM_NAME -Pkotlin.native.cocoapods.archs="$ARCHS" -Pkotlin.native.cocoapods.configuration="$CONFIGURATION"
> Task :buildSrc:compileKotlin FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':buildSrc:compileKotlin'.
> Error while evaluating property 'compilerOptions.jvmTarget' of task ':buildSrc:compileKotlin'.
> Failed to calculate the value of property 'jvmTarget'.
> Unknown Kotlin JVM target: 20
How can I pin the JVM target for iOS builds of the shared library?
Setting
export JAVA_HOME=/Users/ubuntudroid/Library/Java/JavaVirtualMachines/azul-17.0.7/Contents/Home
in the shared build step mentioned above works, but that obviously won’t work on any other than my machine including the CI.
Can I somehow force JAVA_HOME for the build script to be the same like its set on the machine its running on?ubuntudroid
05/02/2023, 3:59 PMkotlin {
jvmToolchain(17)
}
ubuntudroid
05/02/2023, 4:00 PMJeff Lockhart
05/02/2023, 4:03 PMubuntudroid
05/02/2023, 5:06 PMJeff Lockhart
05/02/2023, 5:33 PMkotlin { ... }
configuration block of build.gradle.kts scripts, wherever a Kotlin plugin is applied. You could do it in a convention plugin as well. If you have a pure Java module, without Kotlin, you can do the same with:
java {
toolchain.languageVersion.set(JavaLanguageVersion.of(17))
}
ubuntudroid
05/03/2023, 5:16 PMJeff Lockhart
05/03/2023, 6:39 PMallprojects
or subprojects
because you need a Kotlin plugin applied in order to use the kotlin { ... }
configuration block.
If you want to enforce the same JVM toolchain for multiple modules, you should be able to do this in a convention plugin. You could also make a shared variable for the Java language level that's passed to the jvmToolchain()
function in each project.ubuntudroid
05/03/2023, 7:38 PMBekzod
03/05/2024, 6:42 AMBekzod
03/05/2024, 7:24 AM// settings.gradle.kts
plugins {
id("org.gradle.toolchains.foojay-resolver-convention") version "0.8.0"
}
and then it worked) ios build time take about 30 minf for some reason but eventually it worked.Jeff Lockhart
03/05/2024, 6:26 PMid("org.gradle.toolchains.foojay-resolver-convention")I was going to suggest this plugin. You need to make sure you have the proper JDK installed. This plugin will do that for you.
Jeff Lockhart
03/05/2024, 6:27 PMBekzod
03/06/2024, 5:33 AMJeff Lockhart
03/06/2024, 5:51 AMBekzod
03/06/2024, 6:06 AM