ankushg
08/26/2021, 5:51 PMKotlinCompile
task for a given KotlinCompilation
, or alternatively
• get the KotlinCompilation
for a given KotlinCompile
task?
For background (in case there's a better way to do what I'm trying to do) I have a multiplatform project with a JS(IR)
target.
I'm trying to get the KotlinJsIrLink
task (a subclass of KotlinCompile
) for the production, main artifact so that I can write a Gradle task to send the generated .d.ts
file elsewhere.
I can do tasks.withType<KotlinJsIrLink>.filter { it.mode == KotlinJsBinaryMode.PRODUCTION }
but I still get the tasks corresponding to test compilations in there.
I can also do kotlin.targets.flatMap { it.compilations }.filter { it is KotlinJsIrCompilation && it.name == KotlinCompilation.MAIN_COMPILATION_NAME }
but that includes non-production compilations, and I can't figure out how to go from that to the KotlinJsIrLink
tasks.
Any tips would be appreciated!Nick
08/26/2021, 7:00 PMjmfayard
08/27/2021, 11:24 AMAyfri
08/27/2021, 5:05 PMlibs.versions.toml
?Richard Glen
08/28/2021, 4:07 AMJeff Davidson
08/29/2021, 4:21 AMErdem Tuna
08/30/2021, 11:05 AMbuild.gradle.kts
?Vitaliy Zarubin
08/30/2021, 12:21 PMpcarrier
08/30/2021, 12:44 PMproject.tasks.withType(KotlinCompile::class.java).configureEach {
kotlinOptions {
allWarningsAsErrors = true
freeCompilerArgs = freeCompilerArgs +
listOf("-Xopt-in=kotlin.RequiresOptIn", "-opt-in=kotlin.time.ExperimentalTime")
}
}
and running into:
e: Invalid argument: -opt-in=kotlin.time.ExperimentalTime
Am I getting the syntax wrong? That's how it's documented @ https://kotlinlang.org/docs/opt-in-requirements.html#module-wide-opt-in AFAICTKirill Grouchnikov
08/31/2021, 2:05 AMCopy
task with subprojects.findAll { /* some condition */ }.collect { it.configurations.compileClasspath }
Pitel
08/31/2021, 6:29 AMsourceSets.named("main") {
java.srcDirs("$buildDir/generated/graphql")
}
SourceSet with name 'main' not found.
suresh
08/31/2021, 3:55 PMChachako
09/01/2021, 9:55 AMJames Whitehead
09/01/2021, 10:39 AMhfhbd
09/01/2021, 3:26 PM* What went wrong:
Execution failed for task build
> Failed to notify task execution listener.
> KOTLIN_STAT_LABEl_PROPERTY
FunkyMuse
09/01/2021, 9:02 PM> Task :app:stripReleaseDebugSymbols
Unable to strip the following libraries, packaging them as they are
same thing is happening with gradle 7.0.1 tooGama11
09/03/2021, 1:17 PMtasks.withType<KotlinCompile>().configureEach {
and tasks.withType<KotlinCompile> {
? It seems like the configureEach
is redundantursus
09/05/2021, 2:21 AMapply plugin: foo.bar
. Everyting works
Then I change the plugin source from groovy to kotlin, and it doesn't work
class BrowserStackPlugin :Plugin<Project> {
override fun apply(project: Project) {
...
}
}
A problem occurred evaluating project ':app'.
> No implementation class specified for plugin 'foo.bar' in jar:file:/C:/Users/ursus/.gradle/caches/jars-8/d86af8da5bcd5c16642c4dc40605c5b9/buildSrc.jar!/META-INF/gradle-plugins/foo.bar.properties.
Are kotlin plugins not supported in buildSrc??Scott Whitman
09/05/2021, 10:08 PMplugins {
kotlin("plugin.serialization") version "1.5.30"
}
into
override fun apply(project: Project) {
// none of these work
// project.pluginManager.apply("org.jetbrains.kotlin.plugin.serialization:1.5.30")
// project.pluginManager.apply("org.jetbrains.kotlin.plugin.serialization")
// project.plugins.apply("org.jetbrains.kotlin.plugin.serialization:1.5.30")
// project.plugins.apply("org.jetbrains.kotlin.plugin.serialization")
}
Everything I have tried give me an error Plugin with id 'org.jetbrains.kotlin.plugin.serialization' not found
nuhkoca
09/07/2021, 10:10 AMGroovy
extra in my KTS
scripts but I couldn’t make it. I have something in my constants.gradle
ext {
javaTypes = [
NULL : "null",
TRUE : "true",
FALSE : "false",
BOOLEAN : "boolean",
STRING : "String",
STRING_ARRAY: "String[]",
INT : "int",
LONG : "long"
]
}
val javaTypes by extra
buildConfigField(javaTypes.STRING, constants.HTTP_DEV_URL, asString(Urls.http_dev_url))
And in a KTS script, I am trying to access it like above but I am getting error:
Unresolved reference: javaTypes
Can you help me? Thanks.Richard Glen
09/07/2021, 2:11 PMdsvoronin
09/07/2021, 10:24 PMAppending input value fingerprint for 'kotlinJavaToolchainProvider' to build cache key: 579ef60211f6a32e39cd244937049220
Appending input value fingerprint for 'kotlinJavaToolchainProvider' to build cache key: 7b38054c10085dfb665417dd82eb8269
why it could be different?
nested kotlinJavaToolchainProvider.javaVersion
are equal
Why it's even calculated as a part of compilation task cache if only javaVersion
property marked as @Input
?ursus
09/08/2021, 12:03 AMKarlo Lozovina
09/08/2021, 1:21 PMappleobject
09/08/2021, 9:40 PMJoffrey
09/10/2021, 10:52 PMmingwX64
target:
tasks.withType<org.jetbrains.kotlin.gradle.targets.native.tasks.KotlinNativeTest> {
environment("SOME_VAR", "some value")
}
But for some reason those are not passed when running iOS tests. Does this have to do with the fact that iOS tests run in a simulator and therefore likely start a separate process? Is there any way to pass environment variables to that other process, then?
(Note that in reality I'm setting environment()
in a nested doFirst { }
block because I need execution time information, but the problem occurs as well even without this peculiarity so I simplified the example)A. Sachdeva
09/12/2021, 7:33 PMkotlin-dsl
gradle plugin for android.
So far i really liked the concept of configuring dependencies via a single buildSrc/src/main/Dependencies.kt
file. I want to take it a step further and have the whole app configuration configured from pure kotlin files. is that possible?
something like the old apply from("${project.rootDir}/commons.gradle")
, but for koltin , like if i add an android library, all i need to do is add a build.gradle.kts file in library root with some static function call, like GradleConfigurations.librarySetup(this)
and there i could automatically setup project plugins, dependencies, the android{}
block, etc?
How to do that? So far i have been able to do this for the root level build.gradle.kts
file, but app/build.gradle.kts
seems to use internal/inaccessible extensions. so any other approach ?andylamax
09/13/2021, 1:45 AMOrhan Tozan
09/13/2021, 8:49 AMJonas Frid
09/13/2021, 12:50 PMJonas Frid
09/13/2021, 12:50 PMVampire
09/13/2021, 1:49 PM./gradlew check
?