Skip to content

Commit

Permalink
Use def instead of actual types
Browse files Browse the repository at this point in the history
  • Loading branch information
dnestoro committed Nov 13, 2024
1 parent 87027fa commit 5a422df
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ tasks.register("fetchExistingLibrariesWithNewerVersions", FetchExistingLibraries

tasks.register("extractLibrariesGroupsFromGithubComments", GroupUnsupportedLibraries.class) { task ->
task.setGroup(METADATA_GROUP)
task.setDescription("Extracts groups of libraries from githu comments provided in a form of string.")
task.setDescription("Extracts groups of libraries from github comments provided in a form of string.")
}

// java tasks
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,20 @@ import java.util.regex.Pattern
abstract class GroupUnsupportedLibraries extends DefaultTask {

@Input
@Option(option = "comments", description = "Provides a string that contains github comments for library grouping.")
@Option(option = "comments", description = "Provides github comments for library grouping as string.")
abstract Property<String> getGithubComments()

@TaskAction
void action() {
Pattern pattern = Pattern.compile("--[\n ](.*?)[\n ]--")
Matcher matcher = pattern.matcher(getGithubComments().get())
def pattern = Pattern.compile("--[\n ](.*?)[\n ]--")
def matcher = pattern.matcher(getGithubComments().get())

Map<String, List<String>> libraryGroups = new HashMap<String, List<String>>()
def libraryGroups = new HashMap<String, List<String>>()
while (matcher.find()) {
String coordinates = matcher.group(1)
String[] coordinatesPart = coordinates.split(":")
String artifactKey = coordinatesPart[0] + ":" + coordinatesPart[1]
String version = coordinatesPart[2]
def coordinates = matcher.group(1)
def coordinatesPart = coordinates.split(":")
def artifactKey = coordinatesPart[0] + ":" + coordinatesPart[1]
def version = coordinatesPart[2]

if (libraryGroups.get(artifactKey) == null) {
libraryGroups.put(artifactKey, new ArrayList<String>())
Expand All @@ -40,7 +40,7 @@ abstract class GroupUnsupportedLibraries extends DefaultTask {
}

private static String generateGroupedComment(Map<String, List<String>> groups) {
StringBuilder sb = new StringBuilder("List of all unsupported libraries:\n")
def sb = new StringBuilder("List of all unsupported libraries:\n")

for (String library : groups.keySet()) {
sb.append("- ").append(library).append(":\n")
Expand Down

0 comments on commit 5a422df

Please sign in to comment.