Target.BuiltCompilationUnitSet, Target.DirectDependencies, Target.RootedCompilationUnits
ITarget.TargetType
mainCU, rootedCompilationUnits
progressMonitor, project, targetSettings
Constructor and Description |
---|
FlexJSTarget(IASProject project,
ITargetSettings targetSettings,
ITargetProgressMonitor progressMonitor)
Initialize a JS target with the owner project and root compilation units.
|
Modifier and Type | Method and Description |
---|---|
void |
collectMixinMetaData(TreeSet<String> mixinClassNames,
List<ICompilationUnit> units) |
protected Set<ICompilationUnit> |
findAllCompilationUnitsToLink(Collection<ICompilationUnit> compilationUnits,
Collection<ICompilerProblem> problems)
Discovers dependent compilation units from a set of root compilation
units.
|
build, build, buildAndCollectProblems, computeRootedCompilationUnits, computeTargetReport, getRootedCompilationUnits, getTargetType, initializeApplication
addASMetadataNames, buildAllCompilationUnits, buildFinished, buildStarted, computeFatalProblems, createLinkReport, getAllExternallyVisibleDefinitions, getASMetadataNames, getBuiltCompilationUnitSet, getDependentCompilationUnits, getDirectDependencies, getFatalProblems, getIncludedResourceBundlesCompilationUnits, getIncludeLibrariesCompilationUnits, getIncludesCompilationUnits, getLinkageChecker, getReachableCompilationUnits, getTargetReport, getTargetSettings, isCanceled, isLinkageExternal, setLinkageChecker, updateProgress, updateProgress, waitForCompilationUnitToFinish
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getASMetadataNames, getIncludesCompilationUnits, getTargetReport, getTargetSettings, getTargetType
public FlexJSTarget(IASProject project, ITargetSettings targetSettings, ITargetProgressMonitor progressMonitor)
project
- the owner projectprotected Set<ICompilationUnit> findAllCompilationUnitsToLink(Collection<ICompilationUnit> compilationUnits, Collection<ICompilerProblem> problems) throws InterruptedException
For each public visible definition in all the compilation units, if there's an applicable CSS rule, check if the CSS rule pulls in any dependencies. (i.e. embedded assets, skin classes) Add the dependencies to the list of compilation units, and check if they have any applicable CSS rules which could pull in more dependencies. Loop until we reach a stable set of compilation units.
CSS rules in these CSS documents can introduce class dependencies. If any candidate rule matches a class known to be linked into the target, the candidate rule's dependencies are selected for linking. Those selected dependencies will be included in the next iteration of the dependency discovery loop.
Once a CSS document is "activated", it stays in this collection and its rules are tested against all classes introduced in the "dependency discovery loop".
For example: Suppose in project P, there are "A.as" and "styles.css", and
class "A" is selected for linking.
In "styles.css", there're two rules:
A { xSkin : ClassReference("B"); } K { xSkin : ClassReference("L"); }In the 1st iteration, rule "A" is matched, which introduces dependency on "B".
B { ySkin : ClassReference("C"); } A { ySkin : ClassReference("D"); } K { ySkin : ClassReference("M"); }In the 2nd iteration, rule "A" and rule "B" in "defaults.css" are matched, which introduces dependencies on "C" and "D". However, "K" has not been selected so far, so "L" and "M" are not selected.
Now imagine, "C" is defined in "anotherSkin.swc", and there's a "defaults.css" in "anotherSkin.swc" as well.
C { zSkin : ClassReference("K"); }In the 3rd iteration, rule "C" is matched because "C" was selected in the previous iteration, which makes "K" the selected dependency.
At the beginning of the 4th iteration, the classes selected for linking are "A", "B", "C", "D" and "K". In this iteration, these classes will be tested against all the "activated style sheets" - "styles.css" and two "defaults.css" in "myskins.swc" and "anotherSkin.swc". "K" rules in "styles.css" and "myskins.swc" are now matched, which introduces new dependencies on "L" and "M".
In the 5th iteration, the classes to link are "A", "B", "C", "D", "K", "L" and "M". They are tested against all the activate CSS. No more dependencies are introduced by CSS rules, making it the last iteration of the loop.
findAllCompilationUnitsToLink
in class Target
compilationUnits
- Collection of compilation units known to be
linked in.problems
- Collection of ICompilerProblem
's that the each
found ICompilationUnit
is added to.InterruptedException
public void collectMixinMetaData(TreeSet<String> mixinClassNames, List<ICompilationUnit> units)
Copyright © 2016 The Apache Software Foundation. All rights reserved.