From b91b3c21a1af94a2f44f01cab52cf9bca049cf17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Dominik=20G=C3=B6rtz?= Date: Mon, 13 Oct 2025 17:21:58 +0000 Subject: [PATCH 1/2] Fix tasks for multipage formats Task creation for the individual files of each format was previously handled during the execution phase instead of the configuration phase, leading for the tasks to be ignored. Furthermore, the build had to be split up into multiple gradle runs as the result of the generateDocbookMP task is not yet available during the configuration phase, thus no subsequent tasks were generated. --- build-arc42.sh | 6 +++ subBuild.gradle | 131 ++++++++++++++++++++++++------------------------ 2 files changed, 72 insertions(+), 65 deletions(-) diff --git a/build-arc42.sh b/build-arc42.sh index c5f99f1..628ffbc 100755 --- a/build-arc42.sh +++ b/build-arc42.sh @@ -11,7 +11,13 @@ git pull cd .. echo "build arc42 template" ./gradlew createTemplatesFromGoldenMaster +echo "convert to other singlepage formats" ./gradlew arc42 +echo "generate docbook multipage format" +./gradlew generateDocbookMP +echo "convert docbook multipage to other multipage formats" +./gradlew arc42MP +echo "create distributions" ./gradlew createDistribution echo "please check the results in arc42-template/dist" echo "and if ok, add, commit and push it" diff --git a/subBuild.gradle b/subBuild.gradle index 32c7163..34a511f 100644 --- a/subBuild.gradle +++ b/subBuild.gradle @@ -229,12 +229,11 @@ task convert2MarkdownStrict ( task convert2MarkdownMPStrict ( dependsOn: [copyImages, generateDocbookMP ] ) { - doLast { - def i = 0 - def sourceFolder = file(localBuildDir.docbook + 'MP/.') + def sourceFolder = file(localBuildDir.docbook + 'MP/.') + if (sourceFolder.exists()) { sourceFolder.eachFile { myFile -> if (myFile.name.endsWith('.xml')) { - def taskName = 'convert2MarkdownStrict_file' + i++ + def taskName = 'convert2MarkdownMPStrict_file_' + myFile.name-'.xml' new File(localBuildDir.markdownMPStrict + '/').mkdirs() def theTask = tasks.create(name: taskName, type: Exec, dependsOn: [copyImages, generateDocbookMP]) { //commandLine "pandoc -r arc42-template.xml -o arc42-template.docx " @@ -244,7 +243,7 @@ task convert2MarkdownMPStrict ( '-o', localBuildDir.markdownMPStrict + '/' + myFile.name-'xml'+'md', myFile.canonicalPath] } - theTask.mustRunAfter(it) + it.finalizedBy(theTask) } } } @@ -252,12 +251,11 @@ task convert2MarkdownMPStrict ( task convert2MarkdownMP ( dependsOn: [copyImages, generateDocbookMP ] ) { - doLast { - def i = 0 - def sourceFolder = file(localBuildDir.docbook + 'MP/.') + def sourceFolder = file(localBuildDir.docbook + 'MP/.') + if (sourceFolder.exists()) { sourceFolder.eachFile { myFile -> if (myFile.name.endsWith('.xml')) { - def taskName = 'convert2Markdown_file' + i++ + def taskName = 'convert2MarkdownMP_file' + myFile.name-'.xml' new File(localBuildDir.markdownMP + '/').mkdirs() def theTask = tasks.create(name: taskName, type: Exec, dependsOn: [copyImages, generateDocbookMP]) { //commandLine "pandoc -r arc42-template.xml -o arc42-template.docx " @@ -267,7 +265,7 @@ task convert2MarkdownMP ( '-o', localBuildDir.markdownMP + '/' + myFile.name-'xml'+'md', myFile.canonicalPath] } - theTask.mustRunAfter(it) + it.finalizedBy(theTask) } } } @@ -286,25 +284,25 @@ task convert2GitHubMarkdown ( task convert2GitHubMarkdownMP ( dependsOn: [copyImages, generateDocbookMP ] ) { - doLast { - def i = 0 - def sourceFolder = file(localBuildDir.docbook + 'MP/.') + + def sourceFolder = file(localBuildDir.docbook + 'MP/.') + if (sourceFolder.exists()) { sourceFolder.eachFile { myFile -> if (myFile.name.endsWith('.xml')) { - def taskName = 'convert2GitHubMarkdown_file' + i++ + def taskName = 'convert2GitHubMarkdownMP_' + myFile.name - '.xml' new File(localBuildDir.gitHubmarkdownMP + '/').mkdirs() def theTask = tasks.create(name: taskName, type: Exec, dependsOn: [copyImages, generateDocbookMP]) { - //commandLine "pandoc -r arc42-template.xml -o arc42-template.docx " executable = "pandoc" args = ['-r', 'docbook', '-t', 'gfm', '-o', localBuildDir.gitHubMarkdownMP + '/' + myFile.name-'xml'+'md', myFile.canonicalPath] } - theTask.mustRunAfter(it) + it.finalizedBy(theTask) } } } + } task convert2Mkdocs ( dependsOn: [copyImages, generateDocbook ], @@ -369,13 +367,13 @@ task convert2Mkdocs ( task convert2MkdocsMP ( dependsOn: [copyImages, generateDocbookMP ] ) { - doLast { - def i = 0 - def sourceFolder = file(localBuildDir.docbook + 'MP/.') - def lastFileTask = null + def sourceFolder = file(localBuildDir.docbook + 'MP/.') + def lastFileTask = null + def fileTasks = [] + if(sourceFolder.exists()) { sourceFolder.eachFile { myFile -> if (myFile.name.endsWith('.xml')) { - def taskName = 'convert2Mkdocs_file' + i++ + def taskName = 'convert2MkdocsMP_file_' + myFile.name - '.xml' new File(localBuildDir.mkdocsMP + '/docs/').mkdirs() new File(localBuildDir.mkdocsMP + '/mkdocs.yml') .write(""" |site_name: Arc42 Template @@ -403,65 +401,58 @@ task convert2MkdocsMP ( | - navigation.indexes | - toc.follow |""".stripMargin()) + def outfile = myFile.name-'xml'+'md' + if (myFile.name == "arc42-template.xml") { + outfile = 'index.md' + } def theTask = tasks.create(name: taskName, type: Exec, dependsOn: [copyImages, generateDocbookMP]) { - //commandLine "pandoc -r arc42-template.xml -o arc42-template.docx " - def outfile = myFile.name-'xml'+'md' - if (myFile.name == "arc42-template.xml") { - outfile = 'index.md' - } - - // FIXME remove this and keep the next block - def sout = new StringBuilder(), serr = new StringBuilder() - def proc = ('pandoc -r docbook -t markdown_phpextra --toc --wrap=none --reference-links -o ' + localBuildDir.mkdocsMP + '/docs/' + outfile + ' ' + myFile.canonicalPath).execute() - proc.consumeProcessOutput(sout, serr) - proc.waitForOrKill(1000) - - // was not working for me in any MP task - // FIXME keep this block and remove previous one - /*executable = "pandoc" + executable = "pandoc" args = ['-r', 'docbook', '-t', 'markdown_phpextra', '--toc', // Include table of contents '--wrap=none', // No text wrapping '--reference-links', // Use reference-style links '-o', localBuildDir.mkdocsMP + '/docs/' + outfile, - myFile.canonicalPath]*/ + myFile.canonicalPath] } lastFileTask = theTask - theTask.mustRunAfter(it) + it.finalizedBy(theTask) + fileTasks.add(theTask) } } - def thePostTask = tasks.create(name: "convert2Mkdocs_post", type: Exec, dependsOn: [copyImages, generateDocbookMP]) { - new File(localBuildDir.mkdocsMP + '/docs/config.md').delete() - new File(localBuildDir.mkdocsMP + '/docs/about-arc42.md').delete() - def indexFile = new File(localBuildDir.mkdocsMP + '/docs/index.md') - def indexHeader = indexFile.getText('UTF-8').split(">.").first().substring(1).trim() + ">.\n\n" - indexFile.withWriter('UTF-8') { out -> - out.write(indexHeader) - new File(localBuildDir.mkdocsMP + "/docs/.").eachFile { - if (it.name != "index.md") { - def title = new File(localBuildDir.mkdocsMP + "/docs/" + it.name).withReader { it.readLine() } - if (title.startsWith("#")) { - title = title.split("[#{]+")[1].trim() - out.write("\n0. [${title}](${it.name})\n") + def thePostTask = tasks.create(name: "convert2Mkdocs_post", dependsOn: [copyImages, generateDocbookMP]) { + doLast { + new File(localBuildDir.mkdocsMP + '/docs/config.md').delete() + new File(localBuildDir.mkdocsMP + '/docs/about-arc42.md').delete() + def indexFile = new File(localBuildDir.mkdocsMP + '/docs/index.md') + def indexHeader = indexFile.getText('UTF-8').split(">.").first().substring(1).trim() + ">.\n\n" + indexFile.withWriter('UTF-8') { out -> + out.write(indexHeader) + new File(localBuildDir.mkdocsMP + "/docs/.").eachFile { + if (it.name != "index.md") { + def title = new File(localBuildDir.mkdocsMP + "/docs/" + it.name).withReader { it.readLine() } + if (title.startsWith("#")) { + title = title.split("[#{]+")[1].trim() + out.write("\n0. [${title}](${it.name})\n") + } } } } } } - thePostTask.mustRunAfter(lastFileTask) + thePostTask.mustRunAfter(fileTasks) + lastFileTask.finalizedBy(thePostTask) } } task convert2Textile ( dependsOn: [copyImages, generateDocbookMP ] ) { - doLast { - def i = 0 - def sourceFolder = file(localBuildDir.docbook + 'MP/.') + def sourceFolder = file(localBuildDir.docbook + 'MP/.') + if(sourceFolder.exists()) { sourceFolder.eachFile { myFile -> if (myFile.name.endsWith('.xml')) { - def taskName = 'convert2Textile_file' + i++ + def taskName = 'convert2Textile_file' + myFile.name-'.xml' new File(localBuildDir.textile + '/').mkdirs() def theTask = tasks.create(name: taskName, type: Exec, dependsOn: [copyImages, generateDocbookMP]) { //commandLine "pandoc -r arc42-template.xml -o arc42-template.docx " @@ -471,7 +462,7 @@ task convert2Textile ( '-o', localBuildDir.textile + '/'+myFile.name-'xml'+'textile', myFile.canonicalPath] } - theTask.mustRunAfter(it) + it.finalizedBy(theTask) } } } @@ -479,9 +470,8 @@ task convert2Textile ( task convert2Textile2 ( dependsOn: [copyImages, generateDocbookMP ] ) { - doLast { - def i = 0 - def sourceFolder = file(localBuildDir.docbook + 'MP/.') + def sourceFolder = file(localBuildDir.docbook + 'MP/.') + if(sourceFolder.exists()) { sourceFolder.eachFile { myFile -> if (myFile.name.endsWith('.xml')) { //rewrite file without Date: Tue, 14 Oct 2025 16:05:55 +0000 Subject: [PATCH 2/2] Ignore .deb files in vesion control --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 5d3c861..867a8dd 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,7 @@ gradle-app.setting .nb-gradle-properties src_gen .idea +*.deb # Ignore Mac DS_Store files **/.DS_Store