Modifier and Type | Class and Description |
---|---|
protected static class |
Target.BuiltCompilationUnitSet
Wad that holds a set of
ICompilationUnit s that have been built to
build the output of this target and any ICompilerProblem s found
building those ICompilationUnit s. |
static class |
Target.DirectDependencies
Wad containing an
Iterable of ICompilationUnit s and an
Iterable of ICompilerProblem s found while constructing
the Iterable of ICompilationUnit s. |
static class |
Target.RootedCompilationUnits
Wad containing the set of
ICompilationUnit s that root the dependency walk
and any ICompilerProblem s encountered computing the roots of the
dependency walk. |
ITarget.TargetType
Modifier and Type | Field and Description |
---|---|
protected ITargetProgressMonitor |
progressMonitor |
protected CompilerProject |
project |
protected ITargetSettings |
targetSettings |
Modifier | Constructor and Description |
---|---|
protected |
Target(CompilerProject project,
ITargetSettings targetSettings,
ITargetProgressMonitor progressMonitor)
Constructor
|
Modifier and Type | Method and Description |
---|---|
void |
addASMetadataNames(Collection<String> metadataNames)
Add metadata names to the target.
|
protected Target.BuiltCompilationUnitSet |
buildAllCompilationUnits()
Discovers all the compilation units (roots and dependencies) that will be
linked into the target.
|
protected void |
buildFinished()
Gets called when build operation finishes.
|
protected void |
buildStarted()
Gets called when build operation starts.
|
protected Iterable<ICompilerProblem> |
computeFatalProblems()
|
protected abstract Target.RootedCompilationUnits |
computeRootedCompilationUnits()
Computes the set of compilation units that root the dependency walk.
|
protected abstract ITargetReport |
computeTargetReport() |
protected void |
createLinkReport(Collection<ICompilerProblem> problems)
Create a link report at the path setup in the
targetSettings.getLinkReportPath.
|
protected Set<ICompilationUnit> |
findAllCompilationUnitsToLink(Collection<ICompilationUnit> compilationUnits,
Collection<ICompilerProblem> problems)
Discovers dependent compilation units from a set of root compilation
units.
|
static com.google.common.collect.ImmutableList<IDefinition> |
getAllExternallyVisibleDefinitions(Collection<ICompilationUnit> compilationUnits)
Find all the externally visible definitions in the given compilation unit
list.
|
Set<String> |
getASMetadataNames()
Get the set of metadata names.
|
protected Target.BuiltCompilationUnitSet |
getBuiltCompilationUnitSet() |
protected Set<ICompilationUnit> |
getDependentCompilationUnits(Collection<ICompilationUnit> compilationUnits,
Collection<ICompilerProblem> problems)
Computes the set of all all
ICompilationUnit 's whose output is
part of the output of this target. |
protected Target.DirectDependencies |
getDirectDependencies(ICompilationUnit cu) |
protected Iterable<ICompilerProblem> |
getFatalProblems() |
Collection<ICompilationUnit> |
getIncludedResourceBundlesCompilationUnits(Collection<ICompilerProblem> problems) |
protected Collection<ICompilationUnit> |
getIncludeLibrariesCompilationUnits()
Get a collection of compilation units for all of the classes found in
all of the libraries found in the -include-libraries path.
|
Set<ICompilationUnit> |
getIncludesCompilationUnits()
Gets a set of
ICompilationUnit s that are included into the build
process by -include-classes compiler argument. |
protected LinkageChecker |
getLinkageChecker()
Get the target's linkage checker.
|
com.google.common.collect.ImmutableList<ICompilationUnit> |
getReachableCompilationUnits(Collection<ICompilerProblem> problems) |
abstract Target.RootedCompilationUnits |
getRootedCompilationUnits() |
ITargetReport |
getTargetReport()
Returns a report specific to this target.
|
ITargetSettings |
getTargetSettings()
Returns the settings specific to this target.
|
protected boolean |
isCanceled() |
protected boolean |
isLinkageExternal(ICompilationUnit cu,
ITargetSettings targetSettings)
Determine if a compilation unit should be linked into the target.
|
protected void |
setLinkageChecker(LinkageChecker linkageChecker)
Set the project's linkage checker.
|
protected boolean |
updateProgress(int percentageCompleted)
Updates the value that represents the percentage of the main task that
has been completed so far and notifies the progress monitor about this
value if any.
|
protected boolean |
updateProgress(int numTotalCompilationUnits,
int totalCompilationUnitsWorkCompleted,
int maxPercentage)
Updates the value that represents the percentage of the work completed so
far using the information specified and notifies the progress monitor
about this value.
|
protected void |
waitForCompilationUnitToFinish(ICompilationUnit cu,
Collection<ICompilerProblem> problems)
Waits for the specified
ICompilationUnit to finish building and
add any problems found in the specified ICompilationUnit to the
specified Collection . |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getTargetType
protected final CompilerProject project
protected final ITargetProgressMonitor progressMonitor
protected final ITargetSettings targetSettings
protected Target(CompilerProject project, ITargetSettings targetSettings, ITargetProgressMonitor progressMonitor)
project
- CompilerProject
that this target will be a part of.targetSettings
- ITargetSettings
for this targetprogressMonitor
- ITargetProgressMonitor
that will receive
progress information. Can be null, in which case no progress information
will be collected.public static com.google.common.collect.ImmutableList<IDefinition> getAllExternallyVisibleDefinitions(Collection<ICompilationUnit> compilationUnits) throws InterruptedException
compilationUnits
- A collection of compilation units.InterruptedException
- Concurrency error.protected Set<ICompilationUnit> findAllCompilationUnitsToLink(Collection<ICompilationUnit> compilationUnits, Collection<ICompilerProblem> problems) throws InterruptedException
This method delegates the dependency discovery to
getDependentCompilationUnits(java.util.Collection<org.apache.flex.compiler.units.ICompilationUnit>, java.util.Collection<org.apache.flex.compiler.problems.ICompilerProblem>)
. Subclasses should override
this method if they have more sophisticated dependency discovery
algorithms.
compilationUnits
- ICompilationUnit
s known to be linked into
the target. Dependent compilation units will be added to this method.problems
- Problems building compilation units.compilationUnits
collection from
argument.InterruptedException
- Concurrency error.protected void waitForCompilationUnitToFinish(ICompilationUnit cu, Collection<ICompilerProblem> problems) throws InterruptedException
ICompilationUnit
to finish building and
add any problems found in the specified ICompilationUnit
to the
specified Collection
.
This method exists for the sole purpose of allowing the
FlexLibrarySWFTarget
to filter out
ResourceBundleNotFoundProblem
s and
ResourceBundleNotFoundForLocaleProblem
s from
SWCCompilationUnit
's that are externally linked.
If we rip out support for Flex or if we are willing to report missing resource bundles from external SWCs when linking a SWC, this method can be inlined at its call site.
If we plan on continuing to support Flex, a better way to do this would
be to have the IOutgoingDependenciesRequestResult
interface have method
to get all the resource bundles referenced by an ICompilationUnit
and wait to do the final resolution of resource bundles in Target
or one of its sub-classes.
cu
- problems
- InterruptedException
public ITargetSettings getTargetSettings()
ITarget
getTargetSettings
in interface ITarget
protected abstract ITargetReport computeTargetReport() throws InterruptedException
InterruptedException
public final ITargetReport getTargetReport() throws InterruptedException
ITarget
getTargetReport
in interface ITarget
InterruptedException
protected Target.BuiltCompilationUnitSet buildAllCompilationUnits() throws InterruptedException
Target.BuiltCompilationUnitSet
that contains information about
all the ICompilationUnit
s whose output contribute to this target
and ICompilerProblem
s discovered while building all the
ICompilationUnit
s.InterruptedException
- Concurrency error.protected Target.BuiltCompilationUnitSet getBuiltCompilationUnitSet() throws InterruptedException
InterruptedException
protected final Set<ICompilationUnit> getDependentCompilationUnits(Collection<ICompilationUnit> compilationUnits, Collection<ICompilerProblem> problems) throws InterruptedException
ICompilationUnit
's whose output is
part of the output of this target. This method does NOT compute
the dependencies introduced in CSS.compilationUnits
- A collection of root compilation units.problems
- Problems building compilation units.ICompilationUnit
's whose output is part of the
output of this target. The order of compilation units in this function
does not matter because we topologically sort the dependency graph later
when we are getting ready to add tags to the output SWF or SWC.InterruptedException
protected Target.DirectDependencies getDirectDependencies(ICompilationUnit cu) throws InterruptedException
InterruptedException
public com.google.common.collect.ImmutableList<ICompilationUnit> getReachableCompilationUnits(Collection<ICompilerProblem> problems) throws InterruptedException
InterruptedException
protected void createLinkReport(Collection<ICompilerProblem> problems) throws InterruptedException
problems
- InterruptedException
protected abstract Target.RootedCompilationUnits computeRootedCompilationUnits() throws InterruptedException
ICompilationUnit
's.InterruptedException
public abstract Target.RootedCompilationUnits getRootedCompilationUnits() throws InterruptedException
InterruptedException
public final Set<ICompilationUnit> getIncludesCompilationUnits() throws InterruptedException
ICompilationUnit
s that are included into the build
process by -include-classes compiler argument.
This method is marked final until we have a use case to make it non-final.
getIncludesCompilationUnits
in interface ITarget
ICompilationUnit
s that are included into the
build process by -include-classes compiler argument.InterruptedException
public final Collection<ICompilationUnit> getIncludedResourceBundlesCompilationUnits(Collection<ICompilerProblem> problems) throws InterruptedException
InterruptedException
public final Set<String> getASMetadataNames()
getASMetadataNames
in interface ITarget
public void addASMetadataNames(Collection<String> metadataNames)
metadataNames
- metadata names that should be kept. May not be null.protected final void buildStarted()
protected boolean updateProgress(int numTotalCompilationUnits, int totalCompilationUnitsWorkCompleted, int maxPercentage)
numTotalCompilationUnits
- number of compilation units known to be
included in the build processtotalCompilationUnitsWorkCompleted
- total compilation unit work
completed so far. As described above, each compilation unit has two steps.
Therefore, this value would be equal to (2*numTotalCompilationUnits),
when we are done with compiling all the compilation units.maxPercentage
- the value that represents the maximum percentage of
the work can be considered completed so far in this method. This
method guarantees not to report a percentage value that is higher than
this value as completed to its clients via its progress monitor.false
if the build operation has been requested to be
terminated, true
otherwise.protected boolean updateProgress(int percentageCompleted)
percentageCompleted
- the percentage of the main task that has been
completed so far.false
if the build operation has been requested to be
terminated, true
otherwise.protected boolean isCanceled()
protected final void buildFinished()
protected boolean isLinkageExternal(ICompilationUnit cu, ITargetSettings targetSettings) throws InterruptedException
cu
- The compilation unit to test.targetSettings
- The target settings.InterruptedException
protected final LinkageChecker getLinkageChecker()
protected void setLinkageChecker(LinkageChecker linkageChecker)
linkageChecker
- linkage checker, may not be null.protected Iterable<ICompilerProblem> getFatalProblems() throws InterruptedException
InterruptedException
protected Iterable<ICompilerProblem> computeFatalProblems() throws InterruptedException
Iterable
of fatal ICompilerProblem
s that
prevent this Target
from being built.
Sub-classes override this method to check for additional fatal
ICompilerProblem
s.
Iterable
of fatal ICompilerProblem
sInterruptedException
protected final Collection<ICompilationUnit> getIncludeLibrariesCompilationUnits()
Copyright © 2016 The Apache Software Foundation. All rights reserved.