public abstract class CompilerProject extends Object implements ICompilerProject
| Modifier and Type | Field and Description |
|---|---|
protected DependencyGraph |
dependencyGraph
Dependency graph is used to keep track of which
ICompilationUnit
's are in this project. |
protected Collection<ICompilerProblem> |
problems |
protected Set<Target> |
targets |
| Constructor and Description |
|---|
CompilerProject(Workspace workspace,
boolean useAS3) |
| Modifier and Type | Method and Description |
|---|---|
void |
addCompilationUnit(ICompilationUnit unit)
Add a
ICompilationUnit to the project. |
void |
addCompilationUnits(Collection<ICompilationUnit> units)
Add compilation units to the project.
|
void |
addCompilationUnitsAndUpdateDefinitions(Collection<ICompilationUnit> compilationUnits)
Adds compilation units to the project and updates the public and private
definitions.
|
void |
addConfigVariable(String namespace,
String expression)
Sets project config variable for use on this project
|
void |
addConfigVariables(Map<String,String> map)
Sets project config variables for use on this project
|
void |
addDependency(ICompilationUnit from,
ICompilationUnit to,
DependencyType dt)
Adds an anonymous dependency from one
ICompilationUnit to another
ICompilationUnit. |
void |
addDependency(ICompilationUnit from,
ICompilationUnit to,
DependencyTypeSet dt,
String qname)
Adds a dependency from one
ICompilationUnit to another
ICompilationUnit. |
void |
addDependency(ICompilationUnit from,
ICompilationUnit to,
DependencyType dt,
String qname)
Adds a dependency from one
ICompilationUnit to another
ICompilationUnit. |
void |
addEmbedCompilationUnit(EmbedCompilationUnit unit) |
void |
addGlobalUsedNamespacesToNamespaceSet(Set<INamespaceDefinition> nsSet) |
void |
addToASTCache(IASNode ast)
Add AST to cache.
|
void |
addUnfoundDefinitionDependency(String definitionBaseName,
ICompilationUnit compilationUnit) |
void |
addUnfoundReferencedSourceFileDependency(String sourceFilename,
ICompilationUnit compilationUnit)
Notify project that a compilation unit could not find a referenced file.
|
void |
clean()
Removes all data created during a compile
|
void |
clearScopeCacheForCompilationUnit(ICompilationUnit compilationUnit)
Clears all the
ASScopeCaches associated with the specified
ICompilationUnit and removes all the IASScopes build by
the ICompilationUnit from the list of scopes associated with the
ICompilationUnit. |
protected void |
collectConfigProblems(Collection<ICompilerProblem> problems)
Gets the project level
ICompilerProblem's that come from parsing the
config options, from the command line, or a configuration file |
abstract void |
collectProblems(Collection<ICompilerProblem> problems)
Gets project level
ICompilerProblem's target are not specific to any
one target created by the project. |
ISWFTarget |
createSWFTarget(ITargetSettings targetSettings,
ITargetProgressMonitor progressMonitor)
Create a SWF target
|
void |
delete()
Called before a project is deleted.
|
IDefinition |
doubleCheckAmbiguousDefinition(ASScope scope,
String name,
IDefinition def1,
IDefinition def2)
Override this to disambiguate between two ambiguous definitinos
|
String |
getActualPackageName(String packageName)
Override this to permit package aliasing on imports and elsewhere
|
ITypeDefinition |
getBuiltinType(IASLanguageConstants.BuiltinType type)
Helper method to get some of the built-in types (*, String, Number, etc).
|
ASScopeCache |
getCacheForScope(ASScope scope)
Get the cache for a particular scope
|
EmbedCompilationUnit |
getCompilationUnit(EmbedData data)
Return the compilation unit related this EmbedData, or it's equivalent.
|
Collection<ICompilationUnit> |
getCompilationUnits() |
Collection<ICompilationUnit> |
getCompilationUnits(String filename)
Get all compilation units from the filename
|
Set<ICompilationUnit> |
getDependencies(ICompilationUnit cu)
Gets the set of dependencies referenced by the specified
ICompilationUnit. in the absence of wierd things like
defaults/theme css, this is just the set of ICompilationUnit's
that define definitions directly referenced by the specified
ICompilationUnit. |
Set<ICompilationUnit> |
getDependenciesOnDefinition(String definitionBaseName) |
Set<ICompilationUnit> |
getDependenciesOnUnfoundDefinition(String definitionBaseName) |
Set<ICompilationUnit> |
getDependenciesOnUnfoundReferencedSourceFile(String sourceFilename)
gets the set of all compilation units that have an unsatisfied reference to a given file.
|
DependencyGraph |
getDependencyGraph() |
Set<ICompilationUnit> |
getDirectDependencies(ICompilationUnit cu)
Gets the set of compilation units depended on directly
by the specified compilation unit.
|
Set<ICompilationUnit> |
getDirectReverseDependencies(ICompilationUnit cu,
DependencyTypeSet types)
Gets the set of compilation units that directly depend on the specified compilation unit.
|
Collection<ICompilerProblem> |
getFatalProblems()
Check for fatal problems, that would prevent us from successfully compiling.
|
Collection<ICompilationUnit> |
getIncludingCompilationUnits(String filename)
Get all compilation units from which the filename is included.
|
Collection<ICompilerProblem> |
getProblems() |
IProjectConfigVariables |
getProjectConfigVariables()
Returns an
IProjectConfigVariables struct that contains all the config data for this project |
List<ICompilationUnit> |
getReachableCompilationUnitsInSWFOrder(Collection<ICompilationUnit> roots)
Given a set of roots node in the dependency graph, compute a list of
ICompilationUnit's that are reachable from the specified roots. |
ASProjectScope |
getScope() |
IDefinition |
getUndefinedValue()
Helper method to get the only built-in value (undefined).
|
boolean |
getUseParallelCodeGeneration()
Gets a boolean that indicates whether or not parallel code generation of method bodies is enabled.
|
Workspace |
getWorkspace() |
abstract boolean |
handleAddedFile(File addedFile)
Called by
Workspace.fileAdded(org.apache.flex.compiler.filespecs.IFileSpecification)
for each project in the workspace. |
protected ASProjectScope |
initProjectScope(CompilerProject project)
Init the project scope.
|
boolean |
isCompatibleOverrideReturnType(ITypeDefinition overrideDefinition,
ITypeDefinition baseDefinition) |
boolean |
isInliningEnabled()
Test whether the project supports function inlining
|
boolean |
isValidTypeConversion(IASNode node,
IDefinition actualDefinition,
IDefinition expectedDefinition,
FunctionDefinition func) |
void |
removeAnyUnfoundDependencies(ICompilationUnit compilationUnit) |
void |
removeCompilationUnit(ICompilationUnit unit)
Removes a
ICompilationUnit from the project. |
void |
removeCompilationUnits(Collection<ICompilationUnit> unitsToRemove)
Removes a set of
ICompilationUnit's from the project. |
void |
removeDependencies(Collection<ICompilationUnit> units)
Removes the outgoing dependencies of a collection of
ICompilationUnit. |
void |
resetScopeCacheForCompilationUnit(ICompilationUnit compilationUnit)
Resets all the
ASScopeCaches associated with the specified
ICompilationUnit. |
ICompilationUnit |
resolveQNameToCompilationUnit(String qName)
Resolve a QName such as
mx.controls.Button to the containing
ICompilationUnit |
IDefinition |
resolveQNameToDefinition(String qName)
Resolve a QName such as
mx.controls.Button to a class definition. |
void |
setEnableInlining(boolean enableInlining)
Set whether or not function inlining is enabled.
|
void |
setProblems(Collection<ICompilerProblem> problems)
collection of compiler problems.
|
void |
setUseParallelCodeGeneration(boolean useParallelCodeGeneration)
Enables or disables parallel code generation of method bodies.
|
void |
unitTestingEntryPointForRemovingCompilationUnit(ICompilationUnit unit)
Don't call this from production code.
|
void |
updatePublicAndInternalDefinitions(Collection<ICompilationUnit> units)
Updates the
ASProjectScope to contain reference to public and
internal definitions in those compilation units. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitisAssetEmbeddingSupportedprotected Collection<ICompilerProblem> problems
protected final DependencyGraph dependencyGraph
ICompilationUnit
's are in this project. The dependency graph is in this shared base class
instead of being in ASProject because ICompilationUnit
implementations will want to update the dependency graph and
ICompilationUnit implementations should be able to behave the
same irrespective of what type of CompilerProject they are in.public CompilerProject(Workspace workspace, boolean useAS3)
protected ASProjectScope initProjectScope(CompilerProject project)
ASProjectScopeproject - the project to build the scope fromASProjectScopepublic ASProjectScope getScope()
getScope in interface ICompilerProjectpublic Workspace getWorkspace()
getWorkspace in interface ICompilerProjectpublic List<ICompilationUnit> getReachableCompilationUnitsInSWFOrder(Collection<ICompilationUnit> roots)
ICompilerProjectICompilationUnit's that are reachable from the specified roots.
The returned list of ICompilationUnit's is in the order in which
the ICompilationUnit's should be added to a SWF.getReachableCompilationUnitsInSWFOrder in interface ICompilerProjectroots - The roots of the dependency graph that is walked to compute
which CompilationUnits to include in the return value.ICompilationUnit's reachable from the specified roots
in the order the ICompilationUnit's should be added to a SWF.public void updatePublicAndInternalDefinitions(Collection<ICompilationUnit> units) throws InterruptedException
ASProjectScope to contain reference to public and
internal definitions in those compilation units.units - ICompilationUnit's to add to the project.InterruptedExceptionpublic void addCompilationUnitsAndUpdateDefinitions(Collection<ICompilationUnit> compilationUnits) throws InterruptedException
ICompilationUnit's to be injected into a project.compilationUnits - A collection of compilation units.InterruptedExceptionpublic void addEmbedCompilationUnit(EmbedCompilationUnit unit) throws InterruptedException
InterruptedExceptionpublic void addCompilationUnit(ICompilationUnit unit)
ICompilationUnit to the project. Calling this method does not
trigger the ICompilationUnit to be compiled.unit - ICompilationUnit to addpublic void addCompilationUnits(Collection<ICompilationUnit> units)
units - compilation unitspublic void removeCompilationUnit(ICompilationUnit unit)
ICompilationUnit from the project.unit - ICompilationUnit to remove.public void unitTestingEntryPointForRemovingCompilationUnit(ICompilationUnit unit)
public void removeCompilationUnits(Collection<ICompilationUnit> unitsToRemove)
ICompilationUnit's from the project.unitsToRemove - ICompilationUnit's to remove.public Collection<ICompilationUnit> getCompilationUnits()
getCompilationUnits in interface ICompilerProjectpublic Collection<ICompilationUnit> getCompilationUnits(String filename)
ICompilerProjectgetCompilationUnits in interface ICompilerProjectfilename - path to source filepublic Collection<ICompilationUnit> getIncludingCompilationUnits(String filename)
ICompilerProjectThe returned collection does not include invisible compilation units.
getIncludingCompilationUnits in interface ICompilerProjectfilename - path to source filepublic void addUnfoundDefinitionDependency(String definitionBaseName, ICompilationUnit compilationUnit)
public Set<ICompilationUnit> getDependenciesOnUnfoundDefinition(String definitionBaseName)
public void addUnfoundReferencedSourceFileDependency(String sourceFilename, ICompilationUnit compilationUnit)
sourceFilename - The full path to the required filecompilationUnit - The compilation unit that requires the referenced filepublic Set<ICompilationUnit> getDependenciesOnUnfoundReferencedSourceFile(String sourceFilename)
sourceFilename - The path to the file.public void removeAnyUnfoundDependencies(ICompilationUnit compilationUnit)
public Set<ICompilationUnit> getDependenciesOnDefinition(String definitionBaseName)
public void clean()
ICompilerProjectclean in interface ICompilerProjectpublic void delete()
ICompilerProjectdelete in interface ICompilerProjectpublic ISWFTarget createSWFTarget(ITargetSettings targetSettings, ITargetProgressMonitor progressMonitor) throws InterruptedException
ICompilerProjectcreateSWFTarget in interface ICompilerProjecttargetSettings - The settings to use for this targetprogressMonitor - to collect progress information, can be nullInterruptedExceptionpublic void addDependency(ICompilationUnit from, ICompilationUnit to, DependencyTypeSet dt, String qname)
ICompilationUnit to another
ICompilationUnit.from - ICompilationUnit that depends on "to".to - ICompilationUnit that is depended on by "from".dt - The types of dependencies to add.qname - The qname of the target dependency addedpublic void addDependency(ICompilationUnit from, ICompilationUnit to, DependencyType dt, String qname)
ICompilationUnit to another
ICompilationUnit.from - ICompilationUnit that depends on "to".to - ICompilationUnit that is depended on by "from".dt - The type of dependency to add.qname - The qname of the target dependency addedpublic void addDependency(ICompilationUnit from, ICompilationUnit to, DependencyType dt)
ICompilationUnit to another
ICompilationUnit. This dependency will not be used in the link report.from - ICompilationUnit that depends on "to".to - ICompilationUnit that is depended on by "from".dt - The type of dependency to add.public void removeDependencies(Collection<ICompilationUnit> units)
ICompilationUnit.units - ICompilationUnit to remove dependencies from.public Set<ICompilationUnit> getDependencies(ICompilationUnit cu) throws InterruptedException
ICompilationUnit. in the absence of wierd things like
defaults/theme css, this is just the set of ICompilationUnit's
that define definitions directly referenced by the specified
ICompilationUnit.
This method can be overridden by subclasses to add additional dependencies that are not in the dependency graph.
cu - ICompilationUnit to retrieve dependencies for.ICompilationUnit's that the specified
ICompilationUnit directly depends on.InterruptedExceptionpublic abstract void collectProblems(Collection<ICompilerProblem> problems)
ICompilerProblem's target are not specific to any
one target created by the project.protected void collectConfigProblems(Collection<ICompilerProblem> problems)
ICompilerProblem's that come from parsing the
config options, from the command line, or a configuration fileproblems - the Collection to add the config problems to.public ASScopeCache getCacheForScope(ASScope scope)
scope - the scope you want the cache for.public void clearScopeCacheForCompilationUnit(ICompilationUnit compilationUnit)
ASScopeCaches associated with the specified
ICompilationUnit and removes all the IASScopes build by
the ICompilationUnit from the list of scopes associated with the
ICompilationUnit. This method should only be called when a
ICompilationUnit is being removed from a project.compilationUnit - ICompilationUnit whose scope caches should
be cleared and whose scope list should be emptied.public void resetScopeCacheForCompilationUnit(ICompilationUnit compilationUnit)
ASScopeCaches associated with the specified
ICompilationUnit.compilationUnit - ICompilationUnit whose scope caches should
be clearedpublic void addGlobalUsedNamespacesToNamespaceSet(Set<INamespaceDefinition> nsSet)
public abstract boolean handleAddedFile(File addedFile)
Workspace.fileAdded(org.apache.flex.compiler.filespecs.IFileSpecification)
for each project in the workspace. Each subclass of this class must
decide when an added file is interesting or should be ignored.addedFile - File that was added.public EmbedCompilationUnit getCompilationUnit(EmbedData data)
data - The embedding data.public final DependencyGraph getDependencyGraph()
public void addConfigVariables(Map<String,String> map)
map - the mapping of config names to their expressionsConfigManager.addConfigVariables(Map)public void addConfigVariable(String namespace, String expression)
namespace - the config namespaceexpression - the config expression for the namespaceConfigManager.addConfigVariables(Map)public IProjectConfigVariables getProjectConfigVariables()
IProjectConfigVariables struct that contains all the config data for this projectIProjectConfigVariables object, never nullpublic IDefinition resolveQNameToDefinition(String qName)
ICompilerProjectmx.controls.Button to a class definition.resolveQNameToDefinition in interface ICompilerProjectqName - Qualified name.IDefinition corresponds to the given QName; Null if
the name can't be resolved.public ICompilationUnit resolveQNameToCompilationUnit(String qName)
ICompilerProjectmx.controls.Button to the containing
ICompilationUnitresolveQNameToCompilationUnit in interface ICompilerProjectqName - Qualified name.ICompilationUnit corresponds to the given QName; Null if
the name can't be resolved.public Collection<ICompilerProblem> getFatalProblems()
public ITypeDefinition getBuiltinType(IASLanguageConstants.BuiltinType type)
ICompilerProjectgetBuiltinType in interface ICompilerProjectpublic IDefinition getUndefinedValue()
ICompilerProjectgetUndefinedValue in interface ICompilerProjectpublic boolean getUseParallelCodeGeneration()
public void setUseParallelCodeGeneration(boolean useParallelCodeGeneration)
ICompilerProjectsetUseParallelCodeGeneration in interface ICompilerProjectuseParallelCodeGeneration - If true, method bodies will be generated
in parallel.public Set<ICompilationUnit> getDirectDependencies(ICompilationUnit cu)
ICompilerProjectgetDirectDependencies in interface ICompilerProjectcu - The ICompilationUnit whose set of direct dependencies
will be returned.public Set<ICompilationUnit> getDirectReverseDependencies(ICompilationUnit cu, DependencyTypeSet types)
ICompilerProjectgetDirectReverseDependencies in interface ICompilerProjectcu - An ICompilationUnit.types - A DependencyTypeSet of dependency types used to filter
the returned set of compilation units.public boolean isInliningEnabled()
ICompilerProjectisInliningEnabled in interface ICompilerProjectpublic void setEnableInlining(boolean enableInlining)
enableInlining - true to enable inlining.public void addToASTCache(IASNode ast)
ast - The AST.public String getActualPackageName(String packageName)
getActualPackageName in interface ICompilerProjectpackageName - The package namepublic IDefinition doubleCheckAmbiguousDefinition(ASScope scope, String name, IDefinition def1, IDefinition def2)
doubleCheckAmbiguousDefinition in interface ICompilerProjectscope - The current scope.name - Definition name.def1 - One possibility.def2 - The other possibility.public Collection<ICompilerProblem> getProblems()
getProblems in interface ICompilerProjectpublic void setProblems(Collection<ICompilerProblem> problems)
setProblems in interface ICompilerProjectproblems - All the problems collected so far.
Set this to the main collection so parts of the compiler
can add a problem if they don't have another place to add them.public boolean isCompatibleOverrideReturnType(ITypeDefinition overrideDefinition, ITypeDefinition baseDefinition)
isCompatibleOverrideReturnType in interface ICompilerProjectoverrideDefinition - The definition overriding the base definition.baseDefinition - The definition being overridden.public boolean isValidTypeConversion(IASNode node, IDefinition actualDefinition, IDefinition expectedDefinition, FunctionDefinition func)
isValidTypeConversion in interface ICompilerProjectnode - The node being converted.actualDefinition - The actual definition.expectedDefinition - The expected definition.func - The function being called.Copyright © 2016 The Apache Software Foundation. All rights reserved.