Justin
06/15/2020, 2:48 AMchristophsturm
06/15/2020, 12:02 PMAaron Todd
06/15/2020, 1:36 PM// project A
val integrationTest by creating {
kotlin.srcDir("it")
dependsOn(getByName("jvmTest"))
dependencies {
implementation(project(":test-utils", "jvmMainImplementation"))
implementation("org.jetbrains.kotlin:kotlin-test:$kotlinVersion")
implementation("org.jetbrains.kotlin:kotlin-test-junit:$kotlinVersion")
}
}
I've tried various incantations of depending on the "test-utils" project including custom configurations. I was working on setting up a test Jar output but also having trouble with Gradle Kotlin DSL and MPP.
// project "test-utils"
kotlin {
sourceSets {
jvmMain {
dependencies {
api("org.jetbrains.kotlin:kotlin-test:$kotlinVersion")
api("org.jetbrains.kotlin:kotlin-test-junit:$kotlinVersion")
...
}
}
}
}
I can't tell which I'm fighting, Gradle Kotlin DSL, Kotlin MPP, or both.
The generic problem: How to setup a custom (test) source set and depend on another project that provides common test utils using Kotlin MPP? I've seen examples of this without Kotlin MPP but that seems to be adding an extra layer that I haven't connected. Any ideas or examples to look at?ursus
06/15/2020, 3:48 PMJoost Klitsie
06/15/2020, 7:37 PMfun DependencyHandlerScope.implementKtorServer(flavor: String = "") {
implementation(ktor(Serialization), flavor)
//.... others...
implementation(ktor(AuthJwt), flavor)
}
In this way, I can easily call this from my build.gradle.kts for the backend module
dependencies {
implementKtorServer()
// ... other things
This is because the dependencies in a Gradle file give you a DependencyHandlerScope context. However, with multiplatform, like this:
val commonMain by getting {
dependencies {
// ... stuff
You have a KotlinDependencyHandler
context. So my question is: How can I make an extension function in my buildSrc module on a KotlinDependencyHandler? I tried to pull in some kotlin gradle plugin dependencies in my buildSrc/build.gradle.kts but no luck. For now, it looks like this:
plugins {
`kotlin-dsl`
}
repositories {
jcenter()
}
And KotlinDependencyHandler
is until now unresolved 😞 Does anyone know what I could do here?Brendan Weinstein
06/15/2020, 9:45 PMcmd+b
to see where a dependency version var is defined in a project with many modules. I am not sure that the dev productivity boost outweighs the marginal slowdown in compile time. And when major open source kotlin repositories (eg coroutines) are not using the dsl it signals that there is not even confidence within jetbrains around using it.
You can ctrl+j
for documentation lookup but there is little-to-no documentation of the dsl-ified version of the android plugin, and often the function signatures are not informative.elect
06/19/2020, 11:38 AMcompileKotlin
task when I build, although the project is pure java with kotlin libs, is it fine?tim
06/19/2020, 12:57 PMbuild.gradle.kts
projects/api
...
projects/core <-- a git submodule
projects/core/gradle.build.kts // file in question
Normally, I have the parent project specify plugin dependency versions. This works fine for everything except for core. Because Core is a submodule I can clone it and work on it in isolation, where in that case I need to specify plugin versions: kotlin("jvm") version("...") apply(true)
but when core is consumed as a submodule and the parent project specifies the version i get a build error from gradle: Plugin request for plugin already on the classpath must not include a version
Any suggestions on how to approach/workaround this?Stefano Longhi
06/24/2020, 8:02 AMJoakim Tengstrand
06/24/2020, 2:09 PMStefano Longhi
06/24/2020, 4:35 PM[...]
Successfully started process 'command '/Library/Java/JavaVirtualMachines/jdk-14.0.1.jdk/Contents/Home/bin/java''
Error: Could not find or load main class abaddon83.tests.marvels.AppKt
Caused by: java.lang.ClassNotFoundException: abaddon83.tests.marvels.AppKt
:run (Thread[Execution worker for ':',5,main]) completed. Took 0.118 secs.
BuildUid: local
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':run'.
> Process 'command '/Library/Java/JavaVirtualMachines/jdk-14.0.1.jdk/Contents/Home/bin/java'' finished with non-zero exit value 1
the classpath abaddon83.tests.marvels.AppKt is right 😞
any idea?Brian
06/26/2020, 2:58 AMorg.jetbrains.grammarkit
plugin? I'm having issues with Grammar Kit being able to find a class. I don't actually know if the problem is with Gradle or if it's a Grammar Kit problem. Assuming it's a build script problem, how do I ensure that main/kotlin
is on the parser generator's classpath?Chilli
06/28/2020, 9:28 AMJoakim Tengstrand
06/29/2020, 3:36 PMjanvladimirmostert
06/30/2020, 8:01 PMbuild.gradle.kts
settings.gradle.kts
subprojects
+-- project-www
+-- project-a (kotlin jvm)
+-- project-b (kotlin mp jvm+js)
+-- project-c (kotlin mp jvm+js)
+-- project-d (java jvm)
+-- project-e (kotlin jvm)
inside my settings.gradle.kts (root), i've added
include("project-www")
include("project-a")
include("project-b")
...
include("project-e")
what should be going into my project-b/settings.gradle.kts
and project-b/build.gradle.kts
in order to pull in that project-d or project-e dependencies?
and then i want to include that multiplatform's JVM part in project, would i be following the same steps or should i do something different for including a multiplatform project as dependency?LastExceed
07/01/2020, 11:32 AMtim
07/01/2020, 3:24 PM// inside project A /src/tests/kotlin
package com.example.a
object TestHelper { ... }
And from project b I'd like to be able to do
// inside project B /src/tests/kotlin
package com.example.b
import com.example.a.TestHelper
fun someTest() ...
I was checking out test fixtures gradle plugin for java but I couldn't get it to work. Wasnt sure if i was misconfigurating it, or otherwise?Joakim Tengstrand
07/02/2020, 9:19 AMFrodrigues
07/06/2020, 12:09 PMJoost Klitsie
07/08/2020, 8:07 AM:backend:run
task in intellij) I cannot run my frontend project (by using :frontend:jsBrowserDevelopmentRun
). Absolutely nothing is happening as long as one of the two is running. The other has 0 output and will only magically start running once the first one is killed. (so for example there is no port clash, they use different ports anyway, but it doesn't get that far). If I save the run configuration and check the flag in intellij (or in Android studio, in both) at the run configurations to run in parallel, exactly nothing happens. I can save it all I want, but anytime I open the run configurations dialog again the parallel flag is unchecked. org.gradle.parallel=true
is set in my build.gradle. Is there any way I can run 2 different modules at the same time in intellij? (they share a common library if that is important). Also, I can run them simultaneously in bash with commands like ./gradlew :backend:run
on Windows. But there is no way for me to kill the process (so for example ^C does absolutely nothing, ^D does also nothing). I can only kill the process through task manager or probably if I open another bash find the process and kill it like that)Offz
07/09/2020, 1:49 AMB
from A
.
B
includes several subprojects and I'd like to include one, say subproject
, as a dependency in A
Is there any way to do this nicely with composite builds, what would my alternatives be if there isn't?janvladimirmostert
07/10/2020, 8:13 PMtask("build").finalizedBy("jsPublicPackageJson")
but it complains Cannot add task 'build' as a task with that name already exists.
Exerosis
07/12/2020, 9:09 AM> Could not resolve com.github.Exerosis.Mynt:Mynt-metadata:1.0.4.
Required by:
project : > com.github.Exerosis:Mynt:1.0.4
> Unable to find a matching variant of com.github.Exerosis.Mynt:Mynt-metadata:1.0.4:
- Variant 'metadata-api' capability com.github.Exerosis.Mynt:Mynt-metadata:1.0.4:
- Incompatible attributes:
- Required org.gradle.usage 'java-runtime' and found incompatible value 'kotlin-api'.
- Required org.jetbrains.kotlin.platform.type 'jvm' and found incompatible value 'common'.
- Other attributes:
- Required org.gradle.dependency.bundling 'external' but no value provided.
- Required org.gradle.jvm.version '8' but no value provided.
- Required org.gradle.libraryelements 'jar' but no value provided.
- Found org.gradle.status 'release' but wasn't required.
As well as a similar one for Mynt-js, am I doing something wrong? I've even tried excluding those parts:
implementation("com.github.Exerosis:Mynt:1.0.4") {
exclude("com.github.Exerosis", "Mynt-js")
exclude("com.github.Exerosis", "Mynt-metadata")
}
But no luck 😞Christian Sousa
07/13/2020, 2:17 PMcompile group: 'com.test', name: 'lib', version: '1.0.0', ext: 'pom'
tim
07/13/2020, 7:51 PMLoboda Deni
07/14/2020, 2:26 PMLoboda Deni
07/15/2020, 8:23 AMLoboda Deni
07/16/2020, 4:44 PMJuan Rodríguez
07/16/2020, 6:01 PMandroid {}
from individual modules to subprojects {}
(root gradle.kts) to share configuration between modules.
In gradle I use something like this:
subprojects {
afterEvaluate {
if(project.plugins.findPlugin("com.android.application") != null || project.plugins.findPlugin("com.android.library") != null) {
android{
...
}
Praveen Talari
07/19/2020, 2:39 PMPraveen Talari
07/19/2020, 2:39 PMgildor
07/19/2020, 2:43 PM