|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.sonar.api.resources.DefaultProjectFileSystem
public class DefaultProjectFileSystem
An implementation of ProjectFileSystem
Constructor Summary | |
---|---|
DefaultProjectFileSystem(Project project)
Creates a DefaultProjectFileSystem based on a project |
Method Summary | |
---|---|
DefaultProjectFileSystem |
addSourceDir(File dir)
Adds a source directory |
DefaultProjectFileSystem |
addTestDir(File dir)
Adds a test directory |
File |
getBasedir()
Basedir is the project root directory. |
File |
getBuildDir()
Build directory is by default "target" in maven projects. |
File |
getBuildOutputDir()
Directory where classes are placed. |
File |
getFileFromBuildDirectory(String filename)
|
List<File> |
getJavaSourceFiles()
Gets the list of java source files |
static String |
getRelativePath(File file,
File dir)
getRelativePath("c:/foo/src/my/package/Hello.java", "c:/foo/src") is "my/package/Hello.java" |
static String |
getRelativePath(File file,
List<File> dirs)
getRelativePath("c:/foo/src/my/package/Hello.java", ["c:/bar", "c:/foo/src"]) is "my/package/Hello.java". |
File |
getReportOutputDir()
|
File |
getSonarWorkingDirectory()
|
Charset |
getSourceCharset()
Source encoding. |
List<File> |
getSourceDirs()
The list of directories for sources |
List<File> |
getSourceFiles(Language... langs)
Gets the list of source files for given languages |
List<File> |
getTestDirs()
The list of directories for tests |
List<File> |
getTestFiles(Language... langs)
Gets the list of test files for given languages |
boolean |
hasJavaSourceFiles()
Check if the project has Java files, excluding unit tests and files matching project exclusion patterns. |
boolean |
hasTestFiles(Language lang)
Check if the project has unit test files, excluding files matching project exclusion patterns. |
File |
resolvePath(String path)
Get file from path. |
Resource |
toResource(File file)
|
protected static File |
writeToFile(String content,
File dir,
String fileName)
|
File |
writeToWorkingDirectory(String content,
String fileName)
Save data into a new file of Sonar working directory. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DefaultProjectFileSystem(Project project)
project
- Method Detail |
---|
public Charset getSourceCharset()
getSourceCharset
in interface ProjectFileSystem
public File getBasedir()
getBasedir
in interface ProjectFileSystem
public File getBuildDir()
getBuildDir
in interface ProjectFileSystem
public File getBuildOutputDir()
getBuildOutputDir
in interface ProjectFileSystem
public List<File> getSourceDirs()
getSourceDirs
in interface ProjectFileSystem
public DefaultProjectFileSystem addSourceDir(File dir)
addSourceDir
in interface ProjectFileSystem
public List<File> getTestDirs()
getTestDirs
in interface ProjectFileSystem
public DefaultProjectFileSystem addTestDir(File dir)
addTestDir
in interface ProjectFileSystem
public File getReportOutputDir()
getReportOutputDir
in interface ProjectFileSystem
public File getSonarWorkingDirectory()
getSonarWorkingDirectory
in interface ProjectFileSystem
public File resolvePath(String path)
ProjectFileSystem
resolvePath
in interface ProjectFileSystem
public List<File> getSourceFiles(Language... langs)
getSourceFiles
in interface ProjectFileSystem
langs
- language filter. If null or empty, will return empty listpublic List<File> getJavaSourceFiles()
getJavaSourceFiles
in interface ProjectFileSystem
public boolean hasJavaSourceFiles()
ProjectFileSystem
hasJavaSourceFiles
in interface ProjectFileSystem
public List<File> getTestFiles(Language... langs)
getTestFiles
in interface ProjectFileSystem
langs
- language filter. If null or empty, will return empty listpublic boolean hasTestFiles(Language lang)
ProjectFileSystem
hasTestFiles
in interface ProjectFileSystem
public File writeToWorkingDirectory(String content, String fileName) throws IOException
writeToWorkingDirectory
in interface ProjectFileSystem
IOException
protected static File writeToFile(String content, File dir, String fileName) throws IOException
IOException
public static String getRelativePath(File file, File dir)
public static String getRelativePath(File file, List<File> dirs)
Relative path is composed of slashes. Windows backslaches are replaced by /
public File getFileFromBuildDirectory(String filename)
getFileFromBuildDirectory
in interface ProjectFileSystem
public Resource toResource(File file)
toResource
in interface ProjectFileSystem
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |