1 /*
2  * Copyright 2016-2023 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
3  */
4 
5 package test
6 
7 import kotlinx.atomicfu.gradle.plugin.test.framework.checker.*
8 import kotlinx.atomicfu.gradle.plugin.test.framework.runner.*
9 import kotlin.test.*
10 
11 class MppProjectTest {
12     private val mppSample: GradleBuild = createGradleBuildFromSources("mpp-sample")
13 
14     @Test
testMppWithEnabledJvmIrTransformationnull15     fun testMppWithEnabledJvmIrTransformation() {
16         mppSample.enableJvmIrTransformation = true
17         mppSample.checkMppJvmCompileOnlyDependencies()
18         mppSample.checkConsumableDependencies()
19         mppSample.buildAndCheckBytecode()
20     }
21 
22     @Test
testMppWithDisabledJvmIrTransformationnull23     fun testMppWithDisabledJvmIrTransformation() {
24         mppSample.enableJvmIrTransformation = false
25         mppSample.checkMppJvmCompileOnlyDependencies()
26         mppSample.checkConsumableDependencies()
27         mppSample.buildAndCheckBytecode()
28     }
29 
30     // TODO: JS klib will be checked for kotlinx.atomicfu references when this issue KT-61143 is fixed.
31     @Test
testMppWithEnabledJsIrTransformationnull32     fun testMppWithEnabledJsIrTransformation() {
33         mppSample.enableJsIrTransformation = true
34         assertTrue(mppSample.cleanAndBuild().isSuccessful)
35         mppSample.checkConsumableDependencies()
36     }
37 
38     @Test
testMppWithDisabledJsIrTransformationnull39     fun testMppWithDisabledJsIrTransformation() {
40         mppSample.enableJsIrTransformation = false
41         assertTrue(mppSample.cleanAndBuild().isSuccessful)
42         mppSample.checkConsumableDependencies()
43     }
44 
45     @Test
testMppWasmBuildnull46     fun testMppWasmBuild() {
47         assertTrue(mppSample.cleanAndBuild().isSuccessful)
48         mppSample.checkMppWasmJsImplementationDependencies()
49         mppSample.checkMppWasmWasiImplementationDependencies()
50     }
51 
52     @Test
testMppNativeWithEnabledIrTransformationnull53     fun testMppNativeWithEnabledIrTransformation() {
54         mppSample.enableNativeIrTransformation = true
55         assertTrue(mppSample.cleanAndBuild().isSuccessful)
56         mppSample.checkMppNativeCompileOnlyDependencies()
57         // TODO: klib checks are skipped for now because of this problem KT-61143
58         //mppSample.buildAndCheckNativeKlib()
59     }
60 
61     @Test
testMppNativeWithDisabledIrTransformationnull62     fun testMppNativeWithDisabledIrTransformation() {
63         mppSample.enableNativeIrTransformation = false
64         assertTrue(mppSample.cleanAndBuild().isSuccessful)
65         mppSample.checkMppNativeImplementationDependencies()
66         // TODO: klib checks are skipped for now because of this problem KT-61143
67         //mppSample.buildAndCheckNativeKlib()
68     }
69 }
70