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

Fix cross module resolution local links #3425

Merged

Conversation

vmishenev
Copy link
Member

@vmishenev vmishenev commented Dec 20, 2023

Fixes #2272. There is a situation where 2 (or more) gradle modules have the same package and dokka doesn’t know where to link.
E.g.
The class com.example.classA is in moduleA
and com.example.classB is in moduleB
moduleC depends on moduleA and moduleB.
In moduleC: there is a link [com.example.classB]. Having only package-list, dokka doesn’t know where to link, since the package com.example is in both modules.

This is short-term and temporary solution of #3368 to cover a case of links between only local modules in a project.
It is based on #2901 from @EddieRingle. It generates an external link depending on a check if the local link exists. The check works only when the number of possible resolved links are more than one.

The general solution of #3368 should also cover links to external modules (that are locally unavailable).

EddieRingle and others added 2 commits March 2, 2023 15:46
The existing behavior was just taking the first module that includes the
package name of a given reference, so this resulted in broken links when
a package is split across multiple modules.

This change checks to ensure the resolved file exists before choosing it
as the target for the resolved link.

Signed-off-by: Eddie Ringle <eddie@ringle.io>
@vmishenev vmishenev force-pushed the vmishenev/2272-fix-cross-module-resolution-local-links branch from c4d81f7 to af9a5b2 Compare December 20, 2023 10:39
@vmishenev vmishenev marked this pull request as ready for review December 20, 2023 22:27
@vmishenev vmishenev force-pushed the vmishenev/2272-fix-cross-module-resolution-local-links branch from 27ff46c to 32933c7 Compare January 11, 2024 15:24
@vmishenev vmishenev merged commit 6904571 into master Jan 11, 2024
10 of 12 checks passed
@EddieRingle
Copy link
Contributor

Thanks for working to get all of this resolved @vmishenev!

@vmishenev vmishenev deleted the vmishenev/2272-fix-cross-module-resolution-local-links branch January 11, 2024 17:07
IgnatBeresnev pushed a commit that referenced this pull request Jan 11, 2024
Fixes #2272. There is a situation where 2 (or more) gradle modules have the same package and dokka doesn’t know where to link.
E.g.
The class com.example.classA is in moduleA
and com.example.classB is in moduleB
moduleC depends on moduleA and moduleB.
In moduleC: there is a link [com.example.classB]. Having only package-list, dokka doesn’t know where to link, since the package com.example is in both modules.

This is short-term and temporary solution of #3368 to cover a case of links between only local modules in a project.
It is based on #2901 from @EddieRingle. It generates an external link depending on a check if the local link exists. The check works only when the number of possible resolved links are more than one.

* all-modules-page: Validate cross-module links during resolution

The existing behavior was just taking the first module that includes the
package name of a given reference, so this resulted in broken links when
a package is split across multiple modules.

This change checks to ensure the resolved file exists before choosing it
as the target for the resolved link.

Signed-off-by: Eddie Ringle <eddie@ringle.io>

* Check links only if resolved links has more than one link

* Add integration test

* Refactor

* Add comment

---------

Signed-off-by: Eddie Ringle <eddie@ringle.io>
Co-authored-by: Eddie Ringle <eddie@ringle.io>
(cherry picked from commit 6904571)
vmishenev added a commit that referenced this pull request Mar 20, 2024
Fixes #2272. There is a situation where 2 (or more) gradle modules have the same package and dokka doesn’t know where to link.
E.g.
The class com.example.classA is in moduleA
and com.example.classB is in moduleB
moduleC depends on moduleA and moduleB.
In moduleC: there is a link [com.example.classB]. Having only package-list, dokka doesn’t know where to link, since the package com.example is in both modules.

This is short-term and temporary solution of #3368 to cover a case of links between only local modules in a project.
It is based on #2901 from @EddieRingle. It generates an external link depending on a check if the local link exists. The check works only when the number of possible resolved links are more than one.



* all-modules-page: Validate cross-module links during resolution

The existing behavior was just taking the first module that includes the
package name of a given reference, so this resulted in broken links when
a package is split across multiple modules.

This change checks to ensure the resolved file exists before choosing it
as the target for the resolved link.

Signed-off-by: Eddie Ringle <eddie@ringle.io>

* Check links only if resolved links has more than one link

* Add integration test

* Refactor

* Add comment

---------

Signed-off-by: Eddie Ringle <eddie@ringle.io>
Co-authored-by: Eddie Ringle <eddie@ringle.io>
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.

Unable to correctly link to classes in a multi module project with non-unique package names
4 participants