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

Option to fail build if a subproject is included but there is no build file #17540

Closed
anuraaga opened this issue Jun 25, 2021 · 5 comments
Closed
Labels
a:feature A new functionality closed:not-fixed Indicates the issue was not fixed and is not planned to be

Comments

@anuraaga
Copy link
Contributor

Expected Behavior

Build fails if include points to a path with no build.gradle

Current Behavior

Build succeeds even though the build configuration is broken

Context

It's fairly easy to cause a build.gradle to disappear, most often by moving a folder. If updating settings.gradle is forgotten, it's hard to detect since the build will often continue, the project will be a no-op. While the default behavior probably couldn't be changed, having an option to fail for these cases seems helpful since we can't imagine many if any use cases for include a path that doesn't have any logic.

@anuraaga
Copy link
Contributor Author

Example of where it crops up

https://github.com/open-telemetry/opentelemetry-java-instrumentation/pull/3409/files#r658519847

Luckily the problem won't happen now that I'm switching the build files back to a static name, but previously just because of a misnamed file the tests weren't running at all

@mlopatkin
Copy link
Member

mlopatkin commented Jun 28, 2021

We may reconsider it in the future but we don't plan to add anything like that right now.

@mlopatkin mlopatkin added closed:not-fixed Indicates the issue was not fixed and is not planned to be and removed to-triage labels Jun 28, 2021
@gradle gradle deleted a comment from ahat1992 Jun 28, 2021
@ljacomet
Copy link
Member

To clarify: a project with no build file is a supported setup even though it is not a recommended one.

@anuraaga
Copy link
Contributor Author

@ljacomet Things can change for Gradle 8 right? I'd look through a UX lens - very easy to opt into an emtpy build file, even with just a touch command. I suspect that many more users will benefit from failures catching their mistake of missing or wrong named file though.

@ljacomet
Copy link
Member

I understand what you are asking but the existing behavior also has reasons. And those are unlikely to go away in Gradle 8 though these are simplifications we might aim for at a later stage.

If you do something like include("services:payment") you are effectively creating an implicit :services project while in your hierarchy it may not have any useful content.
Preventing that would force users to have an empty build file there or change their project setup.
Warning would make such builds much more noisy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a:feature A new functionality closed:not-fixed Indicates the issue was not fixed and is not planned to be
Projects
None yet
Development

No branches or pull requests

3 participants