-
Notifications
You must be signed in to change notification settings - Fork 157
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #425 from Worms308/replacing-some-domain-groovy-cl…
…asses-with-java replaced some domain config classes with java implementation
- Loading branch information
Showing
13 changed files
with
161 additions
and
104 deletions.
There are no files selected for viewing
16 changes: 0 additions & 16 deletions
16
src/main/groovy/pl/allegro/tech/build/axion/release/domain/ChecksConfig.groovy
This file was deleted.
Oops, something went wrong.
5 changes: 0 additions & 5 deletions
5
src/main/groovy/pl/allegro/tech/build/axion/release/domain/MonorepoConfig.groovy
This file was deleted.
Oops, something went wrong.
35 changes: 0 additions & 35 deletions
35
src/main/groovy/pl/allegro/tech/build/axion/release/domain/NextVersionConfig.groovy
This file was deleted.
Oops, something went wrong.
40 changes: 0 additions & 40 deletions
40
src/main/groovy/pl/allegro/tech/build/axion/release/domain/NextVersionSerializer.groovy
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
src/main/java/pl/allegro/tech/build/axion/release/domain/ChecksConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package pl.allegro.tech.build.axion.release.domain; | ||
|
||
import org.gradle.api.tasks.Input; | ||
|
||
public class ChecksConfig { | ||
@Input | ||
private boolean aheadOfRemote = true; | ||
|
||
@Input | ||
private boolean uncommittedChanges = true; | ||
|
||
@Input | ||
private boolean snapshotDependencies = true; | ||
|
||
public void setAheadOfRemote(boolean aheadOfRemote) { | ||
this.aheadOfRemote = aheadOfRemote; | ||
} | ||
|
||
public void setUncommittedChanges(boolean uncommittedChanges) { | ||
this.uncommittedChanges = uncommittedChanges; | ||
} | ||
|
||
public void setSnapshotDependencies(boolean snapshotDependencies) { | ||
this.snapshotDependencies = snapshotDependencies; | ||
} | ||
|
||
public boolean isAheadOfRemote() { | ||
return aheadOfRemote; | ||
} | ||
|
||
public boolean isUncommittedChanges() { | ||
return uncommittedChanges; | ||
} | ||
|
||
public boolean isSnapshotDependencies() { | ||
return snapshotDependencies; | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
src/main/java/pl/allegro/tech/build/axion/release/domain/MonorepoConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package pl.allegro.tech.build.axion.release.domain; | ||
|
||
import org.gradle.api.tasks.Internal; | ||
|
||
import java.util.LinkedList; | ||
import java.util.List; | ||
|
||
public class MonorepoConfig { | ||
@Internal | ||
private List<String> projectDirs = new LinkedList<>(); | ||
|
||
public List<String> getProjectDirs() { | ||
return projectDirs; | ||
} | ||
|
||
public void setProjectDirs(List<String> projectDirs) { | ||
this.projectDirs = projectDirs; | ||
} | ||
} |
59 changes: 59 additions & 0 deletions
59
src/main/java/pl/allegro/tech/build/axion/release/domain/NextVersionConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
package pl.allegro.tech.build.axion.release.domain; | ||
|
||
import org.gradle.api.tasks.Input; | ||
import org.gradle.api.tasks.Nested; | ||
import pl.allegro.tech.build.axion.release.domain.properties.NextVersionProperties.*; | ||
|
||
public class NextVersionConfig { | ||
@Input | ||
private String suffix = "alpha"; | ||
|
||
@Input | ||
private String separator = "-"; | ||
|
||
@Nested | ||
private Serializer serializer = NextVersionSerializer.DEFAULT.serializer; | ||
|
||
@Nested | ||
private Deserializer deserializer = NextVersionSerializer.DEFAULT.deserializer; | ||
|
||
public void setSerializer(String type) { | ||
this.serializer = NextVersionSerializer.find(type).serializer; | ||
} | ||
|
||
public void setSerializer(Serializer c) { | ||
this.serializer = c; | ||
} | ||
|
||
public void setDeserializer(String type) { | ||
this.deserializer = NextVersionSerializer.valueOf(type).deserializer; | ||
} | ||
|
||
public void setDeserializer(Deserializer c) { | ||
this.deserializer = c; | ||
} | ||
|
||
public String getSuffix() { | ||
return suffix; | ||
} | ||
|
||
public void setSuffix(String suffix) { | ||
this.suffix = suffix; | ||
} | ||
|
||
public String getSeparator() { | ||
return separator; | ||
} | ||
|
||
public void setSeparator(String separator) { | ||
this.separator = separator; | ||
} | ||
|
||
public Serializer getSerializer() { | ||
return serializer; | ||
} | ||
|
||
public Deserializer getDeserializer() { | ||
return deserializer; | ||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
src/main/java/pl/allegro/tech/build/axion/release/domain/NextVersionSerializer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package pl.allegro.tech.build.axion.release.domain; | ||
|
||
import pl.allegro.tech.build.axion.release.domain.properties.NextVersionProperties; | ||
import pl.allegro.tech.build.axion.release.domain.scm.ScmPosition; | ||
|
||
import java.util.Arrays; | ||
import java.util.stream.Collectors; | ||
|
||
import static pl.allegro.tech.build.axion.release.domain.properties.NextVersionProperties.Deserializer; | ||
import static pl.allegro.tech.build.axion.release.domain.properties.NextVersionProperties.Serializer; | ||
|
||
public enum NextVersionSerializer { | ||
|
||
DEFAULT("default", | ||
(NextVersionProperties rules, String version) -> | ||
rules.getSuffix() != null ? version + rules.getSeparator() + rules.getSuffix() : version, | ||
(NextVersionProperties rules, ScmPosition position, String tag) -> | ||
rules.getSuffix().isEmpty() ? tag : tag.replaceFirst(rules.getSeparator() + rules.getSuffix(), "") | ||
); | ||
|
||
private final String type; | ||
|
||
public final Serializer serializer; | ||
|
||
public final Deserializer deserializer; | ||
|
||
NextVersionSerializer(String type, Serializer serializer, Deserializer deserializer) { | ||
this.type = type; | ||
this.serializer = serializer; | ||
this.deserializer = deserializer; | ||
} | ||
|
||
static NextVersionSerializer find(String type) { | ||
return Arrays.stream(values()) | ||
.filter(it -> it.type.equals(type)) | ||
.findFirst() | ||
.orElseThrow(() -> new IllegalArgumentException( | ||
"There is no predefined next version serializers with " + type + " type. " + | ||
"You can choose from: " + Arrays.stream(values()).map(it -> it.type).collect(Collectors.joining()))); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 0 additions & 1 deletion
1
src/test/groovy/pl/allegro/tech/build/axion/release/domain/VersionSorterTest.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters