mirror of
https://github.com/elastic/elasticsearch.git
synced 2025-04-19 04:45:07 -04:00
Format build-tools and build-tools-internal (#78910)
Our spotless configuration wasn't being applied to `build-tools` and `build-tools-internal`. Move the Spotless configuration to a Java plugin in `build-conventions`, and apply it everywhere. This resulted in a lot more Java files being subject to formatting, so I added more exclusions to the list. Also remove the `paddedCell` stuff, we've never needed it.
This commit is contained in:
parent
d29a8d3ec1
commit
62d2df4f6a
126 changed files with 797 additions and 664 deletions
4
.idea/eclipseCodeFormatter.xml
generated
4
.idea/eclipseCodeFormatter.xml
generated
|
@ -6,9 +6,9 @@
|
|||
<option name="formatter" value="ECLIPSE" />
|
||||
<option name="importOrder" value="java;javax;com;org;" />
|
||||
<option name="optimizeImports" value="false" />
|
||||
<option name="pathToConfigFileJava" value="$PROJECT_DIR$/build-tools-internal/formatterConfig.xml" />
|
||||
<option name="pathToConfigFileJava" value="$PROJECT_DIR$/build-conventions/formatterConfig.xml" />
|
||||
<option name="selectedJavaProfile" value="Elasticsearch" />
|
||||
</ProjectSpecificProfile>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
||||
</project>
|
|
@ -193,14 +193,14 @@ need them.
|
|||
2. Click "Use the Eclipse Code Formatter"
|
||||
3. Under "Eclipse formatter config", select "Eclipse workspace/project
|
||||
folder or config file"
|
||||
4. Click "Browse", and navigate to the file `build-tools-internal/formatterConfig.xml`
|
||||
4. Click "Browse", and navigate to the file `build-conventions/formatterConfig.xml`
|
||||
5. **IMPORTANT** - make sure "Optimize Imports" is **NOT** selected.
|
||||
6. Click "OK"
|
||||
|
||||
Note that only some sub-projects in the Elasticsearch project are currently
|
||||
fully-formatted. You can see a list of project that **are not**
|
||||
automatically formatted in
|
||||
[build-tools-internal/src/main/groovy/elasticsearch.formatting.gradle](build-tools-internal/src/main/groovy/elasticsearch.formatting.gradle).
|
||||
[FormattingPrecommitPlugin.java](build-conventions/src/main/java/org/elasticsearch/gradle/internal/conventions/precommit/FormattingPrecommitPlugin.java).
|
||||
|
||||
### Importing the project into Eclipse
|
||||
|
||||
|
@ -234,7 +234,7 @@ Next you'll want to import our auto-formatter:
|
|||
- Select **Window > Preferences**
|
||||
- Select **Java > Code Style > Formatter**
|
||||
- Click **Import**
|
||||
- Import the file at **build-tools-internal/formatterConfig.xml**
|
||||
- Import the file at **build-conventions/formatterConfig.xml**
|
||||
- Make sure it is the **Active profile**
|
||||
|
||||
Finally, set up import order:
|
||||
|
@ -242,7 +242,7 @@ Finally, set up import order:
|
|||
- Select **Window > Preferences**
|
||||
- Select **Java > Code Style > Organize Imports**
|
||||
- Click **Import...**
|
||||
- Import the file at **build-tools-internal/elastic.importorder**
|
||||
- Import the file at **build-conventions/elastic.importorder**
|
||||
- Set the **Number of imports needed for `.*`** to ***9999***
|
||||
- Set the **Number of static imports needed for `.*`** to ***9999*** as well
|
||||
- Apply that
|
||||
|
@ -279,11 +279,12 @@ form.
|
|||
Java files in the Elasticsearch codebase are automatically formatted using
|
||||
the [Spotless Gradle] plugin. All new projects are automatically formatted,
|
||||
while existing projects are gradually being opted-in. The formatting check
|
||||
can be run explicitly with:
|
||||
is run automatically via the `precommit` task, but it can be run explicitly with:
|
||||
|
||||
./gradlew spotlessJavaCheck
|
||||
|
||||
The code can be formatted with:
|
||||
It is usually more useful, and just as fast, to just reformat the project. You
|
||||
can do this with:
|
||||
|
||||
./gradlew spotlessApply
|
||||
|
||||
|
@ -304,10 +305,9 @@ Please follow these formatting guidelines:
|
|||
* Wildcard imports (`import foo.bar.baz.*`) are forbidden and will cause
|
||||
the build to fail.
|
||||
* If *absolutely* necessary, you can disable formatting for regions of code
|
||||
with the `// tag::NAME` and `// end::NAME` directives, but note that
|
||||
these are intended for use in documentation, so please make it clear what
|
||||
you have done, and only do this where the benefit clearly outweighs the
|
||||
decrease in consistency.
|
||||
with the `// @formatter:off` and `// @formatter:on` directives, but
|
||||
only do this where the benefit clearly outweighs the decrease in formatting
|
||||
consistency.
|
||||
* Note that Javadoc and block comments i.e. `/* ... */` are not formatted,
|
||||
but line comments i.e `// ...` are.
|
||||
* Negative boolean expressions must use the form `foo == false` instead of
|
||||
|
|
|
@ -49,6 +49,10 @@ gradlePlugin {
|
|||
id = 'elasticsearch.versions'
|
||||
implementationClass = 'org.elasticsearch.gradle.internal.conventions.VersionPropertiesPlugin'
|
||||
}
|
||||
formatting {
|
||||
id = 'elasticsearch.formatting'
|
||||
implementationClass = 'org.elasticsearch.gradle.internal.conventions.precommit.FormattingPrecommitPlugin'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -62,6 +66,9 @@ dependencies {
|
|||
api 'gradle.plugin.com.github.jengelman.gradle.plugins:shadow:7.0.0'
|
||||
api 'org.apache.rat:apache-rat:0.11'
|
||||
compileOnly "com.puppycrawl.tools:checkstyle:8.42"
|
||||
api('com.diffplug.spotless:spotless-plugin-gradle:5.16.0') {
|
||||
exclude module: "groovy-xml"
|
||||
}
|
||||
}
|
||||
|
||||
project.getPlugins().withType(JavaBasePlugin.class) {
|
||||
|
|
|
@ -0,0 +1,332 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
||||
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
||||
* Side Public License, v 1.
|
||||
*/
|
||||
|
||||
package org.elasticsearch.gradle.internal.conventions.precommit;
|
||||
|
||||
import com.diffplug.gradle.spotless.SpotlessExtension;
|
||||
import com.diffplug.gradle.spotless.SpotlessPlugin;
|
||||
|
||||
import org.gradle.api.Plugin;
|
||||
import org.gradle.api.Project;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* This plugin configures formatting for Java source using Spotless
|
||||
* for Gradle. Since the act of formatting existing source can interfere
|
||||
* with developers' workflows, we don't automatically format all code
|
||||
* (yet). Instead, we maintain a list of projects that are excluded from
|
||||
* formatting, until we reach a point where we can comfortably format them
|
||||
* in one go without too much disruption.
|
||||
*
|
||||
* <p>Any new sub-projects must not be added to the exclusions list!
|
||||
*
|
||||
* <p>To perform a reformat, run:
|
||||
*
|
||||
* <pre> ./gradlew spotlessApply</pre>
|
||||
*
|
||||
* <p>To check the current format, run:
|
||||
*
|
||||
* <pre> ./gradlew spotlessJavaCheck</pre>
|
||||
*
|
||||
* <p>This is also carried out by the `precommit` task.
|
||||
*
|
||||
* <p>See also the <a href="https://github.com/diffplug/spotless/tree/master/plugin-gradle"
|
||||
* >Spotless project page</a>.
|
||||
*/
|
||||
public class FormattingPrecommitPlugin implements Plugin<Project> {
|
||||
|
||||
@Override
|
||||
public void apply(Project project) {
|
||||
final boolean shouldFormatProject = PROJECT_PATHS_TO_EXCLUDE.contains(project.getPath()) == false
|
||||
|| project.getProviders().systemProperty("es.format.everything").forUseAtConfigurationTime().isPresent();
|
||||
|
||||
if (shouldFormatProject) {
|
||||
project.getPlugins().apply(PrecommitTaskPlugin.class);
|
||||
project.getPlugins().apply(SpotlessPlugin.class);
|
||||
|
||||
project.getExtensions().getByType(SpotlessExtension.class).java(java -> {
|
||||
String importOrderPath = "build-conventions/elastic.importorder";
|
||||
String formatterConfigPath = "build-conventions/formatterConfig.xml";
|
||||
|
||||
// When applied to e.g. `:build-tools`, we need to modify the path to our config files
|
||||
if (project.getRootProject().file(importOrderPath).exists() == false) {
|
||||
importOrderPath = "../" + importOrderPath;
|
||||
formatterConfigPath = "../" + formatterConfigPath;
|
||||
}
|
||||
|
||||
java.target(getTargets(project.getPath()));
|
||||
|
||||
// Use `@formatter:off` and `@formatter:on` to toggle formatting - ONLY IF STRICTLY NECESSARY
|
||||
java.toggleOffOn("@formatter:off", "@formatter:on");
|
||||
|
||||
java.removeUnusedImports();
|
||||
|
||||
// We enforce a standard order for imports
|
||||
java.importOrderFile(project.getRootProject().file(importOrderPath));
|
||||
|
||||
// Most formatting is done through the Eclipse formatter
|
||||
java.eclipse().configFile(project.getRootProject().file(formatterConfigPath));
|
||||
|
||||
// Ensure blank lines are actually empty. Since formatters are applied in
|
||||
// order, apply this one last, otherwise non-empty blank lines can creep
|
||||
// in.
|
||||
java.trimTrailingWhitespace();
|
||||
});
|
||||
|
||||
project.getTasks().named("precommit").configure(precommitTask -> precommitTask.dependsOn("spotlessJavaCheck"));
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("CheckStyle")
|
||||
private Object[] getTargets(String projectPath) {
|
||||
if (projectPath.equals(":server")) {
|
||||
return new String[] {
|
||||
"src/*/java/org/elasticsearch/action/admin/cluster/repositories/**/*.java",
|
||||
"src/*/java/org/elasticsearch/action/admin/cluster/snapshots/**/*.java",
|
||||
"src/test/java/org/elasticsearch/common/xcontent/support/AbstractFilteringTestCase.java",
|
||||
"src/test/java/org/elasticsearch/common/xcontent/support/XContentMapValuesTests.java",
|
||||
"src/*/java/org/elasticsearch/index/snapshots/**/*.java",
|
||||
"src/*/java/org/elasticsearch/repositories/**/*.java",
|
||||
"src/*/java/org/elasticsearch/search/aggregations/**/*.java",
|
||||
"src/*/java/org/elasticsearch/snapshots/**/*.java" };
|
||||
} else {
|
||||
// Normally this isn"t necessary, but we have Java sources in
|
||||
// non-standard places
|
||||
return new String[] { "src/**/*.java" };
|
||||
}
|
||||
}
|
||||
|
||||
// Do not add new sub-projects here!
|
||||
private static final List<String> PROJECT_PATHS_TO_EXCLUDE = List.of(
|
||||
":client:benchmark",
|
||||
":client:client-benchmark-noop-api-plugin",
|
||||
":client:rest",
|
||||
":client:rest-high-level",
|
||||
":client:rest-high-level:qa:ssl-enabled",
|
||||
":client:sniffer",
|
||||
":client:test",
|
||||
":distribution:archives:integ-test-zip",
|
||||
":distribution:docker",
|
||||
":docs",
|
||||
":example-plugins:custom-settings",
|
||||
":example-plugins:custom-significance-heuristic",
|
||||
":example-plugins:custom-suggester",
|
||||
":example-plugins:painless-whitelist",
|
||||
":example-plugins:rescore",
|
||||
":example-plugins:rest-handler",
|
||||
":example-plugins:script-expert-scoring",
|
||||
":example-plugins:security-authorization-engine",
|
||||
":libs:elasticsearch-cli",
|
||||
":libs:elasticsearch-core",
|
||||
":libs:elasticsearch-dissect",
|
||||
":libs:elasticsearch-geo",
|
||||
":libs:elasticsearch-grok",
|
||||
":libs:elasticsearch-lz4",
|
||||
":libs:elasticsearch-nio",
|
||||
":libs:elasticsearch-plugin-classloader",
|
||||
":libs:elasticsearch-secure-sm",
|
||||
":libs:elasticsearch-ssl-config",
|
||||
":libs:elasticsearch-x-content",
|
||||
":modules:analysis-common",
|
||||
":modules:ingest-common",
|
||||
":modules:ingest-geoip",
|
||||
":modules:ingest-geoip:qa:file-based-update",
|
||||
":modules:ingest-user-agent",
|
||||
":modules:lang-expression",
|
||||
":modules:lang-mustache",
|
||||
":modules:lang-painless",
|
||||
":modules:lang-painless:spi",
|
||||
":modules:mapper-extras",
|
||||
":modules:parent-join",
|
||||
":modules:percolator",
|
||||
":modules:rank-eval",
|
||||
":modules:reindex",
|
||||
":modules:repository-url",
|
||||
":modules:systemd",
|
||||
":modules:tasks",
|
||||
":modules:transport-netty4",
|
||||
":plugins:analysis-icu",
|
||||
":plugins:analysis-kuromoji",
|
||||
":plugins:analysis-nori",
|
||||
":plugins:analysis-phonetic",
|
||||
":plugins:analysis-smartcn",
|
||||
":plugins:analysis-stempel",
|
||||
":plugins:analysis-ukrainian",
|
||||
":plugins:discovery-azure-classic",
|
||||
":plugins:discovery-ec2",
|
||||
":plugins:discovery-ec2:qa:amazon-ec2",
|
||||
":plugins:discovery-gce",
|
||||
":plugins:discovery-gce:qa:gce",
|
||||
":plugins:ingest-attachment",
|
||||
":plugins:mapper-annotated-text",
|
||||
":plugins:mapper-murmur3",
|
||||
":plugins:mapper-size",
|
||||
":plugins:repository-azure",
|
||||
":plugins:repository-gcs",
|
||||
":plugins:repository-hdfs",
|
||||
":plugins:repository-hdfs:hadoop-common",
|
||||
":plugins:repository-s3",
|
||||
":plugins:store-smb",
|
||||
":plugins:transport-nio",
|
||||
":qa:ccs-rolling-upgrade-remote-cluster",
|
||||
":qa:ccs-unavailable-clusters",
|
||||
":qa:die-with-dignity",
|
||||
":qa:evil-tests",
|
||||
":qa:full-cluster-restart",
|
||||
":qa:logging-config",
|
||||
":qa:mixed-cluster",
|
||||
":qa:multi-cluster-search",
|
||||
":qa:no-bootstrap-tests",
|
||||
":qa:remote-clusters",
|
||||
":qa:repository-multi-version",
|
||||
":qa:rolling-upgrade",
|
||||
":qa:smoke-test-http",
|
||||
":qa:smoke-test-ingest-with-all-dependencies",
|
||||
":qa:smoke-test-multinode",
|
||||
":qa:smoke-test-plugins",
|
||||
":qa:snapshot-based-recoveries",
|
||||
":qa:snapshot-based-recoveries:azure",
|
||||
":qa:snapshot-based-recoveries:fs",
|
||||
":qa:snapshot-based-recoveries:gcs",
|
||||
":qa:snapshot-based-recoveries:s3",
|
||||
":qa:verify-version-constants",
|
||||
":rest-api-spec",
|
||||
":test:fixtures:geoip-fixture",
|
||||
":test:fixtures:krb5kdc-fixture",
|
||||
":test:fixtures:old-elasticsearch",
|
||||
":test:framework",
|
||||
":test:logger-usage",
|
||||
":x-pack:docs",
|
||||
":x-pack:license-tools",
|
||||
":x-pack:plugin",
|
||||
":x-pack:plugin:async-search",
|
||||
":x-pack:plugin:async-search:qa",
|
||||
":x-pack:plugin:async-search:qa:security",
|
||||
":x-pack:plugin:autoscaling:qa:rest",
|
||||
":x-pack:plugin:ccr",
|
||||
":x-pack:plugin:ccr:qa",
|
||||
":x-pack:plugin:ccr:qa:downgrade-to-basic-license",
|
||||
":x-pack:plugin:ccr:qa:multi-cluster",
|
||||
":x-pack:plugin:ccr:qa:non-compliant-license",
|
||||
":x-pack:plugin:ccr:qa:rest",
|
||||
":x-pack:plugin:ccr:qa:restart",
|
||||
":x-pack:plugin:ccr:qa:security",
|
||||
":x-pack:plugin:core",
|
||||
":x-pack:plugin:data-streams:qa:multi-node",
|
||||
":x-pack:plugin:data-streams:qa:rest",
|
||||
":x-pack:plugin:deprecation",
|
||||
":x-pack:plugin:enrich:qa:common",
|
||||
":x-pack:plugin:enrich:qa:rest",
|
||||
":x-pack:plugin:enrich:qa:rest-with-advanced-security",
|
||||
":x-pack:plugin:enrich:qa:rest-with-security",
|
||||
":x-pack:plugin:eql",
|
||||
":x-pack:plugin:eql:qa",
|
||||
":x-pack:plugin:eql:qa:common",
|
||||
":x-pack:plugin:eql:qa:mixed-node",
|
||||
":x-pack:plugin:eql:qa:multi-cluster-with-security",
|
||||
":x-pack:plugin:eql:qa:rest",
|
||||
":x-pack:plugin:eql:qa:security",
|
||||
":x-pack:plugin:fleet:qa:rest",
|
||||
":x-pack:plugin:graph",
|
||||
":x-pack:plugin:graph:qa:with-security",
|
||||
":x-pack:plugin:identity-provider",
|
||||
":x-pack:plugin:identity-provider:qa:idp-rest-tests",
|
||||
":x-pack:plugin:ilm",
|
||||
":x-pack:plugin:ilm:qa:multi-cluster",
|
||||
":x-pack:plugin:ilm:qa:multi-node",
|
||||
":x-pack:plugin:ilm:qa:rest",
|
||||
":x-pack:plugin:ilm:qa:with-security",
|
||||
":x-pack:plugin:mapper-constant-keyword",
|
||||
":x-pack:plugin:mapper-flattened",
|
||||
":x-pack:plugin:ml",
|
||||
":x-pack:plugin:ml:qa:basic-multi-node",
|
||||
":x-pack:plugin:ml:qa:disabled",
|
||||
":x-pack:plugin:ml:qa:ml-with-security",
|
||||
":x-pack:plugin:ml:qa:native-multi-node-tests",
|
||||
":x-pack:plugin:ml:qa:no-bootstrap-tests",
|
||||
":x-pack:plugin:ml:qa:single-node-tests",
|
||||
":x-pack:plugin:monitoring",
|
||||
":x-pack:plugin:ql",
|
||||
":x-pack:plugin:repository-encrypted:qa:azure",
|
||||
":x-pack:plugin:repository-encrypted:qa:gcs",
|
||||
":x-pack:plugin:repository-encrypted:qa:s3",
|
||||
":x-pack:plugin:rollup:qa:rest",
|
||||
":x-pack:plugin:search-business-rules",
|
||||
":x-pack:plugin:searchable-snapshots:qa:rest",
|
||||
":x-pack:plugin:security",
|
||||
":x-pack:plugin:security:cli",
|
||||
":x-pack:plugin:security:qa:basic-enable-security",
|
||||
":x-pack:plugin:security:qa:security-basic",
|
||||
":x-pack:plugin:security:qa:security-disabled",
|
||||
":x-pack:plugin:security:qa:security-not-enabled",
|
||||
":x-pack:plugin:security:qa:security-trial",
|
||||
":x-pack:plugin:security:qa:service-account",
|
||||
":x-pack:plugin:security:qa:smoke-test-all-realms",
|
||||
":x-pack:plugin:security:qa:tls-basic",
|
||||
":x-pack:plugin:shutdown:qa:multi-node",
|
||||
":x-pack:plugin:snapshot-repo-test-kit:qa:rest",
|
||||
":x-pack:plugin:spatial",
|
||||
":x-pack:plugin:sql",
|
||||
":x-pack:plugin:sql:jdbc",
|
||||
":x-pack:plugin:sql:qa",
|
||||
":x-pack:plugin:sql:qa:jdbc",
|
||||
":x-pack:plugin:sql:qa:jdbc:security",
|
||||
":x-pack:plugin:sql:qa:mixed-node",
|
||||
":x-pack:plugin:sql:qa:security",
|
||||
":x-pack:plugin:sql:qa:server:multi-node",
|
||||
":x-pack:plugin:sql:qa:server:single-node",
|
||||
":x-pack:plugin:sql:sql-action",
|
||||
":x-pack:plugin:sql:sql-cli",
|
||||
":x-pack:plugin:sql:sql-client",
|
||||
":x-pack:plugin:sql:sql-proto",
|
||||
":x-pack:plugin:stack:qa:rest",
|
||||
":x-pack:plugin:text-structure:qa:text-structure-with-security",
|
||||
":x-pack:plugin:transform",
|
||||
":x-pack:plugin:transform:qa:multi-cluster-tests-with-security",
|
||||
":x-pack:plugin:transform:qa:multi-node-tests",
|
||||
":x-pack:plugin:transform:qa:single-node-tests",
|
||||
":x-pack:plugin:vector-tile:qa:multi-cluster",
|
||||
":x-pack:plugin:vectors",
|
||||
":x-pack:plugin:watcher",
|
||||
":x-pack:plugin:watcher:qa:rest",
|
||||
":x-pack:plugin:watcher:qa:with-monitoring",
|
||||
":x-pack:plugin:watcher:qa:with-security",
|
||||
":x-pack:plugin:wildcard",
|
||||
":x-pack:qa",
|
||||
":x-pack:qa:core-rest-tests-with-security",
|
||||
":x-pack:qa:evil-tests",
|
||||
":x-pack:qa:full-cluster-restart",
|
||||
":x-pack:qa:kerberos-tests",
|
||||
":x-pack:qa:mixed-tier-cluster",
|
||||
":x-pack:qa:multi-cluster-search-security",
|
||||
":x-pack:qa:multi-node",
|
||||
":x-pack:qa:oidc-op-tests",
|
||||
":x-pack:qa:openldap-tests",
|
||||
":x-pack:qa:password-protected-keystore",
|
||||
":x-pack:qa:reindex-tests-with-security",
|
||||
":x-pack:qa:rolling-upgrade",
|
||||
":x-pack:qa:rolling-upgrade-multi-cluster",
|
||||
":x-pack:qa:runtime-fields:core-with-mapped",
|
||||
":x-pack:qa:runtime-fields:core-with-search",
|
||||
":x-pack:qa:runtime-fields:with-security",
|
||||
":x-pack:qa:saml-idp-tests",
|
||||
":x-pack:qa:security-example-spi-extension",
|
||||
":x-pack:qa:security-setup-password-tests",
|
||||
":x-pack:qa:security-tools-tests",
|
||||
":x-pack:qa:smoke-test-plugins",
|
||||
":x-pack:qa:smoke-test-plugins-ssl",
|
||||
":x-pack:qa:smoke-test-security-with-mustache",
|
||||
":x-pack:qa:third-party:active-directory",
|
||||
":x-pack:qa:third-party:jira",
|
||||
":x-pack:qa:third-party:pagerduty",
|
||||
":x-pack:qa:third-party:slack",
|
||||
":x-pack:test:idp-fixture",
|
||||
":x-pack:test:smb-fixture"
|
||||
);
|
||||
}
|
|
@ -20,6 +20,7 @@ plugins {
|
|||
id 'elasticsearch.build-tools'
|
||||
id 'elasticsearch.eclipse'
|
||||
id 'elasticsearch.versions'
|
||||
id 'elasticsearch.formatting'
|
||||
}
|
||||
|
||||
group = 'org.elasticsearch.gradle'
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
package org.elasticsearch.gradle.internal;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.elasticsearch.gradle.VersionProperties;
|
||||
import org.elasticsearch.gradle.internal.test.GradleIntegrationTestCase;
|
||||
import org.gradle.testkit.runner.BuildResult;
|
||||
import org.junit.Rule;
|
||||
|
|
|
@ -8,8 +8,6 @@
|
|||
|
||||
package org.elasticsearch.gradle.internal.test;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import net.bytebuddy.ByteBuddy;
|
||||
import net.bytebuddy.description.modifier.Ownership;
|
||||
import net.bytebuddy.description.modifier.Visibility;
|
||||
|
@ -21,6 +19,9 @@ import net.bytebuddy.implementation.FixedValue;
|
|||
import net.bytebuddy.implementation.Implementation;
|
||||
import net.bytebuddy.implementation.bytecode.ByteCodeAppender;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
public class TestClasspathUtils {
|
||||
|
@ -30,18 +31,16 @@ public class TestClasspathUtils {
|
|||
}
|
||||
|
||||
public static void setupJarJdkClasspath(File projectRoot, String errorMessage) {
|
||||
generateJdkJarHellCheck(projectRoot,
|
||||
ExceptionMethod.throwing(IllegalStateException.class, errorMessage));
|
||||
generateJdkJarHellCheck(projectRoot, ExceptionMethod.throwing(IllegalStateException.class, errorMessage));
|
||||
}
|
||||
|
||||
private static void generateJdkJarHellCheck(File projectRoot, Implementation mainImplementation) {
|
||||
DynamicType.Unloaded<?> dynamicType = new ByteBuddy()
|
||||
.subclass(Object.class)
|
||||
.name("org.elasticsearch.jdk.JdkJarHellCheck")
|
||||
.defineMethod("main", void.class, Visibility.PUBLIC, Ownership.STATIC)
|
||||
.withParameters(String[].class)
|
||||
.intercept(mainImplementation)
|
||||
.make();
|
||||
DynamicType.Unloaded<?> dynamicType = new ByteBuddy().subclass(Object.class)
|
||||
.name("org.elasticsearch.jdk.JdkJarHellCheck")
|
||||
.defineMethod("main", void.class, Visibility.PUBLIC, Ownership.STATIC)
|
||||
.withParameters(String[].class)
|
||||
.intercept(mainImplementation)
|
||||
.make();
|
||||
try {
|
||||
dynamicType.toJar(targetFile(projectRoot));
|
||||
} catch (IOException e) {
|
||||
|
@ -52,15 +51,14 @@ public class TestClasspathUtils {
|
|||
|
||||
private static File targetFile(File projectRoot) {
|
||||
File targetFile = new File(
|
||||
projectRoot,
|
||||
"sample_jars/build/testrepo/org/elasticsearch/elasticsearch-core/current/elasticsearch-core-current.jar"
|
||||
projectRoot,
|
||||
"sample_jars/build/testrepo/org/elasticsearch/elasticsearch-core/current/elasticsearch-core-current.jar"
|
||||
);
|
||||
|
||||
targetFile.getParentFile().mkdirs();
|
||||
return targetFile;
|
||||
}
|
||||
|
||||
|
||||
private static class InconsistentParameterReferenceMethod implements net.bytebuddy.implementation.Implementation {
|
||||
@Override
|
||||
public ByteCodeAppender appender(Target implementationTarget) {
|
||||
|
|
|
@ -30,13 +30,13 @@ public class ThirdPartyAuditTaskIT extends GradleIntegrationTestCase {
|
|||
|
||||
public void testElasticsearchIgnored() {
|
||||
BuildResult result = getGradleRunner().withArguments(
|
||||
":clean",
|
||||
":empty",
|
||||
"-s",
|
||||
"-PcompileOnlyGroup=elasticsearch.gradle:broken-log4j",
|
||||
"-PcompileOnlyVersion=0.0.1",
|
||||
"-PcompileGroup=elasticsearch.gradle:dummy-io",
|
||||
"-PcompileVersion=0.0.1"
|
||||
":clean",
|
||||
":empty",
|
||||
"-s",
|
||||
"-PcompileOnlyGroup=elasticsearch.gradle:broken-log4j",
|
||||
"-PcompileOnlyVersion=0.0.1",
|
||||
"-PcompileGroup=elasticsearch.gradle:dummy-io",
|
||||
"-PcompileVersion=0.0.1"
|
||||
).build();
|
||||
assertTaskNoSource(result, ":empty");
|
||||
assertNoDeprecationWarning(result);
|
||||
|
@ -46,13 +46,13 @@ public class ThirdPartyAuditTaskIT extends GradleIntegrationTestCase {
|
|||
setupJarJdkClasspath(getProjectDir());
|
||||
|
||||
BuildResult result = getGradleRunner().withArguments(
|
||||
":clean",
|
||||
":absurd",
|
||||
"-s",
|
||||
"-PcompileOnlyGroup=other.gradle:broken-log4j",
|
||||
"-PcompileOnlyVersion=0.0.1",
|
||||
"-PcompileGroup=other.gradle:dummy-io",
|
||||
"-PcompileVersion=0.0.1"
|
||||
":clean",
|
||||
":absurd",
|
||||
"-s",
|
||||
"-PcompileOnlyGroup=other.gradle:broken-log4j",
|
||||
"-PcompileOnlyVersion=0.0.1",
|
||||
"-PcompileGroup=other.gradle:dummy-io",
|
||||
"-PcompileVersion=0.0.1"
|
||||
).buildAndFail();
|
||||
|
||||
assertTaskFailed(result, ":absurd");
|
||||
|
@ -64,47 +64,47 @@ public class ThirdPartyAuditTaskIT extends GradleIntegrationTestCase {
|
|||
public void testClassNotFoundAndCompileOnlyIgnored() {
|
||||
setupJarJdkClasspath(getProjectDir());
|
||||
BuildResult result = getGradleRunner().withArguments(
|
||||
":clean",
|
||||
":absurd",
|
||||
"-s",
|
||||
"-PcompileGroup=other.gradle:broken-log4j",
|
||||
"-PcompileVersion=0.0.1",
|
||||
"-PcompileOnlyGroup=other.gradle:dummy-io",
|
||||
"-PcompileOnlyVersion=0.0.1"
|
||||
":clean",
|
||||
":absurd",
|
||||
"-s",
|
||||
"-PcompileGroup=other.gradle:broken-log4j",
|
||||
"-PcompileVersion=0.0.1",
|
||||
"-PcompileOnlyGroup=other.gradle:dummy-io",
|
||||
"-PcompileOnlyVersion=0.0.1"
|
||||
).buildAndFail();
|
||||
assertTaskFailed(result, ":absurd");
|
||||
|
||||
assertOutputContains(
|
||||
result.getOutput(),
|
||||
"Missing classes:",
|
||||
" * org.apache.logging.log4j.LogManager",
|
||||
"> Audit of third party dependencies failed"
|
||||
result.getOutput(),
|
||||
"Missing classes:",
|
||||
" * org.apache.logging.log4j.LogManager",
|
||||
"> Audit of third party dependencies failed"
|
||||
);
|
||||
assertOutputMissing(result.getOutput(), "Classes with violations:");
|
||||
assertNoDeprecationWarning(result);
|
||||
}
|
||||
|
||||
public void testJarHellWithJDK() {
|
||||
setupJarJdkClasspath(getProjectDir(), "> Audit of third party dependencies failed:" +
|
||||
" Jar Hell with the JDK:" +
|
||||
" * java.lang.String"
|
||||
setupJarJdkClasspath(
|
||||
getProjectDir(),
|
||||
"> Audit of third party dependencies failed:" + " Jar Hell with the JDK:" + " * java.lang.String"
|
||||
);
|
||||
BuildResult result = getGradleRunner().withArguments(
|
||||
":clean",
|
||||
":absurd",
|
||||
"-s",
|
||||
"-PcompileGroup=other.gradle:jarhellJdk",
|
||||
"-PcompileVersion=0.0.1",
|
||||
"-PcompileOnlyGroup=other.gradle:dummy-io",
|
||||
"-PcompileOnlyVersion=0.0.1"
|
||||
":clean",
|
||||
":absurd",
|
||||
"-s",
|
||||
"-PcompileGroup=other.gradle:jarhellJdk",
|
||||
"-PcompileVersion=0.0.1",
|
||||
"-PcompileOnlyGroup=other.gradle:dummy-io",
|
||||
"-PcompileOnlyVersion=0.0.1"
|
||||
).buildAndFail();
|
||||
assertTaskFailed(result, ":absurd");
|
||||
|
||||
assertOutputContains(
|
||||
result.getOutput(),
|
||||
"> Audit of third party dependencies failed:",
|
||||
" Jar Hell with the JDK:",
|
||||
" * java.lang.String"
|
||||
result.getOutput(),
|
||||
"> Audit of third party dependencies failed:",
|
||||
" Jar Hell with the JDK:",
|
||||
" * java.lang.String"
|
||||
);
|
||||
assertOutputMissing(result.getOutput(), "Classes with violations:");
|
||||
assertNoDeprecationWarning(result);
|
||||
|
@ -112,13 +112,13 @@ public class ThirdPartyAuditTaskIT extends GradleIntegrationTestCase {
|
|||
|
||||
public void testElasticsearchIgnoredWithViolations() {
|
||||
BuildResult result = getGradleRunner().withArguments(
|
||||
":clean",
|
||||
":absurd",
|
||||
"-s",
|
||||
"-PcompileOnlyGroup=elasticsearch.gradle:broken-log4j",
|
||||
"-PcompileOnlyVersion=0.0.1",
|
||||
"-PcompileGroup=elasticsearch.gradle:dummy-io",
|
||||
"-PcompileVersion=0.0.1"
|
||||
":clean",
|
||||
":absurd",
|
||||
"-s",
|
||||
"-PcompileOnlyGroup=elasticsearch.gradle:broken-log4j",
|
||||
"-PcompileOnlyVersion=0.0.1",
|
||||
"-PcompileGroup=elasticsearch.gradle:dummy-io",
|
||||
"-PcompileVersion=0.0.1"
|
||||
).build();
|
||||
assertTaskNoSource(result, ":absurd");
|
||||
assertNoDeprecationWarning(result);
|
||||
|
|
|
@ -1,247 +0,0 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
||||
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
||||
* Side Public License, v 1.
|
||||
*/
|
||||
|
||||
import org.elasticsearch.gradle.internal.ElasticsearchJavaPlugin
|
||||
|
||||
/*
|
||||
* This script plugin configures formatting for Java source using Spotless
|
||||
* for Gradle. Since the act of formatting existing source can interfere
|
||||
* with developers' workflows, we don't automatically format all code
|
||||
* (yet). Instead, we maintain a list of projects that are excluded from
|
||||
* formatting, until we reach a point where we can comfortably format them
|
||||
* in one go without too much disruption.
|
||||
*
|
||||
* Any new sub-projects must not be added to the exclusions list!
|
||||
*
|
||||
* To perform a reformat, run:
|
||||
*
|
||||
* ./gradlew spotlessApply
|
||||
*
|
||||
* To check the current format, run:
|
||||
*
|
||||
* ./gradlew spotlessJavaCheck
|
||||
*
|
||||
* This is also carried out by the `precommit` task.
|
||||
*
|
||||
* For more about Spotless, see:
|
||||
*
|
||||
* https://github.com/diffplug/spotless/tree/master/plugin-gradle
|
||||
*/
|
||||
|
||||
// Do not add new sub-projects here!
|
||||
def projectPathsToExclude = [
|
||||
':client:benchmark',
|
||||
':client:client-benchmark-noop-api-plugin',
|
||||
':client:rest',
|
||||
':client:rest-high-level',
|
||||
':client:sniffer',
|
||||
':client:test',
|
||||
':example-plugins:custom-settings',
|
||||
':example-plugins:custom-significance-heuristic',
|
||||
':example-plugins:custom-suggester',
|
||||
':example-plugins:painless-whitelist',
|
||||
':example-plugins:rescore',
|
||||
':example-plugins:rest-handler',
|
||||
':example-plugins:script-expert-scoring',
|
||||
':example-plugins:security-authorization-engine',
|
||||
':libs:elasticsearch-cli',
|
||||
':libs:elasticsearch-core',
|
||||
':libs:elasticsearch-dissect',
|
||||
':libs:elasticsearch-geo',
|
||||
':libs:elasticsearch-grok',
|
||||
':libs:elasticsearch-lz4',
|
||||
':libs:elasticsearch-nio',
|
||||
':libs:elasticsearch-plugin-classloader',
|
||||
':libs:elasticsearch-secure-sm',
|
||||
':libs:elasticsearch-ssl-config',
|
||||
':libs:elasticsearch-x-content',
|
||||
':modules:analysis-common',
|
||||
':modules:ingest-common',
|
||||
':modules:ingest-geoip',
|
||||
':modules:ingest-user-agent',
|
||||
':modules:lang-expression',
|
||||
':modules:lang-mustache',
|
||||
':modules:lang-painless',
|
||||
':modules:lang-painless:spi',
|
||||
':modules:mapper-extras',
|
||||
':modules:parent-join',
|
||||
':modules:percolator',
|
||||
':modules:rank-eval',
|
||||
':modules:reindex',
|
||||
':modules:repository-url',
|
||||
':modules:systemd',
|
||||
':modules:tasks',
|
||||
':modules:transport-netty4',
|
||||
':plugins:analysis-icu',
|
||||
':plugins:analysis-kuromoji',
|
||||
':plugins:analysis-nori',
|
||||
':plugins:analysis-phonetic',
|
||||
':plugins:analysis-smartcn',
|
||||
':plugins:analysis-stempel',
|
||||
':plugins:analysis-ukrainian',
|
||||
':plugins:discovery-azure-classic',
|
||||
':plugins:discovery-ec2',
|
||||
':plugins:discovery-ec2:qa:amazon-ec2',
|
||||
':plugins:discovery-gce',
|
||||
':plugins:discovery-gce:qa:gce',
|
||||
':plugins:ingest-attachment',
|
||||
':plugins:mapper-annotated-text',
|
||||
':plugins:mapper-murmur3',
|
||||
':plugins:mapper-size',
|
||||
':plugins:repository-azure',
|
||||
':plugins:repository-gcs',
|
||||
':plugins:repository-hdfs',
|
||||
':plugins:repository-hdfs:hadoop-common',
|
||||
':plugins:repository-s3',
|
||||
':plugins:store-smb',
|
||||
':plugins:transport-nio',
|
||||
':qa:die-with-dignity',
|
||||
':rest-api-spec',
|
||||
':test:fixtures:geoip-fixture',
|
||||
':test:fixtures:krb5kdc-fixture',
|
||||
':test:fixtures:old-elasticsearch',
|
||||
':test:framework',
|
||||
':test:logger-usage',
|
||||
':x-pack:license-tools',
|
||||
':x-pack:plugin',
|
||||
':x-pack:plugin:async-search',
|
||||
':x-pack:plugin:async-search:qa',
|
||||
':x-pack:plugin:async-search:qa:security',
|
||||
':x-pack:plugin:autoscaling:qa:rest',
|
||||
':x-pack:plugin:ccr',
|
||||
':x-pack:plugin:ccr:qa',
|
||||
':x-pack:plugin:ccr:qa:rest',
|
||||
':x-pack:plugin:core',
|
||||
':x-pack:plugin:data-streams:qa:multi-node',
|
||||
':x-pack:plugin:data-streams:qa:rest',
|
||||
':x-pack:plugin:deprecation',
|
||||
':x-pack:plugin:enrich:qa:common',
|
||||
':x-pack:plugin:enrich:qa:rest',
|
||||
':x-pack:plugin:enrich:qa:rest-with-advanced-security',
|
||||
':x-pack:plugin:enrich:qa:rest-with-security',
|
||||
':x-pack:plugin:eql',
|
||||
':x-pack:plugin:eql:qa',
|
||||
':x-pack:plugin:eql:qa:common',
|
||||
':x-pack:plugin:eql:qa:rest',
|
||||
':x-pack:plugin:eql:qa:security',
|
||||
':x-pack:plugin:fleet:qa:rest',
|
||||
':x-pack:plugin:graph',
|
||||
':x-pack:plugin:graph:qa:with-security',
|
||||
':x-pack:plugin:identity-provider',
|
||||
':x-pack:plugin:identity-provider:qa:idp-rest-tests',
|
||||
':x-pack:plugin:ilm',
|
||||
':x-pack:plugin:ilm:qa:multi-node',
|
||||
':x-pack:plugin:ilm:qa:rest',
|
||||
':x-pack:plugin:ilm:qa:with-security',
|
||||
':x-pack:plugin:mapper-constant-keyword',
|
||||
':x-pack:plugin:mapper-flattened',
|
||||
':x-pack:plugin:ml',
|
||||
':x-pack:plugin:ml:qa:basic-multi-node',
|
||||
':x-pack:plugin:ml:qa:disabled',
|
||||
':x-pack:plugin:ml:qa:ml-with-security',
|
||||
':x-pack:plugin:ml:qa:native-multi-node-tests',
|
||||
':x-pack:plugin:ml:qa:single-node-tests',
|
||||
':x-pack:plugin:monitoring',
|
||||
':x-pack:plugin:ql',
|
||||
':x-pack:plugin:repository-encrypted:qa:azure',
|
||||
':x-pack:plugin:repository-encrypted:qa:gcs',
|
||||
':x-pack:plugin:repository-encrypted:qa:s3',
|
||||
':x-pack:plugin:search-business-rules',
|
||||
':x-pack:plugin:security',
|
||||
':x-pack:plugin:security:cli',
|
||||
':x-pack:plugin:security:qa:basic-enable-security',
|
||||
':x-pack:plugin:security:qa:security-basic',
|
||||
':x-pack:plugin:security:qa:security-disabled',
|
||||
':x-pack:plugin:security:qa:security-not-enabled',
|
||||
':x-pack:plugin:security:qa:security-trial',
|
||||
':x-pack:plugin:security:qa:service-account',
|
||||
':x-pack:plugin:security:qa:smoke-test-all-realms',
|
||||
':x-pack:plugin:security:qa:tls-basic',
|
||||
':x-pack:plugin:shutdown:qa:multi-node',
|
||||
':x-pack:plugin:spatial',
|
||||
':x-pack:plugin:sql',
|
||||
':x-pack:plugin:sql:jdbc',
|
||||
':x-pack:plugin:sql:qa',
|
||||
':x-pack:plugin:sql:qa:jdbc',
|
||||
':x-pack:plugin:sql:qa:jdbc:security',
|
||||
':x-pack:plugin:sql:qa:security',
|
||||
':x-pack:plugin:sql:sql-action',
|
||||
':x-pack:plugin:sql:sql-cli',
|
||||
':x-pack:plugin:sql:sql-client',
|
||||
':x-pack:plugin:sql:sql-proto',
|
||||
':x-pack:plugin:stack:qa:rest',
|
||||
':x-pack:plugin:text-structure:qa:text-structure-with-security',
|
||||
':x-pack:plugin:transform',
|
||||
':x-pack:plugin:transform:qa:multi-node-tests',
|
||||
':x-pack:plugin:transform:qa:single-node-tests',
|
||||
':x-pack:plugin:vectors',
|
||||
':x-pack:plugin:watcher',
|
||||
':x-pack:plugin:watcher:qa:rest',
|
||||
':x-pack:plugin:watcher:qa:with-monitoring',
|
||||
':x-pack:plugin:watcher:qa:with-security',
|
||||
':x-pack:plugin:wildcard',
|
||||
':x-pack:qa',
|
||||
':x-pack:qa:runtime-fields:core-with-mapped',
|
||||
':x-pack:qa:runtime-fields:core-with-search',
|
||||
':x-pack:qa:runtime-fields:with-security',
|
||||
':x-pack:qa:security-example-spi-extension',
|
||||
':x-pack:test:idp-fixture',
|
||||
':x-pack:test:smb-fixture'
|
||||
]
|
||||
|
||||
subprojects {
|
||||
plugins.withType(ElasticsearchJavaPlugin).whenPluginAdded {
|
||||
if (projectPathsToExclude.contains(project.path) == false ||
|
||||
providers.systemProperty("es.format.everything").forUseAtConfigurationTime().isPresent()) {
|
||||
project.apply plugin: "com.diffplug.spotless"
|
||||
|
||||
|
||||
spotless {
|
||||
java {
|
||||
if (project.path == ':server') {
|
||||
target 'src/*/java/org/elasticsearch/action/admin/cluster/repositories/**/*.java',
|
||||
'src/*/java/org/elasticsearch/action/admin/cluster/snapshots/**/*.java',
|
||||
'src/test/java/org/elasticsearch/common/xcontent/support/AbstractFilteringTestCase.java',
|
||||
'src/test/java/org/elasticsearch/common/xcontent/support/XContentMapValuesTests.java',
|
||||
'src/*/java/org/elasticsearch/index/snapshots/**/*.java',
|
||||
'src/*/java/org/elasticsearch/repositories/**/*.java',
|
||||
'src/*/java/org/elasticsearch/search/aggregations/**/*.java',
|
||||
'src/*/java/org/elasticsearch/snapshots/**/*.java'
|
||||
} else {
|
||||
// Normally this isn't necessary, but we have Java sources in
|
||||
// non-standard places
|
||||
target 'src/**/*.java'
|
||||
}
|
||||
|
||||
toggleOffOn('@formatter:off', '@formatter:on') // use `@formatter:off` and `@formatter:on` to toggle formatting - ONLY IF STRICTLY NECESSARY
|
||||
removeUnusedImports()
|
||||
importOrderFile rootProject.file('build-tools-internal/elastic.importorder')
|
||||
eclipse().configFile rootProject.file('build-tools-internal/formatterConfig.xml')
|
||||
trimTrailingWhitespace()
|
||||
|
||||
// Sometimes Spotless will report a "misbehaving rule which can't make up its
|
||||
// mind" and will recommend enabling the `paddedCell()` setting. If you
|
||||
// enabled this setting and run the format check again,
|
||||
// Spotless will write files to
|
||||
// `$PROJECT/build/spotless-diagnose-java/` to aid diagnosis. It writes
|
||||
// different copies of the formatted files, so that you can see how they
|
||||
// differ and infer what is the problem.
|
||||
|
||||
// The `paddedCell()` option is disabled for normal operation so that any
|
||||
// misbehaviour is detected, and not just suppressed. You can enabled the
|
||||
// option from the command line by running Gradle with `-Dspotless.paddedcell`.
|
||||
if (providers.systemProperty('spotless.paddedcell').forUseAtConfigurationTime().isPresent()) {
|
||||
paddedCell()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tasks.named("precommit").configure { dependsOn 'spotlessJavaCheck' }
|
||||
}
|
||||
}
|
||||
}
|
|
@ -21,9 +21,10 @@ import org.gradle.api.provider.ProviderFactory;
|
|||
import org.gradle.api.tasks.bundling.Jar;
|
||||
import org.gradle.initialization.layout.BuildLayout;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import java.io.File;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
/**
|
||||
* Encapsulates build configuration for elasticsearch projects.
|
||||
*/
|
||||
|
@ -37,7 +38,7 @@ public class BuildPlugin implements Plugin<Project> {
|
|||
private final ProjectLayout projectLayout;
|
||||
|
||||
@Inject
|
||||
BuildPlugin(BuildLayout buildLayout, ObjectFactory objectFactory, ProviderFactory providerFactory, ProjectLayout projectLayout){
|
||||
BuildPlugin(BuildLayout buildLayout, ObjectFactory objectFactory, ProviderFactory providerFactory, ProjectLayout projectLayout) {
|
||||
this.buildLayout = buildLayout;
|
||||
this.objectFactory = objectFactory;
|
||||
this.providerFactory = providerFactory;
|
||||
|
@ -62,7 +63,6 @@ public class BuildPlugin implements Plugin<Project> {
|
|||
configureLicenseAndNotice(project);
|
||||
}
|
||||
|
||||
|
||||
public void configureLicenseAndNotice(final Project project) {
|
||||
final ExtraPropertiesExtension ext = project.getExtensions().getByType(ExtraPropertiesExtension.class);
|
||||
RegularFileProperty licenseFileProperty = objectFactory.fileProperty();
|
||||
|
|
|
@ -13,9 +13,10 @@ import org.gradle.api.model.ObjectFactory;
|
|||
import org.gradle.api.provider.Property;
|
||||
import org.gradle.api.provider.Provider;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import java.io.File;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
public class BwcGitExtension {
|
||||
|
||||
private Provider<Version> bwcVersion;
|
||||
|
|
|
@ -11,8 +11,8 @@ package org.elasticsearch.gradle.internal;
|
|||
import org.apache.commons.io.FileUtils;
|
||||
import org.apache.tools.ant.taskdefs.condition.Os;
|
||||
import org.elasticsearch.gradle.LoggedExec;
|
||||
import org.gradle.api.Action;
|
||||
import org.elasticsearch.gradle.Version;
|
||||
import org.gradle.api.Action;
|
||||
import org.gradle.api.GradleException;
|
||||
import org.gradle.api.Project;
|
||||
import org.gradle.api.Task;
|
||||
|
@ -45,10 +45,10 @@ public class BwcSetupExtension {
|
|||
private Provider<File> checkoutDir;
|
||||
|
||||
public BwcSetupExtension(
|
||||
Project project,
|
||||
Provider<BwcVersions.UnreleasedVersionInfo> unreleasedVersionInfo,
|
||||
Provider<InternalDistributionBwcSetupPlugin.BwcTaskThrottle> bwcTaskThrottleProvider,
|
||||
Provider<File> checkoutDir
|
||||
Project project,
|
||||
Provider<BwcVersions.UnreleasedVersionInfo> unreleasedVersionInfo,
|
||||
Provider<InternalDistributionBwcSetupPlugin.BwcTaskThrottle> bwcTaskThrottleProvider,
|
||||
Provider<File> checkoutDir
|
||||
) {
|
||||
this.project = project;
|
||||
this.unreleasedVersionInfo = unreleasedVersionInfo;
|
||||
|
@ -115,9 +115,9 @@ public class BwcSetupExtension {
|
|||
}
|
||||
|
||||
private String minimumCompilerVersionPath(Version bwcVersion) {
|
||||
return (bwcVersion.onOrAfter(BUILD_TOOL_MINIMUM_VERSION)) ?
|
||||
"build-tools-internal/" + MINIMUM_COMPILER_VERSION_PATH :
|
||||
"buildSrc/" + MINIMUM_COMPILER_VERSION_PATH;
|
||||
return (bwcVersion.onOrAfter(BUILD_TOOL_MINIMUM_VERSION))
|
||||
? "build-tools-internal/" + MINIMUM_COMPILER_VERSION_PATH
|
||||
: "buildSrc/" + MINIMUM_COMPILER_VERSION_PATH;
|
||||
}
|
||||
|
||||
private static class IndentingOutputStream extends OutputStream {
|
||||
|
@ -132,7 +132,7 @@ public class BwcSetupExtension {
|
|||
|
||||
@Override
|
||||
public void write(int b) throws IOException {
|
||||
int[] arr = {b};
|
||||
int[] arr = { b };
|
||||
write(arr, 0, 1);
|
||||
}
|
||||
|
||||
|
|
|
@ -343,11 +343,11 @@ public class BwcVersions {
|
|||
}
|
||||
|
||||
public void withIndexCompatiple(BiConsumer<Version, String> versionAction) {
|
||||
getIndexCompatible().forEach(v -> versionAction.accept(v, "v"+v.toString()));
|
||||
getIndexCompatible().forEach(v -> versionAction.accept(v, "v" + v.toString()));
|
||||
}
|
||||
|
||||
public void withIndexCompatiple(Predicate<Version> filter, BiConsumer<Version, String> versionAction) {
|
||||
getIndexCompatible().stream().filter(filter).forEach(v -> versionAction.accept(v, "v"+v.toString()));
|
||||
getIndexCompatible().stream().filter(filter).forEach(v -> versionAction.accept(v, "v" + v.toString()));
|
||||
}
|
||||
|
||||
public List<Version> getWireCompatible() {
|
||||
|
@ -364,11 +364,11 @@ public class BwcVersions {
|
|||
}
|
||||
|
||||
public void withWireCompatiple(BiConsumer<Version, String> versionAction) {
|
||||
getWireCompatible().forEach(v -> versionAction.accept(v, "v"+v.toString()));
|
||||
getWireCompatible().forEach(v -> versionAction.accept(v, "v" + v.toString()));
|
||||
}
|
||||
|
||||
public void withWireCompatiple(Predicate<Version> filter, BiConsumer<Version, String> versionAction) {
|
||||
getWireCompatible().stream().filter(filter).forEach(v -> versionAction.accept(v, "v"+v.toString()));
|
||||
getWireCompatible().stream().filter(filter).forEach(v -> versionAction.accept(v, "v" + v.toString()));
|
||||
}
|
||||
|
||||
private List<Version> filterSupportedVersions(List<Version> wireCompat) {
|
||||
|
|
|
@ -7,6 +7,14 @@
|
|||
*/
|
||||
package org.elasticsearch.gradle.internal;
|
||||
|
||||
import org.gradle.api.DefaultTask;
|
||||
import org.gradle.api.file.FileTree;
|
||||
import org.gradle.api.tasks.Input;
|
||||
import org.gradle.api.tasks.InputFiles;
|
||||
import org.gradle.api.tasks.Optional;
|
||||
import org.gradle.api.tasks.OutputFile;
|
||||
import org.gradle.api.tasks.TaskAction;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
@ -16,14 +24,6 @@ import java.util.ArrayList;
|
|||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
|
||||
import org.gradle.api.DefaultTask;
|
||||
import org.gradle.api.file.FileTree;
|
||||
import org.gradle.api.tasks.Input;
|
||||
import org.gradle.api.tasks.InputFiles;
|
||||
import org.gradle.api.tasks.Optional;
|
||||
import org.gradle.api.tasks.OutputFile;
|
||||
import org.gradle.api.tasks.TaskAction;
|
||||
|
||||
/**
|
||||
* Concatenates a list of files into one and removes duplicate lines.
|
||||
*/
|
||||
|
|
|
@ -14,12 +14,12 @@ import org.apache.http.entity.StringEntity;
|
|||
import org.apache.http.impl.client.CloseableHttpClient;
|
||||
import org.apache.http.impl.client.HttpClients;
|
||||
import org.apache.http.util.EntityUtils;
|
||||
import org.gradle.api.DefaultTask;
|
||||
import org.gradle.api.GradleException;
|
||||
import org.gradle.api.artifacts.Configuration;
|
||||
import org.gradle.api.artifacts.Dependency;
|
||||
import org.gradle.api.artifacts.DependencySet;
|
||||
import org.gradle.api.artifacts.ProjectDependency;
|
||||
import org.gradle.api.DefaultTask;
|
||||
import org.gradle.api.tasks.Input;
|
||||
import org.gradle.api.tasks.InputFiles;
|
||||
import org.gradle.api.tasks.TaskAction;
|
||||
|
|
|
@ -10,17 +10,14 @@ package org.elasticsearch.gradle.internal;
|
|||
|
||||
import org.elasticsearch.gradle.VersionProperties;
|
||||
import org.elasticsearch.gradle.internal.conventions.precommit.PrecommitTaskPlugin;
|
||||
import org.elasticsearch.gradle.internal.info.GlobalBuildInfoPlugin;
|
||||
import org.elasticsearch.gradle.internal.info.BuildParams;
|
||||
import org.elasticsearch.gradle.internal.info.GlobalBuildInfoPlugin;
|
||||
import org.elasticsearch.gradle.util.GradleUtils;
|
||||
import org.gradle.api.Action;
|
||||
import org.gradle.api.JavaVersion;
|
||||
import org.gradle.api.Plugin;
|
||||
import org.gradle.api.Project;
|
||||
import org.gradle.api.artifacts.Configuration;
|
||||
import org.gradle.api.artifacts.ResolutionStrategy;
|
||||
import org.gradle.api.plugins.JavaBasePlugin;
|
||||
import org.gradle.api.plugins.JavaPlugin;
|
||||
import org.gradle.api.plugins.JavaPluginExtension;
|
||||
import org.gradle.api.provider.Provider;
|
||||
import org.gradle.api.tasks.SourceSet;
|
||||
|
@ -31,9 +28,6 @@ import org.gradle.api.tasks.compile.GroovyCompile;
|
|||
import org.gradle.api.tasks.compile.JavaCompile;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
/**
|
||||
* A wrapper around Gradle's Java Base plugin that applies our
|
||||
|
@ -95,16 +89,17 @@ public class ElasticsearchJavaBasePlugin implements Plugin<Project> {
|
|||
|
||||
private static void disableTransitiveDependenciesForSourceSet(Project project, SourceSet sourceSet) {
|
||||
List<String> sourceSetConfigurationNames = List.of(
|
||||
sourceSet.getApiConfigurationName(),
|
||||
sourceSet.getImplementationConfigurationName(),
|
||||
sourceSet.getImplementationConfigurationName(),
|
||||
sourceSet.getCompileOnlyConfigurationName(),
|
||||
sourceSet.getRuntimeOnlyConfigurationName()
|
||||
sourceSet.getApiConfigurationName(),
|
||||
sourceSet.getImplementationConfigurationName(),
|
||||
sourceSet.getImplementationConfigurationName(),
|
||||
sourceSet.getCompileOnlyConfigurationName(),
|
||||
sourceSet.getRuntimeOnlyConfigurationName()
|
||||
);
|
||||
|
||||
project.getConfigurations().matching(c -> sourceSetConfigurationNames.contains(c.getName()))
|
||||
.configureEach(GradleUtils::disableTransitiveDependencies);
|
||||
}
|
||||
project.getConfigurations()
|
||||
.matching(c -> sourceSetConfigurationNames.contains(c.getName()))
|
||||
.configureEach(GradleUtils::disableTransitiveDependencies);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds compiler settings to the project
|
||||
|
@ -139,14 +134,10 @@ public class ElasticsearchJavaBasePlugin implements Plugin<Project> {
|
|||
compileOptions.getRelease().set(releaseVersionProviderFromCompileTask(project, compileTask));
|
||||
});
|
||||
// also apply release flag to groovy, which is used in build-tools
|
||||
project.getTasks()
|
||||
.withType(GroovyCompile.class)
|
||||
.configureEach(
|
||||
compileTask -> {
|
||||
// TODO: this probably shouldn't apply to groovy at all?
|
||||
compileTask.getOptions().getRelease().set(releaseVersionProviderFromCompileTask(project, compileTask));
|
||||
}
|
||||
);
|
||||
project.getTasks().withType(GroovyCompile.class).configureEach(compileTask -> {
|
||||
// TODO: this probably shouldn't apply to groovy at all?
|
||||
compileTask.getOptions().getRelease().set(releaseVersionProviderFromCompileTask(project, compileTask));
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -8,44 +8,29 @@
|
|||
|
||||
package org.elasticsearch.gradle.internal;
|
||||
|
||||
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar;
|
||||
import nebula.plugin.info.InfoBrokerPlugin;
|
||||
|
||||
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar;
|
||||
|
||||
import org.elasticsearch.gradle.VersionProperties;
|
||||
import org.elasticsearch.gradle.internal.info.BuildParams;
|
||||
import org.elasticsearch.gradle.util.GradleUtils;
|
||||
import org.elasticsearch.gradle.internal.conventions.util.Util;
|
||||
import org.elasticsearch.gradle.internal.info.BuildParams;
|
||||
import org.gradle.api.Action;
|
||||
import org.gradle.api.JavaVersion;
|
||||
import org.gradle.api.Plugin;
|
||||
import org.gradle.api.Project;
|
||||
import org.gradle.api.Task;
|
||||
import org.gradle.api.artifacts.Configuration;
|
||||
import org.gradle.api.artifacts.ModuleDependency;
|
||||
import org.gradle.api.artifacts.ProjectDependency;
|
||||
import org.gradle.api.artifacts.ResolutionStrategy;
|
||||
import org.gradle.api.plugins.BasePlugin;
|
||||
import org.gradle.api.plugins.JavaLibraryPlugin;
|
||||
import org.gradle.api.plugins.JavaPlugin;
|
||||
import org.gradle.api.plugins.JavaPluginExtension;
|
||||
import org.gradle.api.provider.Provider;
|
||||
import org.gradle.api.tasks.SourceSet;
|
||||
import org.gradle.api.tasks.SourceSetContainer;
|
||||
import org.gradle.api.tasks.TaskProvider;
|
||||
import org.gradle.api.tasks.bundling.Jar;
|
||||
import org.gradle.api.tasks.compile.AbstractCompile;
|
||||
import org.gradle.api.tasks.compile.CompileOptions;
|
||||
import org.gradle.api.tasks.compile.GroovyCompile;
|
||||
import org.gradle.api.tasks.compile.JavaCompile;
|
||||
import org.gradle.api.tasks.javadoc.Javadoc;
|
||||
import org.gradle.external.javadoc.CoreJavadocOptions;
|
||||
import org.gradle.language.base.plugins.LifecycleBasePlugin;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import static org.elasticsearch.gradle.internal.conventions.util.Util.toStringable;
|
||||
|
||||
|
@ -59,7 +44,7 @@ public class ElasticsearchJavaPlugin implements Plugin<Project> {
|
|||
project.getPluginManager().apply(ElasticsearchJavaBasePlugin.class);
|
||||
project.getPluginManager().apply(JavaLibraryPlugin.class);
|
||||
|
||||
// configureConfigurations(project);
|
||||
// configureConfigurations(project);
|
||||
configureJars(project);
|
||||
configureJarManifest(project);
|
||||
configureJavadoc(project);
|
||||
|
@ -77,41 +62,37 @@ public class ElasticsearchJavaPlugin implements Plugin<Project> {
|
|||
* Adds additional manifest info to jars
|
||||
*/
|
||||
static void configureJars(Project project) {
|
||||
project.getTasks().withType(Jar.class).configureEach(
|
||||
jarTask -> {
|
||||
// we put all our distributable files under distributions
|
||||
jarTask.getDestinationDirectory().set(new File(project.getBuildDir(), "distributions"));
|
||||
// fixup the jar manifest
|
||||
// Explicitly using an Action interface as java lambdas
|
||||
// are not supported by Gradle up-to-date checks
|
||||
jarTask.doFirst(new Action<Task>() {
|
||||
@Override
|
||||
public void execute(Task task) {
|
||||
// this doFirst is added before the info plugin, therefore it will run
|
||||
// after the doFirst added by the info plugin, and we can override attributes
|
||||
jarTask.getManifest()
|
||||
.attributes(
|
||||
Map.of("Build-Date", BuildParams.getBuildDate(), "Build-Java-Version", BuildParams.getGradleJavaVersion()
|
||||
)
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
);
|
||||
project.getTasks().withType(Jar.class).configureEach(jarTask -> {
|
||||
// we put all our distributable files under distributions
|
||||
jarTask.getDestinationDirectory().set(new File(project.getBuildDir(), "distributions"));
|
||||
// fixup the jar manifest
|
||||
// Explicitly using an Action interface as java lambdas
|
||||
// are not supported by Gradle up-to-date checks
|
||||
jarTask.doFirst(new Action<Task>() {
|
||||
@Override
|
||||
public void execute(Task task) {
|
||||
// this doFirst is added before the info plugin, therefore it will run
|
||||
// after the doFirst added by the info plugin, and we can override attributes
|
||||
jarTask.getManifest()
|
||||
.attributes(
|
||||
Map.of("Build-Date", BuildParams.getBuildDate(), "Build-Java-Version", BuildParams.getGradleJavaVersion())
|
||||
);
|
||||
}
|
||||
});
|
||||
});
|
||||
project.getPluginManager().withPlugin("com.github.johnrengelman.shadow", p -> {
|
||||
project.getTasks().withType(ShadowJar.class).configureEach(shadowJar -> {
|
||||
/*
|
||||
* Replace the default "-all" classifier with null
|
||||
* which will leave the classifier off of the file name.
|
||||
*/
|
||||
shadowJar.getArchiveClassifier().set((String) null);
|
||||
/*
|
||||
* Not all cases need service files merged but it is
|
||||
* better to be safe
|
||||
*/
|
||||
shadowJar.mergeServiceFiles();
|
||||
}
|
||||
);
|
||||
/*
|
||||
* Replace the default "-all" classifier with null
|
||||
* which will leave the classifier off of the file name.
|
||||
*/
|
||||
shadowJar.getArchiveClassifier().set((String) null);
|
||||
/*
|
||||
* Not all cases need service files merged but it is
|
||||
* better to be safe
|
||||
*/
|
||||
shadowJar.mergeServiceFiles();
|
||||
});
|
||||
// Add "original" classifier to the non-shadowed JAR to distinguish it from the shadow JAR
|
||||
project.getTasks().named(JavaPlugin.JAR_TASK_NAME, Jar.class).configure(jar -> jar.getArchiveClassifier().set("original"));
|
||||
// Make sure we assemble the shadow jar
|
||||
|
|
|
@ -9,14 +9,15 @@
|
|||
package org.elasticsearch.gradle.internal;
|
||||
|
||||
import com.github.jengelman.gradle.plugins.shadow.ShadowBasePlugin;
|
||||
|
||||
import org.elasticsearch.gradle.OS;
|
||||
import org.elasticsearch.gradle.internal.test.SimpleCommandLineArgumentProvider;
|
||||
import org.elasticsearch.gradle.test.GradleTestPolicySetupPlugin;
|
||||
import org.elasticsearch.gradle.test.SystemPropertyCommandLineArgumentProvider;
|
||||
import org.elasticsearch.gradle.internal.conventions.util.Util;
|
||||
import org.elasticsearch.gradle.internal.info.BuildParams;
|
||||
import org.elasticsearch.gradle.internal.info.GlobalBuildInfoPlugin;
|
||||
import org.elasticsearch.gradle.internal.test.ErrorReportingTestListener;
|
||||
import org.elasticsearch.gradle.internal.conventions.util.Util;
|
||||
import org.elasticsearch.gradle.internal.test.SimpleCommandLineArgumentProvider;
|
||||
import org.elasticsearch.gradle.test.GradleTestPolicySetupPlugin;
|
||||
import org.elasticsearch.gradle.test.SystemPropertyCommandLineArgumentProvider;
|
||||
import org.gradle.api.Action;
|
||||
import org.gradle.api.Plugin;
|
||||
import org.gradle.api.Project;
|
||||
|
|
|
@ -7,16 +7,16 @@
|
|||
*/
|
||||
package org.elasticsearch.gradle.internal;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import org.gradle.api.DefaultTask;
|
||||
import org.gradle.api.tasks.Input;
|
||||
import org.gradle.api.tasks.Internal;
|
||||
import org.gradle.api.tasks.TaskAction;
|
||||
import org.gradle.internal.file.Chmod;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
/**
|
||||
* Creates an empty directory.
|
||||
*/
|
||||
|
|
|
@ -25,13 +25,14 @@ import org.gradle.process.ExecOperations;
|
|||
import org.gradle.process.ExecResult;
|
||||
import org.gradle.process.ExecSpec;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.UncheckedIOException;
|
||||
import java.nio.file.Files;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import static java.nio.file.StandardOpenOption.CREATE;
|
||||
import static java.nio.file.StandardOpenOption.TRUNCATE_EXISTING;
|
||||
import static java.util.Arrays.asList;
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
package org.elasticsearch.gradle.internal;
|
||||
|
||||
import org.elasticsearch.gradle.VersionProperties;
|
||||
import org.elasticsearch.gradle.internal.conventions.GUtils;
|
||||
import org.elasticsearch.gradle.internal.conventions.LicensingPlugin;
|
||||
import org.gradle.api.Action;
|
||||
import org.gradle.api.GradleException;
|
||||
|
@ -19,7 +20,6 @@ import org.gradle.api.plugins.BasePlugin;
|
|||
import org.gradle.api.tasks.Copy;
|
||||
import org.gradle.api.tasks.TaskProvider;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
|
@ -29,7 +29,8 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
import java.util.concurrent.Callable;
|
||||
import java.util.stream.Collectors;
|
||||
import org.elasticsearch.gradle.internal.conventions.GUtils;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
public class InternalDistributionArchiveCheckPlugin implements InternalPlugin {
|
||||
|
||||
|
|
|
@ -21,8 +21,8 @@ import org.gradle.api.tasks.bundling.Compression;
|
|||
import org.gradle.api.tasks.bundling.Zip;
|
||||
|
||||
import java.io.File;
|
||||
import static org.elasticsearch.gradle.internal.conventions.GUtils.capitalize;
|
||||
|
||||
import static org.elasticsearch.gradle.internal.conventions.GUtils.capitalize;
|
||||
import static org.gradle.api.internal.artifacts.ArtifactAttributes.ARTIFACT_FORMAT;
|
||||
|
||||
/**
|
||||
|
|
|
@ -22,13 +22,14 @@ import org.gradle.api.services.BuildServiceParameters;
|
|||
import org.gradle.api.tasks.TaskProvider;
|
||||
import org.gradle.language.base.plugins.LifecycleBasePlugin;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import static java.util.Arrays.asList;
|
||||
import static java.util.Arrays.stream;
|
||||
|
||||
|
@ -243,7 +244,7 @@ public class InternalDistributionBwcSetupPlugin implements InternalPlugin {
|
|||
public void execute(Task task) {
|
||||
if (expectedOutputFile.exists() == false) {
|
||||
throw new InvalidUserDataException(
|
||||
"Building " + bwcVersion.get() + " didn't generate expected artifact " + expectedOutputFile
|
||||
"Building " + bwcVersion.get() + " didn't generate expected artifact " + expectedOutputFile
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -75,7 +75,8 @@ public class InternalDistributionDownloadPlugin implements InternalPlugin {
|
|||
}));
|
||||
|
||||
resolutions.register("bwc", distributionResolution -> distributionResolution.setResolver((project, distribution) -> {
|
||||
BwcVersions.UnreleasedVersionInfo unreleasedInfo = BuildParams.getBwcVersions().unreleasedInfo(Version.fromString(distribution.getVersion()));
|
||||
BwcVersions.UnreleasedVersionInfo unreleasedInfo = BuildParams.getBwcVersions()
|
||||
.unreleasedInfo(Version.fromString(distribution.getVersion()));
|
||||
if (unreleasedInfo != null) {
|
||||
if (distribution.getBundledJdk() == false) {
|
||||
throw new GradleException(
|
||||
|
|
|
@ -9,9 +9,10 @@
|
|||
package org.elasticsearch.gradle.internal;
|
||||
|
||||
import groovy.lang.Closure;
|
||||
|
||||
import org.elasticsearch.gradle.internal.conventions.util.Util;
|
||||
import org.elasticsearch.gradle.internal.precommit.TestingConventionsTasks;
|
||||
import org.elasticsearch.gradle.internal.test.RestTestBasePlugin;
|
||||
import org.elasticsearch.gradle.internal.conventions.util.Util;
|
||||
import org.elasticsearch.gradle.plugin.PluginBuildPlugin;
|
||||
import org.elasticsearch.gradle.plugin.PluginPropertiesExtension;
|
||||
import org.elasticsearch.gradle.util.GradleUtils;
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
package org.elasticsearch.gradle.internal;
|
||||
|
||||
import org.gradle.api.Project;
|
||||
import org.gradle.api.artifacts.Configuration;
|
||||
import org.gradle.api.artifacts.Dependency;
|
||||
import org.gradle.api.artifacts.dsl.DependencyHandler;
|
||||
import org.gradle.api.plugins.BasePluginExtension;
|
||||
|
|
|
@ -20,7 +20,6 @@ import org.gradle.api.artifacts.repositories.IvyArtifactRepository;
|
|||
import org.gradle.api.artifacts.type.ArtifactTypeDefinition;
|
||||
import org.gradle.api.attributes.Attribute;
|
||||
import org.gradle.api.internal.artifacts.ArtifactAttributes;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
package org.elasticsearch.gradle.internal;
|
||||
|
||||
import org.codehaus.groovy.runtime.StringGroovyMethods;
|
||||
import org.elasticsearch.gradle.util.FileUtils;
|
||||
import org.gradle.api.DefaultTask;
|
||||
import org.gradle.api.file.FileCollection;
|
||||
import org.gradle.api.file.FileTree;
|
||||
|
@ -19,7 +20,6 @@ import org.gradle.api.tasks.Optional;
|
|||
import org.gradle.api.tasks.OutputFile;
|
||||
import org.gradle.api.tasks.TaskAction;
|
||||
|
||||
import org.elasticsearch.gradle.util.FileUtils;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
|
|
|
@ -15,11 +15,6 @@ import org.gradle.api.Project;
|
|||
import org.gradle.api.artifacts.dsl.RepositoryHandler;
|
||||
import org.gradle.api.artifacts.repositories.MavenArtifactRepository;
|
||||
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URI;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
|
|
|
@ -16,10 +16,11 @@ import org.gradle.api.tasks.InputFiles;
|
|||
import org.gradle.api.tasks.TaskAction;
|
||||
import org.gradle.internal.deprecation.DeprecatableConfiguration;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import java.util.Collection;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import static org.elasticsearch.gradle.DistributionDownloadPlugin.DISTRO_EXTRACTED_CONFIG_PREFIX;
|
||||
import static org.elasticsearch.gradle.internal.rest.compat.YamlRestCompatTestPlugin.BWC_MINOR_CONFIG_NAME;
|
||||
|
||||
|
|
|
@ -34,6 +34,7 @@ import java.io.IOException;
|
|||
import java.nio.file.Files;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
/**
|
||||
|
|
|
@ -17,7 +17,6 @@ import org.gradle.api.services.BuildServiceParameters;
|
|||
import org.gradle.process.ExecOperations;
|
||||
import org.gradle.process.ExecResult;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
@ -32,6 +31,8 @@ import java.util.Map;
|
|||
import java.util.Optional;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
/**
|
||||
* Build service for detecting available Docker installation and checking for compatibility with Elasticsearch Docker image build
|
||||
* requirements. This includes a minimum version requirement, as well as the ability to run privileged commands.
|
||||
|
|
|
@ -8,8 +8,8 @@
|
|||
package org.elasticsearch.gradle.internal.info;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.elasticsearch.gradle.internal.BwcVersions;
|
||||
import org.elasticsearch.gradle.OS;
|
||||
import org.elasticsearch.gradle.internal.BwcVersions;
|
||||
import org.elasticsearch.gradle.internal.conventions.info.GitInfo;
|
||||
import org.elasticsearch.gradle.internal.conventions.info.ParallelDetector;
|
||||
import org.elasticsearch.gradle.internal.conventions.util.Util;
|
||||
|
@ -29,7 +29,6 @@ import org.gradle.jvm.toolchain.internal.InstallationLocation;
|
|||
import org.gradle.jvm.toolchain.internal.JavaInstallationRegistry;
|
||||
import org.gradle.util.GradleVersion;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
|
@ -50,6 +49,8 @@ import java.util.Random;
|
|||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
public class GlobalBuildInfoPlugin implements Plugin<Project> {
|
||||
private static final Logger LOGGER = Logging.getLogger(GlobalBuildInfoPlugin.class);
|
||||
private static final String DEFAULT_VERSION_JAVA_FILE_PATH = "server/src/main/java/org/elasticsearch/Version.java";
|
||||
|
@ -344,10 +345,9 @@ public class GlobalBuildInfoPlugin implements Plugin<Project> {
|
|||
return _defaultParallel;
|
||||
}
|
||||
|
||||
|
||||
public static String getResourceContents(String resourcePath) {
|
||||
try (
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(GlobalBuildInfoPlugin.class.getResourceAsStream(resourcePath)))
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(GlobalBuildInfoPlugin.class.getResourceAsStream(resourcePath)))
|
||||
) {
|
||||
StringBuilder b = new StringBuilder();
|
||||
for (String line = reader.readLine(); line != null; line = reader.readLine()) {
|
||||
|
@ -373,7 +373,7 @@ public class GlobalBuildInfoPlugin implements Plugin<Project> {
|
|||
@Override
|
||||
public JvmInstallationMetadata getMetadata(File file) {
|
||||
JvmInstallationMetadata metadata = delegate.getMetadata(file);
|
||||
if(metadata instanceof JvmInstallationMetadata.FailureInstallationMetadata) {
|
||||
if (metadata instanceof JvmInstallationMetadata.FailureInstallationMetadata) {
|
||||
throw new GradleException("Jvm Metadata cannot be resolved for " + metadata.getJavaHome().toString());
|
||||
}
|
||||
return metadata;
|
||||
|
|
|
@ -16,9 +16,10 @@ import org.gradle.api.Task;
|
|||
import org.gradle.api.provider.ProviderFactory;
|
||||
import org.gradle.api.tasks.TaskProvider;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
public class FilePermissionsPrecommitPlugin extends PrecommitPlugin implements InternalPlugin {
|
||||
|
||||
public static final String FILEPERMISSIONS_TASK_NAME = "filepermissions";
|
||||
|
|
|
@ -7,15 +7,6 @@
|
|||
*/
|
||||
package org.elasticsearch.gradle.internal.precommit;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.attribute.PosixFileAttributeView;
|
||||
import java.nio.file.attribute.PosixFilePermission;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.apache.tools.ant.taskdefs.condition.Os;
|
||||
import org.gradle.api.DefaultTask;
|
||||
import org.gradle.api.GradleException;
|
||||
|
@ -32,6 +23,15 @@ import org.gradle.api.tasks.TaskAction;
|
|||
import org.gradle.api.tasks.util.PatternFilterable;
|
||||
import org.gradle.api.tasks.util.PatternSet;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.attribute.PosixFileAttributeView;
|
||||
import java.nio.file.attribute.PosixFilePermission;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
/**
|
||||
|
|
|
@ -11,10 +11,11 @@ package org.elasticsearch.gradle.internal.precommit;
|
|||
import de.thetaphi.forbiddenapis.gradle.CheckForbiddenApis;
|
||||
import de.thetaphi.forbiddenapis.gradle.ForbiddenApisPlugin;
|
||||
import groovy.lang.Closure;
|
||||
|
||||
import org.elasticsearch.gradle.internal.ExportElasticsearchBuildResourcesTask;
|
||||
import org.elasticsearch.gradle.internal.info.BuildParams;
|
||||
import org.elasticsearch.gradle.internal.InternalPlugin;
|
||||
import org.elasticsearch.gradle.internal.conventions.precommit.PrecommitPlugin;
|
||||
import org.elasticsearch.gradle.internal.info.BuildParams;
|
||||
import org.elasticsearch.gradle.util.GradleUtils;
|
||||
import org.gradle.api.JavaVersion;
|
||||
import org.gradle.api.Project;
|
||||
|
|
|
@ -16,9 +16,10 @@ import org.gradle.api.Task;
|
|||
import org.gradle.api.provider.ProviderFactory;
|
||||
import org.gradle.api.tasks.TaskProvider;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
public class ForbiddenPatternsPrecommitPlugin extends PrecommitPlugin implements InternalPlugin {
|
||||
|
||||
public static final String FORBIDDEN_PATTERNS_TASK_NAME = "forbiddenPatterns";
|
||||
|
|
|
@ -28,7 +28,6 @@ import org.gradle.api.tasks.TaskAction;
|
|||
import org.gradle.api.tasks.util.PatternFilterable;
|
||||
import org.gradle.api.tasks.util.PatternSet;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.UncheckedIOException;
|
||||
|
@ -46,6 +45,8 @@ import java.util.stream.Collectors;
|
|||
import java.util.stream.IntStream;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
/**
|
||||
* Checks for patterns in source files for the project which are forbidden.
|
||||
*/
|
||||
|
|
|
@ -152,14 +152,27 @@ public class LicenseAnalyzer {
|
|||
new LicenseMatcher("EDL-1.0", true, false, Pattern.compile("Eclipse Distribution License - v 1.0", Pattern.DOTALL)),
|
||||
new LicenseMatcher("LGPL-2.1", true, true, Pattern.compile("GNU LESSER GENERAL PUBLIC LICENSE.*Version 2.1", Pattern.DOTALL)),
|
||||
new LicenseMatcher("LGPL-3.0", true, true, Pattern.compile("GNU LESSER GENERAL PUBLIC LICENSE.*Version 3", Pattern.DOTALL)),
|
||||
new LicenseMatcher("GeoLite", false, false,
|
||||
Pattern.compile(("The Elastic GeoIP Database Service uses the GeoLite2 Data created " +
|
||||
"and licensed by MaxMind,\nwhich is governed by MaxMind’s GeoLite2 End User License Agreement, " +
|
||||
"available at https://www.maxmind.com/en/geolite2/eula.\n").replaceAll("\\s+", "\\\\s*"), Pattern.DOTALL)),
|
||||
new LicenseMatcher("GeoIp-Database-Service", false, false,
|
||||
Pattern.compile(("By using the GeoIP Database Service, you agree to the Elastic GeoIP Database Service Agreement,\n" +
|
||||
"available at www.elastic.co/elastic-geoip-database-service-terms.").replaceAll("\\s+", "\\\\s*"), Pattern.DOTALL))};
|
||||
|
||||
new LicenseMatcher(
|
||||
"GeoLite",
|
||||
false,
|
||||
false,
|
||||
Pattern.compile(
|
||||
("The Elastic GeoIP Database Service uses the GeoLite2 Data created "
|
||||
+ "and licensed by MaxMind,\nwhich is governed by MaxMind’s GeoLite2 End User License Agreement, "
|
||||
+ "available at https://www.maxmind.com/en/geolite2/eula.\n").replaceAll("\\s+", "\\\\s*"),
|
||||
Pattern.DOTALL
|
||||
)
|
||||
),
|
||||
new LicenseMatcher(
|
||||
"GeoIp-Database-Service",
|
||||
false,
|
||||
false,
|
||||
Pattern.compile(
|
||||
("By using the GeoIP Database Service, you agree to the Elastic GeoIP Database Service Agreement,\n"
|
||||
+ "available at www.elastic.co/elastic-geoip-database-service-terms.").replaceAll("\\s+", "\\\\s*"),
|
||||
Pattern.DOTALL
|
||||
)
|
||||
) };
|
||||
|
||||
public static LicenseInfo licenseType(File licenseFile) {
|
||||
for (LicenseMatcher matcher : matchers) {
|
||||
|
|
|
@ -11,7 +11,6 @@ package org.elasticsearch.gradle.internal.precommit;
|
|||
import org.elasticsearch.gradle.LoggedExec;
|
||||
import org.elasticsearch.gradle.internal.conventions.precommit.PrecommitTask;
|
||||
import org.gradle.api.file.FileCollection;
|
||||
import org.gradle.api.plugins.JavaPluginConvention;
|
||||
import org.gradle.api.plugins.JavaPluginExtension;
|
||||
import org.gradle.api.tasks.CacheableTask;
|
||||
import org.gradle.api.tasks.Classpath;
|
||||
|
@ -23,9 +22,10 @@ import org.gradle.api.tasks.SourceSet;
|
|||
import org.gradle.api.tasks.TaskAction;
|
||||
import org.gradle.process.ExecOperations;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import java.io.File;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
/**
|
||||
* Runs LoggerUsageCheck on a set of directories.
|
||||
*/
|
||||
|
@ -63,7 +63,8 @@ public class LoggerUsageTask extends PrecommitTask {
|
|||
@PathSensitive(PathSensitivity.RELATIVE)
|
||||
@SkipWhenEmpty
|
||||
public FileCollection getClassDirectories() {
|
||||
return getProject().getExtensions().getByType(JavaPluginExtension.class)
|
||||
return getProject().getExtensions()
|
||||
.getByType(JavaPluginExtension.class)
|
||||
.getSourceSets()
|
||||
.stream()
|
||||
// Don't pick up all source sets like the java9 ones as logger-check doesn't support the class format
|
||||
|
|
|
@ -32,7 +32,6 @@ import org.gradle.workers.WorkAction;
|
|||
import org.gradle.workers.WorkParameters;
|
||||
import org.gradle.workers.WorkerExecutor;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.UncheckedIOException;
|
||||
|
@ -47,11 +46,12 @@ import java.util.HashSet;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.TreeMap;
|
||||
import java.util.TreeSet;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
/**
|
||||
* Checks for split packages with dependencies. These are not allowed in a future modularized world.
|
||||
*/
|
||||
|
@ -163,8 +163,10 @@ public class SplitPackagesAuditTask extends DefaultTask {
|
|||
LOGGER.error(String.join(System.lineSeparator(), msg));
|
||||
}
|
||||
if (splitPackages.isEmpty() == false) {
|
||||
throw new GradleException("Verification failed: Split packages found! See errors above for details.\n" +
|
||||
"DO NOT ADD THESE SPLIT PACKAGES TO THE IGNORE LIST! Choose a new package name for the classes added.");
|
||||
throw new GradleException(
|
||||
"Verification failed: Split packages found! See errors above for details.\n"
|
||||
+ "DO NOT ADD THESE SPLIT PACKAGES TO THE IGNORE LIST! Choose a new package name for the classes added."
|
||||
);
|
||||
}
|
||||
|
||||
try {
|
||||
|
@ -184,7 +186,10 @@ public class SplitPackagesAuditTask extends DefaultTask {
|
|||
if (LOGGER.isInfoEnabled()) {
|
||||
List<String> msg = new ArrayList<>();
|
||||
msg.add("Packages from dependencies:");
|
||||
packages.entrySet().stream().sorted(Map.Entry.comparingByKey()).forEach(e -> msg.add(" -" + e.getKey() + " -> " + e.getValue()));
|
||||
packages.entrySet()
|
||||
.stream()
|
||||
.sorted(Map.Entry.comparingByKey())
|
||||
.forEach(e -> msg.add(" -" + e.getKey() + " -> " + e.getValue()));
|
||||
LOGGER.info(String.join(System.lineSeparator(), msg));
|
||||
}
|
||||
return packages;
|
||||
|
@ -198,9 +203,16 @@ public class SplitPackagesAuditTask extends DefaultTask {
|
|||
String packageName = getPackageName(path);
|
||||
String className = path.subpath(path.getNameCount() - 1, path.getNameCount()).toString();
|
||||
className = className.substring(0, className.length() - ".java".length());
|
||||
LOGGER.info("Inspecting " + path + System.lineSeparator()
|
||||
+ " package: " + packageName + System.lineSeparator()
|
||||
+ " class: " + className);
|
||||
LOGGER.info(
|
||||
"Inspecting "
|
||||
+ path
|
||||
+ System.lineSeparator()
|
||||
+ " package: "
|
||||
+ packageName
|
||||
+ System.lineSeparator()
|
||||
+ " class: "
|
||||
+ className
|
||||
);
|
||||
if (dependencyPackages.contains(packageName)) {
|
||||
splitPackages.computeIfAbsent(packageName, k -> new TreeSet<>()).add(packageName + "." + className);
|
||||
}
|
||||
|
@ -212,7 +224,10 @@ public class SplitPackagesAuditTask extends DefaultTask {
|
|||
if (LOGGER.isInfoEnabled()) {
|
||||
List<String> msg = new ArrayList<>();
|
||||
msg.add("Split packages:");
|
||||
splitPackages.entrySet().stream().sorted(Map.Entry.comparingByKey()).forEach(e -> msg.add(" -" + e.getKey() + " -> " + e.getValue()));
|
||||
splitPackages.entrySet()
|
||||
.stream()
|
||||
.sorted(Map.Entry.comparingByKey())
|
||||
.forEach(e -> msg.add(" -" + e.getKey() + " -> " + e.getValue()));
|
||||
LOGGER.info(String.join(System.lineSeparator(), msg));
|
||||
}
|
||||
return splitPackages;
|
||||
|
@ -319,10 +334,15 @@ public class SplitPackagesAuditTask extends DefaultTask {
|
|||
|
||||
interface Parameters extends WorkParameters {
|
||||
Property<String> getProjectPath();
|
||||
|
||||
MapProperty<File, String> getProjectBuildDirs();
|
||||
|
||||
ConfigurableFileCollection getClasspath();
|
||||
|
||||
SetProperty<File> getSrcDirs();
|
||||
|
||||
SetProperty<String> getIgnoreClasses();
|
||||
|
||||
RegularFileProperty getMarkerFile();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,8 +8,9 @@
|
|||
package org.elasticsearch.gradle.internal.precommit;
|
||||
|
||||
import groovy.lang.Closure;
|
||||
import org.elasticsearch.gradle.util.GradleUtils;
|
||||
|
||||
import org.elasticsearch.gradle.internal.conventions.util.Util;
|
||||
import org.elasticsearch.gradle.util.GradleUtils;
|
||||
import org.gradle.api.DefaultTask;
|
||||
import org.gradle.api.NamedDomainObjectContainer;
|
||||
import org.gradle.api.Task;
|
||||
|
@ -24,7 +25,6 @@ import org.gradle.api.tasks.SourceSetContainer;
|
|||
import org.gradle.api.tasks.TaskAction;
|
||||
import org.gradle.api.tasks.testing.Test;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.lang.annotation.Annotation;
|
||||
|
@ -48,6 +48,8 @@ import java.util.function.Predicate;
|
|||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
public class TestingConventionsTasks extends DefaultTask {
|
||||
|
||||
private static final String TEST_METHOD_PREFIX = "test";
|
||||
|
|
|
@ -8,11 +8,11 @@
|
|||
|
||||
package org.elasticsearch.gradle.internal.precommit;
|
||||
|
||||
import org.elasticsearch.gradle.internal.ExportElasticsearchBuildResourcesTask;
|
||||
import org.elasticsearch.gradle.dependencies.CompileOnlyResolvePlugin;
|
||||
import org.elasticsearch.gradle.internal.info.BuildParams;
|
||||
import org.elasticsearch.gradle.internal.ExportElasticsearchBuildResourcesTask;
|
||||
import org.elasticsearch.gradle.internal.InternalPlugin;
|
||||
import org.elasticsearch.gradle.internal.conventions.precommit.PrecommitPlugin;
|
||||
import org.elasticsearch.gradle.internal.info.BuildParams;
|
||||
import org.gradle.api.Project;
|
||||
import org.gradle.api.Task;
|
||||
import org.gradle.api.artifacts.Configuration;
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
package org.elasticsearch.gradle.internal.precommit;
|
||||
|
||||
import de.thetaphi.forbiddenapis.cli.CliMain;
|
||||
|
||||
import org.apache.commons.io.output.NullOutputStream;
|
||||
import org.elasticsearch.gradle.OS;
|
||||
import org.elasticsearch.gradle.dependencies.CompileOnlyResolvePlugin;
|
||||
|
|
|
@ -15,6 +15,7 @@ import com.networknt.schema.JsonSchemaFactory;
|
|||
import com.networknt.schema.SchemaValidatorsConfig;
|
||||
import com.networknt.schema.SpecVersion;
|
||||
import com.networknt.schema.ValidationMessage;
|
||||
|
||||
import org.gradle.api.DefaultTask;
|
||||
import org.gradle.api.UncheckedIOException;
|
||||
import org.gradle.api.file.FileCollection;
|
||||
|
|
|
@ -12,6 +12,7 @@ import com.fasterxml.jackson.core.JsonParser;
|
|||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||
|
||||
import org.gradle.api.DefaultTask;
|
||||
import org.gradle.api.GradleException;
|
||||
import org.gradle.api.file.FileCollection;
|
||||
|
|
|
@ -36,6 +36,7 @@ import java.util.Iterator;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import static java.util.Comparator.naturalOrder;
|
||||
|
|
|
@ -19,7 +19,6 @@ import org.gradle.api.logging.Logger;
|
|||
import org.gradle.api.logging.Logging;
|
||||
import org.gradle.api.model.ObjectFactory;
|
||||
import org.gradle.api.tasks.Internal;
|
||||
import org.gradle.api.tasks.SkipWhenEmpty;
|
||||
import org.gradle.api.tasks.TaskAction;
|
||||
import org.gradle.api.tasks.options.Option;
|
||||
import org.gradle.process.ExecOperations;
|
||||
|
@ -30,6 +29,7 @@ import java.util.Set;
|
|||
import java.util.TreeSet;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
/**
|
||||
|
@ -146,10 +146,9 @@ public class PruneChangelogsTask extends DefaultTask {
|
|||
* @return filenames for changelog files in previous releases, without any path
|
||||
*/
|
||||
private static Set<String> findAllFilesInEarlierVersions(GitWrapper gitWrapper, QualifiedVersion version) {
|
||||
return findPreviousVersion(gitWrapper, version)
|
||||
.flatMap(earlierVersion -> gitWrapper.listFiles("v" + earlierVersion, "docs/changelog"))
|
||||
.map(line -> Path.of(line).getFileName().toString())
|
||||
.collect(Collectors.toSet());
|
||||
return findPreviousVersion(gitWrapper, version).flatMap(
|
||||
earlierVersion -> gitWrapper.listFiles("v" + earlierVersion, "docs/changelog")
|
||||
).map(line -> Path.of(line).getFileName().toString()).collect(Collectors.toSet());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -166,8 +165,7 @@ public class PruneChangelogsTask extends DefaultTask {
|
|||
final int majorSeries = version.getMinor() == 0 && version.getRevision() == 0 ? version.getMajor() - 1 : version.getMajor();
|
||||
final String tagPattern = "v" + majorSeries + ".*";
|
||||
|
||||
return gitWrapper.listVersions(tagPattern)
|
||||
.filter(v -> v.isBefore(version));
|
||||
return gitWrapper.listVersions(tagPattern).filter(v -> v.isBefore(version));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -22,6 +22,7 @@ import org.gradle.api.tasks.TaskProvider;
|
|||
import org.gradle.api.tasks.util.PatternSet;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
/**
|
||||
|
|
|
@ -20,6 +20,7 @@ import org.gradle.api.tasks.TaskAction;
|
|||
import java.net.URI;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
/**
|
||||
|
|
|
@ -68,6 +68,7 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
/**
|
||||
|
@ -126,7 +127,7 @@ public class RestCompatTestTransformTask extends DefaultTask {
|
|||
}
|
||||
|
||||
public void skipTest(String fullTestName, String reason) {
|
||||
//The tests are defined by 3 parts a/b/c where
|
||||
// The tests are defined by 3 parts a/b/c where
|
||||
// a = the folder name
|
||||
// b = the file name without the .yml extension
|
||||
// c = the test name inside the .yml
|
||||
|
@ -135,15 +136,19 @@ public class RestCompatTestTransformTask extends DefaultTask {
|
|||
// So we also need to support a1/a2/a3/b/c1/c2/c3
|
||||
|
||||
String[] testParts = fullTestName.split("/");
|
||||
if(testParts.length < 3 ){
|
||||
throw new IllegalArgumentException("To skip tests, all 3 parts [folder/file/test name] must be defined. found [" + fullTestName + "]");
|
||||
if (testParts.length < 3) {
|
||||
throw new IllegalArgumentException(
|
||||
"To skip tests, all 3 parts [folder/file/test name] must be defined. found [" + fullTestName + "]"
|
||||
);
|
||||
}
|
||||
|
||||
PatternSet skippedPatternSet = patternSetFactory.create();
|
||||
//create file patterns for all a1/a2/a3/b.yml possibilities.
|
||||
for(int i = testParts.length - 1; i > 1; i-- ){
|
||||
// create file patterns for all a1/a2/a3/b.yml possibilities.
|
||||
for (int i = testParts.length - 1; i > 1; i--) {
|
||||
final String lastPart = testParts[i];
|
||||
String filePattern = "**/" + Arrays.stream(testParts).takeWhile(x -> x.equals(lastPart) == false).collect(Collectors.joining("/")) + ".yml";
|
||||
String filePattern = "**/"
|
||||
+ Arrays.stream(testParts).takeWhile(x -> x.equals(lastPart) == false).collect(Collectors.joining("/"))
|
||||
+ ".yml";
|
||||
skippedPatternSet.include(filePattern);
|
||||
}
|
||||
|
||||
|
@ -305,7 +310,6 @@ public class RestCompatTestTransformTask extends DefaultTask {
|
|||
transformations.add(new ReplaceTextual(key, oldValue, MAPPER.convertValue(newValue, TextNode.class), testName));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Removes the key/value of a match assertion all project REST tests for the matching subkey.
|
||||
* For example "match":{"_type": "foo"} to "match":{}
|
||||
|
@ -425,7 +429,7 @@ public class RestCompatTestTransformTask extends DefaultTask {
|
|||
|
||||
Map<File, String> skippedFilesWithReason = new HashMap<>();
|
||||
skippedTestByFilePatternTransformations.forEach((filePattern, reason) -> {
|
||||
//resolve file pattern to concrete files
|
||||
// resolve file pattern to concrete files
|
||||
for (File file : getTestFiles().matching(filePattern).getFiles()) {
|
||||
skippedFilesWithReason.put(file, reason);
|
||||
}
|
||||
|
@ -433,7 +437,7 @@ public class RestCompatTestTransformTask extends DefaultTask {
|
|||
|
||||
Map<File, List<Pair<String, String>>> skippedFilesWithTestAndReason = new HashMap<>();
|
||||
skippedTestByTestNameTransformations.forEach((filePattern, testWithReason) -> {
|
||||
//resolve file pattern to concrete files
|
||||
// resolve file pattern to concrete files
|
||||
for (File file : getTestFiles().matching(filePattern).getFiles()) {
|
||||
skippedFilesWithTestAndReason.put(file, testWithReason);
|
||||
}
|
||||
|
@ -446,12 +450,14 @@ public class RestCompatTestTransformTask extends DefaultTask {
|
|||
List<ObjectNode> tests = READER.<ObjectNode>readValues(yamlParser).readAll();
|
||||
List<ObjectNode> transformRestTests;
|
||||
if (skippedFilesWithReason.containsKey(file)) {
|
||||
//skip all the tests in the file
|
||||
transformRestTests = transformer.transformRestTests(new LinkedList<>(tests),
|
||||
Collections.singletonList(new Skip(skippedFilesWithReason.get(file))));
|
||||
// skip all the tests in the file
|
||||
transformRestTests = transformer.transformRestTests(
|
||||
new LinkedList<>(tests),
|
||||
Collections.singletonList(new Skip(skippedFilesWithReason.get(file)))
|
||||
);
|
||||
} else {
|
||||
if (skippedFilesWithTestAndReason.containsKey(file)) {
|
||||
//skip the named tests for this file
|
||||
// skip the named tests for this file
|
||||
skippedFilesWithTestAndReason.get(file).forEach(fullTestNameAndReasonPair -> {
|
||||
String prefix = file.getName().replace(".yml", "/");
|
||||
String singleTestName = fullTestNameAndReasonPair.getLeft().replaceAll(".*" + prefix, "");
|
||||
|
@ -488,7 +494,8 @@ public class RestCompatTestTransformTask extends DefaultTask {
|
|||
|
||||
@Input
|
||||
public String getSkippedTestByFilePatternTransformations() {
|
||||
return skippedTestByFilePatternTransformations.keySet().stream()
|
||||
return skippedTestByFilePatternTransformations.keySet()
|
||||
.stream()
|
||||
.map(key -> String.join(",", key.getIncludes()) + skippedTestByFilePatternTransformations.get(key))
|
||||
.collect(Collectors.joining());
|
||||
}
|
||||
|
@ -496,7 +503,8 @@ public class RestCompatTestTransformTask extends DefaultTask {
|
|||
@Input
|
||||
public String getSkippedTestByTestNameTransformations() {
|
||||
|
||||
return skippedTestByTestNameTransformations.keySet().stream()
|
||||
return skippedTestByTestNameTransformations.keySet()
|
||||
.stream()
|
||||
.map(key -> String.join(",", key.getIncludes()) + skippedTestByTestNameTransformations.get(key))
|
||||
.collect(Collectors.joining());
|
||||
}
|
||||
|
|
|
@ -214,7 +214,6 @@ public class YamlRestCompatTestPlugin implements Plugin<Project> {
|
|||
testTask.onlyIf(t -> isEnabled(project));
|
||||
});
|
||||
|
||||
|
||||
setupTestDependenciesDefaults(project, yamlCompatTestSourceSet);
|
||||
|
||||
// setup IDE
|
||||
|
|
|
@ -118,7 +118,7 @@ public class DistroTestPlugin implements Plugin<Project> {
|
|||
TaskProvider<Test> destructiveTask = configureTestTask(project, taskname, distribution, t -> {
|
||||
t.onlyIf(t2 -> distribution.isDocker() == false || dockerSupport.get().getDockerAvailability().isAvailable);
|
||||
addDistributionSysprop(t, DISTRIBUTION_SYSPROP, distribution::getFilepath);
|
||||
//addDistributionSysprop(t, EXAMPLE_PLUGIN_SYSPROP, () -> examplePlugin.getSingleFile().toString());
|
||||
// addDistributionSysprop(t, EXAMPLE_PLUGIN_SYSPROP, () -> examplePlugin.getSingleFile().toString());
|
||||
t.exclude("**/PackageUpgradeTests.class");
|
||||
}, depsTask);
|
||||
|
||||
|
@ -366,9 +366,12 @@ public class DistroTestPlugin implements Plugin<Project> {
|
|||
List<ElasticsearchDistribution> currentDistros = new ArrayList<>();
|
||||
|
||||
for (Architecture architecture : Architecture.values()) {
|
||||
ALL_INTERNAL.stream().forEach(type -> currentDistros.add(
|
||||
createDistro(distributions, architecture, type, null, true, VersionProperties.getElasticsearch())
|
||||
));
|
||||
ALL_INTERNAL.stream()
|
||||
.forEach(
|
||||
type -> currentDistros.add(
|
||||
createDistro(distributions, architecture, type, null, true, VersionProperties.getElasticsearch())
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
for (Architecture architecture : Architecture.values()) {
|
||||
|
|
|
@ -70,7 +70,9 @@ public class RestTestBasePlugin implements Plugin<Project> {
|
|||
}
|
||||
});
|
||||
|
||||
project.getTasks().named(JavaBasePlugin.CHECK_TASK_NAME).configure(check -> check.dependsOn(project.getTasks().withType(RestIntegTestTask.class)));
|
||||
project.getTasks()
|
||||
.named(JavaBasePlugin.CHECK_TASK_NAME)
|
||||
.configure(check -> check.dependsOn(project.getTasks().withType(RestIntegTestTask.class)));
|
||||
project.getTasks()
|
||||
.withType(StandaloneRestIntegTestTask.class)
|
||||
.configureEach(t -> t.finalizedBy(project.getTasks().withType(FixtureStop.class)));
|
||||
|
|
|
@ -20,7 +20,6 @@ import org.gradle.api.tasks.SourceSet;
|
|||
import org.gradle.api.tasks.SourceSetContainer;
|
||||
import org.gradle.api.tasks.testing.Test;
|
||||
import org.gradle.plugins.ide.eclipse.model.EclipseModel;
|
||||
|
||||
import org.gradle.plugins.ide.idea.model.IdeaModel;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
|
||||
package org.elasticsearch.gradle.internal.test;
|
||||
|
||||
import org.elasticsearch.gradle.internal.ElasticsearchJavaPlugin;
|
||||
import org.gradle.api.Plugin;
|
||||
import org.gradle.api.Project;
|
||||
import org.gradle.api.plugins.JavaBasePlugin;
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
package org.elasticsearch.gradle.internal.test;
|
||||
|
||||
import org.elasticsearch.gradle.internal.ExportElasticsearchBuildResourcesTask;
|
||||
import org.elasticsearch.gradle.internal.conventions.util.Util;
|
||||
import org.elasticsearch.gradle.internal.info.BuildParams;
|
||||
import org.elasticsearch.gradle.internal.precommit.FilePermissionsPrecommitPlugin;
|
||||
import org.elasticsearch.gradle.internal.precommit.ForbiddenPatternsPrecommitPlugin;
|
||||
|
@ -16,7 +17,6 @@ import org.elasticsearch.gradle.internal.precommit.ForbiddenPatternsTask;
|
|||
import org.elasticsearch.gradle.testclusters.ElasticsearchCluster;
|
||||
import org.elasticsearch.gradle.testclusters.TestClustersAware;
|
||||
import org.elasticsearch.gradle.testclusters.TestClustersPlugin;
|
||||
import org.elasticsearch.gradle.internal.conventions.util.Util;
|
||||
import org.gradle.api.NamedDomainObjectContainer;
|
||||
import org.gradle.api.Plugin;
|
||||
import org.gradle.api.Project;
|
||||
|
|
|
@ -7,10 +7,7 @@
|
|||
*/
|
||||
package org.elasticsearch.gradle.internal.test.rest;
|
||||
|
||||
import org.elasticsearch.gradle.VersionProperties;
|
||||
import org.elasticsearch.gradle.internal.info.BuildParams;
|
||||
import org.gradle.api.DefaultTask;
|
||||
import org.gradle.api.file.ArchiveOperations;
|
||||
import org.gradle.api.file.DirectoryProperty;
|
||||
import org.gradle.api.file.FileCollection;
|
||||
import org.gradle.api.file.FileSystemOperations;
|
||||
|
@ -28,13 +25,14 @@ import org.gradle.api.tasks.util.PatternFilterable;
|
|||
import org.gradle.api.tasks.util.PatternSet;
|
||||
import org.gradle.internal.Factory;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import static org.elasticsearch.gradle.util.GradleUtils.getProjectPathFromTask;
|
||||
|
||||
/**
|
||||
|
|
|
@ -30,6 +30,7 @@ import java.io.File;
|
|||
import java.util.Map;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import static org.elasticsearch.gradle.util.GradleUtils.getProjectPathFromTask;
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
*/
|
||||
package org.elasticsearch.gradle.internal.test.rest;
|
||||
|
||||
import org.elasticsearch.gradle.internal.info.BuildParams;
|
||||
import org.gradle.api.Action;
|
||||
import org.gradle.api.model.ObjectFactory;
|
||||
import org.gradle.api.provider.ListProperty;
|
||||
|
|
|
@ -89,12 +89,11 @@ public class RestResourcesPlugin implements Plugin<Project> {
|
|||
Configuration testConfig = project.getConfigurations().create("restTestConfig");
|
||||
Configuration xpackTestConfig = project.getConfigurations().create("restXpackTestConfig");
|
||||
// core
|
||||
Dependency restTestdependency = project.getDependencies()
|
||||
.project(Map.of("path", ":rest-api-spec", "configuration", "restTests"));
|
||||
Dependency restTestdependency = project.getDependencies().project(Map.of("path", ":rest-api-spec", "configuration", "restTests"));
|
||||
project.getDependencies().add(testConfig.getName(), restTestdependency);
|
||||
// x-pack
|
||||
Dependency restXPackTestdependency = project.getDependencies()
|
||||
.project(Map.of("path", ":x-pack:plugin", "configuration", "restXpackTests"));
|
||||
.project(Map.of("path", ":x-pack:plugin", "configuration", "restXpackTests"));
|
||||
project.getDependencies().add(xpackTestConfig.getName(), restXPackTestdependency);
|
||||
|
||||
project.getConfigurations().create("restTests");
|
||||
|
@ -115,8 +114,7 @@ public class RestResourcesPlugin implements Plugin<Project> {
|
|||
|
||||
// api
|
||||
Configuration specConfig = project.getConfigurations().create("restSpec"); // name chosen for passivity
|
||||
Dependency restSpecDependency = project.getDependencies()
|
||||
.project(Map.of("path", ":rest-api-spec", "configuration", "restSpecs"));
|
||||
Dependency restSpecDependency = project.getDependencies().project(Map.of("path", ":rest-api-spec", "configuration", "restSpecs"));
|
||||
project.getDependencies().add(specConfig.getName(), restSpecDependency);
|
||||
project.getConfigurations().create("restSpecs");
|
||||
|
||||
|
|
|
@ -24,8 +24,7 @@ import org.gradle.api.tasks.bundling.Zip;
|
|||
*/
|
||||
public class RestTestUtil {
|
||||
|
||||
private RestTestUtil() {
|
||||
}
|
||||
private RestTestUtil() {}
|
||||
|
||||
/**
|
||||
* Creates a {@link RestIntegTestTask} task with the source set of the same name
|
||||
|
@ -42,9 +41,7 @@ public class RestTestUtil {
|
|||
return project.getTasks().register(taskName, RestIntegTestTask.class, testTask -> {
|
||||
testTask.setGroup(JavaBasePlugin.VERIFICATION_GROUP);
|
||||
testTask.setDescription("Runs the REST tests against an external cluster");
|
||||
project.getPlugins().withType(JavaPlugin.class, t ->
|
||||
testTask.mustRunAfter(project.getTasks().named("test"))
|
||||
);
|
||||
project.getPlugins().withType(JavaPlugin.class, t -> testTask.mustRunAfter(project.getTasks().named("test")));
|
||||
|
||||
testTask.setTestClassesDirs(sourceSet.getOutput().getClassesDirs());
|
||||
testTask.setClasspath(sourceSet.getRuntimeClasspath());
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
package org.elasticsearch.gradle.internal.test.rest.transform;
|
||||
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
|
||||
import org.gradle.api.tasks.Input;
|
||||
import org.gradle.api.tasks.Optional;
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
package org.elasticsearch.gradle.internal.test.rest.transform;
|
||||
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
|
||||
import org.gradle.api.Named;
|
||||
import org.gradle.api.tasks.Input;
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@ package org.elasticsearch.gradle.internal.test.rest.transform.do_; // 'do' is a
|
|||
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||
|
||||
import org.elasticsearch.gradle.internal.test.rest.transform.ReplaceByKey;
|
||||
import org.gradle.api.tasks.Internal;
|
||||
|
||||
|
|
|
@ -13,13 +13,15 @@ import com.fasterxml.jackson.databind.node.ArrayNode;
|
|||
import com.fasterxml.jackson.databind.node.JsonNodeFactory;
|
||||
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||
import com.fasterxml.jackson.databind.node.TextNode;
|
||||
|
||||
import org.elasticsearch.gradle.internal.test.rest.transform.RestTestTransformGlobalSetup;
|
||||
import org.elasticsearch.gradle.internal.test.rest.transform.RestTestTransformGlobalTeardown;
|
||||
import org.gradle.api.tasks.Internal;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Iterator;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
/**
|
||||
* A parent class for transformations that are backed by a feature. This will inject the necessary "feature" into the
|
||||
* global setup and teardown section. See also org.elasticsearch.test.rest.yaml.Features for a list of possible features.
|
||||
|
|
|
@ -11,6 +11,7 @@ package org.elasticsearch.gradle.internal.test.rest.transform.headers;
|
|||
import com.fasterxml.jackson.databind.node.JsonNodeFactory;
|
||||
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||
import com.fasterxml.jackson.databind.node.TextNode;
|
||||
|
||||
import org.elasticsearch.gradle.internal.test.rest.transform.RestTestTransform;
|
||||
import org.elasticsearch.gradle.internal.test.rest.transform.RestTestTransformByParentObject;
|
||||
import org.elasticsearch.gradle.internal.test.rest.transform.feature.FeatureInjector;
|
||||
|
@ -19,7 +20,6 @@ import org.gradle.api.tasks.Internal;
|
|||
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.function.BiConsumer;
|
||||
import java.util.function.Function;
|
||||
|
||||
/**
|
||||
|
|
|
@ -10,6 +10,7 @@ package org.elasticsearch.gradle.internal.test.rest.transform.length;
|
|||
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||
|
||||
import org.elasticsearch.gradle.internal.test.rest.transform.ReplaceByKey;
|
||||
import org.gradle.api.tasks.Internal;
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@ import com.fasterxml.jackson.databind.JsonNode;
|
|||
import com.fasterxml.jackson.databind.node.ArrayNode;
|
||||
import com.fasterxml.jackson.databind.node.JsonNodeFactory;
|
||||
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||
|
||||
import org.elasticsearch.gradle.internal.test.rest.transform.RestTestContext;
|
||||
import org.elasticsearch.gradle.internal.test.rest.transform.RestTestTransformByParentArray;
|
||||
import org.gradle.api.tasks.Input;
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
package org.elasticsearch.gradle.internal.test.rest.transform.match;
|
||||
|
||||
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||
|
||||
import org.elasticsearch.gradle.internal.test.rest.transform.RestTestContext;
|
||||
import org.elasticsearch.gradle.internal.test.rest.transform.RestTestTransformByParentObject;
|
||||
import org.gradle.api.tasks.Input;
|
||||
|
|
|
@ -10,6 +10,7 @@ package org.elasticsearch.gradle.internal.test.rest.transform.match;
|
|||
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||
|
||||
import org.elasticsearch.gradle.internal.test.rest.transform.ReplaceByKey;
|
||||
import org.gradle.api.tasks.Internal;
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@ package org.elasticsearch.gradle.internal.test.rest.transform.match;
|
|||
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||
|
||||
import org.elasticsearch.gradle.internal.test.rest.transform.ReplaceByKey;
|
||||
import org.gradle.api.tasks.Internal;
|
||||
|
||||
|
|
|
@ -17,15 +17,10 @@ import com.fasterxml.jackson.databind.node.TextNode;
|
|||
import org.elasticsearch.gradle.internal.test.rest.transform.RestTestTransform;
|
||||
import org.elasticsearch.gradle.internal.test.rest.transform.RestTestTransformByParentObject;
|
||||
import org.elasticsearch.gradle.internal.test.rest.transform.RestTestTransformGlobalSetup;
|
||||
import org.elasticsearch.gradle.internal.test.rest.transform.feature.FeatureInjector;
|
||||
import org.gradle.api.tasks.Input;
|
||||
import org.gradle.api.tasks.Internal;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.function.Function;
|
||||
|
||||
/**
|
||||
* A {@link RestTestTransform} that injects a skip into a REST test.
|
||||
|
@ -91,7 +86,6 @@ public class Skip implements RestTestTransformGlobalSetup, RestTestTransformByPa
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void transformTest(ObjectNode parent) {
|
||||
if (testName.isBlank() == false) {
|
||||
|
|
|
@ -11,6 +11,7 @@ package org.elasticsearch.gradle.internal.test.rest.transform.text;
|
|||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||
import com.fasterxml.jackson.databind.node.TextNode;
|
||||
|
||||
import org.elasticsearch.gradle.internal.test.rest.transform.RestTestContext;
|
||||
import org.elasticsearch.gradle.internal.test.rest.transform.RestTestTransformByParentObject;
|
||||
import org.gradle.api.tasks.Input;
|
||||
|
|
|
@ -11,6 +11,7 @@ package org.elasticsearch.gradle.internal.test.rest.transform.warnings;
|
|||
import com.fasterxml.jackson.databind.node.ArrayNode;
|
||||
import com.fasterxml.jackson.databind.node.JsonNodeFactory;
|
||||
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||
|
||||
import org.elasticsearch.gradle.internal.test.rest.transform.RestTestContext;
|
||||
import org.elasticsearch.gradle.internal.test.rest.transform.RestTestTransformByParentObject;
|
||||
import org.elasticsearch.gradle.internal.test.rest.transform.feature.FeatureInjector;
|
||||
|
|
|
@ -39,6 +39,7 @@ public class RemoveWarnings implements RestTestTransformByParentObject {
|
|||
public RemoveWarnings(Set<String> warnings) {
|
||||
this.warnings = warnings;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param warnings The allowed warnings to inject
|
||||
* @param testName The testName to inject
|
||||
|
|
|
@ -13,11 +13,12 @@ import com.avast.gradle.dockercompose.ServiceInfo;
|
|||
import com.avast.gradle.dockercompose.tasks.ComposeDown;
|
||||
import com.avast.gradle.dockercompose.tasks.ComposePull;
|
||||
import com.avast.gradle.dockercompose.tasks.ComposeUp;
|
||||
import org.elasticsearch.gradle.test.SystemPropertyCommandLineArgumentProvider;
|
||||
|
||||
import org.elasticsearch.gradle.internal.docker.DockerSupportPlugin;
|
||||
import org.elasticsearch.gradle.internal.docker.DockerSupportService;
|
||||
import org.elasticsearch.gradle.internal.info.BuildParams;
|
||||
import org.elasticsearch.gradle.internal.precommit.TestingConventionsTasks;
|
||||
import org.elasticsearch.gradle.test.SystemPropertyCommandLineArgumentProvider;
|
||||
import org.elasticsearch.gradle.util.GradleUtils;
|
||||
import org.gradle.api.Action;
|
||||
import org.gradle.api.DefaultTask;
|
||||
|
@ -34,7 +35,6 @@ import org.gradle.api.tasks.TaskContainer;
|
|||
import org.gradle.api.tasks.TaskProvider;
|
||||
import org.gradle.api.tasks.testing.Test;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.UncheckedIOException;
|
||||
|
@ -42,6 +42,8 @@ import java.nio.file.Files;
|
|||
import java.util.Collections;
|
||||
import java.util.function.BiConsumer;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
public class TestFixturesPlugin implements Plugin<Project> {
|
||||
|
||||
private static final Logger LOGGER = Logging.getLogger(TestFixturesPlugin.class);
|
||||
|
|
|
@ -10,8 +10,8 @@ package org.elasticsearch.gradle.internal.vagrant;
|
|||
|
||||
import org.apache.commons.io.output.TeeOutputStream;
|
||||
import org.elasticsearch.gradle.LoggedExec;
|
||||
import org.elasticsearch.gradle.internal.LoggingOutputStream;
|
||||
import org.elasticsearch.gradle.ReaperService;
|
||||
import org.elasticsearch.gradle.internal.LoggingOutputStream;
|
||||
import org.elasticsearch.gradle.internal.conventions.util.Util;
|
||||
import org.gradle.api.Action;
|
||||
import org.gradle.api.Project;
|
||||
|
@ -20,7 +20,6 @@ import org.gradle.internal.logging.progress.ProgressLogger;
|
|||
import org.gradle.internal.logging.progress.ProgressLoggerFactory;
|
||||
import org.gradle.process.ExecOperations;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import java.io.File;
|
||||
import java.io.OutputStream;
|
||||
import java.nio.file.Paths;
|
||||
|
@ -28,6 +27,8 @@ import java.util.Arrays;
|
|||
import java.util.Objects;
|
||||
import java.util.function.UnaryOperator;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
/**
|
||||
* An helper to manage a vagrant box.
|
||||
*
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
package org.elasticsearch.gradle;
|
||||
|
||||
import org.elasticsearch.gradle.internal.BwcVersions;
|
||||
import org.elasticsearch.gradle.internal.info.BuildParams;
|
||||
import org.elasticsearch.gradle.internal.test.GradleUnitTestCase;
|
||||
import org.gradle.api.NamedDomainObjectContainer;
|
||||
import org.gradle.api.Project;
|
||||
|
|
|
@ -7,16 +7,16 @@
|
|||
*/
|
||||
package org.elasticsearch.gradle.internal;
|
||||
|
||||
import org.elasticsearch.gradle.internal.test.GradleUnitTestCase;
|
||||
import org.gradle.api.Project;
|
||||
import org.gradle.testfixtures.ProjectBuilder;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.Files;
|
||||
import java.util.Arrays;
|
||||
|
||||
import org.elasticsearch.gradle.internal.test.GradleUnitTestCase;
|
||||
import org.gradle.api.Project;
|
||||
import org.gradle.testfixtures.ProjectBuilder;
|
||||
|
||||
public class ConcatFilesTaskTests extends GradleUnitTestCase {
|
||||
|
||||
public void testHeaderAdded() throws IOException {
|
||||
|
|
|
@ -7,15 +7,16 @@
|
|||
*/
|
||||
package org.elasticsearch.gradle.internal;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
import com.carrotsearch.randomizedtesting.RandomizedTest;
|
||||
|
||||
import org.apache.tools.ant.taskdefs.condition.Os;
|
||||
import org.elasticsearch.gradle.internal.test.GradleUnitTestCase;
|
||||
import org.gradle.api.Project;
|
||||
import org.gradle.testfixtures.ProjectBuilder;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
public class EmptyDirTaskTests extends GradleUnitTestCase {
|
||||
|
||||
public void testCreateEmptyDir() throws Exception {
|
||||
|
|
|
@ -7,13 +7,8 @@
|
|||
*/
|
||||
package org.elasticsearch.gradle.internal.precommit;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.file.Files;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.carrotsearch.randomizedtesting.RandomizedTest;
|
||||
|
||||
import org.apache.tools.ant.taskdefs.condition.Os;
|
||||
import org.elasticsearch.gradle.internal.test.GradleUnitTestCase;
|
||||
import org.elasticsearch.gradle.util.GradleUtils;
|
||||
|
@ -23,6 +18,12 @@ import org.gradle.api.plugins.JavaPlugin;
|
|||
import org.gradle.testfixtures.ProjectBuilder;
|
||||
import org.junit.Assert;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.file.Files;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class FilePermissionsTaskTests extends GradleUnitTestCase {
|
||||
|
||||
public void testCheckPermissionsWhenAnExecutableFileExists() throws Exception {
|
||||
|
|
|
@ -16,9 +16,7 @@ import java.nio.file.Paths;
|
|||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import static org.hamcrest.Matchers.containsString;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.hamcrest.Matchers.not;
|
||||
import static org.junit.Assert.assertThat;
|
||||
|
||||
public class BreakingChangesGeneratorTest {
|
||||
|
|
|
@ -12,7 +12,6 @@ import org.elasticsearch.gradle.OS;
|
|||
import org.elasticsearch.gradle.internal.release.PruneChangelogsTask.DeleteHelper;
|
||||
import org.elasticsearch.gradle.internal.test.GradleUnitTestCase;
|
||||
import org.gradle.api.GradleException;
|
||||
import org.junit.Assume;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
|
@ -23,7 +22,6 @@ import java.util.Set;
|
|||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import static org.elasticsearch.gradle.OS.LINUX;
|
||||
import static org.elasticsearch.gradle.OS.WINDOWS;
|
||||
import static org.elasticsearch.gradle.internal.release.PruneChangelogsTask.findAndDeleteFiles;
|
||||
import static org.elasticsearch.gradle.internal.release.PruneChangelogsTask.findPreviousVersion;
|
||||
|
|
|
@ -13,6 +13,7 @@ import com.fasterxml.jackson.databind.ObjectWriter;
|
|||
import com.fasterxml.jackson.databind.SequenceWriter;
|
||||
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||
import com.fasterxml.jackson.dataformat.yaml.YAMLFactory;
|
||||
|
||||
import org.junit.ComparisonFailure;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
|
|
|
@ -186,7 +186,12 @@ public abstract class TransformTests extends GradleUnitTestCase {
|
|||
validateBodyHasWarnings(featureName, null, tests, expectedWarnings);
|
||||
}
|
||||
|
||||
protected void validateBodyHasWarnings(String featureName, String testName, List<ObjectNode> tests, Collection<String> expectedWarnings) {
|
||||
protected void validateBodyHasWarnings(
|
||||
String featureName,
|
||||
String testName,
|
||||
List<ObjectNode> tests,
|
||||
Collection<String> expectedWarnings
|
||||
) {
|
||||
AtomicBoolean actuallyDidSomething = new AtomicBoolean(false);
|
||||
tests.forEach(test -> {
|
||||
Iterator<Map.Entry<String, JsonNode>> testsIterator = test.fields();
|
||||
|
@ -202,9 +207,9 @@ public abstract class TransformTests extends GradleUnitTestCase {
|
|||
ObjectNode doSection = (ObjectNode) testSection.get("do");
|
||||
assertThat(doSection.get(featureName), CoreMatchers.notNullValue());
|
||||
ArrayNode warningsNode = (ArrayNode) doSection.get(featureName);
|
||||
List<String> actual = new ArrayList<>();
|
||||
List<String> actual = new ArrayList<>();
|
||||
warningsNode.forEach(node -> actual.add(node.asText()));
|
||||
String[] expected = expectedWarnings.toArray(new String[]{});
|
||||
String[] expected = expectedWarnings.toArray(new String[] {});
|
||||
assertThat(actual, Matchers.containsInAnyOrder(expected));
|
||||
actuallyDidSomething.set(true);
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
package org.elasticsearch.gradle.internal.test.rest.transform.do_;
|
||||
|
||||
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||
|
||||
import org.elasticsearch.gradle.internal.test.rest.transform.AssertObjectNodes;
|
||||
import org.elasticsearch.gradle.internal.test.rest.transform.TransformTests;
|
||||
import org.junit.Test;
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
package org.elasticsearch.gradle.internal.test.rest.transform.feature;
|
||||
|
||||
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||
|
||||
import org.elasticsearch.gradle.internal.test.rest.transform.TransformTests;
|
||||
import org.junit.Test;
|
||||
|
||||
|
|
|
@ -9,12 +9,12 @@
|
|||
package org.elasticsearch.gradle.internal.test.rest.transform.header;
|
||||
|
||||
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||
|
||||
import org.elasticsearch.gradle.internal.test.rest.transform.RestTestTransform;
|
||||
import org.elasticsearch.gradle.internal.test.rest.transform.feature.InjectFeatureTests;
|
||||
import org.elasticsearch.gradle.internal.test.rest.transform.headers.InjectHeaders;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
@ -60,7 +60,6 @@ public class InjectHeaderTests extends InjectFeatureTests {
|
|||
validateBodyHasHeaders(transformedTests, headers);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testNotInjectingHeaders() throws Exception {
|
||||
String testName = "/rest/transform/header/with_operation_to_skip_adding_headers.yml";
|
||||
|
@ -68,8 +67,9 @@ public class InjectHeaderTests extends InjectFeatureTests {
|
|||
validateSetupExist(tests);
|
||||
validateBodyHasHeaders(tests, Map.of("foo", "bar"));
|
||||
|
||||
List<RestTestTransform<?>> transformations =
|
||||
Collections.singletonList(new InjectHeaders(headers, Set.of(InjectHeaderTests::applyCondition)));
|
||||
List<RestTestTransform<?>> transformations = Collections.singletonList(
|
||||
new InjectHeaders(headers, Set.of(InjectHeaderTests::applyCondition))
|
||||
);
|
||||
List<ObjectNode> transformedTests = transformTests(tests, transformations);
|
||||
printTest(testName, transformedTests);
|
||||
validateSetupAndTearDown(transformedTests);
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
package org.elasticsearch.gradle.internal.test.rest.transform.length;
|
||||
|
||||
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||
|
||||
import org.elasticsearch.gradle.internal.test.rest.transform.AssertObjectNodes;
|
||||
import org.elasticsearch.gradle.internal.test.rest.transform.TransformTests;
|
||||
import org.junit.Test;
|
||||
|
|
|
@ -13,6 +13,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
|
|||
import com.fasterxml.jackson.databind.node.ArrayNode;
|
||||
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||
import com.fasterxml.jackson.dataformat.yaml.YAMLFactory;
|
||||
|
||||
import org.elasticsearch.gradle.internal.test.rest.transform.TransformTests;
|
||||
import org.hamcrest.CoreMatchers;
|
||||
import org.junit.Test;
|
||||
|
|
|
@ -14,6 +14,7 @@ import com.fasterxml.jackson.databind.ObjectReader;
|
|||
import com.fasterxml.jackson.databind.node.ArrayNode;
|
||||
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||
import com.fasterxml.jackson.dataformat.yaml.YAMLFactory;
|
||||
|
||||
import org.elasticsearch.gradle.internal.test.rest.transform.TransformTests;
|
||||
import org.hamcrest.CoreMatchers;
|
||||
import org.junit.Test;
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
package org.elasticsearch.gradle.internal.test.rest.transform.match;
|
||||
|
||||
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||
|
||||
import org.elasticsearch.gradle.internal.test.rest.transform.AssertObjectNodes;
|
||||
import org.elasticsearch.gradle.internal.test.rest.transform.TransformTests;
|
||||
import org.junit.Test;
|
||||
|
|
|
@ -12,6 +12,7 @@ import com.fasterxml.jackson.databind.JsonNode;
|
|||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||
import com.fasterxml.jackson.dataformat.yaml.YAMLFactory;
|
||||
|
||||
import org.elasticsearch.gradle.internal.test.rest.transform.AssertObjectNodes;
|
||||
import org.elasticsearch.gradle.internal.test.rest.transform.TransformTests;
|
||||
import org.junit.Test;
|
||||
|
|
|
@ -11,9 +11,7 @@ package org.elasticsearch.gradle.internal.test.rest.transform.skip;
|
|||
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||
|
||||
import org.elasticsearch.gradle.internal.test.rest.transform.AssertObjectNodes;
|
||||
import org.elasticsearch.gradle.internal.test.rest.transform.RestTestTransform;
|
||||
import org.elasticsearch.gradle.internal.test.rest.transform.TransformTests;
|
||||
import org.elasticsearch.gradle.internal.test.rest.transform.match.ReplaceKeyInMatch;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.Collections;
|
||||
|
@ -21,7 +19,6 @@ import java.util.List;
|
|||
|
||||
public class SkipTests extends TransformTests {
|
||||
|
||||
|
||||
@Test
|
||||
public void testAddGlobalSetup() throws Exception {
|
||||
String test_original = "/rest/transform/skip/without_setup_original.yml";
|
||||
|
@ -30,10 +27,7 @@ public class SkipTests extends TransformTests {
|
|||
String test_transformed = "/rest/transform/skip/without_setup_transformed.yml";
|
||||
List<ObjectNode> expectedTransformation = getTests(test_transformed);
|
||||
|
||||
List<ObjectNode> transformedTests = transformTests(
|
||||
tests,
|
||||
Collections.singletonList(new Skip("my reason"))
|
||||
);
|
||||
List<ObjectNode> transformedTests = transformTests(tests, Collections.singletonList(new Skip("my reason")));
|
||||
|
||||
AssertObjectNodes.areEqual(transformedTests, expectedTransformation);
|
||||
}
|
||||
|
@ -46,10 +40,7 @@ public class SkipTests extends TransformTests {
|
|||
String test_transformed = "/rest/transform/skip/without_setup_transformed.yml";
|
||||
List<ObjectNode> expectedTransformation = getTests(test_transformed);
|
||||
|
||||
List<ObjectNode> transformedTests = transformTests(
|
||||
tests,
|
||||
Collections.singletonList(new Skip("my reason"))
|
||||
);
|
||||
List<ObjectNode> transformedTests = transformTests(tests, Collections.singletonList(new Skip("my reason")));
|
||||
|
||||
AssertObjectNodes.areEqual(transformedTests, expectedTransformation);
|
||||
}
|
||||
|
@ -62,10 +53,7 @@ public class SkipTests extends TransformTests {
|
|||
String test_transformed = "/rest/transform/skip/with_setup_no_skip_transformed.yml";
|
||||
List<ObjectNode> expectedTransformation = getTests(test_transformed);
|
||||
|
||||
List<ObjectNode> transformedTests = transformTests(
|
||||
tests,
|
||||
Collections.singletonList(new Skip("my reason"))
|
||||
);
|
||||
List<ObjectNode> transformedTests = transformTests(tests, Collections.singletonList(new Skip("my reason")));
|
||||
|
||||
AssertObjectNodes.areEqual(transformedTests, expectedTransformation);
|
||||
}
|
||||
|
@ -78,10 +66,7 @@ public class SkipTests extends TransformTests {
|
|||
String test_transformed = "/rest/transform/skip/with_features_transformed.yml";
|
||||
List<ObjectNode> expectedTransformation = getTests(test_transformed);
|
||||
|
||||
List<ObjectNode> transformedTests = transformTests(
|
||||
tests,
|
||||
Collections.singletonList(new Skip("my reason"))
|
||||
);
|
||||
List<ObjectNode> transformedTests = transformTests(tests, Collections.singletonList(new Skip("my reason")));
|
||||
|
||||
AssertObjectNodes.areEqual(transformedTests, expectedTransformation);
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
|
|||
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||
import com.fasterxml.jackson.databind.node.TextNode;
|
||||
import com.fasterxml.jackson.dataformat.yaml.YAMLFactory;
|
||||
|
||||
import org.elasticsearch.gradle.internal.test.rest.transform.AssertObjectNodes;
|
||||
import org.elasticsearch.gradle.internal.test.rest.transform.TransformTests;
|
||||
import org.junit.Test;
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
package org.elasticsearch.gradle.internal.test.rest.transform.warnings;
|
||||
|
||||
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||
|
||||
import org.elasticsearch.gradle.internal.test.rest.transform.RestTestTransform;
|
||||
import org.elasticsearch.gradle.internal.test.rest.transform.feature.InjectFeatureTests;
|
||||
import org.junit.Test;
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
package org.elasticsearch.gradle.internal.test.rest.transform.warnings;
|
||||
|
||||
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||
|
||||
import org.elasticsearch.gradle.internal.test.rest.transform.RestTestTransform;
|
||||
import org.elasticsearch.gradle.internal.test.rest.transform.feature.InjectFeatureTests;
|
||||
import org.junit.Test;
|
||||
|
@ -61,7 +62,12 @@ public class InjectAllowedWarningsTests extends InjectFeatureTests {
|
|||
List<ObjectNode> transformedTests = transformTests(tests, getTransformationsForTest("Test with existing allowed warnings"));
|
||||
printTest(testName, transformedTests);
|
||||
validateSetupAndTearDown(transformedTests);
|
||||
validateBodyHasWarnings(ALLOWED_WARNINGS, "Test with existing allowed warnings", transformedTests, Set.of("a", "b", "added warning"));
|
||||
validateBodyHasWarnings(
|
||||
ALLOWED_WARNINGS,
|
||||
"Test with existing allowed warnings",
|
||||
transformedTests,
|
||||
Set.of("a", "b", "added warning")
|
||||
);
|
||||
validateBodyHasWarnings(ALLOWED_WARNINGS, "Test with existing allowed warnings not to change", transformedTests, Set.of("a", "b"));
|
||||
}
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue