public class UnconfiguredBuildTarget extends Object implements Comparable<UnconfiguredBuildTarget>, QueryTarget, DependencyStack.Element
In other words, this represents a parsed representation of a build target with flavors but without configuration.
For example, a fully qualified target name like `cell//path/to:target#flavor1,flavor2` parses `cell` as a cell name, `//path/to` as a base name that corresponds to the real path to the build file that contains a target, `target` is a target name found in that build file and `flavor1` and 'flavor2' as flavors as applied to this build target.
Flavors are a legacy way to configure a build target so it can mutate its behavior based on
user-provided input or client settings, like target or running platforms. Flavors should not be
used anymore, instead you want to use a BuildTarget
along with passed TargetConfiguration
.
Modifier and Type | Method and Description |
---|---|
UnconfiguredBuildTarget |
assertUnflavored()
Verifies that this build target has no flavors.
|
int |
compareTo(UnconfiguredBuildTarget that) |
BuildTarget |
configure(TargetConfiguration targetConfiguration) |
boolean |
equals(Object o) |
BaseName |
getBaseName() |
CanonicalCellName |
getCell()
Name of the cell that current build target belongs to
|
CellRelativePath |
getCellRelativeBasePath()
Typed version of
getBaseName() . |
String |
getCellRelativeName() |
DependencyStack.Element |
getElement() |
FlavorSet |
getFlavors() |
com.google.common.collect.ImmutableSortedSet<Flavor> |
getFlavorSet()
Set of flavors used with that build target.
|
String |
getFullyQualifiedName()
Fully qualified name of unconfigured build target, for example
cell//some/target:name#flavor1,flavor2
|
String |
getName()
Name of the build target, i.e.
|
String |
getShortNameAndFlavorPostfix() |
UnflavoredBuildTarget |
getUnflavoredBuildTarget() |
int |
hashCode() |
boolean |
isFlavored() |
static UnconfiguredBuildTarget |
of(BaseName baseName,
String shortName)
Helper for creating a build target in the root cell with no flavors.
|
static UnconfiguredBuildTarget |
of(CanonicalCellName cell,
BaseName baseName,
String name,
FlavorSet flavors)
A constructor
|
static UnconfiguredBuildTarget |
of(UnflavoredBuildTarget unflavoredBuildTarget,
FlavorSet flavors)
A constructor
|
String |
toString() |
UnconfiguredBuildTarget |
withFlavors(Flavor... flavors)
Creates a new build target by copying all of the information from this build target and using
the provided flavors as flavors in the new build target.
|
UnconfiguredBuildTarget |
withFlavors(Iterable<? extends Flavor> flavors)
Creates a new build target by copying all of the information from this build target and using
the provided flavors as flavors in the new build target.
|
UnconfiguredBuildTarget |
withLocalName(String localName) |
UnconfiguredBuildTarget |
withoutFlavors() |
UnconfiguredBuildTarget |
withShortName(String shortName)
Creates a new build target by copying all of the information from this build target and
replacing the short name with the given name.
|
UnconfiguredBuildTarget |
withUnflavoredBuildTarget(UnflavoredBuildTarget target) |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
compare
public UnflavoredBuildTarget getUnflavoredBuildTarget()
public CanonicalCellName getCell()
public BaseName getBaseName()
public CellRelativePath getCellRelativeBasePath()
getBaseName()
.public String getName()
public com.google.common.collect.ImmutableSortedSet<Flavor> getFlavorSet()
public FlavorSet getFlavors()
public String getFullyQualifiedName()
public String getShortNameAndFlavorPostfix()
public int compareTo(UnconfiguredBuildTarget that)
compareTo
in interface Comparable<UnconfiguredBuildTarget>
public String getCellRelativeName()
public DependencyStack.Element getElement()
getElement
in interface DependencyStack.Element
getElement
in interface DependencyStack.ProvidesElement
public static UnconfiguredBuildTarget of(UnflavoredBuildTarget unflavoredBuildTarget, FlavorSet flavors)
public static UnconfiguredBuildTarget of(CanonicalCellName cell, BaseName baseName, String name, FlavorSet flavors)
public static UnconfiguredBuildTarget of(BaseName baseName, String shortName)
public UnconfiguredBuildTarget withoutFlavors()
public UnconfiguredBuildTarget withLocalName(String localName)
public BuildTarget configure(TargetConfiguration targetConfiguration)
public boolean isFlavored()
public UnconfiguredBuildTarget withFlavors(Iterable<? extends Flavor> flavors)
flavors
- flavors to use when creating a new build targetpublic UnconfiguredBuildTarget withFlavors(Flavor... flavors)
flavors
- flavors to use when creating a new build targetpublic UnconfiguredBuildTarget withShortName(String shortName)
shortName
- short name of the new build targetpublic UnconfiguredBuildTarget withUnflavoredBuildTarget(UnflavoredBuildTarget target)
public UnconfiguredBuildTarget assertUnflavored()
IllegalStateException
- if a build target has flavors