com.android.tools.lint.detector.api
Class Project

java.lang.Object
  extended by com.android.tools.lint.detector.api.Project

public class Project
extends Object

A project contains information about an Android project being scanned for Lint errors.

TODO: Accumulate more project info here, such as the project package name, the minimum and target SDK API levels, etc.


Constructor Summary
Project(LintClient tool, File dir, File referenceDir)
          Creates a new Project.
 
Method Summary
 void addFile(File file)
          Adds the given file to the list of files which should be checked in this project.
 boolean equals(Object obj)
           
 Configuration getConfiguration()
          Gets the configuration associated with this project
 File getDir()
          Returns the project root directory
 String getDisplayPath(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
 List<File> getJavaClassFolders()
          Returns the list of output folders for class files
 List<File> getJavaSourceFolders()
          Returns the list of source folders for Java source files
 int getMinSdk()
          Returns the minimum API level requested by the manifest, or -1 if not specified
 String getPackage()
          Returns the application package specified by the manifest
 File getReferenceDir()
          Returns the original user supplied directory where the lint search started.
 String getRelativePath(File file)
          Returns the relative path of a given file within the current project.
 List<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()
           
 void readManifest(Document document)
          Initialized the manifest state from the given manifest model
 void setConfiguration(Configuration configuration)
          Sets the configuration associated with this project
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Project

public Project(LintClient tool,
               File dir,
               File referenceDir)
Creates a new Project.

Parameters:
tool - the tool running the lint check
dir - the root directory of the project
referenceDir - See getReferenceDir().
Method Detail

toString

public String toString()
Overrides:
toString in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

addFile

public void addFile(File file)
Adds the given file to the list of files which should be checked in this project. If no files are added, the whole project will be checked.

Parameters:
file - the file to be checked

getSubset

public List<File> getSubset()
The list of files to be checked in this project. If null, the whole project should be checked.

Returns:
the subset of files to be checked, or null for the whole project

getJavaSourceFolders

public List<File> getJavaSourceFolders()
Returns the list of source folders for Java source files

Returns:
a list of source folders to search for .java files

getJavaClassFolders

public List<File> getJavaClassFolders()
Returns the list of output folders for class files

Returns:
a list of output folders to search for .class files

getDisplayPath

public String getDisplayPath(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

Parameters:
file - the file under this project to check
Returns:
the path relative to the reference directory (often the project directory)

getRelativePath

public String getRelativePath(File file)
Returns the relative path of a given file within the current project.

Parameters:
file - the file under this project to check
Returns:
the path relative to the project

getDir

public File getDir()
Returns the project root directory

Returns:
the dir

getReferenceDir

public File getReferenceDir()
Returns the original user supplied directory where the lint search started. For example, if you run lint against /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/.

Returns:
the reference directory, never null

getConfiguration

public Configuration getConfiguration()
Gets the configuration associated with this project

Returns:
the configuration associated with this project

setConfiguration

public void setConfiguration(Configuration configuration)
Sets the configuration associated with this project

Parameters:
configuration - sets the configuration associated with this project

getPackage

public String getPackage()
Returns the application package specified by the manifest

Returns:
the application package, or null if unknown

getMinSdk

public int getMinSdk()
Returns the minimum API level requested by the manifest, or -1 if not specified

Returns:
the minimum API level or -1 if unknown

getTargetSdk

public int getTargetSdk()
Returns the target API level specified by the manifest, or -1 if not specified

Returns:
the target API level or -1 if unknown

readManifest

public void readManifest(Document document)
Initialized the manifest state from the given manifest model

Parameters:
document - the DOM document for the manifest XML document


Copyright © 2008-2012. All Rights Reserved.