|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.sonar.api.resources.DefaultProjectFileSystem
public class DefaultProjectFileSystem
| Constructor Summary | |
|---|---|
DefaultProjectFileSystem(Project project)
|
|
| Method Summary | |
|---|---|
DefaultProjectFileSystem |
addSourceDir(File dir)
|
DefaultProjectFileSystem |
addTestDir(File dir)
|
File |
getBasedir()
Basedir is the project root directory. |
File |
getBuildDir()
Build directory is by default "target" in maven projects. |
File |
getBuildOutputDir()
|
File |
getFileFromBuildDirectory(String filename)
|
List<File> |
getJavaSourceFiles()
Java source files, excluding unit tests and files matching project exclusion patterns. |
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()
|
List<File> |
getSourceFiles(Language... langs)
Source files, excluding unit tests and files matching project exclusion patterns. |
List<File> |
getTestDirs()
|
List<File> |
getTestFiles(Language... langs)
Unit test files, excluding files matching project exclusion patterns. |
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)
| Method Detail |
|---|
public Charset getSourceCharset()
getSourceCharset in interface ProjectFileSystempublic File getBasedir()
getBasedir in interface ProjectFileSystempublic File getBuildDir()
getBuildDir in interface ProjectFileSystempublic File getBuildOutputDir()
getBuildOutputDir in interface ProjectFileSystempublic List<File> getSourceDirs()
getSourceDirs in interface ProjectFileSystempublic DefaultProjectFileSystem addSourceDir(File dir)
addSourceDir in interface ProjectFileSystempublic List<File> getTestDirs()
getTestDirs in interface ProjectFileSystempublic DefaultProjectFileSystem addTestDir(File dir)
addTestDir in interface ProjectFileSystempublic File getReportOutputDir()
getReportOutputDir in interface ProjectFileSystempublic File getSonarWorkingDirectory()
getSonarWorkingDirectory in interface ProjectFileSystempublic File resolvePath(String path)
ProjectFileSystem
resolvePath in interface ProjectFileSystempublic List<File> getSourceFiles(Language... langs)
ProjectFileSystem
getSourceFiles in interface ProjectFileSystemlangs - language filter. Check all files, whatever their language, if null or empty.public List<File> getJavaSourceFiles()
ProjectFileSystem
getJavaSourceFiles in interface ProjectFileSystempublic boolean hasJavaSourceFiles()
ProjectFileSystem
hasJavaSourceFiles in interface ProjectFileSystempublic List<File> getTestFiles(Language... langs)
ProjectFileSystem
getTestFiles in interface ProjectFileSystempublic boolean hasTestFiles(Language lang)
ProjectFileSystem
hasTestFiles in interface ProjectFileSystem
public File writeToWorkingDirectory(String content,
String fileName)
throws IOException
writeToWorkingDirectory in interface ProjectFileSystemIOException
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 ProjectFileSystempublic Resource toResource(File file)
toResource in interface ProjectFileSystem
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||