Skip to content

Conversation

@BoD
Copy link
Collaborator

@BoD BoD commented Nov 6, 2025

No description provided.

Comment on lines +266 to +267
apolloCompilerCodegenJob = coroutineScope.launch {
ApolloCompilerHelper(project).generateAllSources()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

generateAllSources() is 100% blocking code IIRC. There is no need for a coroutine, a plain Executor should be enough. Also worth noting that you may end up with multiple compilation happening in parallel (not safe) if you start/stop/start/stop quickly.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The guide recommends using coroutines with the provided scope to do background work nowadays, also saying that blocking code is OK. But the doc (+ situation with different versions of IDEs) is kind of messy and I'm actually not sure about whether job.cancel() actually works here. I'll test a bit more.

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.

3 participants