diff --git a/build.gradle.kts b/build.gradle.kts index 1fd9dad..2558ba6 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -26,7 +26,3 @@ dependencies { tasks.runShadow { args("8002") } - -tasks.compileJava { - options.compilerArgs.add("--enable-preview") -} \ No newline at end of file diff --git a/src/main/java/io/gitlab/jfronny/woodpecker/include/PipelineUnpacker.java b/src/main/java/io/gitlab/jfronny/woodpecker/include/PipelineUnpacker.java index 75c100b..1590fb8 100644 --- a/src/main/java/io/gitlab/jfronny/woodpecker/include/PipelineUnpacker.java +++ b/src/main/java/io/gitlab/jfronny/woodpecker/include/PipelineUnpacker.java @@ -34,20 +34,17 @@ record PipelineUnpacker(AtomicBoolean changed) implements BiConsumer download(str.value(), null, pipelineConsumer); - case YamlMapping map -> { - for (YamlNode key : map.keys()) { - download(map.string(key), key.asScalar().value(), pipelineConsumer); - } + //TODO switch back to switch pattern matching once that is available + if (include instanceof Scalar str) download(str.value(), null, pipelineConsumer); + else if (include instanceof YamlMapping map) { + for (YamlNode key : map.keys()) { + download(map.string(key), key.asScalar().value(), pipelineConsumer); } - case YamlSequence seq -> { - for (YamlNode node : seq) { - download(node.asScalar().value(), null, pipelineConsumer); - } + } else if (include instanceof YamlSequence seq) { + for (YamlNode node : seq) { + download(node.asScalar().value(), null, pipelineConsumer); } - default -> throw new IllegalStateException("Unexpected value: " + include); - } + } else throw new IllegalStateException("Unexpected value: " + include); // Remove include from original Pipeline filtered = new Pipeline(); filtered.name = pipeline.name;