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

org.xbib.gradle.plugin.elasticsearch.test.StandaloneRestTestPlugin.groovy Maven / Gradle / Ivy

Go to download

Gradle plugins for the developer kit for building and testing Elasticsearch and Elasticsearch plugins

The newest version!
package org.xbib.gradle.plugin.elasticsearch.test

import org.gradle.api.InvalidUserDataException
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.api.plugins.JavaBasePlugin
import org.xbib.gradle.plugin.elasticsearch.build.BuildPlugin
import org.xbib.gradle.plugin.randomizedtesting.RandomizedTestingPlugin
import org.xbib.gradle.task.elasticsearch.qa.QualityAssuranceTasks

/**
 * Configures the build to compile tests against Elasticsearch's test framework
 * and run REST tests. Use BuildPlugin if you want to build main code as well
 * as tests.
 */
class StandaloneRestTestPlugin implements Plugin {

    @Override
    void apply(Project project) {
        if (project.pluginManager.hasPlugin('org.xbib.gradle.plugin.elasticsearch.build')) {
            throw new InvalidUserDataException('org.xbib.gradle.plugin.elasticsearch.standalone-test '
                + 'org.xbib.gradle.plugin.elasticsearch.standalone-rest-test, and org.xbib.gradle.plugin.elasticsearch.build '
                + 'are mutually exclusive')
        }
        project.pluginManager.apply(JavaBasePlugin)
        project.pluginManager.apply(RandomizedTestingPlugin)

        BuildPlugin.globalBuildInfo(project)
        BuildPlugin.configureRepositories(project)

        // only setup tests to build
        project.sourceSets.create('test')
        project.dependencies.add('testCompile',
                "org.xbib.elasticsearch:elasticsearch-test-framework:${project.property('elasticsearch-devkit.version')}")

        QualityAssuranceTasks tasks = new QualityAssuranceTasks()
        tasks.create(project, false)
        project.check.dependsOn(project.precommit)
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy