-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
build.gradle.kts
67 lines (59 loc) · 3.08 KB
/
build.gradle.kts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
import org.jetbrains.kotlin.gradle.utils.extendsFrom
plugins {
id("org.gradle.java")
id("org.gradle.java-test-fixtures")
id("org.gradle.jvm-test-suite")
id("org.jetbrains.kotlin.jvm") version "1.8.20"
id("org.jetbrains.kotlin.kapt") version "1.8.20"
}
// | > Task :compileTestFixturesKotlin FAILED
// | e: src/testFixtures/kotlin/com/example/UsagesFromKotlin.kt
// | Cannot access 'MainKotlinInternal': it is internal in 'com.example'
kotlin.target.compilations { named("testFixtures") { associateWith(getByName("main")) } }
@Suppress("UnstableApiUsage", "UNUSED_VARIABLE")
testing {
suites {
val test = JvmTestSuitePlugin.DEFAULT_TEST_SUITE_NAME(JvmTestSuite::class) {
testType.set(TestSuiteType.UNIT_TEST)
// | > Task :compileTestKotlin FAILED
// | e: src/test/kotlin/com/example/UsagesFromKotlin.kt
// | Cannot access 'TestFixturesKotlinInternal': it is internal in 'com.example'
kotlin.target.compilations { named("test") { associateWith(getByName("testFixtures")) } }
}
val integrationTest by registering(JvmTestSuite::class) {
testType.set(TestSuiteType.INTEGRATION_TEST)
// | > Task :compileIntegrationTestKotlin FAILED
// | e: src/integrationTest/kotlin/com/example/UsagesFromKotlin.kt
// | Unresolved reference: MainJavaPublic
// | Unresolved reference: MainJavaPackagePrivate
// | Unresolved reference: MainKotlinPublic
// | Unresolved reference: MainKotlinInternal
dependencies { implementation(project()) }
// | > Task :compileIntegrationTestKotlin FAILED
// | e: src/integrationTest/kotlin/com/example/UsagesFromKotlin.kt
// | Cannot access 'MainKotlinInternal': it is internal in 'com.example'
kotlin.target.compilations { named("integrationTest") { associateWith(getByName("main")) } }
// In a real project this might be also necessary to get the full classpath correctly:
//propagateDependencies(project.sourceSets.main.get().implementationConfigurationName)
// | > Task :compileIntegrationTestKotlin FAILED
// | e: src/integrationTest/kotlin/com/example/UsagesFromKotlin.kt
// | Unresolved reference: TestFixturesJavaPublic
// | Unresolved reference: TestFixturesKotlinPublic
// | Unresolved reference: TestFixturesJavaPackagePrivate
// | Unresolved reference: TestFixturesKotlinInternal
dependencies { implementation(testFixtures(project())) }
// | > Task :compileIntegrationTestKotlin FAILED
// | e: src/integrationTest/kotlin/com/example/UsagesFromKotlin.kt
// | Cannot access 'TestFixturesKotlinInternal': it is internal in 'com.example'
kotlin.target.compilations { named("integrationTest") { associateWith(getByName("testFixtures")) } }
// In a real project this might be also necessary to get the full classpath correctly:
//propagateDependencies(project.sourceSets.testFixtures.get().implementationConfigurationName)
}
}
}
@Suppress("UnstableApiUsage")
fun JvmTestSuite.propagateDependencies(configurationName: String) {
// Depend on main project's internal dependencies.
project.configurations.named(sources.implementationConfigurationName)
.extendsFrom(project.configurations.named(configurationName))
}