Skip to content

Commit e947b64

Browse files
authored
Merge pull request #163 from costin/dev
2 parents 157c873 + a97f956 commit e947b64

File tree

1,769 files changed

+25284
-13281
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,769 files changed

+25284
-13281
lines changed

benchmarks/src/main/resources/org/elasticsearch/benchmark/xcontent/monitor_cluster_stats.json

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -298,16 +298,6 @@
298298
"extended_plugins" : [ ],
299299
"has_native_controller" : false
300300
},
301-
{
302-
"name" : "ingest-attachment",
303-
"version" : "7.10.0",
304-
"elasticsearch_version" : "7.10.0",
305-
"java_version" : "1.8",
306-
"description" : "Ingest processor that uses Apache Tika to extract contents",
307-
"classname" : "org.elasticsearch.ingest.attachment.IngestAttachmentPlugin",
308-
"extended_plugins" : [ ],
309-
"has_native_controller" : false
310-
},
311301
{
312302
"name" : "mapper-murmur3",
313303
"version" : "7.10.0",

build-tools-internal/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,7 @@ repositories {
213213
configurations {
214214
integTestRuntimeOnly.extendsFrom(testRuntimeOnly)
215215
}
216+
216217
dependencies {
217218
constraints {
218219
integTestImplementation('org.ow2.asm:asm:9.3')
@@ -297,7 +298,6 @@ tasks.named('test').configure {
297298
useJUnitPlatform()
298299
}
299300
tasks.register("integTest", Test) {
300-
inputs.dir(file("src/testKit")).withPropertyName("testkit dir").withPathSensitivity(PathSensitivity.RELATIVE)
301301
systemProperty 'test.version_under_test', version
302302
testClassesDirs = sourceSets.integTest.output.classesDirs
303303
classpath = sourceSets.integTest.runtimeClasspath
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/*
2+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3+
* or more contributor license agreements. Licensed under the Elastic License
4+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
5+
* in compliance with, at your election, the Elastic License 2.0 or the Server
6+
* Side Public License, v 1.
7+
*/
8+
9+
package org.elasticsearch.gradle.fixtures
10+
11+
import org.gradle.api.Plugin
12+
13+
abstract class AbstractGradleInternalPluginFuncTest extends AbstractJavaGradleFuncTest {
14+
15+
abstract <T extends Plugin> Class<T> getPluginClassUnderTest();
16+
17+
def setup() {
18+
buildFile << """
19+
import ${getPluginClassUnderTest().getName()}
20+
21+
plugins {
22+
// bring in build-tools-internal onto the classpath
23+
id 'elasticsearch.global-build-info'
24+
}
25+
// internally used plugins do not have a plugin id as they are
26+
// not intended to be used directly from build scripts
27+
plugins.apply(${getPluginClassUnderTest().getSimpleName()})
28+
29+
"""
30+
}
31+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
/*
2+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3+
* or more contributor license agreements. Licensed under the Elastic License
4+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
5+
* in compliance with, at your election, the Elastic License 2.0 or the Server
6+
* Side Public License, v 1.
7+
*/
8+
9+
package org.elasticsearch.gradle.fixtures
10+
11+
import net.bytebuddy.ByteBuddy
12+
import net.bytebuddy.dynamic.DynamicType
13+
import org.junit.rules.ExternalResource
14+
import org.junit.rules.TemporaryFolder
15+
16+
class LocalRepositoryFixture extends ExternalResource{
17+
18+
private TemporaryFolder temporaryFolder
19+
20+
LocalRepositoryFixture(TemporaryFolder temporaryFolder){
21+
this.temporaryFolder = temporaryFolder
22+
}
23+
24+
void generateJar(String group, String module, String version, String... clazzNames){
25+
def baseGroupFolderPath = group.replace('.', '/')
26+
def targetFolder = new File(repoDir, "${baseGroupFolderPath}/$module/$version")
27+
targetFolder.mkdirs()
28+
29+
def jarFile = new File(targetFolder, "${module}-${version}.jar")
30+
clazzNames.each {clazzName ->
31+
DynamicType.Unloaded<?> dynamicType = new ByteBuddy().subclass(Object.class)
32+
.name(clazzName)
33+
.make()
34+
if(jarFile.exists()) {
35+
dynamicType.inject(jarFile);
36+
}else {
37+
dynamicType.toJar(jarFile);
38+
}
39+
}
40+
}
41+
42+
void configureBuild(File buildFile) {
43+
buildFile << """
44+
repositories {
45+
maven {
46+
name = "local-test"
47+
url = "${getRepoDir()}"
48+
metadataSources {
49+
artifact()
50+
}
51+
}
52+
}
53+
"""
54+
}
55+
56+
File getRepoDir() {
57+
new File(temporaryFolder.root, 'local-repo')
58+
}
59+
}

build-tools-internal/src/integTest/groovy/org/elasticsearch/gradle/internal/ElasticsearchJavaModulePathPluginFuncTest.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class ElasticsearchJavaModulePathPluginFuncTest extends AbstractJavaGradleFuncTe
2424
public static final String ES_VERSION = VersionProperties.getElasticsearch()
2525

2626
def setup() {
27-
javaMainClass()
27+
clazz("org.acme.JavaMainClass")
2828
subProject("some-lib") << """
2929
plugins {
3030
id 'java-library'

build-tools-internal/src/integTest/groovy/org/elasticsearch/gradle/internal/precommit/LicenseHeadersPrecommitPluginFuncTest.groovy

Lines changed: 14 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,24 @@
88

99
package org.elasticsearch.gradle.internal.precommit
1010

11-
import org.elasticsearch.gradle.fixtures.AbstractGradleFuncTest
11+
import org.elasticsearch.gradle.fixtures.AbstractGradleInternalPluginFuncTest
12+
import org.elasticsearch.gradle.internal.conventions.precommit.LicenseHeadersPrecommitPlugin
13+
import org.elasticsearch.gradle.internal.conventions.precommit.PrecommitPlugin
1214
import org.gradle.testkit.runner.TaskOutcome
1315

14-
class LicenseHeadersPrecommitPluginFuncTest extends AbstractGradleFuncTest {
16+
class LicenseHeadersPrecommitPluginFuncTest extends AbstractGradleInternalPluginFuncTest {
1517

16-
def "detects invalid files with invalid license header"() {
17-
given:
18+
Class<? extends PrecommitPlugin> pluginClassUnderTest = LicenseHeadersPrecommitPlugin.class
19+
20+
def setup() {
21+
configurationCacheCompatible = true
1822
buildFile << """
19-
plugins {
20-
id 'java'
21-
id 'elasticsearch.internal-licenseheaders'
22-
}
23+
apply plugin:'java'
2324
"""
25+
}
26+
27+
def "detects invalid files with invalid license header"() {
28+
given:
2429
dualLicensedFile()
2530
unknownSourceFile()
2631
unapprovedSourceFile()
@@ -39,11 +44,6 @@ class LicenseHeadersPrecommitPluginFuncTest extends AbstractGradleFuncTest {
3944
def "can filter source files"() {
4045
given:
4146
buildFile << """
42-
plugins {
43-
id 'java'
44-
id 'elasticsearch.internal-licenseheaders'
45-
}
46-
4747
tasks.named("licenseHeaders").configure {
4848
excludes << 'org/acme/filtered/**/*'
4949
}
@@ -61,12 +61,6 @@ class LicenseHeadersPrecommitPluginFuncTest extends AbstractGradleFuncTest {
6161

6262
def "supports sspl by convention"() {
6363
given:
64-
buildFile << """
65-
plugins {
66-
id 'java'
67-
id 'elasticsearch.internal-licenseheaders'
68-
}
69-
"""
7064
dualLicensedFile()
7165

7266
when:
@@ -79,11 +73,6 @@ class LicenseHeadersPrecommitPluginFuncTest extends AbstractGradleFuncTest {
7973
def "sspl default additional license can be overridden"() {
8074
given:
8175
buildFile << """
82-
plugins {
83-
id 'java'
84-
id 'elasticsearch.internal-licenseheaders'
85-
}
86-
8776
tasks.named("licenseHeaders").configure {
8877
additionalLicense 'ELAST', 'Elastic License 2.0', '2.0; you may not use this file except in compliance with the Elastic License'
8978
}
@@ -173,4 +162,5 @@ class LicenseHeadersPrecommitPluginFuncTest extends AbstractGradleFuncTest {
173162
String normalizedPath = normalized(sourceFile.getPath())
174163
(normalizedPath.substring(normalizedPath.indexOf("src/main/java")) - "src/main/java/" - ("/" + sourceFile.getName())).replaceAll("/", ".")
175164
}
165+
176166
}

0 commit comments

Comments
 (0)