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

Deprecate nested builds without a settings.gradle #3137

Closed
blindpirate opened this issue Oct 11, 2017 · 1 comment
Closed

Deprecate nested builds without a settings.gradle #3137

blindpirate opened this issue Oct 11, 2017 · 1 comment
Assignees
Labels
Milestone

Comments

@blindpirate
Copy link
Member

@blindpirate blindpirate commented Oct 11, 2017

As stated in gradle/gradle-private#708, we're going to deprecate and remove support for upward-searching settings.gradle.

With this change, this part of https://docs.gradle.org/4.2.1/userguide/build_lifecycle.html#sec:initialization would be changed to:

  • If a settings.gradle file is found, Gradle checks if the current project is part of the multiproject hierarchy defined in the found settings.gradle file. If not, AN EXCEPTION WILL BE THROWN. Otherwise a multiproject build is executed.

However, given that this is a considerable behavior change, I'd like to break this thing into two steps:

  • Deprecate the suport in 4.4
  • Remove the support in 5.0

The deprecation thing includes:

  • Deprecation warning when user's build doesn't contains a settings.gradle and is not part of a multiproject.
@blindpirate blindpirate added this to the 4.4 RC1 milestone Oct 11, 2017
@blindpirate blindpirate self-assigned this Oct 11, 2017
@oehme

This comment has been minimized.

Copy link
Member

@oehme oehme commented Oct 11, 2017

we're going to deprecate and remove support for upward-searching settings.gradle

No, we are removing support for not searching upwards.

If a settings.gradle file isn't found in current project, the build is executed as a single project build.

This is not the intended behavior.

The linked ticket is about the following scenario: You have a build with a settings.gradle file. Nested in a directory under that build is another build without a settings.gradle file. When you try to run that nested build, Gradle will search upwards to find the settings.gradle file, load that file and determine that the project you were trying to start is actually not part of that higher-level build. It will then roll back a bunch of services and start again, treating it as a single-project build instead.

foo
  settings.gradle // does not include bar
  build.gradle
  bar // user starts a build here
    build.gradle

This is complex and should be deprecated/removed.

In the future, Gradle would throw an error when it finds a settings.gradle file further up, but that settings.gradle file doesn't actually include the project you were trying to run. To fix that, the user should add a settings.gradle file to the nested build.

foo
  settings.gradle
  build.gradle
  bar
    settings.gradle //this fixes the problem, it is now clear that this is a different build
    build.gradle
@oehme oehme changed the title Deprecate `----no-search-upwards` and upward-searching `settings.gradle` Deprecate `----no-search-upwards` and nested builds without a settings.gradle Oct 11, 2017
@blindpirate blindpirate changed the title Deprecate `----no-search-upwards` and nested builds without a settings.gradle Deprecate `--no-search-upwards` and nested builds without a settings.gradle Oct 12, 2017
@blindpirate blindpirate changed the title Deprecate `--no-search-upwards` and nested builds without a settings.gradle Deprecate nested builds without a settings.gradle Oct 16, 2017
blindpirate added a commit that referenced this issue Oct 18, 2017
Fix #3137
blindpirate added a commit that referenced this issue Oct 18, 2017
Fix #3137
blindpirate added a commit that referenced this issue Oct 18, 2017
Fix #3137
@blindpirate blindpirate reopened this Oct 19, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.