Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTML Comments Inside Content Blocks Cause Compilation Failure in gg.jte.gradle v3.1.7+ #325

Closed
PsychotherapistSam opened this issue Jan 27, 2024 · 2 comments
Assignees

Comments

@PsychotherapistSam
Copy link

Since updating to gg.jte.gradle version 3.1.8, I've encountered an issue where HTML comments within content blocks cause compilation failures.
This seems to be related to the changess in 3.1.7

Removing the comment or using a version <3.1.7 seems to work.
Previously, they just rendered like any other tag and were visible in the HTML.

HTML Comments outside of content blocks also seem to still work.

I tried this using kotlin 1.9.22 using gradle with gg.jte.gradle 3.1.8

I was able to replicate it with this minimal example:
src/main/jte/test.kte

@template.layout.page(
    content = @`
        <!-- test comment (breaks) -->
        <div class="test"></div>
    `
)

src/main/jte/layout/page.kte

@import gg.jte.Content

@param content: Content

${content}

The error messages:

Execution failed for task ':generateJte'.
> There was a failure while executing work items
   > A failure occurred while executing gg.jte.gradle.GenerateJteWorker
      > Failed to compile template, error at test.kte:2. No parameter with name <div class is defined in layout/page.kte
Caused by: gg.jte.TemplateException: Failed to compile template, error at test.kte:2. No parameter with name <div class is defined in layout/page.kte
	at gg.jte.compiler.kotlin.KotlinCodeGenerator.getParameterIndex(KotlinCodeGenerator.java:592)
	at gg.jte.compiler.kotlin.KotlinCodeGenerator.appendParams(KotlinCodeGenerator.java:554)
	at gg.jte.compiler.kotlin.KotlinCodeGenerator.onTemplateCall(KotlinCodeGenerator.java:461)
	at gg.jte.compiler.TemplateParser.lambda$doParse$3(TemplateParser.java:253)
	at gg.jte.compiler.TemplateParser.extract(TemplateParser.java:953)
	at gg.jte.compiler.TemplateParser.doParse(TemplateParser.java:253)
	at gg.jte.compiler.TemplateParser.parse(TemplateParser.java:85)
	at gg.jte.compiler.TemplateParser.parse(TemplateParser.java:80)
	at gg.jte.compiler.TemplateCompiler.generateTemplateCall(TemplateCompiler.java:265)
	at gg.jte.compiler.TemplateCompiler.generate(TemplateCompiler.java:169)
	at gg.jte.compiler.TemplateCompiler.generateAll(TemplateCompiler.java:83)
	at gg.jte.TemplateEngine.generateAll(TemplateEngine.java:306)
	at gg.jte.gradle.GenerateJteWorker.execute(GenerateJteWorker.java:43)
	at org.gradle.workers.internal.DefaultWorkerServer.execute(DefaultWorkerServer.java:63)
	at org.gradle.workers.internal.AbstractClassLoaderWorker$1.create(AbstractClassLoaderWorker.java:54)
	at org.gradle.workers.internal.AbstractClassLoaderWorker$1.create(AbstractClassLoaderWorker.java:48)
	at org.gradle.internal.classloader.ClassLoaderUtils.executeInClassloader(ClassLoaderUtils.java:100)
	at org.gradle.workers.internal.AbstractClassLoaderWorker.executeInClassLoader(AbstractClassLoaderWorker.java:48)
	at org.gradle.workers.internal.IsolatedClassloaderWorker.run(IsolatedClassloaderWorker.java:49)
	at org.gradle.workers.internal.IsolatedClassloaderWorker.run(IsolatedClassloaderWorker.java:30)
	at org.gradle.workers.internal.IsolatedClassloaderWorkerFactory$1.lambda$execute$0(IsolatedClassloaderWorkerFactory.java:57)
	at org.gradle.workers.internal.AbstractWorker$1.call(AbstractWorker.java:44)
	at org.gradle.workers.internal.AbstractWorker$1.call(AbstractWorker.java:41)
	at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:204)
	at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:199)
	at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:66)
	at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:59)
	at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:157)
	at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:59)
	at org.gradle.internal.operations.DefaultBuildOperationRunner.call(DefaultBuildOperationRunner.java:53)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:78)
	at org.gradle.workers.internal.AbstractWorker.executeWrappedInBuildOperation(AbstractWorker.java:41)
	at org.gradle.workers.internal.IsolatedClassloaderWorkerFactory$1.execute(IsolatedClassloaderWorkerFactory.java:49)
	at org.gradle.workers.internal.DefaultWorkerExecutor.lambda$submitWork$0(DefaultWorkerExecutor.java:170)
	at org.gradle.internal.work.DefaultConditionalExecutionQueue$ExecutionRunner.runExecution(DefaultConditionalExecutionQueue.java:187)
	at org.gradle.internal.work.DefaultConditionalExecutionQueue$ExecutionRunner.access$700(DefaultConditionalExecutionQueue.java:120)
	at org.gradle.internal.work.DefaultConditionalExecutionQueue$ExecutionRunner$1.run(DefaultConditionalExecutionQueue.java:162)
	at org.gradle.internal.Factories$1.create(Factories.java:31)
	at org.gradle.internal.work.DefaultWorkerLeaseService.withLocks(DefaultWorkerLeaseService.java:264)
	at org.gradle.internal.work.DefaultWorkerLeaseService.runAsWorkerThread(DefaultWorkerLeaseService.java:128)
	at org.gradle.internal.work.DefaultWorkerLeaseService.runAsWorkerThread(DefaultWorkerLeaseService.java:133)
	at org.gradle.internal.work.DefaultConditionalExecutionQueue$ExecutionRunner.runBatch(DefaultConditionalExecutionQueue.java:157)
	at org.gradle.internal.work.DefaultConditionalExecutionQueue$ExecutionRunner.run(DefaultConditionalExecutionQueue.java:126)
	... 2 more

Thank you in advance! :)

casid added a commit that referenced this issue Jan 27, 2024
@casid casid self-assigned this Jan 27, 2024
@casid
Copy link
Owner

casid commented Jan 27, 2024

Thank you for reporting!

I just added a testcase and can confirm this was introduced to my change here. I've reverted that commit and will publish a new hotfix asap.

Sorry for the inconvenience!

@casid
Copy link
Owner

casid commented Jan 27, 2024

I just published version 3.1.9 containing a hotfix for this problem.

@casid casid closed this as completed Jan 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants