Slackbot
07/19/2022, 9:17 PMShaun Wild
07/19/2022, 9:17 PMShaun Wild
07/19/2022, 9:17 PMShaun Wild
07/19/2022, 9:18 PMShaun Wild
07/19/2022, 9:18 PMtony
07/19/2022, 9:20 PMShaun Wild
07/19/2022, 9:20 PMShaun Wild
07/19/2022, 9:24 PMShaun Wild
07/19/2022, 9:24 PMCould not resolve project :.
Required by:
project :integrationtony
07/19/2022, 9:25 PMval functionalTestSourceSet = sourceSets.create("functionalTest") {
compileClasspath += main.output + configurations["testRuntimeClasspath"] + commonTest.output
runtimeClasspath += output + compileClasspath
}
Create the new source set. Set its compile classpath to the output of the main source set (i.e., the compiled class files), and set its runtime classpath to the compile classpath + the result of compiling this source set
val functionalTestImplementation = configurations
.getByName("functionalTestImplementation")
.extendsFrom(configurations.getByName("testImplementation"))
the new configuration should extend from the default testImplementation configuration, mostly for ergonomics so I don't have to re-declare a bunch of test dependencies. This is optional.
val compileFunctionalTestKotlin = tasks.named("compileFunctionalTestKotlin")
tasks.named<AbstractCompile>("compileFunctionalTestGroovy") {
dependsOn(compileFunctionalTestKotlin)
classpath += files(compileFunctionalTestKotlin.get().outputs.files)
}
Optional, this lets me write code in Kotlin and then have Groovy code depend on ittony
07/19/2022, 9:25 PMephemient
07/19/2022, 9:27 PMShaun Wild
07/19/2022, 9:27 PMShaun Wild
07/19/2022, 9:28 PMShaun Wild
07/19/2022, 9:30 PMtasks.withType<Test> {
useJUnitPlatform()
}
with this plugin?ephemient
07/19/2022, 9:30 PMtesting blocktony
07/19/2022, 9:31 PMIt's creating the source set but it's not a test source setYou are misunderstanding.
integration is a source set. You don't need another source set (named "test") inside of ittony
07/19/2022, 9:32 PMShaun Wild
07/19/2022, 9:32 PMephemient
07/19/2022, 9:32 PMidea plugin. Gradle itself doesn't careShaun Wild
07/19/2022, 9:33 PMtony
07/19/2022, 9:33 PMBut IDEA doesn't mark it as a test source setI don't know what that means.
Shaun Wild
07/19/2022, 9:33 PMtony
07/19/2022, 9:33 PMShaun Wild
07/19/2022, 9:34 PMtony
07/19/2022, 9:34 PMtony
07/19/2022, 9:34 PMShaun Wild
07/19/2022, 9:34 PMtony
07/19/2022, 9:34 PMtest. I don't know how to tell it something is a test in that view, but I can confirm it still lets you run tests from within the IDEtony
07/19/2022, 9:35 PMfunctionalTest source setShaun Wild
07/19/2022, 9:37 PMtestImplementation deps?tony
07/19/2022, 9:37 PMval functionalTestImplementation = configurations
.getByName("functionalTestImplementation")
.extendsFrom(configurations.getByName("testImplementation"))Shaun Wild
07/19/2022, 9:38 PMConfiguration with name 'functionalTestImplementation' not found.tony
07/19/2022, 9:38 PMephemient
07/19/2022, 9:38 PMtony
07/19/2022, 9:38 PMintegrationImplementation, I thinkShaun Wild
07/19/2022, 9:39 PMephemient
07/19/2022, 9:41 PMJohn
07/19/2022, 9:42 PMShaun Wild
07/19/2022, 9:42 PMgrossws
07/19/2022, 9:42 PMpluginManager.withPlugin("idea") {
the<IdeaModel>().module {
// using legacy setters since IDEA ignores new ones
testSourceDirs = testSourceDirs + sourceSet.allSource.sourceDirectories
testResourceDirs = testResourceDirs + sourceSet.resources.sourceDirectories
}
}grossws
07/19/2022, 9:44 PMJohn
07/19/2022, 9:44 PMtony
07/19/2022, 9:45 PMtasks.withType<Test>().configureEach {
useJUnitPlatform()
}
or use the test suites thing. YMMVgrossws
07/19/2022, 9:45 PMShaun Wild
07/19/2022, 9:47 PMtony
07/19/2022, 9:52 PMtony
07/19/2022, 9:52 PM./gradlew <my-module>:integrationTestephemient
07/19/2022, 9:53 PMcheck task as the documentation indicatesShaun Wild
07/19/2022, 9:53 PMTask 'integrationTest' not found in root project 'backend'.Shaun Wild
07/19/2022, 9:54 PMtony
07/19/2022, 9:55 PMephemient
07/19/2022, 9:55 PMtony
07/19/2022, 9:55 PMtony
07/19/2022, 9:56 PMShaun Wild
07/19/2022, 9:56 PMShaun Wild
07/19/2022, 9:57 PMephemient
07/19/2022, 9:58 PMephemient
07/19/2022, 9:59 PMShaun Wild
07/19/2022, 10:01 PMShaun Wild
07/19/2022, 10:01 PMShaun Wild
07/19/2022, 10:02 PMdependencies {
implementation(project)
}Shaun Wild
07/19/2022, 10:03 PMShaun Wild
07/19/2022, 10:03 PMShaun Wild
07/19/2022, 10:03 PMShaun Wild
07/19/2022, 10:12 PMShaun Wild
07/19/2022, 10:15 PMdependencies {
implementation(project)
}John
07/19/2022, 10:18 PMJohn
07/19/2022, 10:18 PMJohn
07/19/2022, 10:18 PMconfigurations {
testApp {
extendsFrom(runtime)
}ephemient
07/19/2022, 10:18 PMJohn
07/19/2022, 10:19 PMtask testJar (type: Jar) {
from sourceSets.main.runtimeClasspath
}
artifacts {
testApp testJar
}Shaun Wild
07/19/2022, 10:19 PMShaun Wild
07/19/2022, 10:19 PMJohn
07/19/2022, 10:19 PMtestImplementation(project(path: ":backend", configuration: "testApp"))John
07/19/2022, 10:20 PMephemient
07/19/2022, 10:20 PMephemient
07/19/2022, 10:20 PMShaun Wild
07/19/2022, 10:21 PMShaun Wild
07/19/2022, 10:39 PMShaun Wild
07/19/2022, 10:39 PMShaun Wild
07/19/2022, 10:40 PMephemient
07/19/2022, 10:42 PMimplementation(project) is only implicit for the main test, you should add it explicitly for the additional suites as needed, and 2. with that it seems to work fine for me, so if you have further issues, see if you can share a reproducible example.Shaun Wild
07/19/2022, 10:43 PMephemient
07/19/2022, 10:47 PMimplementation or api in the main configuration? if they're implementation, then it doesn't show up in downstream compile classpath by defaultephemient
07/19/2022, 10:48 PMapi and that makes them in both the compile and runtime classpathsShaun Wild
07/19/2022, 10:50 PMtestImplementation and implementation apply to both source setsephemient
07/19/2022, 10:52 PMconfigurations.getByName("integrationImplementation") {
extendsFrom(configurations.getByName("implementation"))
extendsFrom(configurations.getByName("testImplementation"))
}
then that'll happen but that seems kinda questionable. I think it would be better to create a new shared configuration that gets included into everything else, if you want some shared set of internal-only dependencies.Shaun Wild
07/19/2022, 10:53 PMJendrik Johannes
07/20/2022, 7:05 AM