[tests][plugin][nop] added nop-plugin for basic testing of mechanism loading plugins
This commit is contained in:
@@ -32,6 +32,7 @@ buildscript {
|
|||||||
}
|
}
|
||||||
|
|
||||||
apply plugin: 'konan'
|
apply plugin: 'konan'
|
||||||
|
apply plugin: 'kotlin'
|
||||||
|
|
||||||
configurations {
|
configurations {
|
||||||
cli_bc
|
cli_bc
|
||||||
@@ -4048,3 +4049,48 @@ task buildKonanTests { t ->
|
|||||||
.matching { !(it instanceof KonanStandaloneTest) && it instanceof KonanLocalTest }
|
.matching { !(it instanceof KonanStandaloneTest) && it instanceof KonanLocalTest }
|
||||||
.forEach { it.dependsOn(t) }
|
.forEach { it.dependsOn(t) }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sourceSets {
|
||||||
|
nopPlugin {
|
||||||
|
kotlin {
|
||||||
|
srcDir 'extensions/nop/src/main/kotlin'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Task pluginTest(String name, String pluginName, Closure configureClosure) {
|
||||||
|
def jarTask = project.tasks.create("jar-$pluginName", Jar).configure {
|
||||||
|
it.dependsOn("compile${pluginName.capitalize()}Kotlin")
|
||||||
|
from {
|
||||||
|
sourceSets[pluginName].output
|
||||||
|
}
|
||||||
|
baseName = pluginName
|
||||||
|
destinationDirectory = buildDir
|
||||||
|
}
|
||||||
|
def taskName = "$name-with-$pluginName"
|
||||||
|
return KotlinNativeTestKt.createTest(project, taskName, KonanStandaloneTest) { task ->
|
||||||
|
task.configure(configureClosure)
|
||||||
|
task.dependsOn(jarTask)
|
||||||
|
if (task.enabled) {
|
||||||
|
konanArtifacts {
|
||||||
|
program(taskName, targets: [target.name]) {
|
||||||
|
baseDir "$testOutputLocal/$taskName"
|
||||||
|
srcFiles task.getSources()
|
||||||
|
extraOpts task.flags + "-Xplugin=$buildDir/nop-plugin.jar"
|
||||||
|
extraOpts project.globalTestArgs
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pluginTest("runtime_basic_init", "nopPlugin") {
|
||||||
|
disabled = (project.testTarget == 'wasm32')
|
||||||
|
source = "runtime/basic/hello3.kt"
|
||||||
|
flags = ["-tr"]
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
nopPluginCompile kotlinCompilerModule
|
||||||
|
}
|
||||||
+14
@@ -0,0 +1,14 @@
|
|||||||
|
package org.jetbrains.konan.test.plugin.nop
|
||||||
|
|
||||||
|
import org.jetbrains.kotlin.backend.common.extensions.IrPluginContext
|
||||||
|
import org.jetbrains.kotlin.backend.common.extensions.IrGenerationExtension
|
||||||
|
import org.jetbrains.kotlin.ir.declarations.IrModuleFragment
|
||||||
|
|
||||||
|
open class NopExtension : IrGenerationExtension {
|
||||||
|
override fun generate(
|
||||||
|
moduleFragment: IrModuleFragment,
|
||||||
|
pluginContext: IrPluginContext
|
||||||
|
) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user