Fix readme generator (multiplatform / jvm) (#188)

Links for jvm orx'es were broken. Fixed.
Also orx'es are now shown in two lists: multiplatform and jvm.
This commit is contained in:
Abe Pazos
2021-08-07 23:18:09 +02:00
committed by GitHub
parent 18f8224d90
commit 48987fc551

View File

@@ -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
@@ -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")
@@ -206,8 +201,14 @@ 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 {
@@ -215,6 +216,16 @@ task buildMainReadme {
}
}
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)
}