From 71309adc879e699740614791aedd27f77f2c9afc Mon Sep 17 00:00:00 2001 From: Mark Vieira Date: Thu, 13 Feb 2020 13:10:44 -0800 Subject: [PATCH 1/2] Fix input snapshotting error when using test clusters cliSetup Signed-off-by: Mark Vieira --- .../org/elasticsearch/gradle/LazyPropertyList.java | 14 +++++++++++++- .../gradle/testclusters/ElasticsearchNode.java | 2 +- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/buildSrc/src/main/java/org/elasticsearch/gradle/LazyPropertyList.java b/buildSrc/src/main/java/org/elasticsearch/gradle/LazyPropertyList.java index 1d302ded63223..5dd8570d7018b 100644 --- a/buildSrc/src/main/java/org/elasticsearch/gradle/LazyPropertyList.java +++ b/buildSrc/src/main/java/org/elasticsearch/gradle/LazyPropertyList.java @@ -170,13 +170,25 @@ public List subList(int fromIndex, int toIndex) { } @Override - public List getNormalizedCollection() { + public List> getNormalizedCollection() { return delegate.stream() .peek(this::validate) .filter(entry -> entry.getNormalization() != PropertyNormalization.IGNORE_VALUE) .collect(Collectors.toList()); } + /** + * Return a "flattened" collection. This should be used when the collection type is itself a complex type with properties + * annotated as Gradle inputs rather than a simple type like {@link String}. + * + * @return a flattened collection filtered according to normalization strategy + */ + public List getFlatNormalizedCollection() { + return getNormalizedCollection().stream() + .map(PropertyListEntry::getValue) + .collect(Collectors.toList()); + } + private void validate(PropertyListEntry entry) { assertNotNull(entry.getValue(), "entry"); } diff --git a/buildSrc/src/main/java/org/elasticsearch/gradle/testclusters/ElasticsearchNode.java b/buildSrc/src/main/java/org/elasticsearch/gradle/testclusters/ElasticsearchNode.java index 7670bee959ba1..81dbf95fae145 100644 --- a/buildSrc/src/main/java/org/elasticsearch/gradle/testclusters/ElasticsearchNode.java +++ b/buildSrc/src/main/java/org/elasticsearch/gradle/testclusters/ElasticsearchNode.java @@ -1163,7 +1163,7 @@ public List getKeystoreFiles() { @Nested public List getCliSetup() { - return cliSetup.getNormalizedCollection(); + return cliSetup.getFlatNormalizedCollection(); } @Nested From fa16926a14464560f6500965a34a0063a89cecdf Mon Sep 17 00:00:00 2001 From: Mark Vieira Date: Thu, 13 Feb 2020 13:19:00 -0800 Subject: [PATCH 2/2] Fix spotless errors Signed-off-by: Mark Vieira --- .../main/java/org/elasticsearch/gradle/LazyPropertyList.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/buildSrc/src/main/java/org/elasticsearch/gradle/LazyPropertyList.java b/buildSrc/src/main/java/org/elasticsearch/gradle/LazyPropertyList.java index 5dd8570d7018b..9f8bbe1c024a0 100644 --- a/buildSrc/src/main/java/org/elasticsearch/gradle/LazyPropertyList.java +++ b/buildSrc/src/main/java/org/elasticsearch/gradle/LazyPropertyList.java @@ -184,9 +184,7 @@ public List> getNormalizedCollection() { * @return a flattened collection filtered according to normalization strategy */ public List getFlatNormalizedCollection() { - return getNormalizedCollection().stream() - .map(PropertyListEntry::getValue) - .collect(Collectors.toList()); + return getNormalizedCollection().stream().map(PropertyListEntry::getValue).collect(Collectors.toList()); } private void validate(PropertyListEntry entry) {