usage
Specifies a reusable block of configuration to be consumed at a later point.
usage 'MyUsage'
The usage
API is used to define configuration to be consumed by the uses
API. Usages must have unique names, except for magic usage block names (as described below).
Magic Usage Blocks
PRIVATE
- Private specifies a configuration to be automatically applied to the project defining theusage
block. This block is inaccessible to be consumed byuses
. This is the equivalent of defining configuration inside the project directly.INTERFACE
- Interface has the opposite meaning as private usages. An interface usage is applied only to those projects consuming it viauses
. Interface usage blocks are consumed by specfiying the containing project's name in theuses
list.PUBLIC
- Public specifies a configuration to be automatically applied to the project defining theusage
block and any project consuming it viauses
. LikeINTERFACE
, it is consumed by specifying the name of the project it is defined in.
If projects define both an INTERFACE
and PUBLIC
usage block, both blocks will be applied to any project consuming that project.
Example
project 'A'
usage 'PRIVATE'
defines { 'A_PRIVATE' }
usage 'PUBLIC'
defines { 'A_PUBLIC' }
usage 'NotMagic'
defines { 'A_NOT_MAGIC' }
project 'B'
uses { 'NotMagic' } -- Applies usage NotMagic from A
usage 'PUBLIC'
uses { 'A' } -- Applies PUBLIC from A to self and to any project consuming B
Applies To
Project configurations.