Add test for KMM Wizard

This commit is contained in:
Kirill Shmakov
2020-06-08 22:52:46 +03:00
parent a22fb2c1ba
commit a6feae0fbb
2 changed files with 8 additions and 1 deletions
@@ -86,7 +86,7 @@ abstract class AbstractNewWizardProjectImportTest : PlatformTestCase() {
wizard.apply(projectDependentServices, GenerationPhase.ALL).assertSuccess()
}
private fun prepareGradleBuildSystem(directory: Path) {
protected fun prepareGradleBuildSystem(directory: Path) {
com.intellij.openapi.components.ServiceManager.getService(project, GradleSettings::class.java)?.apply {
isOfflineWork = GradleEnvironment.Headless.GRADLE_OFFLINE?.toBoolean() ?: isOfflineWork
serviceDirectoryPath = GradleEnvironment.Headless.GRADLE_SERVICE_DIRECTORY ?: serviceDirectoryPath
@@ -1,5 +1,11 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.tools.projectWizard.core.service
import org.jetbrains.kotlin.tools.projectWizard.core.Success
import org.jetbrains.kotlin.tools.projectWizard.core.TaskResult
import org.jetbrains.kotlin.tools.projectWizard.core.computeM
import org.jetbrains.kotlin.tools.projectWizard.core.safe
@@ -13,6 +19,7 @@ interface FileSystemWizardService : WizardService {
class OsFileSystemWizardService : FileSystemWizardService, IdeaIndependentWizardService {
override fun createFile(path: Path, text: String) = computeM {
if (path.toFile().exists()) return@computeM Success(Unit)
createDirectory(path.parent).ensure()
safe { Files.createFile(path.normalize()).toFile().writeText(text) }
}