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

Document extension search #12699

Open
matthiaskraaz opened this issue Apr 2, 2020 · 0 comments
Open

Document extension search #12699

matthiaskraaz opened this issue Apr 2, 2020 · 0 comments
Labels
a:documentation Documentation content in:configuration-model lazy api, domain object container

Comments

@matthiaskraaz
Copy link

Expected Behavior

Documentation should in detail explain how extension properties are search.

Current Behavior

The only hint I found was "Extra properties on a project are visible from its subprojects."
at https://docs.gradle.org/current/userguide/writing_build_scripts.html#sec:extra_properties

Context

I had to do a lot of experimenting. I think I finally got it:

If you write just the name of the extension property:

  1. outside of a task, the current project's extension is searched, then the parent projects up to the root project.
  2. inside of a task, the task's extension is searched first, then as in 1

If you prepend ext like this: 'ext.myprop', the ext object is used instead for your context, i.e. the task ext if within a task. The project.ext if not within a task. So only that ext object is asked for that property and the above search strategy does not take place.

I don't know about the other extension aware objects (SourceSet, DependencyHandler, Settings).

@big-guy big-guy added a:documentation Documentation content in:configuration-model lazy api, domain object container and removed to-triage a:feature A new functionality labels Sep 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a:documentation Documentation content in:configuration-model lazy api, domain object container
Projects
None yet
Development

No branches or pull requests

4 participants