HyperX
HyperX

Reputation: 1201

Get root project name in library

Is it somehow possible to get root project name in library module when building root project? For example:

mainProject has one module(library) project included with:

compile project(path: ':lib-subproject')

now in this lib-subproject i want to flavour builds based on root project name. I already tried with getRootProject.getName() in my lib-subproject gradle but this gives me the name of this library.

Upvotes: 1

Views: 7273

Answers (1)

Daniel Vermaasen
Daniel Vermaasen

Reputation: 347

You can access the root Projects name with:
rootProject.name

In your example you tried to use the probably undefined property getRootProject, but you most likely meant to use the method getRootProject().

You can find more information about the properties and methods of the project in the offical gradle documentation.

Upvotes: 5

Related Questions