-
-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: generate code on the fly without storing in repo (#1704)
Part of #1701.
- Loading branch information
Showing
14 changed files
with
58 additions
and
2,040 deletions.
There are no files selected for viewing
47 changes: 0 additions & 47 deletions
47
.github/workflows/check-if-generated-code-up-to-date.main.kts
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 0 additions & 13 deletions
13
.../src/main/kotlin/io/github/typesafegithub/workflows/codegenerator/GenerationEntryPoint.kt
This file was deleted.
Oops, something went wrong.
21 changes: 21 additions & 0 deletions
21
...enerator/src/main/kotlin/io/github/typesafegithub/workflows/codegenerator/KspGenerator.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package io.github.typesafegithub.workflows.codegenerator | ||
|
||
import com.google.devtools.ksp.processing.CodeGenerator | ||
import com.google.devtools.ksp.processing.Resolver | ||
import com.google.devtools.ksp.processing.SymbolProcessor | ||
import com.google.devtools.ksp.symbol.KSAnnotated | ||
import io.github.typesafegithub.workflows.dsl.expressions.generateEventPayloads | ||
|
||
class KspGenerator( | ||
private val codeGenerator: CodeGenerator, | ||
) : SymbolProcessor { | ||
private var wasRun = false | ||
|
||
override fun process(resolver: Resolver): List<KSAnnotated> { | ||
if (!wasRun) { | ||
generateEventPayloads(codeGenerator = codeGenerator) | ||
wasRun = true | ||
} | ||
return emptyList() | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
.../src/main/kotlin/io/github/typesafegithub/workflows/codegenerator/KspGeneratorProvider.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package io.github.typesafegithub.workflows.codegenerator | ||
|
||
import com.google.devtools.ksp.processing.SymbolProcessor | ||
import com.google.devtools.ksp.processing.SymbolProcessorEnvironment | ||
import com.google.devtools.ksp.processing.SymbolProcessorProvider | ||
|
||
class KspGeneratorProvider : SymbolProcessorProvider { | ||
override fun create(environment: SymbolProcessorEnvironment): SymbolProcessor = | ||
KspGenerator( | ||
codeGenerator = environment.codeGenerator, | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
...in/resources/META-INF/services/com.google.devtools.ksp.processing.SymbolProcessorProvider
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
io.github.typesafegithub.workflows.codegenerator.KspGeneratorProvider |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.