@@ -0,0 +1,3096 @@
+package org.fakekoji.jobmanager;%0A%0Aimport org.fakekoji.jobmanager.model.BuildJob;%0Aimport org.fakekoji.jobmanager.model.TestJob;%0Aimport org.fakekoji.model.Task;%0Aimport org.fakekoji.model.TaskVariant;%0Aimport org.fakekoji.model.TaskVariantValue;%0A%0Aimport java.util.AbstractMap;%0Aimport java.util.Map;%0Aimport java.util.stream.Collectors;%0Aimport java.util.stream.Stream;%0A%0Apublic class TaskVariantAdder extends JobModifier %7B%0A%0A    private final TaskVariant taskVariant;%0A    %0A    public TaskVariantAdder(final TaskVariant taskVariant) %7B%0A        this.taskVariant = taskVariant;%0A    %7D%0A    %0A    @Override%0A    boolean shouldPass(BuildJob job) %7B%0A        return taskVariant.getType().equals(Task.Type.BUILD);%0A    %7D%0A%0A    @Override%0A    boolean shouldPass(TestJob job) %7B%0A        return true;%0A    %7D%0A    %0A    private Map%3CTaskVariant, TaskVariantValue%3E getBuildVariants(final Map%3CTaskVariant, TaskVariantValue%3E variants) %7B%0A        if (taskVariant.getType() == Task.Type.TEST) %7B%0A            return variants;%0A        %7D%0A        return Stream.concat(%0A                variants.entrySet().stream(),%0A                Stream.of(new AbstractMap.SimpleEntry%3C%3E(taskVariant, taskVariant.getVariants().get(taskVariant.getDefaultValue())))%0A        ).collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));%0A    %7D%0A%0A    private Map%3CTaskVariant, TaskVariantValue%3E getTestVariants(final Map%3CTaskVariant, TaskVariantValue%3E variants) %7B%0A        if (taskVariant.getType() == Task.Type.BUILD) %7B%0A            return variants;%0A        %7D%0A        return Stream.concat(%0A                variants.entrySet().stream(),%0A                Stream.of(new AbstractMap.SimpleEntry%3C%3E(taskVariant, taskVariant.getVariants().get(taskVariant.getDefaultValue())))%0A        ).collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));%0A    %7D%0A%0A    @Override%0A    BuildJob transform(BuildJob job) %7B%0A        return new BuildJob(%0A                job.getPlatformProvider(),%0A                job.getProjectName(),%0A                job.getProduct(),%0A                job.getJdkVersion(),%0A                job.getBuildProviders(),%0A                job.getTask(),%0A                job.getPlatform(),%0A                getBuildVariants(job.getVariants()),%0A                job.getScriptsRoot(),%0A                job.getProjectVariables()%0A        );%0A    %7D%0A%0A    @Override%0A    TestJob transform(TestJob job) %7B%0A        return new TestJob(%0A                job.getPlatformProvider(),%0A                job.getProjectName(),%0A                job.getProjectType(),%0A                job.getProduct(),%0A                job.getJdkVersion(),%0A                job.getBuildProviders(),%0A                job.getTask(),%0A                job.getPlatform(),%0A                getTestVariants(job.getVariants()),%0A                job.getBuildPlatform(),%0A                job.getBuildPlatformProvider(),%0A                job.getBuildTask(),%0A                getBuildVariants(job.getBuildVariants()),%0A                job.getProjectSubpackageBlacklist(),%0A                job.getProjectSubpackageWhitelist(),%0A                job.getScriptsRoot(),%0A                job.getProjectVariables()%0A        );%0A    %7D%0A%7D%0A

Create TaskVariantAdder