Vincent Williams
07/28/2020, 8:20 PMkotlinOptions
. Im using gradle version 6.5serebit
07/28/2020, 8:21 PMtasks.withType<KotlinCompile> {
kotlinOptions.jvmTarget = "1.8"
}
Vincent Williams
07/28/2020, 8:23 PMunresolved reference KotlinCompile
Vincent Williams
07/28/2020, 8:23 PMVincent Williams
07/28/2020, 8:23 PMimport org.jetbrains.kotlin.gradle.tasks.KotlinCompile
but had the same issueoctylFractal
07/28/2020, 8:23 PMVincent Williams
07/28/2020, 8:24 PMplugins {
`kotlin-dsl`
}
Vincent Williams
07/28/2020, 8:24 PMoctylFractal
07/28/2020, 8:24 PMkotlin("jvm")
octylFractal
07/28/2020, 8:24 PMkotlin("jvm") version "1.3.72"
Vincent Williams
07/28/2020, 8:27 PMVincent Williams
07/28/2020, 8:27 PMVincent Williams
07/28/2020, 8:29 PMkotlin("android")
Vincent Williams
07/28/2020, 8:29 PMkotlin("jvm")
with it?octylFractal
07/28/2020, 8:29 PMVincent Williams
07/28/2020, 8:30 PMoctylFractal
07/28/2020, 8:30 PMserebit
07/28/2020, 8:30 PMserebit
07/28/2020, 8:30 PMVincent Williams
07/28/2020, 8:30 PMVincent Williams
07/28/2020, 8:30 PMoctylFractal
07/28/2020, 8:32 PMoctylFractal
07/28/2020, 8:32 PMVincent Williams
07/28/2020, 8:33 PMkotlinOptions {
jvmTarget = "1.8"
}
this is what im trying to accomplishoctylFractal
07/28/2020, 8:33 PMandroid
block, not configured via tasksVincent Williams
07/28/2020, 8:34 PMserebit
07/28/2020, 8:34 PMVincent Williams
07/28/2020, 8:34 PMkotlinOptions
Vincent Williams
07/28/2020, 8:34 PMVincent Williams
07/28/2020, 8:34 PMVincent Williams
07/28/2020, 8:35 PMVincent Williams
07/28/2020, 8:48 PMimplementation(kotlin("gradle-plugin", version = "1.3.72"))
Vincent Williams
07/28/2020, 8:48 PMkotlinOptions
but at least I can configure the KotlinCompile
taskoctylFractal
07/28/2020, 8:49 PMkotlin("android")
is that plugin I thinkVincent Williams
07/28/2020, 8:49 PMVincent Williams
07/28/2020, 8:49 PMoctylFractal
07/28/2020, 8:50 PMVincent Williams
07/28/2020, 8:51 PMclass AndroidLibraryCommon : Plugin<Project> {
override fun apply(target: Project) {
target.plugins.apply("com.android.library")
target.plugins.apply("kotlin-android")
target.plugins.apply("kotlin-android-extensions")
target.extensions.getByType<LibraryExtension>().configure()
}
private fun LibraryExtension.configure() {
compileSdkVersion(...
Vincent Williams
07/28/2020, 8:51 PMserebit
07/28/2020, 8:51 PMVincent Williams
07/28/2020, 8:51 PMoctylFractal
07/28/2020, 8:51 PMVincent Williams
07/28/2020, 8:52 PMoctylFractal
07/28/2020, 8:52 PMimplementation(kotlin("gradle-plugin", version = "1.3.72"))
octylFractal
07/28/2020, 8:52 PMdependencies
block, not nested in buildscript
Vincent Williams
07/28/2020, 8:53 PMkotlinCompile
though?octylFractal
07/28/2020, 8:53 PMVincent Williams
07/28/2020, 8:53 PMoctylFractal
07/28/2020, 8:57 PMkotlin("android")
in your plugin's buildscript, I don't think that's very usefuloctylFractal
07/28/2020, 8:57 PMVincent Williams
07/28/2020, 8:58 PMDependencies.kt
file with a KOTLIN_VERSION
constant. Do you know if theres a way to reference that from within the buildSrc/build.gradle.kts
? I seem to only be able to reference it from other build filesVincent Williams
07/28/2020, 8:58 PMkotlin("android")
is being applied to the plugins AndroidLibrary
extensionoctylFractal
07/28/2020, 8:59 PMbuildSrc/build.gradle.kts
(and settings too) cannot access any declared files that need to be compiled, since you need the build.gradle.kts
to define how to build themoctylFractal
07/28/2020, 8:59 PMDependencies.kts
though? I'm not sure how that works outVincent Williams
07/28/2020, 9:00 PMoctylFractal
07/28/2020, 9:01 PMbuildSrc
stuff is usually compiled against embeddedKotlinVersion
(defined by Gradle) since it is used by the Gradle build, not your projectoctylFractal
07/28/2020, 9:01 PMVincent Williams
07/28/2020, 9:02 PMVincent Williams
07/28/2020, 9:02 PMoctylFractal
07/28/2020, 9:02 PMVincent Williams
07/28/2020, 9:02 PMVincent Williams
07/28/2020, 9:02 PMgradle-plugin
dependencyoctylFractal
07/28/2020, 9:03 PMVincent Williams
07/28/2020, 9:03 PMoctylFractal
07/28/2020, 9:04 PMoctylFractal
07/28/2020, 9:04 PMVincent Williams
07/28/2020, 9:04 PMVincent Williams
07/28/2020, 9:04 PMoctylFractal
07/28/2020, 9:08 PMcompileOnly(kotlin("gradle-plugin"))
-- that is, it uses the embedded version for compiling against, but does not enforce it on the end build, and does not provide a specific version thereoctylFractal
07/28/2020, 9:09 PMVincent Williams
07/28/2020, 9:10 PMVincent Williams
07/28/2020, 9:46 PMbuildscript { dependencies {
block as suggested here: https://kotlinlang.org/docs/reference/using-gradle.html then it doesnt workVincent Williams
07/28/2020, 9:47 PMimplementation
otherwise KotlinCompile
cant be found. Any ideas as to why the difference from what the gradle docs show?octylFractal
07/28/2020, 9:47 PMbuild.gradle.kts
octylFractal
07/28/2020, 9:47 PMbuildscript
is for the `build.gradle.kts`'s classpathVincent Williams
07/28/2020, 9:50 PMVincent Williams
07/28/2020, 9:52 PMbuildSrc
module?octylFractal
07/28/2020, 9:53 PMbuild.gradle.kts
classpath, not on the compile classpathoctylFractal
07/28/2020, 9:53 PMVincent Williams
07/28/2020, 9:55 PMimplementation
the compile classpath?octylFractal
07/28/2020, 9:56 PMbuildSrc
compile classpath for sure, but not your main projectoctylFractal
07/28/2020, 9:56 PMbuildSrc/build.gradle.kts
Vincent Williams
07/28/2020, 9:57 PMimplementation
vs classpath
octylFractal
07/28/2020, 9:58 PMclasspath
is always for when you need a class in the build.gradle.kts
you're currently in, it's only valid inside of buildscript { dependenices {} }
octylFractal
07/28/2020, 9:58 PMimplementation
is for when you need to compile against a class, regardless of if that is for a plugin or for an applicationVincent Williams
07/28/2020, 9:59 PMclasspath(kotlin("gradle-plugin"))
in my projects build.gradle.kts
(not buildSrc) If I have it in the buildSrc as well, is it redundant to have it both places?Vincent Williams
07/28/2020, 9:59 PMoctylFractal
07/28/2020, 10:00 PMoctylFractal
07/28/2020, 10:01 PMkotlin("gradle-plugin")
in both places as a dependency is redundantVincent Williams
07/28/2020, 10:01 PMoctylFractal
07/28/2020, 10:01 PMbuildSrc
as api
instead, so that it appears on the compile classpath of the main build.gradle.kts
octylFractal
07/28/2020, 10:01 PMVincent Williams
07/28/2020, 10:02 PM