How to use CompilerPlugin class of org.spekframework.spek2.gradle.kotlin package

Best Spek code snippet using org.spekframework.spek2.gradle.kotlin.CompilerPlugin

MultiplatformPlugin.kt

Source:MultiplatformPlugin.kt Github

copy

Full Screen

...9import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTargetWithTests10import org.jetbrains.kotlin.gradle.targets.jvm.KotlinJvmTarget11import org.spekframework.spek2.gradle.domain.MultiplatformExtension12import org.spekframework.spek2.gradle.domain.SpekTest13import org.spekframework.spek2.gradle.kotlin.CompilerPlugin14import org.spekframework.spek2.gradle.task.ExecSpekTests15class MultiplatformPlugin : Plugin<Project> {16 override fun apply(project: Project) {17 project.pluginManager.withPlugin("org.jetbrains.kotlin.multiplatform") {18 val kotlinMppExtension = checkNotNull(project.extensions.findByType(KotlinMultiplatformExtension::class.java)) { "Kotlin multiplatform plugin not applied!" }19 val mppExtension = project.extensions.create("spek2", MultiplatformExtension::class.java, project.objects)20 configureTestsContainer(project, mppExtension)21 configureDefaults(project, mppExtension, kotlinMppExtension)22 }23 project.pluginManager.apply(CompilerPlugin::class.java)24 }25 private fun configureTestsContainer(project: Project, mppExtension: MultiplatformExtension) {26 mppExtension.tests.all {27 val spekTest = this28 project.tasks.create("spek${spekTest.name.capitalize()}", ExecSpekTests::class.java) {29 group = SPEK_GROUP30 description = "Run Spek tests for ${spekTest.name}"31 target.set(spekTest.target)32 compilation.set(spekTest.target.map { it.compilations.getByName("test") })33 project.afterEvaluate {34 val target = spekTest.target.get()35 project.tasks.named("${target.name}SpekTests").configure {36 dependsOn(this@create)37 }...

Full Screen

Full Screen

CompilerPlugin.kt

Source:CompilerPlugin.kt Github

copy

Full Screen

1package org.spekframework.spek2.gradle.kotlin2import org.gradle.api.Project3import org.gradle.api.provider.Provider4import org.jetbrains.kotlin.gradle.plugin.KotlinCompilation5import org.jetbrains.kotlin.gradle.plugin.KotlinCompilerPluginSupportPlugin6import org.jetbrains.kotlin.gradle.plugin.SubpluginArtifact7import org.jetbrains.kotlin.gradle.plugin.SubpluginOption8import org.spekframework.spek2.gradle.domain.MultiplatformExtension9import org.spekframework.spek2.gradle.entry.MultiplatformPlugin10class CompilerPlugin : KotlinCompilerPluginSupportPlugin {11 private lateinit var project: Project12 override fun apply(target: Project) {13 project = target14 }15 override fun applyToCompilation(kotlinCompilation: KotlinCompilation<*>): Provider<List<SubpluginOption>> {16 return project.provider {17 val extension = checkNotNull(project.extensions.findByType(MultiplatformExtension::class.java))18 listOf(SubpluginOption("enabled", extension.enabled.toString()))19 }20 }21 override fun getCompilerPluginId() = "spek2"22 override fun getPluginArtifact(): SubpluginArtifact {23 return SubpluginArtifact(24 MultiplatformPlugin.spekMavenGroup,25 "spek-kotlin-compiler-plugin-jvm",26 MultiplatformPlugin.spekVersion27 )28 }29 override fun getPluginArtifactForNative(): SubpluginArtifact? {30 return SubpluginArtifact(31 MultiplatformPlugin.spekMavenGroup,32 "spek-kotlin-compiler-plugin-native",33 MultiplatformPlugin.spekVersion34 )35 }...

Full Screen

Full Screen

CompilerPlugin

Using AI Code Generation

copy

Full Screen

1plugins {2 id("org.spekframework.spek2") version "2.0.15"3}4plugins {5 id("org.spekframework.spek2") version "2.0.15"6}

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Spek automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful