James Hendry
01/12/2022, 9:23 PMreobfJar {
shadowJar
}
I can't figure out how to do this in kotlin. reobfJar is a task. I want the reobfJar task to also be run on the shadowJar too. (not sure quite how this works unfortunately)
The closest i've got i think is:
tasks.all {
println("Task $this, path ${this.path}")
if (this.path == ":reobfJar") {
println("I AM REOBFJAR!")
this.configure<net.minecraftforge.gradle.patcher.tasks.ReobfuscateJar> {
tasks.getByName("shadowJar")
}
}
}
I can't figure out how to get the reobfjar task without iterating, .getByPath doesn't seem to work.
But also this.configure seems to want an Extension instead of a task? No clue what im supposed to do here.FunkyMuse
01/16/2022, 1:45 PMdave08
01/16/2022, 4:03 PMe: .../app/build.gradle.kts:10:45: Unresolved reference: util
e: .../app/build.gradle.kts:11:65: Unresolved reference: newDataInputStream
I updated to gradle 7.3.3 and android plugin 7.0.4...dave08
01/16/2022, 4:15 PMColton Idle
01/16/2022, 11:25 PMplugins {
id("java-library")
id("org.jetbrains.kotlin.jvm")
}
but then I went and looked at an old project and it had a kotlin only lib module that looked like this:
plugins {
id("java-library")
id("kotlin")
}
So is there any diff between the second lines in both of these?K Merle
01/17/2022, 12:08 PM:app:compileDebugUnitTestKotlin
. Any help appreciated.leandro
01/17/2022, 6:11 PMkotlin-multiplatform
plugin, is it possible to create a sourceSet from a folder that’s sibling to the module that I’m currently configuring? As in, I have modules A and B, like so:
moduleA
test
testShared
build.gradle.kts
moduleB
test
build.gradle.kts
I would like to include testShared
when running :moduleB:test
What I have on moduleA:
val jvmTestShared by creating
val jvmTest by getting {
dependencies {
dependsOn(jvmTestShared)
}
}
but I can’t seem to be able to create jvmTestShared
on moduleBleandro
01/17/2022, 6:25 PMtestShared
anywhere, actually. It’s quite a unique setup because I can only run it on JVM targets, so even having one depending on the other might be tricky because ArchUnit does not know about kotlin-multiplatform
pluginTravis Reitter
01/18/2022, 6:55 PMcreate()
function here from a Groovy gradle file. I've tried calling this way:
cklib {
create("sqlighter") {
language "co.touchlab.cklib.gradle.CompileToBitcode.Language.OBJC"
}
}
but I'm getting:
org.gradle.api.GradleScriptException: A problem occurred evaluating project ':SharedCode'.
...
Caused by: groovy.lang.MissingMethodException: No signature of method: build_89t0gtdiazmlot5b0npjl25b8.cklib() is applicable for argument types: (build_89t0gtdiazmlot5b0npjl25b8$_run_closure3) values: [build_89t0gtdiazmlot5b0npjl25b8$_run_closure3@7e7932ea]
Possible solutions: mkdir(java.lang.Object), split(groovy.lang.Closure), wait(), file(java.lang.Object), wait(long), copy(groovy.lang.Closure)
Here's a working example of it being called from Kotlin DSL.
What simple syntax error am I making? 🙂Zahara Vidumshikova
01/19/2022, 8:15 AMbuildscript {
repositories {
maven {
url = uri("<https://files.minecraftforge.net/maven>")
}
mavenCentral()
}
dependencies {
classpath("net.minecraftforge.gradle", "ForgeGradle", "5.+") {
isChanging = true
}
}
}
How can I rewrite it into apply(plugin="smth") style?
This does not work:
repositories {
maven(url = "<https://maven.minecraftforge.net>")
mavenCentral()
}
apply(plugin = "net.minecraftforge.gradle:ForgeGradle:5.+")
Slackbot
01/22/2022, 12:28 AMiamthevoid
01/23/2022, 11:00 AMbuild.gradle(kts)
files, but if i add it as project
dependency (:path:to:submodule
) submodule use root project build.gradle(kts)
files to build its sources and i must to synschronize build variables. It is kind of easy (but not normal) if i use own project as submodule, but what if i want to add any project and it has own gradle build architecture?Justin Tullgren
01/24/2022, 6:26 PMtseisel
01/30/2022, 12:56 PMtasks.withType<KotlinCompile>().configureEach {
kotlinOptions {
freeCompilerArgs = freeCompilerArgs + listOf(
"-Xno-param-assertions",
"-Xno-call-assertions",
"-Xno-receiver-assertions"
)
}
}
but it's applied to all build variants, which is not what I want.
The kotlin.android
Gradle plugin creates compilation tasks (compileDebugKotlin
, compileReleaseUnitTestKotlin
, etc) for each source set, but it seems there is no way to configure their kotlinOptions
individually.Kiki Abdullah
01/30/2022, 3:58 PMAlessandro Tagliapietra
01/30/2022, 6:04 PM// Custom jars for kafka connect
create<ShadowJar>("kafkaConnectUtilsJar") {
archiveClassifier.set("connect-utils")
include("co/visup/kafkaProcessor/connect/**")
include("co/visup/kafkaProcessor/serializer/**")
dependencies {
include(dependency("io.confluent:kafka-connect-storage-partitioner:10.2.4"))
}
from(project.sourceSets.main.get().output)
configurations = listOf(project.configurations.runtimeClasspath.get())
}
however while I see the classes in co/visup
etc, I don't see the dependency, anyone has any idea?Alexander Black
01/31/2022, 7:53 PMursus
01/31/2022, 9:20 PMmartmists
02/01/2022, 2:56 PMKarlo Lozovina
02/01/2022, 5:03 PMtasks {
compileKotlin {
kotlinOptions { ... }
}
compileTestKotlin {
kotlinOptions {... }
}
}
How would I specify options for some other buildSrc, let's call it "someOtherSrc"?Jan
02/02/2022, 5:46 PMKarlo Lozovina
02/03/2022, 4:37 PMtasks { test { jvmArgs = ...}}
vs. tasks { withType<Test> { jvmArgs = ...}
? It seems to work identically, but is one way better than the other?Eugen Martynov
02/04/2022, 7:31 PMbrabo-hi
02/05/2022, 8:06 PMbuild.gradle
to build.gradle.kt
Jan Skrasek
02/09/2022, 9:16 AMconfigurations
.configureEach {
incoming.afterResolve {
dependencies.forEach { dependency ->
if (dependency.name == "eithernet") {
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach {
kotlinOptions {
@Suppress("SuspiciousCollectionReassignment")
freeCompilerArgs += "-Xopt-in=com.slack.eithernet.ExperimentalEitherNetApi"
}
}
}
}
}
}
I've spent two days resolving the transitive deps but still failing to do it properly anyhow. Any idea?electrolobzik
02/09/2022, 10:09 AMval answer: String by project
work? Project
interface doesn’t have getValue()
and setValue()
, so how does it work as a delegate then?ursus
02/10/2022, 1:40 AMjava
processes running? I presume 1 is for kotlin deamon, 2nd is for gradle daemon. But are 3, 4 necessary? They both seem to be pointing to gradle.
Is this normal or possible a bug? (Since there are issues with new AS version not respecting the JDK path settings and using its own packages JRE etc; and no I’m not couting these in)Goldcrest
02/11/2022, 2:44 AM:kaptGenerateStubsKotlin
with java.lang.NoClassDefFoundError: Could not initialize class <http://org.jetbrains.kotlin.com|org.jetbrains.kotlin.com>.intellij.pom.java.LanguageLevel
on JVM 17?
I’m having a “it works on my machine” problem and the only difference seems to be the JVM version.
We were able to amend it by adding gradle.properties settings option org.gradle.jvmargs=-Dkotlin.daemon.jvm.options=--illegal-access=permit
, but it seems like out of random the build fails even with the option too, in which case we remove the option again-- as if the error switches on and off out of nowhere.
Any hints would be appreciated! Thanks in advance!martmists
02/12/2022, 1:14 PMapply(from="/path/to/file.gradle.kts")
, I don't seem to get any syntax highlighting or other IDA features. Is there a different way I should split gradle scripts?darkmoon_uk
02/12/2022, 1:53 PMinline
:
I'm moving code out of my build.gradle.kts
into extension functions on Android's LibraryExtension
in buildSrc
, making the config nice and neat 👍
After moving the code, it doesn't work 😱, Gradle behaves as though the config hasn't applied, even though the calls are there and it compiles.
One of the things I tried out of desperation was to make the functions inline
, and suddenly it all works!!!
Never before have I come across a situation in Kotlin where inline
changes behaviour 🤷
Oh Gradle... the tool that's guaranteed to keep me humble as a developer. Whenever I think I've finally understood it; you can be guaranteed a heavy fall is just around the corner.darkmoon_uk
02/12/2022, 1:53 PMinline
:
I'm moving code out of my build.gradle.kts
into extension functions on Android's LibraryExtension
in buildSrc
, making the config nice and neat 👍
After moving the code, it doesn't work 😱, Gradle behaves as though the config hasn't applied, even though the calls are there and it compiles.
One of the things I tried out of desperation was to make the functions inline
, and suddenly it all works!!!
Never before have I come across a situation in Kotlin where inline
changes behaviour 🤷
Oh Gradle... the tool that's guaranteed to keep me humble as a developer. Whenever I think I've finally understood it; you can be guaranteed a heavy fall is just around the corner.Vampire
02/12/2022, 2:08 PM