Skip to content

Conversation

JesusMcCloud
Copy link
Contributor

Fixes #4870

@JesusMcCloud JesusMcCloud requested a review from a team as a code owner May 8, 2025 10:47
@JesusMcCloud JesusMcCloud marked this pull request as draft May 8, 2025 10:52
@JesusMcCloud JesusMcCloud marked this pull request as ready for review May 8, 2025 11:04
@JesusMcCloud
Copy link
Contributor Author

now the generated code actually works. as for the TODO regarding how to generate code, how about something similar as we hacked together here (without the regex, but the full power of the compiler):

  • setup a generated sources folder from inside the Kotest gradle plugin once and use some semi-randomly-generated name for it
  • on every test run:
    1. delete all code inside
    2. use KotlinPoet to generate the code inside that generated soruces folder. This way, no mess with escaping as in this PR, etc.
    3. run tests
    4. don't delete the generated source as they are viable for debugging and step 1 takes care of this anyway

@JesusMcCloud
Copy link
Contributor Author

another discovery: we run into conflicting overloads due to the generated code. seems that the new compiler plugin may have been intentionally not shipped and referenced, as it is not yet ready

@JesusMcCloud
Copy link
Contributor Author

* setup a generated sources folder from inside the Kotest gradle plugin once and use some semi-randomly-generated name for it

* on every test run:
  1. delete all code inside
  2. use KotlinPoet to generate the code inside that generated soruces folder. This way, no mess with escaping as in this PR, etc.
  3. run tests
  4. _don't_ delete the generated source as they are viable for debugging and step 1 takes care of this anyway

The more I think about it, the more i feel that steps 1 + 2 should be done from a dedicated gradle task that that should be specified as a dependency of all test compile tasks

@sksamuel sksamuel changed the title fix 4087 Fix the compiler plugin to generate correct files May 9, 2025
@sksamuel sksamuel enabled auto-merge May 9, 2025 17:12
@sksamuel sksamuel added this pull request to the merge queue May 9, 2025
Merged via the queue into kotest:master with commit 213310d May 9, 2025
7 checks passed
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

Successfully merging this pull request may close these issues.

Missing kotest-framework-multiplatform-plugin-embeddable-compiler-6.0.0.M4 dependency
2 participants