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

Exclude root project from type-safe project dependencies #24295

Open
tynn opened this issue Mar 11, 2023 · 6 comments
Open

Exclude root project from type-safe project dependencies #24295

tynn opened this issue Mar 11, 2023 · 6 comments
Assignees
Labels
a:bug has:reproducer Indicates the issue has a confirmed reproducer has:workaround Indicates that the issue has a workaround in:project-accessors 👋 team-triage Issues that need to be triaged by a specific team

Comments

@tynn
Copy link

tynn commented Mar 11, 2023

In Gradle the rootProject is special and accessible from every project.

Expected Behavior

Skip root project for type-safe project dependencies

Current Behavior

With type-safe project dependencies, the root project raises several issues with some provided names.

Context

  1. The root project is in the same hierarchy like its subprojects. Therefore it's not possible to name the root project Lib and have a subproject :lib as a subproject.
  2. The root project name is also used by other tools (like Intellij) to display it to the user, but it's not possible to use a readable name including spaces or other characters not mathing the projects pattern.

Steps to Reproduce

enableFeaturePreview 'TYPESAFE_PROJECT_ACCESSORS'

rootProject.name = 'Lib' // or 'Some lib'

include ':lib'
@ov7a ov7a added in:project-accessors has:reproducer Indicates the issue has a confirmed reproducer has:workaround Indicates that the issue has a workaround and removed to-triage labels Mar 17, 2023
@ov7a
Copy link
Member

ov7a commented Mar 17, 2023

Thank you for providing a valid reproducer.

The issue is in the backlog of the relevant team but the existence of a workaround makes it non-critical so it might take a while before a fix is made.


Note: the source of the problem is a name clash between project name and subproject name.

* What went wrong:
org.gradle.api.internal.catalog.GeneratedClassCompilationException: Unable to compile generated sources:
  - File RootProjectAccessor.java, line: 29, method getLib() is already defined in class org.gradle.accessors.dm.RootProjectAccessor
> Unable to compile generated sources:
    - File RootProjectAccessor.java, line: 29, method getLib() is already defined in class org.gradle.accessors.dm.RootProjectAccessor

@osipxd
Copy link

osipxd commented Apr 17, 2024

@ov7a, can I contribute a fix? It seems like just RootProjectAccessorSource and everything related to it should be deleted. Yes it is a breaking change, but typesafe project accessors is still an experimental feature.

@ov7a
Copy link
Member

ov7a commented Apr 26, 2024

@osipxd Sorry for the late reply. The team responsible for this area should make a decision. They have been informed. Response time may vary.

@ov7a ov7a added the 👋 team-triage Issues that need to be triaged by a specific team label Apr 26, 2024
@ov7a ov7a removed the to-triage label May 16, 2024
@alllex
Copy link
Member

alllex commented May 31, 2024

Yet another problem with the root accessors is that changing the root project's name does not make the accessors to be regenerated. More surprisingly, the state accessors continue to work, and the builds are successful.

@alllex
Copy link
Member

alllex commented May 31, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a:bug has:reproducer Indicates the issue has a confirmed reproducer has:workaround Indicates that the issue has a workaround in:project-accessors 👋 team-triage Issues that need to be triaged by a specific team
Projects
None yet
Development

No branches or pull requests

4 participants