|
1 | 1 | package javaposse.jobdsl.plugin; |
2 | 2 |
|
3 | | -import com.google.common.base.Function; |
4 | 3 | import com.google.common.base.Predicate; |
5 | 4 | import com.google.common.base.Predicates; |
6 | 5 | import com.google.common.collect.Collections2; |
@@ -138,8 +137,6 @@ public ExecuteDslScripts() { |
138 | 137 | this.ignoreExisting = false; |
139 | 138 | this.failOnSeedCollision = false; |
140 | 139 | this.removedJobAction = RemovedJobAction.DISABLE; |
141 | | - this.removedViewAction = RemovedViewAction.IGNORE; |
142 | | - this.lookupStrategy = LookupStrategy.JENKINS_ROOT; |
143 | 140 | this.additionalClasspath = null; |
144 | 141 | } |
145 | 142 |
|
@@ -318,8 +315,7 @@ public void perform(@Nonnull Run<?, ?> run, @Nonnull FilePath workspace, @Nonnul |
318 | 315 | env.putAll(((AbstractBuild<?, ?>) run).getBuildVariables()); |
319 | 316 | } |
320 | 317 |
|
321 | | - Map<String, Object> binding = new HashMap<>(); |
322 | | - binding.putAll(env); |
| 318 | + Map<String, Object> binding = new HashMap<>(env); |
323 | 319 | if (additionalParameters != null) { |
324 | 320 | binding.putAll(additionalParameters); |
325 | 321 | } |
@@ -364,11 +360,11 @@ public void perform(@Nonnull Run<?, ?> run, @Nonnull FilePath workspace, @Nonnul |
364 | 360 | addJobAction(run, new GeneratedConfigFilesBuildAction(freshConfigFiles)); |
365 | 361 | addJobAction(run, new GeneratedUserContentsBuildAction(freshUserContents)); |
366 | 362 |
|
367 | | - updateTemplates(run.getParent(), listener, new HashSet<GeneratedJob>(run.getAction(GeneratedJobsBuildAction.class).getModifiedObjects())); |
368 | | - updateGeneratedJobs(run.getParent(), listener, new HashSet<GeneratedJob>(run.getAction(GeneratedJobsBuildAction.class).getModifiedObjects())); |
369 | | - updateGeneratedViews(run.getParent(), listener, new HashSet<GeneratedView>(run.getAction(GeneratedViewsBuildAction.class).getModifiedObjects())); |
370 | | - updateGeneratedConfigFiles(run.getParent(), listener, new HashSet<GeneratedConfigFile>(run.getAction(GeneratedConfigFilesBuildAction.class).getModifiedObjects())); |
371 | | - updateGeneratedUserContents(run.getParent(), listener, new HashSet<GeneratedUserContent>(run.getAction(GeneratedUserContentsBuildAction.class).getModifiedObjects())); |
| 363 | + updateTemplates(run.getParent(), listener, new HashSet<>(run.getAction(GeneratedJobsBuildAction.class).getModifiedObjects())); |
| 364 | + updateGeneratedJobs(run.getParent(), listener, new HashSet<>(run.getAction(GeneratedJobsBuildAction.class).getModifiedObjects())); |
| 365 | + updateGeneratedViews(run.getParent(), listener, new HashSet<>(run.getAction(GeneratedViewsBuildAction.class).getModifiedObjects())); |
| 366 | + updateGeneratedConfigFiles(run.getParent(), listener, new HashSet<>(run.getAction(GeneratedConfigFilesBuildAction.class).getModifiedObjects())); |
| 367 | + updateGeneratedUserContents(run.getParent(), listener, new HashSet<>(run.getAction(GeneratedUserContentsBuildAction.class).getModifiedObjects())); |
372 | 368 | } |
373 | 369 | } catch (RuntimeException e) { |
374 | 370 | if (!(e instanceof DslException) && !(e instanceof AccessDeniedException)) { |
@@ -604,12 +600,7 @@ private static void logItems(TaskListener listener, String message, Collection<? |
604 | 600 | } |
605 | 601 |
|
606 | 602 | private static Set<String> getTemplates(Collection<GeneratedJob> jobs) { |
607 | | - Collection<String> templateNames = Collections2.transform(jobs, new Function<GeneratedJob, String>() { |
608 | | - @Override |
609 | | - public String apply(GeneratedJob input) { |
610 | | - return input.getTemplateName(); |
611 | | - } |
612 | | - }); |
| 603 | + Collection<String> templateNames = Collections2.transform(jobs, GeneratedJob::getTemplateName); |
613 | 604 | return new LinkedHashSet<>(Collections2.filter(templateNames, Predicates.notNull())); |
614 | 605 | } |
615 | 606 |
|
|
0 commit comments