Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
* 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
* License v3.0 only", or the "Server Side Public License, v 1".
*/

package org.elasticsearch.gradle.util;

import java.util.stream.Collectors;

public class PlatformUtils {

public static String normalize(String input) {
return input.lines()
.map(it -> it.replace('\\', '/'))
.map(it -> it.replaceAll("\\d+\\.\\d\\ds", "0.00s"))
.map(it -> it.replace("file:/./", "file:./"))
.collect(Collectors.joining("\n"));
}
}
7 changes: 4 additions & 3 deletions x-pack/plugin/esql/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import org.elasticsearch.gradle.internal.info.BuildParams
import org.elasticsearch.gradle.internal.precommit.CheckForbiddenApisTask;
import org.elasticsearch.gradle.internal.util.SourceDirectoryCommandLineArgumentProvider;
import static org.elasticsearch.gradle.util.PlatformUtils.normalize

apply plugin: 'elasticsearch.internal-es-plugin'
apply plugin: 'elasticsearch.internal-cluster-test'
Expand Down Expand Up @@ -56,7 +57,7 @@ def generatedSourceDir = projectDirectory.dir("src/main/generated")
tasks.named("compileJava").configure {
options.compilerArgumentProviders.add(new SourceDirectoryCommandLineArgumentProvider(generatedSourceDir))
// IntelliJ sticks generated files here and we can't stop it....
exclude { it.file.toString().contains("src/main/generated-src/generated") }
exclude { normalize(it.file.toString()).contains("src/main/generated-src/generated") }
}

interface Injected {
Expand Down Expand Up @@ -262,8 +263,8 @@ tasks.register("regen") {
tasks.named("spotlessJava") { dependsOn stringTemplates }
tasks.named('checkstyleMain').configure {
excludes = [ "**/*.java.st" ]
exclude { it.file.toString().contains("src/main/generated-src/generated") }
exclude { it.file.toString().contains("src/main/generated") }
exclude { normalize(it.file.toString()).contains("src/main/generated-src/generated") }
exclude { normalize(it.file.toString()).contains("src/main/generated") }
}

def prop(Type, type, TYPE, BYTES, Array) {
Expand Down
3 changes: 2 additions & 1 deletion x-pack/plugin/kql/build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import org.elasticsearch.gradle.internal.info.BuildParams
import static org.elasticsearch.gradle.util.PlatformUtils.normalize

apply plugin: 'elasticsearch.internal-es-plugin'
apply plugin: 'elasticsearch.internal-cluster-test'
Expand Down Expand Up @@ -54,7 +55,7 @@ pluginManager.withPlugin('com.diffplug.spotless') {
}
}
tasks.named('checkstyleMain').configure {
exclude { it.file.toString().contains("src/main/java/org/elasticsearch/xpack/kql/parser/KqlBase") }
exclude { normalize(it.file.toString()).contains("src/main/java/org/elasticsearch/xpack/kql/parser/KqlBase") }
}

tasks.register("cleanGenerated", Delete) {
Expand Down