Skip to content

Commit

Permalink
Merge pull request #123 from isaqb-org/110-update-asciidoctor-stuff
Browse files Browse the repository at this point in the history
Update asciidoctor stuff

I reviewed it myself, after a few months of a stale PR.
  • Loading branch information
programming-wolf authored Nov 4, 2022
2 parents d0fc0b6 + a4f86c4 commit 4ce8225
Show file tree
Hide file tree
Showing 9 changed files with 97 additions and 89 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build_main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

name: CI - Releases and Main

# Controls when the action will run. Triggers the workflow on push or pull request
# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the main branch
on:
push:
Expand Down Expand Up @@ -35,7 +35,7 @@ jobs:
uses: eskatos/gradle-command-action@v2
with:
# Gradle command line arguments, see gradle --help
gradle-version: 7.3.2
gradle-version: 7.5.1
arguments: buildDocs

# do the following two things only for a release!
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/build_pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

name: CI – Pull Requests

# Controls when the action will run. Triggers the workflow on push or pull request
# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the main branch
on:
pull_request:
Expand Down Expand Up @@ -33,5 +33,5 @@ jobs:
uses: eskatos/gradle-command-action@v2
with:
# Gradle command line arguments, see gradle --help
gradle-version: 7.3.2
gradle-version: 7.5.1
arguments: buildDocs
2 changes: 1 addition & 1 deletion .github/workflows/build_releasecandidate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
uses: eskatos/gradle-command-action@v2
with:
# Gradle command line arguments, see gradle --help
gradle-version: 7.3.2
gradle-version: 7.5.1
arguments: buildDocs

# do the following two things only for a release!
Expand Down
153 changes: 76 additions & 77 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,101 +1,100 @@
import org.asciidoctor.gradle.AsciidoctorTask
import org.asciidoctor.gradle.jvm.AsciidoctorTask
import java.text.SimpleDateFormat

buildscript {
repositories {
plugins {
id "org.asciidoctor.jvm.base" version "3.3.2"
id "org.asciidoctor.jvm.convert" version "3.3.2"
id "org.asciidoctor.jvm.pdf" version "3.3.2"
}
repositories {
mavenCentral()
}

dependencies {
classpath "org.asciidoctor:asciidoctorj-pdf:1.5.3"
}
}
plugins {
id "org.asciidoctor.convert" version "1.6.0"

asciidoctorj {
version = '2.5.3'
}

ext {
today = new Date()
versionDate = new SimpleDateFormat("yyyyMMdd").format(today)
today = new Date()
versionDate = new SimpleDateFormat("yyyyMMdd").format(today)

project.version = project.file("./document.version").text
curriculumFileName = "curriculum-template"
addSuffixToCurriculum = { suffix ->
for (extension in ["html", "pdf"]) {
File source = new File("${buildDir}/${curriculumFileName}.${extension}")
File target = new File("${buildDir}/${curriculumFileName}${suffix}.${extension}")
project.version = project.file("./document.version").text
curriculumFileName = "curriculum-template"
addSuffixToCurriculum = { suffix ->
for (extension in ["html", "pdf"]) {
File source = new File("${buildDir}/${curriculumFileName}.${extension}")
File target = new File("${buildDir}/${curriculumFileName}${suffix}.${extension}")

source.renameTo(target)
source.renameTo(target)
}
}
}
}




class RenderCurriculumTask extends AsciidoctorTask {
@Inject
RenderCurriculumTask(String curriculumFileName, String versionDate, String language, boolean withRemarks) {
sourceDir = new File("./docs/")
sources {
include "index.adoc"
include "${curriculumFileName}.adoc"
}
outputDir = new File("./build/")
separateOutputDirs = false
backends 'pdf', 'html5'

def fileVersion = project.version.trim() + "-" + language

attributes = [
'icons' : 'font',
'version-label' : '',
'revnumber' : fileVersion,
'revdate' : versionDate,
'document-version' : fileVersion + "-" + versionDate,
'currentDate' : versionDate,
'language' : language,
'withRemarks' : withRemarks,
'curriculumFileName': curriculumFileName,
'debug_adoc' : false,
'pdf-stylesdir' : '../pdf-theme/themes',
'pdf-fontsdir' : '../pdf-theme/fonts',
'pdf-style' : 'isaqb',
'stylesheet' : '../html-theme/adoc-github.css',
'stylesheet-dir' : '../html-theme'
]
}
}
@Inject
RenderCurriculumTask(WorkerExecutor we, String curriculumFileName, String versionDate, String language, boolean withRemarks) {
super(we)

task buildDocs {
group 'Documentation'
description 'Grouping task for generating all languages in several formats'
dependsOn "includeLearningObjectives", "renderNoRemarksDE", "renderNoRemarksEN"
}
forkOptions {
jvmArgs "--add-opens", "java.base/sun.nio.ch=ALL-UNNAMED", "--add-opens", "java.base/java.io=ALL-UNNAMED"
}


sourceDir = new File("./docs/")
baseDir = new File ("./docs/")
sources {
include "index.adoc"
include "${curriculumFileName}.adoc"
}
outputDir = new File("./build/")
outputOptions {
separateOutputDirs = false
backends 'pdf', 'html5'
}

def fileVersion = project.version.trim() + "-" + language

task renderNoRemarksDE(type: RenderCurriculumTask,
constructorArgs: [curriculumFileName, versionDate, "DE", false]) {
doLast {
addSuffixToCurriculum("-de")
}
attributes = [
'icons' : 'font',
'version-label' : '',
'revnumber' : fileVersion,
'revdate' : versionDate,
'document-version' : fileVersion + "-" + versionDate,
'currentDate' : versionDate,
'language' : language,
'withRemarks' : withRemarks,
'curriculumFileName': curriculumFileName,
'debug_adoc' : false,
'pdf-stylesdir' : '../pdf-theme/themes',
'pdf-fontsdir' : '../pdf-theme/fonts',
'pdf-style' : 'isaqb',
'stylesheet' : '../html-theme/adoc-github.css',
'stylesheet-dir' : '../html-theme'
]
}
}

task renderWithRemarksDE(type: RenderCurriculumTask,
constructorArgs: [curriculumFileName, versionDate, "DE", true]) {
doLast {
addSuffixToCurriculum("-remarks-de")
}
task buildDocs {
group 'Documentation'
description 'Grouping task for generating all languages in several formats'
dependsOn "includeLearningObjectives", "renderDE", "renderEN"
}

task renderNoRemarksEN(type: RenderCurriculumTask,
constructorArgs: [curriculumFileName, versionDate, "EN", false]) {
doLast {
addSuffixToCurriculum("-en")
}
task renderDE(type: RenderCurriculumTask,
constructorArgs: [curriculumFileName, versionDate, "DE", false]) {
doLast {
addSuffixToCurriculum("-de")
}
}

task renderWithRemarksEN(type: RenderCurriculumTask,
constructorArgs: [curriculumFileName, versionDate, "EN", true]) {
doLast {
addSuffixToCurriculum("-remarks-en")
}
task renderEN(type: RenderCurriculumTask,
constructorArgs: [curriculumFileName, versionDate, "EN", false]) {
doLast {
addSuffixToCurriculum("-en")
}
}

apply from: 'scripts/includeLearningObjectives.gradle'
Expand Down
1 change: 1 addition & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
org.gradle.jvmargs=-Xmx1024m --add-opens java.base/sun.nio.ch=ALL-UNNAMED --add-opens java.base/java.io=ALL-UNNAMED
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
6 changes: 6 additions & 0 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,12 @@ set -- \
org.gradle.wrapper.GradleWrapperMain \
"$@"

# Stop when "xargs" is not available.
if ! command -v xargs >/dev/null 2>&1
then
die "xargs is not available"
fi

# Use "xargs" to parse quoted args.
#
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
Expand Down
14 changes: 8 additions & 6 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
@rem limitations under the License.
@rem

@if "%DEBUG%" == "" @echo off
@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
Expand All @@ -25,7 +25,7 @@
if "%OS%"=="Windows_NT" setlocal

set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
if "%DIRNAME%"=="" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

Expand All @@ -40,7 +40,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome

set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto execute
if %ERRORLEVEL% equ 0 goto execute

echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Expand Down Expand Up @@ -75,13 +75,15 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar

:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
if %ERRORLEVEL% equ 0 goto mainEnd

:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
set EXIT_CODE=%ERRORLEVEL%
if %EXIT_CODE% equ 0 set EXIT_CODE=1
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
exit /b %EXIT_CODE%

:mainEnd
if "%OS%"=="Windows_NT" endlocal
Expand Down

0 comments on commit 4ce8225

Please sign in to comment.