Skip to content

Multi-Project doc improvement #15167

@xenoterracide

Description

@xenoterracide

Fine Tuning the Project Layout

this is confusing, since it includes the rootProject and with no spaces a project() invocation, so it doesn't say or suggest that include(...) has to be called before project(...).

rootProject.name = "main"
project(":project-a").projectDir = file("../my-project-a")
project(":project-a").buildFileName = "project-a.gradle"

Just needs to be written like

rootProject.name = "main"
include(":project-a")
project(":project-a").projectDir = file("../my-project-a")
project(":project-a").buildFileName = "project-a.gradle"

Executing Task by name

This seems false or maybe misleading

The basic rule behind Gradle’s behavior is: execute all tasks down the hierarchy which have this name. Only complain if there is no such task found in any of the subprojects traversed.

Gradle looks down the hierarchy, starting with the current dir, for tasks with the given name and executes them. One thing is very important to note. Gradle always evaluates every project of the multi-project build and creates all existing task objects. Then, according to the task name arguments and the current directory, Gradle filters the tasks which should be executed. Because of Gradle’s cross project configuration, every project has to be evaluated before any task gets executed.

The dependencies command is only run on the root. Maybe this is a bug and I should report it as one.

note: api is just the root gradlew command in the api directory under the hood

> yarn api -q projects                                             # ppm -> 1-setup — ! + ?

------------------------------------------------------------
Root project
------------------------------------------------------------

Root project 'api'
\--- Project ':app'

To see a list of the tasks of a project, run gradlew <project-path>:tasks
For example, try running gradlew :app:tasks
> yarn api dependencies                                            # ppm -> 1-setup — ! + ?

> Task :dependencies

------------------------------------------------------------
Root project
------------------------------------------------------------

No configurations

A web-based, searchable dependency report is available by adding the --scan option.

BUILD SUCCESSFUL in 1s
1 actionable task: 1 executed

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions