Wizard: introduce unit test mode

This commit is contained in:
Ilya Kirillov
2019-12-17 23:12:29 +03:00
parent 1c30572844
commit 1ab405a86c
9 changed files with 22 additions and 14 deletions
@@ -14,12 +14,13 @@ import java.nio.file.Paths
class YamlWizard(
private val yaml: String,
private val path: String,
createPlugins: (Context) -> List<Plugin>
createPlugins: (Context) -> List<Plugin>,
isUnitTestMode: Boolean
) : Wizard(
createPlugins,
ServicesManager(Services.IDEA_INDEPENDENT_SERVICES) { services ->
services.firstOrNull { it is IdeaIndependentWizardService }
}
}, isUnitTestMode
) {
override fun apply(
services: List<WizardService>,
@@ -4,7 +4,7 @@ kotlin:
modules:
- type:
name: android
androidSdkPath: /home/ilya/Android/Sdk
androidSdkPath: /home/user/Android/Sdk
kind: singleplatform
name: android
sourcesets:
@@ -38,7 +38,7 @@ abstract class AbstractBuildFileGenerationTest : AbstractPluginBasedTest() {
defaultStructure + "\n" +
buildSystem.yaml
val tempDir = Files.createTempDirectory(null)
val wizard = YamlWizard(yaml, tempDir.toString(), testData.createPlugins)
val wizard = YamlWizard(yaml, tempDir.toString(), testData.createPlugins, isUnitTestMode = true)
val result = wizard.apply(Services.IDEA_INDEPENDENT_SERVICES, GenerationPhase.ALL)
result.onFailure { errors ->
errors.forEach { error ->