From d5a21c2c1a59cad65e62327a355b307c697c68ef Mon Sep 17 00:00:00 2001 From: Cedric Beust Date: Mon, 25 Jul 2016 03:21:37 -0800 Subject: [PATCH] Don't need BaseTest. --- src/test/kotlin/com/beust/kobalt/BaseTest.kt | 23 ------------------ .../com/beust/kobalt/internal/ProfileTest.kt | 24 +++++++++++++++---- 2 files changed, 20 insertions(+), 27 deletions(-) diff --git a/src/test/kotlin/com/beust/kobalt/BaseTest.kt b/src/test/kotlin/com/beust/kobalt/BaseTest.kt index e0e6d6d9..aacb57fa 100644 --- a/src/test/kotlin/com/beust/kobalt/BaseTest.kt +++ b/src/test/kotlin/com/beust/kobalt/BaseTest.kt @@ -1,16 +1,8 @@ package com.beust.kobalt -import com.beust.kobalt.api.Kobalt import com.beust.kobalt.api.KobaltContext -import com.beust.kobalt.app.BuildFileCompiler -import com.beust.kobalt.internal.JvmCompilerPlugin -import com.beust.kobalt.internal.KobaltPluginXml -import com.beust.kobalt.internal.PluginInfo -import com.beust.kobalt.internal.build.BuildFile import com.beust.kobalt.maven.aether.KobaltAether import org.testng.annotations.BeforeClass -import java.io.File -import java.nio.file.Paths open class BaseTest(open val aether: KobaltAether) { val context = KobaltContext(Args()) @@ -19,19 +11,4 @@ open class BaseTest(open val aether: KobaltAether) { fun bc() { context.aether = aether } - - fun compileBuildFile(buildFileText: String, args: Args, compilerFactory: BuildFileCompiler.IFactory) - : BuildFileCompiler.FindProjectResult { - val tmpBuildFile = File.createTempFile("kobaltTest", "").apply { - deleteOnExit() - writeText(buildFileText) - } - val thisBuildFile = BuildFile(Paths.get(tmpBuildFile.absolutePath), "Build.kt") - args.buildFile = tmpBuildFile.absolutePath - val jvmCompilerPlugin = Kobalt.findPlugin("JvmCompiler") as JvmCompilerPlugin - val pluginInfo = PluginInfo(KobaltPluginXml(), null, null).apply { - projectContributors.add(jvmCompilerPlugin) - } - return compilerFactory.create(listOf(thisBuildFile), pluginInfo).compileBuildFiles(args) - } } \ No newline at end of file diff --git a/src/test/kotlin/com/beust/kobalt/internal/ProfileTest.kt b/src/test/kotlin/com/beust/kobalt/internal/ProfileTest.kt index 2ea7d714..84f1f0ee 100644 --- a/src/test/kotlin/com/beust/kobalt/internal/ProfileTest.kt +++ b/src/test/kotlin/com/beust/kobalt/internal/ProfileTest.kt @@ -1,20 +1,36 @@ package com.beust.kobalt.internal import com.beust.kobalt.Args -import com.beust.kobalt.BaseTest import com.beust.kobalt.TestModule import com.beust.kobalt.api.Kobalt import com.beust.kobalt.api.Project import com.beust.kobalt.app.BuildFileCompiler -import com.beust.kobalt.maven.aether.KobaltAether +import com.beust.kobalt.internal.build.BuildFile import com.google.inject.Inject import org.assertj.core.api.Assertions.assertThat import org.testng.annotations.Guice import org.testng.annotations.Test +import java.io.File +import java.nio.file.Paths @Guice(modules = arrayOf(TestModule::class)) -class ProfileTest @Inject constructor(val compilerFactory: BuildFileCompiler.IFactory, - override val aether: KobaltAether): BaseTest(aether) { +class ProfileTest @Inject constructor(val compilerFactory: BuildFileCompiler.IFactory) { + + private fun compileBuildFile(buildFileText: String, args: Args, compilerFactory: BuildFileCompiler.IFactory) + : BuildFileCompiler.FindProjectResult { + val tmpBuildFile = File.createTempFile("kobaltTest", "").apply { + deleteOnExit() + writeText(buildFileText) + } + val thisBuildFile = BuildFile(Paths.get(tmpBuildFile.absolutePath), "Build.kt") + args.buildFile = tmpBuildFile.absolutePath + val jvmCompilerPlugin = Kobalt.findPlugin("JvmCompiler") as JvmCompilerPlugin + val pluginInfo = PluginInfo(KobaltPluginXml(), null, null).apply { + projectContributors.add(jvmCompilerPlugin) + } + return compilerFactory.create(listOf(thisBuildFile), pluginInfo).compileBuildFiles(args) + } + private fun runTestWithProfile(enabled: Boolean) : Project { val buildFileString = """ | import com.beust.kobalt.*