[Commonizer] InlineSourceBuilder: Also mark ModuleBuilder functions with InlineSourcesCommonizationTestDsl
This commit is contained in:
committed by
Space
parent
87ac436a35
commit
e041532dd2
@@ -6,6 +6,7 @@
|
|||||||
package org.jetbrains.kotlin.commonizer.utils
|
package org.jetbrains.kotlin.commonizer.utils
|
||||||
|
|
||||||
import org.intellij.lang.annotations.Language
|
import org.intellij.lang.annotations.Language
|
||||||
|
import org.jetbrains.kotlin.commonizer.AbstractInlineSourcesCommonizationTest.InlineSourcesCommonizationTestDsl
|
||||||
import org.jetbrains.kotlin.commonizer.tree.CirTreeModule
|
import org.jetbrains.kotlin.commonizer.tree.CirTreeModule
|
||||||
import org.jetbrains.kotlin.descriptors.ModuleDescriptor
|
import org.jetbrains.kotlin.descriptors.ModuleDescriptor
|
||||||
import org.jetbrains.kotlin.library.SerializedMetadata
|
import org.jetbrains.kotlin.library.SerializedMetadata
|
||||||
@@ -19,6 +20,7 @@ interface InlineSourceBuilder {
|
|||||||
val name: String, val sourceFiles: List<SourceFile>, val dependencies: List<Module>
|
val name: String, val sourceFiles: List<SourceFile>, val dependencies: List<Module>
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@InlineSourcesCommonizationTestDsl
|
||||||
@ModuleBuilderDsl
|
@ModuleBuilderDsl
|
||||||
class ModuleBuilder {
|
class ModuleBuilder {
|
||||||
var name: String = "test-module"
|
var name: String = "test-module"
|
||||||
@@ -26,16 +28,19 @@ interface InlineSourceBuilder {
|
|||||||
private var dependencies: List<Module> = emptyList()
|
private var dependencies: List<Module> = emptyList()
|
||||||
|
|
||||||
|
|
||||||
|
@InlineSourcesCommonizationTestDsl
|
||||||
@ModuleBuilderDsl
|
@ModuleBuilderDsl
|
||||||
fun source(@Language("kotlin") content: String, name: String = "test.kt") {
|
fun source(@Language("kotlin") content: String, name: String = "test.kt") {
|
||||||
sourceFiles = sourceFiles + SourceFile(name, content)
|
sourceFiles = sourceFiles + SourceFile(name, content)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@InlineSourcesCommonizationTestDsl
|
||||||
@ModuleBuilderDsl
|
@ModuleBuilderDsl
|
||||||
fun dependency(builder: ModuleBuilder.() -> Unit) {
|
fun dependency(builder: ModuleBuilder.() -> Unit) {
|
||||||
dependency(ModuleBuilder().also(builder).build())
|
dependency(ModuleBuilder().also(builder).build())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@InlineSourcesCommonizationTestDsl
|
||||||
@ModuleBuilderDsl
|
@ModuleBuilderDsl
|
||||||
fun dependency(module: Module) {
|
fun dependency(module: Module) {
|
||||||
this.dependencies += module.copy(name = "${this.name}-dependency-${module.name}-${dependencies.size}")
|
this.dependencies += module.copy(name = "${this.name}-dependency-${module.name}-${dependencies.size}")
|
||||||
|
|||||||
Reference in New Issue
Block a user