From 1ab538aa6c8bcd365357f32415df75a2c33fb842 Mon Sep 17 00:00:00 2001 From: Ioannis Tsakpinis Date: Wed, 5 Jun 2024 10:37:48 +0300 Subject: [PATCH] fix(generator) invalid javadoc generation --- .github/workflows/build.yml | 16 ++++++++-------- .../main/kotlin/org/lwjgl/generator/JavaDoc.kt | 4 ++-- .../org/lwjgl/system/jawt/JAWTFunctions.java | 4 ++-- .../src/templates/kotlin/jawt/templates/jawt.kt | 2 +- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a2171416d0..82c8b0780c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -19,7 +19,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 3 - name: Download JDK @@ -202,7 +202,7 @@ jobs: fail-fast: false steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 3 fetch-tags: true @@ -255,7 +255,7 @@ jobs: LWJGL_BUILD_ARCH: ${{matrix.ARCH}} steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 3 - name: Install dependencies @@ -322,7 +322,7 @@ jobs: shell: cmd steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 3 - name: Configure MSVC @@ -334,9 +334,9 @@ jobs: if: contains(matrix.ARCH, 'arm') != true - name: Install dependencies run: | - Invoke-WebRequest https://cdn.azul.com/zulu/bin/zulu8.72.0.17-ca-fx-jdk8.0.382-win_x64.zip -OutFile jdk.zip + Invoke-WebRequest https://cdn.azul.com/zulu/bin/zulu8.78.0.19-ca-jdk8.0.412-win_x64.zip -OutFile jdk.zip Expand-Archive -Path jdk.zip -DestinationPath .\ - Rename-Item zulu8.72.0.17-ca-fx-jdk8.0.382-win_x64 jdk8 + Rename-Item zulu8.78.0.19-ca-jdk8.0.412-win_x64 jdk8 shell: pwsh - name: Restore kotlinc output uses: actions/cache/restore@v3 @@ -354,9 +354,9 @@ jobs: - name: Switch to x86 JDK run: | Remove-Item -Recurse jdk8 - Invoke-WebRequest https://cdn.azul.com/zulu/bin/zulu8.72.0.17-ca-fx-jdk8.0.382-win_i686.zip -OutFile jdk.zip + Invoke-WebRequest https://cdn.azul.com/zulu/bin/zulu8.78.0.19-ca-jdk8.0.412-win_i686.zip -OutFile jdk.zip Expand-Archive -Path jdk.zip -DestinationPath .\ - Rename-Item zulu8.72.0.17-ca-fx-jdk8.0.382-win_i686 jdk8 + Rename-Item zulu8.78.0.19-ca-jdk8.0.412-win_i686 jdk8 shell: pwsh if: matrix.ARCH == 'x86' - name: Build native diff --git a/modules/generator/src/main/kotlin/org/lwjgl/generator/JavaDoc.kt b/modules/generator/src/main/kotlin/org/lwjgl/generator/JavaDoc.kt index 29b663661d..bb295d2a5a 100644 --- a/modules/generator/src/main/kotlin/org/lwjgl/generator/JavaDoc.kt +++ b/modules/generator/src/main/kotlin/org/lwjgl/generator/JavaDoc.kt @@ -334,13 +334,13 @@ private val CODE_BLOCK_ESCAPE_PATTERN = "^".toRegex(RegexOption.MULTILINE) // li private val CODE_BLOCK_TAB_PATTERN = "\t".toRegex() // tabs /** Useful for pre-formatted code blocks. HTML markup is not allowed and will be escaped. */ -fun codeBlock(code: String) = """

+fun codeBlock(code: String, javadocBlock: Boolean = false) = """
${if (javadocBlock) "{@code" else ""}
 ${code
     .htmlEscaped
     .replace(CODE_BLOCK_TRIM_PATTERN, "") // ...trim
     .replace(CODE_BLOCK_ESCAPE_PATTERN, "\uFFFF") // ...escape
     .replace(CODE_BLOCK_TAB_PATTERN, "    ") // ...replace with 4 spaces for consistent formatting.
-}
""" +}${if (javadocBlock) "}" else "
"}
""" fun note(content: String) = "
Note
\n$content
" diff --git a/modules/lwjgl/jawt/src/generated/java/org/lwjgl/system/jawt/JAWTFunctions.java b/modules/lwjgl/jawt/src/generated/java/org/lwjgl/system/jawt/JAWTFunctions.java index 778599785c..496a67fe16 100644 --- a/modules/lwjgl/jawt/src/generated/java/org/lwjgl/system/jawt/JAWTFunctions.java +++ b/modules/lwjgl/jawt/src/generated/java/org/lwjgl/system/jawt/JAWTFunctions.java @@ -71,11 +71,11 @@ public static SharedLibrary getLibrary() { * {@code Component}'s rectangle. If the window the {@code Component} belongs to has a {@code CALayer} attached to it, this layer will be accessible via * the {@code windowLayer} property.

* - *

+     * 
{@code
      * @protocol JAWT_SurfaceLayers
      * @property (readwrite, retain) CALayer *layer;
      * @property (readonly) CALayer *windowLayer;
-     * @end 
+ * @end}
*/ public static final int JAWT_MACOSX_USE_CALAYER = 0x80000000; diff --git a/modules/lwjgl/jawt/src/templates/kotlin/jawt/templates/jawt.kt b/modules/lwjgl/jawt/src/templates/kotlin/jawt/templates/jawt.kt index b574e32f0d..b4bb355bfe 100644 --- a/modules/lwjgl/jawt/src/templates/kotlin/jawt/templates/jawt.kt +++ b/modules/lwjgl/jawt/src/templates/kotlin/jawt/templates/jawt.kt @@ -67,7 +67,7 @@ jboolean success = JAWT_GetAWT(env, &awt);""")} @protocol JAWT_SurfaceLayers @property (readwrite, retain) CALayer *layer; @property (readonly) CALayer *windowLayer; -@end """)} +@end""", javadocBlock = true)} """, "MACOSX_USE_CALAYER"..0x80000000.i