Build: Move test framework files to their new location

The test jar was previously built in maven by copying class files. With
gradle we now have a proper test framework artifact. This change moves
the classes used by the test framework into the test-framework module.

See #13930
This commit is contained in:
Ryan Ernst 2015-10-29 23:25:24 -07:00
parent c7897a7524
commit 63f6c6db85
162 changed files with 157 additions and 85 deletions

View File

@ -89,20 +89,10 @@ dependencies {
compile 'net.java.dev.jna:jna:4.1.0', optional
// TODO: remove these test deps and just depend on test-framework
testCompile(group: 'junit', name: 'junit', version: '4.11') {
transitive = false
testCompile("org.elasticsearch:test-framework:${version}") {
// tests use the locally compiled version of core
exclude group: 'org.elasticsearch', module: 'elasticsearch'
}
testCompile "com.carrotsearch.randomizedtesting:randomizedtesting-runner:${versions.randomizedrunner}"
testCompile("org.apache.lucene:lucene-test-framework:${versions.lucene}") {
exclude group: 'com.carrotsearch.randomizedtesting', module: 'junit4-ant'
}
testCompile(group: 'org.hamcrest', name: 'hamcrest-all', version: '1.3') {
exclude group: 'org.hamcrest', module: 'hamcrest-core'
}
testCompile 'com.google.jimfs:jimfs:1.0'
testCompile "org.apache.httpcomponents:httpclient:${versions.httpclient}"
}
compileJava.options.compilerArgs << "-Xlint:-cast,-deprecation,-fallthrough,-overrides,-rawtypes,-serial,-try,-unchecked"
@ -129,5 +119,4 @@ integTest.mustRunAfter test
RestSpecHack.configureDependencies(project)
Task copyRestSpec = RestSpecHack.configureTask(project, true)
integTest.dependsOn copyRestSpec
test.dependsOn copyRestSpec

View File

@ -1,69 +1,48 @@
/*
* Licensed to Elasticsearch under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import org.elasticsearch.gradle.precommit.PrecommitTasks
apply plugin: 'java'
apply plugin: 'elasticsearch.build'
apply plugin: 'com.bmuschko.nexus'
dependencies {
// TODO: change to elasticsearch core jar dep, and use dependnecy subs to point at core project
compile "org.elasticsearch:elasticsearch:${version}"
compile "com.carrotsearch.randomizedtesting:randomizedtesting-runner:${versions.randomizedrunner}"
compile(group: 'junit', name: 'junit', version: '4.11') {
exclude group: 'org.hamcrest', module: 'hamcrest-core'
}
compile "com.carrotsearch.randomizedtesting:randomizedtesting-runner:${versions.randomizedrunner}"
compile("org.apache.lucene:lucene-test-framework:${versions.lucene}") {
exclude group: 'com.carrotsearch.randomizedtesting', module: 'junit4-ant'
}
compile(group: 'org.hamcrest', name: 'hamcrest-all', version: '1.3') {
compile('org.hamcrest:hamcrest-all:1.3') {
exclude group: 'org.hamcrest', module: 'hamcrest-core'
}
compile "com.google.jimfs:jimfs:1.0"
compile 'com.google.jimfs:jimfs:1.0'
compile "org.apache.httpcomponents:httpclient:${versions.httpclient}"
}
// HACK: this is temporary until we have moved to gradle, at which
// point we can physically move the test framework files to this project
project.ext {
srcDir = new File(project.buildDir, 'src')
coreDir = new File(project("${projectsPrefix}:core").projectDir, 'src' + File.separator + 'test')
}
sourceSets.main.java.srcDir(new File(srcDir, "java"))
sourceSets.main.resources.srcDir(new File(srcDir, "resources"))
task copySourceFiles(type: Sync) {
from(coreDir) {
include 'resources/log4j.properties'
include 'java/org/elasticsearch/test/**'
include 'java/org/elasticsearch/bootstrap/BootstrapForTesting.java'
include 'java/org/elasticsearch/bootstrap/MockPluginPolicy.java'
include 'java/org/elasticsearch/common/cli/CliToolTestCase.java'
include 'java/org/elasticsearch/cluster/MockInternalClusterInfoService.java'
include 'java/org/elasticsearch/cluster/routing/TestShardRouting.java'
include 'java/org/elasticsearch/index/MockEngineFactoryPlugin.java'
include 'java/org/elasticsearch/search/MockSearchService.java'
include 'java/org/elasticsearch/search/aggregations/bucket/AbstractTermsTestCase.java'
include 'java/org/elasticsearch/search/aggregations/bucket/script/NativeSignificanceScoreScriptNoParams.java'
include 'java/org/elasticsearch/search/aggregations/bucket/script/NativeSignificanceScoreScriptWithParams.java'
include 'java/org/elasticsearch/search/aggregations/bucket/script/TestScript.java'
include 'java/org/elasticsearch/search/aggregations/metrics/AbstractNumericTestCase.java'
include 'java/org/elasticsearch/percolator/PercolatorTestUtil.java'
include 'java/org/elasticsearch/cache/recycler/MockPageCacheRecycler.java'
include 'java/org/elasticsearch/common/util/MockBigArrays.java'
include 'java/org/elasticsearch/node/NodeMocksPlugin.java'
include 'java/org/elasticsearch/node/MockNode.java'
include 'java/org/elasticsearch/common/io/PathUtilsForTesting.java'
// unit tests for yaml suite parser & rest spec parser need to be excluded
exclude 'java/org/elasticsearch/test/rest/test/**'
// unit tests for test framework classes
exclude 'java/org/elasticsearch/test/test/**'
compileJava.options.compilerArgs << '-Xlint:-cast,-deprecation,-fallthrough,-overrides,-rawtypes,-serial,-try,-unchecked'
compileTestJava.options.compilerArgs << '-Xlint:-rawtypes'
// no geo (requires optional deps)
exclude 'java/org/elasticsearch/test/hamcrest/ElasticsearchGeoAssertions.java'
exclude 'java/org/elasticsearch/test/geo/RandomShapeGenerator.java'
// this mock is just for a single logging test
exclude 'java/org/elasticsearch/test/MockLogAppender.java'
}
into srcDir
// the main files are actually test files, so use the appopriate forbidden api sigs
forbiddenApisMain {
bundledSignatures = ['jdk-unsafe', 'jdk-deprecated']
signaturesURLs = [PrecommitTasks.getResource('/forbidden/all-signatures.txt'),
PrecommitTasks.getResource('/forbidden/test-signatures.txt')]
}
compileJava.dependsOn copySourceFiles
compileJava.options.compilerArgs << "-Xlint:-cast,-deprecation,-fallthrough,-overrides,-rawtypes,-serial,-try,-unchecked"

Some files were not shown because too many files have changed in this diff Show More