How To Create a VEE Port Testsuite
The SDK 6 does not have a dedicated Gradle plugin yet to create a VEE Port Validation Testsuite project, but it is possible to create one using the Library Gradle plugin:
Update the project name to make sure it contains the word
testsuite(for examplemy-testsuite). Updating the project name depends on the project structure:if the project is in a multi-project, the project name is the project folder or could be overwritten in the
settings.gradle.ktsfile usingproject(":xxx").name = "xxx-testsuite".if the project is not in a multi-project, the name must be defined by the
rootProject.nameproperty in thesettings.gradle.ktsfile, for example:rootProject.name = "my-testsuite"
Replace the
build.gradle.ktsfile content with this content:
import com.microej.gradle.plugins.ivy.IvyVariantDerivationRule
plugins {
id("com.microej.gradle.library") version "1.5.0"
}
group = "com.mycompany"
version = "0.1.0-RC"
dependencies {
implementation("ej.api:edc:1.3.7")
implementation("ej.library.test:junit:1.12.0")
}
// Package test classes in JAR
sourceSets {
main {
java {
srcDir("src/test/java")
}
}
}
// Compile all sources in Java 7
java {
sourceCompatibility = JavaVersion.VERSION_1_7
targetCompatibility = JavaVersion.VERSION_1_7
}
tasks {
jar {
from(sourceSets.test.map { it.output }) {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}
}
}
tasks.test {
enabled = false
}
// Create the RIP containing the JAR file
val buildRipTask = tasks.register<Zip>("buildRip") {
from(tasks.jar) {
into("content/javaLibs")
}
archiveExtension = "rip"
}
tasks.named("build") {
dependsOn(buildRipTask)
}
val microejTestsuiteConfiguration = configurations.create("microejTestsuite") {
attributes {
attribute<Usage>(Usage.USAGE_ATTRIBUTE, objects.named<Usage>(Usage.JAVA_RUNTIME))
attribute<String>(
IvyVariantDerivationRule.IVY_CONFIGURATION_ATTRIBUTE,
IvyVariantDerivationRule.IVY_DEFAULT_CONFIGURATION
)
}
}
val javaComponent = components["java"] as AdhocComponentWithVariants
javaComponent.withVariantsFromConfiguration(configurations["apiElements"]) {
skip()
}
javaComponent.withVariantsFromConfiguration(configurations["runtimeElements"]) {
skip()
}
javaComponent.addVariantsFromConfiguration(microejTestsuiteConfiguration) {
artifacts { add("microejTestsuite", buildRipTask) }
}
Adapt the
groupandversionvariables.Add the Testsuite Java classes in the
src/test/javafolder.
You can now publish the Testsuite (with the publish task) and use it in your VEE Port.
