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

Reintroduce compileElements/projectInternalView #23477

Open
big-guy opened this issue Jan 11, 2023 · 9 comments
Open

Reintroduce compileElements/projectInternalView #23477

big-guy opened this issue Jan 11, 2023 · 9 comments
Labels
a:feature A new functionality in:dependency-declarations variant notation attributes capability substitution in:test-suites Work related to the JvmTestSuite Plugin
Milestone

Comments

@big-guy
Copy link
Member

big-guy commented Jan 11, 2023

In 7.6 and 8.0, we backed out changes to introduce a dependency-management based way of getting access to a module for testing.

We should find a way to reintroduce this or define some steps we can take to reintroduce this feature.

See

@jzrebiec
Copy link

jzrebiec commented Mar 6, 2023

Here is the use case jzrebiec/jvm-test-suite-issue@1ba571a from the issue #24050

@ljacomet ljacomet added a:feature A new functionality in:dependency-declarations variant notation attributes capability substitution in:test-suites Work related to the JvmTestSuite Plugin labels Mar 6, 2023
@jvandort jvandort modified the milestones: 8.2 RC1, 8.3 RC1 Apr 5, 2023
@jimshowalter
Copy link

jimshowalter commented Jun 12, 2023

I filed #25269, but it was closed as a duplicate of this issue.

I don't understand why it's considered a duplicate, but the developer who closed it said to add my use case(s) here.

When it was closed, the developer said:

"Your test suite with a dependency on project() can see the api transitive dependencies of the main component at compilation time and the implementation transitive dependencies of the main component at runtime.

If your test uses json, explicitly declare the dependency in your test suite while the linked issue is unsolved."

But in fact, the test suites cannot see any of the dependencies in project(), nor any of the classes under src/main/java, which was the whole point of filing the issue.

It's really simple to reproduce. Just unzip this, and try to run the command in the readme:

gradle-upgrade-bug-main-classes.zip

@jimshowalter
Copy link

jimshowalter commented Jun 12, 2023

Here's another example.

gradle-upgrade-bug-dependencies.zip

@jimshowalter
Copy link

I checked the codebase for Gradle, and while there are several unit tests that verify dependencies in test suites, there aren't any that actually try to build a project that uses test suites. If you add tests that try to build, they'll fail the same as the zipped examples posted here.

@ygmkk
Copy link

ygmkk commented Jul 13, 2023

an irrelevant answer

@big-guy big-guy modified the milestones: 8.4 RC1, 8.5 RC1 Jul 18, 2023
@big-guy big-guy modified the milestones: 8.5 RC1, 8.x Sep 5, 2023
@big-guy
Copy link
Member Author

big-guy commented Sep 5, 2023

Blocked until 1.9.20 of KMP is released

@JiangHongTiao
Copy link

Any update on this? KMP 1.9.20 was already released. And how is kotlin multiplatform related to this fix?

@matsandreassen
Copy link

I tried to move to a jvm-test-suite based solution for integration tests and while implementation project() adds the main classes, none of the dependencies are added to the test suite. Having to duplicate the dependencies for the test suites seems like an obvious problem to me.

I'll ditto the previous commenter: what does KMP have to do with this?

@jzrebiec
Copy link

@matsandreassen The workaround for your problem is to extend the integration test configuration from the project one e.g.

configurations["testIntegrationImplementation"].extendsFrom(configurations.implementation.get())

if you use annotationProcesor or runtimeonly dependencies, you can also extend them e.g.

configurations["testIntegrationAnnotationProcessor"].extendsFrom(configurations.annotationProcessor.get())

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a:feature A new functionality in:dependency-declarations variant notation attributes capability substitution in:test-suites Work related to the JvmTestSuite Plugin
Projects
None yet
Development

No branches or pull requests

8 participants