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

New instrumented Jar approach causes tests to test non-production code #1332

Closed
hurricup opened this issue Mar 3, 2023 · 2 comments
Closed
Assignees
Labels
Milestone

Comments

@hurricup
Copy link

hurricup commented Mar 3, 2023

If you have a default project set up, like project with main and test roots, gradle sets tests dependency on main classes. Not instrumented jar.

Meaning, that in runtime tests will test non-instrumented code and may miss at least nullability issues.
Also, if you have tests for forms created with legacy forms creator, they will just fail, because of missing setupUI method.

Probably there is a way to tell gradle to use instrumented jar instead of main output, but I could not find one.
Even if I add instrumented jar dependency to the testRuntime, it comes after non-instrumented classes in the resulting classpath and classloader will still resolve to these non-instrumented classes.

The only way to solve this I could imagine is to move tests to separate project and specify dependencies explicitly. But this feels really bad.

@hurricup
Copy link
Author

hurricup commented Mar 3, 2023

Created tests. Cross-project dependencies are ok, because they are manual and to instrumented jar. And in-project deps are failing.

@hsz hsz added this to the next milestone Mar 8, 2023
@hsz hsz self-assigned this Mar 8, 2023
hurricup added a commit to Camelcade/Perl5-IDEA that referenced this issue Mar 8, 2023
This should address issue with test code depending on instrumented code instead of plain code

See: JetBrains/intellij-platform-gradle-plugin#1332
@hurricup
Copy link
Author

The only viable solution for now is to extract some core module and make following structure for the plugin:

plugin
\ tests
\ plugin:core
 \ main

This way we may specify test runtime dependencies for tests as project(':plugin:core', 'instrumentedJar')
You may also need to set up fat jar generation.
See commits from: Camelcade/Perl5-IDEA#2620

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

No branches or pull requests

2 participants