@@ -24,52 +24,47 @@ private fun GradleBuild.checkAtomicfuDependencyIsAbsent(configurations: List<Str
2424 val dependencies = dependencies()
2525 for (config in configurations) {
2626 val configDependencies = dependencies.getDependenciesForConfig(config)
27- check(! configDependencies.contains(atomicfuDependency)) { " Dependency $atomicfuDependency should be compileOnly, but it was found in the configuration: $config " }
27+ check(! configDependencies.contains(atomicfuDependency)) { " Dependency $atomicfuDependency should not be present in the configuration: $config " }
2828 }
2929}
3030
31+ internal fun GradleBuild.jvmCheckAtomicfuInCompileClasspath () {
32+ checkAtomicfuDependencyIsPresent(listOf (" compileClasspath" ), jvmAtomicfuDependency)
33+ }
34+
35+ internal fun GradleBuild.mppCheckAtomicfuInCompileClasspath (targetName : String ) {
36+ checkAtomicfuDependencyIsPresent(listOf (" ${targetName} CompileClasspath" ), commonAtomicfuDependency)
37+ }
38+
39+ internal fun GradleBuild.mppCheckAtomicfuInRuntimeClasspath (targetName : String ) {
40+ checkAtomicfuDependencyIsPresent(listOf (" ${targetName} CompileClasspath" ), commonAtomicfuDependency)
41+ }
42+
3143/* *
32- * For JVM there are 4 final configurations:
44+ * There are 4 final configurations:
3345 * compileClasspath — compile dependencies
3446 * runtimeClasspath — runtime dependencies
3547 * apiElements — compile dependencies that will be included in publication
3648 * runtimeElements — runtime dependencies that will be included in publication
3749 *
38- * The functions below check that `org.jetbrains.kotlinx:atomicfu` dependency is only included in compile configurations.
50+ * The functions below check that `org.jetbrains.kotlinx:atomicfu` dependency is not present in the runtime configurations.
3951 */
4052
41- // Checks a simple JVM project with a single target
42- internal fun GradleBuild.checkJvmCompileOnlyDependencies () {
43- checkAtomicfuDependencyIsPresent(listOf (" compileClasspath" ), jvmAtomicfuDependency)
53+ internal fun GradleBuild.jvmCheckNoAtomicfuInRuntimeConfigs () {
4454 checkAtomicfuDependencyIsAbsent(listOf (" runtimeClasspath" , " apiElements" , " runtimeElements" ), jvmAtomicfuDependency)
4555}
4656
47- // Checks JVM target of an MPP project
48- internal fun GradleBuild.checkMppJvmCompileOnlyDependencies () {
49- checkAtomicfuDependencyIsPresent(listOf (" jvmCompileClasspath" ), commonAtomicfuDependency)
50- checkAtomicfuDependencyIsAbsent(listOf (" jvmRuntimeClasspath" , " jvmApiElements" , " jvmRuntimeElements" ), commonAtomicfuDependency)
51- }
52-
53- // Checks wasmJs target of an MPP project
54- internal fun GradleBuild.checkMppWasmJsImplementationDependencies () {
55- checkAtomicfuDependencyIsPresent(listOf (" wasmJsCompileClasspath" , " wasmJsRuntimeClasspath" ), commonAtomicfuDependency)
57+ internal fun GradleBuild.mppCheckNoAtomicfuInRuntimeConfigs (targetName : String ) {
58+ checkAtomicfuDependencyIsAbsent(listOf (" ${targetName} RuntimeClasspath" , " ${targetName} ApiElements" , " ${targetName} RuntimeElements" ), commonAtomicfuDependency)
5659}
5760
58- internal fun GradleBuild.checkMppWasmWasiImplementationDependencies () {
59- checkAtomicfuDependencyIsPresent(listOf (" wasmWasiCompileClasspath" , " wasmWasiRuntimeClasspath" ), commonAtomicfuDependency)
60- }
61-
62- // Checks Native target of an MPP project
63- internal fun GradleBuild.checkMppNativeCompileOnlyDependencies () {
64- // Here the name of the native target is hardcoded because the tested mpp-sample project declares this target and
65- // KGP generates the same set of dependencies for every declared native target ([mingwX64|linuxX64|macosX64...]CompileKlibraries)
66- checkAtomicfuDependencyIsPresent(listOf (" macosX64CompileKlibraries" ), commonAtomicfuDependency)
67- checkAtomicfuDependencyIsAbsent(listOf (" macosX64MainImplementation" ), commonAtomicfuDependency)
61+ internal fun GradleBuild.mppCheckAtomicfuInApi (targetName : String ) {
62+ checkAtomicfuDependencyIsPresent(listOf (" ${targetName} MainApi" ), commonAtomicfuDependency)
6863}
6964
7065// Checks Native target of an MPP project
71- internal fun GradleBuild.checkMppNativeImplementationDependencies () {
72- checkAtomicfuDependencyIsPresent(listOf (" macosX64CompileKlibraries " , " macosX64MainImplementation" ), commonAtomicfuDependency)
66+ internal fun GradleBuild.mppNativeCheckAtomicfuInImplementation () {
67+ checkAtomicfuDependencyIsPresent(listOf (" macosX64MainImplementation" ), commonAtomicfuDependency)
7368}
7469
7570// Some dependencies may be not resolvable but consumable and will not be present in the output of :dependencies task,
0 commit comments