All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.mictaege.arete_gradle.AretePlugin.kt Maven / Gradle / Ivy

The newest version!
package com.github.mictaege.arete_gradle

import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.api.tasks.testing.Test
import java.util.*

class AretePlugin: Plugin{

    companion object {
        const val BUILD_DIR_PROPERTY = "com.github.mictaege.arete_gradle.buildDir"
        const val TASK_NAME_PROPERTY = "com.github.mictaege.arete_gradle.taskName"
    }

    override fun apply(project: Project) {
        val props = Properties()
        props.load(javaClass.classLoader.getResourceAsStream("arete-gradle.properties"))
        val version = props.getProperty("version")
        project.dependencies.add("testRuntimeOnly", "com.github.mictaege:arete-gradle:${version}")
        project.tasks.withType(Test::class.java) { testTask ->
            testTask.doFirst {
                testTask.systemProperties[BUILD_DIR_PROPERTY] = project.buildDir.absolutePath
                testTask.systemProperties[TASK_NAME_PROPERTY] = testTask.name
            }
        }
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy