[core] Allow using lists as globalProperty in config files (#8339)

This commit is contained in:
Peter Leibiger
2021-03-29 14:56:11 +02:00
committed by GitHub
parent d913b14d45
commit 6c8bc1ec88

View File

@@ -26,9 +26,11 @@ import java.net.URISyntaxException;
import java.net.URL;
import java.nio.file.Paths;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
/**
* Represents those settings applied to a generation workflow.
@@ -66,7 +68,7 @@ public class WorkflowSettings {
private String templateDir;
private String templatingEngineName = DEFAULT_TEMPLATING_ENGINE_NAME;
private String ignoreFileOverride;
private ImmutableMap<String, String> globalProperties = DEFAULT_GLOBAL_PROPERTIES;
private ImmutableMap<String, ?> globalProperties = DEFAULT_GLOBAL_PROPERTIES;
private WorkflowSettings(Builder builder) {
this.inputSpec = builder.inputSpec;
@@ -282,7 +284,15 @@ public class WorkflowSettings {
* @return the system properties
*/
public Map<String, String> getGlobalProperties() {
return globalProperties;
return globalProperties.entrySet().stream()
.collect(Collectors.toMap(Map.Entry::getKey, e -> {
if (e.getValue() instanceof List) {
return ((List<?>) e.getValue()).stream()
.map(Object::toString)
.collect(Collectors.joining(","));
}
return String.valueOf(e.getValue());
}));
}
/**