Skip to content

Commit

Permalink
Fix readme generator (multiplatform / jvm) (#188)
Browse files Browse the repository at this point in the history
Links for jvm orx'es were broken. Fixed.
Also orx'es are now shown in two lists: multiplatform and jvm.
  • Loading branch information
hamoid authored Aug 7, 2021
1 parent 18f8224 commit 48987fc
Showing 1 changed file with 21 additions and 10 deletions.
31 changes: 21 additions & 10 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -181,14 +181,6 @@ task buildMainReadme {
for (line in header) {
newReadme.add(line)
}
newReadme.add("| name" +
"      " +
"      " +
"      " +
"      " +
"      " +
"      " + " | description |")
newReadme.add("| --- | --- |")

// Search for the description at the top of the readme.
// Skip the hash character from the headline, then start
Expand All @@ -197,6 +189,9 @@ task buildMainReadme {
def descriptionRx = ~/(?s)\#.*?\n(.+?)\n\r?\n/
// Note: the readme needs an empty line after the description

def orxMultiplatform = []
def orxJVMOnly = []

// Build orx list
for (sub in subProjects) {
def orxReadmeFile = sub.file("README.md")
Expand All @@ -206,15 +201,31 @@ task buildMainReadme {
description ->
def trimmedDescription = description[1].trim() //.strip() supports unicode, java11 only
.replace("\n", " ").replace("\r", "")
newReadme.add("| [`${sub.name}`](${sub.name}/) " +
"| $trimmedDescription |")
def path = sub.path.substring(1).replace(":", "/")
if (path.startsWith("orx-jvm")) {
orxJVMOnly.add("| [`${sub.name}`]($path/) " +
"| $trimmedDescription |")
} else {
orxMultiplatform.add("| [`${sub.name}`]($path/) " +
"| $trimmedDescription |")
}
}

} else {
println("${sub.name}/README.md not found!")
}
}

newReadme.add("\n## Multiplatform\n")
newReadme.add("| name" + " " * 36 + " | description |")
newReadme.add("| --- | --- |")
newReadme.addAll(orxMultiplatform)

newReadme.add("\n## JVM only\n")
newReadme.add("| name" + " " * 36 + " | description |")
newReadme.add("| --- | --- |")
newReadme.addAll(orxJVMOnly)

for (line in footer) {
newReadme.add(line)
}
Expand Down

0 comments on commit 48987fc

Please sign in to comment.