Skip to content
This repository was archived by the owner on Jun 27, 2020. It is now read-only.

#98 : Remove hard coded karma-phantomjs-launcher #99

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ open class KarmaConfigTask : DefaultTask() {
@TaskAction
fun main() {
val prepares = mutableListOf<String>()
val plugins = mutableSetOf("karma-phantomjs-launcher").apply { this += extension.plugins }
val plugins = if(extension.plugins.isNotEmpty()) { extension.plugins } else { mutableSetOf("karma-phantomjs-launcher") }
val preprocessors = extension.preprocessors.toMutableSet()
val clientConfig = mutableMapOf<String, Any>()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,10 @@ object KarmaLauncher : Launcher {
require("karma-junit-reporter")
require("karma-sourcemap-loader")

require("karma-phantomjs-launcher")
require("phantomjs-prebuilt")
if (project.karmaExtension.plugins.contains("karma-phantomjs-launcher")) {
require("karma-phantomjs-launcher")
require("phantomjs-prebuilt")
}

var webPackRequireAdded = false
project.withTask(GenerateWebPackConfigTask::class) { task ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package org.jetbrains.kotlin.gradle.frontend.util

import org.gradle.api.*
import org.jetbrains.kotlin.gradle.frontend.*
import org.jetbrains.kotlin.gradle.frontend.karma.KarmaExtension
import kotlin.reflect.*

inline fun <reified T : Task> Project.withTask(noinline block: (T) -> Unit) = withTask(T::class, block)
Expand All @@ -23,3 +24,6 @@ fun <T : Task> Project.withTask(type: KClass<T>, block: (T) -> Unit) {

val Project.frontendExtension: KotlinFrontendExtension
get() = project.extensions.getByType(KotlinFrontendExtension::class.java)

val Project.karmaExtension: KarmaExtension
get() = project.extensions.getByType(KarmaExtension::class.java)