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

Support control over enabling plugin transformations between test and main source sets #343

Open
jeffdgr8 opened this issue Sep 4, 2023 · 0 comments

Comments

@jeffdgr8
Copy link

jeffdgr8 commented Sep 4, 2023

There are scenarios where the Atomicfu Gradle plugin fails to transform test code to remove the Atomicfu runtime dependency, for example when atomics are used within a runBlocking coroutine lambda:

java.lang.IllegalStateException: Unsupported type of atomic receiver expression: GET_VAR 'val canceled: kotlinx.atomicfu.AtomicBoolean [val] declared in kotbase.BaseCoroutineTest.testCoroutineScopeListenerRemoved.' type=kotlinx.atomicfu.AtomicBoolean origin=null

But all the usages in the main source sets are able to be transformed successfully, so it's desirable to apply the plugin transformation to these published source sets, while just using the Atomicfu dependency directly in tests.

Alternatively, there are scenarios where atomics are only needed in tests and not in the main source sets. But applying the Atomicfu Gradle plugin to the module results in adding the Atomicfu runtime dependency to native targets in the main source sets, which is unnecessary.

It would be helpful to exclude certain source sets from the Gradle plugin's transformations as well as which source sets have the runtime dependency added. Also, if it could be determined which source sets don't actually require the runtime dependency (because atomics aren't used) and avoid adding it, this would be ideal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants