buildscript {
    repositories {
        jcenter()
        maven {
            url 'http://xbib.org/repository'
        }
    }
    dependencies {
        classpath "org.xbib.elasticsearch:gradle-plugin-elasticsearch-build:6.2.3.4"
    }
}

apply plugin: 'org.xbib.gradle.plugin.elasticsearch.build'

configurations {
    main
    tests
}

dependencies {
    compile project(':common')
    testCompile "org.xbib.elasticsearch:elasticsearch-test-framework:${project.property('elasticsearch-devkit.version')}"
    testRuntime "org.xbib.elasticsearch:elasticsearch-test-framework:${project.property('elasticsearch-devkit.version')}"
}

jar {
    baseName "${rootProject.name}-node"
}

/*
task testJar(type: Jar, dependsOn: testClasses) {
    baseName = "${project.archivesBaseName}-tests"
    from sourceSets.test.output
}
*/

artifacts {
    main jar
    tests testJar
    archives sourcesJar, javadocJar
}

test {
    enabled = false
    jvmArgs "-javaagent:" + configurations.alpnagent.asPath
    systemProperty 'path.home', projectDir.absolutePath
    testLogging {
        showStandardStreams = true
        exceptionFormat = 'full'
    }
}

randomizedTest {
    enabled = false
}


esTest {
    // test with the jars, not the classes, for security manager
    // classpath = files(configurations.testRuntime) + configurations.main.artifacts.files + configurations.tests.artifacts.files
    systemProperty 'tests.security.manager', 'true'
    // maybe we like some extra security policy for our code
    systemProperty 'tests.security.policy', '/extra-security.policy'
}
esTest.dependsOn jar, testJar