Skip to content

Commit 5500427

Browse files
committed
G2-1885 Generalize command invocation & integrate metadata
1 parent eb5ef97 commit 5500427

File tree

2 files changed

+10
-27
lines changed

2 files changed

+10
-27
lines changed

bd-build/pom.xml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
1+
<project xmlns="http://maven.apache.org/POM/4.0.0"
2+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
24

35
<modelVersion>4.0.0</modelVersion>
46
<artifactId>bd-build</artifactId>

bd-build/src/main/java/com/g2forge/bulldozer/build/maven/IMaven.java

Lines changed: 7 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,34 @@
11
package com.g2forge.bulldozer.build.maven;
22

33
import java.nio.file.Path;
4-
import java.util.Collection;
54
import java.util.List;
6-
import java.util.stream.Collectors;
75
import java.util.stream.Stream;
86

97
import com.g2forge.alexandria.java.core.helpers.HCollection;
108
import com.g2forge.alexandria.java.core.helpers.HStream;
119
import com.g2forge.gearbox.command.converter.IMethodArgument;
12-
import com.g2forge.gearbox.command.converter.dumb.ArgumentRenderer;
10+
import com.g2forge.gearbox.command.converter.argumentrenderer.ASimpleArgumentRenderer;
11+
import com.g2forge.gearbox.command.converter.argumentrenderer.ArgumentRenderer;
12+
import com.g2forge.gearbox.command.converter.argumentrenderer.CSVArgumentRenderer;
1313
import com.g2forge.gearbox.command.converter.dumb.Command;
1414
import com.g2forge.gearbox.command.converter.dumb.Constant;
1515
import com.g2forge.gearbox.command.converter.dumb.Flag;
16-
import com.g2forge.gearbox.command.converter.dumb.HDumbCommandConverter;
17-
import com.g2forge.gearbox.command.converter.dumb.IArgumentRenderer;
1816
import com.g2forge.gearbox.command.converter.dumb.Named;
1917
import com.g2forge.gearbox.command.converter.dumb.Working;
2018
import com.g2forge.gearbox.command.proxy.method.ICommandInterface;
2119

2220
public interface IMaven extends ICommandInterface {
23-
public static class CSVArgumentRenderer implements IArgumentRenderer<Object> {
21+
public static class SnapshotArgumentRenderer extends ASimpleArgumentRenderer<Boolean> {
2422
@Override
25-
public List<String> render(IMethodArgument<Object> argument) {
26-
final Stream<String> stream;
27-
final Object value = argument.get();
28-
if (value instanceof String[]) stream = Stream.of((String[]) value);
29-
else {
30-
@SuppressWarnings("unchecked")
31-
final Collection<String> includes = (Collection<String>) value;
32-
stream = includes.stream();
33-
}
34-
final String string = stream.collect(Collectors.joining(","));
35-
if (string.isEmpty()) return HCollection.emptyList();
36-
return HDumbCommandConverter.computeString(argument, string);
37-
}
38-
}
39-
40-
public static class SnapshotArgumentRenderer implements IArgumentRenderer<Boolean> {
41-
@Override
42-
public List<String> render(IMethodArgument<Boolean> argument) {
23+
protected List<String> renderSimple(IMethodArgument<Boolean> argument) {
4324
if (argument.get()) return HCollection.asList("versions:use-latest-snapshots", "-DallowSnapshots=true");
4425
return HCollection.asList("versions:use-latest-releases");
4526
}
4627
}
4728

48-
public static class UpdateParentArgumentRenderer implements IArgumentRenderer<Boolean> {
29+
public static class UpdateParentArgumentRenderer extends ASimpleArgumentRenderer<Boolean> {
4930
@Override
50-
public List<String> render(IMethodArgument<Boolean> argument) {
31+
protected List<String> renderSimple(IMethodArgument<Boolean> argument) {
5132
if (argument.get()) return HCollection.asList("versions:update-parent");
5233
return HCollection.emptyList();
5334
}

0 commit comments

Comments
 (0)