|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.android.tools.lint.detector.api.Project
@Beta public class Project
A project contains information about an Android project being scanned for Lint errors.
NOTE: This is not a public or final API; if you rely on this be prepared to adjust your code for the next tools release.
Method Summary | |
---|---|
void |
addFile(java.io.File file)
Adds the given file to the list of files which should be checked in this project. |
static Project |
create(LintClient client,
java.io.File dir,
java.io.File referenceDir)
Creates a new Project for the given directory. |
boolean |
equals(java.lang.Object obj)
|
java.util.List<Project> |
getAllLibraries()
Returns the transitive closure of the library projects for this project |
int |
getBuildSdk()
Returns the target API used to build the project, or -1 if not known |
Configuration |
getConfiguration()
Gets the configuration associated with this project |
java.io.File |
getDir()
Returns the project root directory |
java.util.List<Project> |
getDirectLibraries()
Returns the list of library projects referenced by this project |
java.lang.String |
getDisplayPath(java.io.File file)
Returns the relative path of a given file relative to the user specified directory (which is often the project directory but sometimes a higher up directory when a directory tree is being scanned |
java.util.List<java.io.File> |
getJavaClassFolders()
Returns the list of output folders for class files |
java.util.List<java.io.File> |
getJavaLibraries()
Returns the list of Java libraries (typically .jar files) that this project depends on. |
java.util.List<java.io.File> |
getJavaSourceFolders()
Returns the list of source folders for Java source files |
java.io.File |
getManifestFile()
Gets the path to the manifest file in this project, if it exists |
int |
getMinSdk()
Returns the minimum API level requested by the manifest, or -1 if not specified |
java.lang.String |
getName()
Returns the name of the project |
java.lang.String |
getPackage()
Returns the application package specified by the manifest |
java.lang.String |
getProguardPath()
Returns the proguard path configured for this project, or null if ProGuard is not configured. |
java.io.File |
getReferenceDir()
Returns the original user supplied directory where the lint search started. |
java.lang.String |
getRelativePath(java.io.File file)
Returns the relative path of a given file within the current project. |
boolean |
getReportIssues()
Returns whether lint should report issues in this project. |
java.util.List<java.io.File> |
getResourceFolders()
Returns the resource folder. |
SdkInfo |
getSdkInfo()
Gets the SDK info for the current project. |
java.util.List<java.io.File> |
getSubset()
The list of files to be checked in this project. |
int |
getTargetSdk()
Returns the target API level specified by the manifest, or -1 if not specified |
int |
hashCode()
|
boolean |
isGradleProject()
Returns true if this project is a Gradle-based Android project |
boolean |
isLibrary()
Returns true if this project is an Android library project |
boolean |
isMergingManifests()
Returns whether manifest merging is in effect |
void |
readManifest(org.w3c.dom.Document document)
Initialized the manifest state from the given manifest model |
void |
setMergingManifests(boolean merging)
Sets whether manifest merging is in effect. |
void |
setName(java.lang.String name)
Sets the name of the project |
void |
setReportIssues(boolean reportIssues)
Sets whether lint should report issues in this project. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Method Detail |
---|
@NonNull public static Project create(@NonNull LintClient client, @NonNull java.io.File dir, @NonNull java.io.File referenceDir)
Project
for the given directory.
client
- the tool running the lint checkdir
- the root directory of the projectreferenceDir
- See getReferenceDir()
.
Project
public boolean isGradleProject()
public java.lang.String toString()
toString
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(@Nullable java.lang.Object obj)
equals
in class java.lang.Object
public void addFile(@NonNull java.io.File file)
file
- the file to be checked@Nullable public java.util.List<java.io.File> getSubset()
@NonNull public java.util.List<java.io.File> getJavaSourceFolders()
@NonNull public java.util.List<java.io.File> getJavaClassFolders()
@NonNull public java.util.List<java.io.File> getJavaLibraries()
@NonNull public java.util.List<java.io.File> getResourceFolders()
@NonNull public java.lang.String getDisplayPath(@NonNull java.io.File file)
file
- the file under this project to check
@NonNull public java.lang.String getRelativePath(@NonNull java.io.File file)
file
- the file under this project to check
@NonNull public java.io.File getDir()
@NonNull public java.io.File getReferenceDir()
/tmp/foo
, and it
finds a project to lint in /tmp/foo/dev/src/project1
, then the
dir
is /tmp/foo/dev/src/project1
and the
referenceDir
is /tmp/foo/
.
@NonNull public Configuration getConfiguration()
@Nullable public java.lang.String getPackage()
public int getMinSdk()
public int getTargetSdk()
public int getBuildSdk()
public void readManifest(@NonNull org.w3c.dom.Document document)
document
- the DOM document for the manifest XML documentpublic boolean isLibrary()
@NonNull public java.util.List<Project> getDirectLibraries()
@NonNull public java.util.List<Project> getAllLibraries()
@NonNull public SdkInfo getSdkInfo()
@Nullable public java.io.File getManifestFile()
@Nullable public java.lang.String getProguardPath()
@NonNull public java.lang.String getName()
public void setName(@NonNull java.lang.String name)
name
- the name of the project, never nullpublic void setReportIssues(boolean reportIssues)
getReportIssues()
for a full description of what that means.
reportIssues
- whether lint should report issues in this projectpublic boolean getReportIssues()
If a user specifies a project and its library projects for analysis, then
those library projects are all "included", and all errors found in all
the projects are reported. But if the user is only running lint on the
main project, we shouldn't report errors in any of the library projects.
We still need to consider them for certain types of checks, such
as determining whether resources found in the main project are unused, so
the detectors must still get a chance to look at these projects. The
#getReportIssues()
attribute is used for this purpose.
public void setMergingManifests(boolean merging)
merging
- whether manifest merging is in effectpublic boolean isMergingManifests()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |