1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
|
/*
* Sonar, open source software quality management tool.
* Copyright (C) 2008-2011 SonarSource
* mailto:contact AT sonarsource DOT com
*
* Sonar is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* Sonar is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with Sonar; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
*/
package org.sonar.api.resources;
import org.sonar.api.BatchComponent;
import java.io.File;
import java.io.IOException;
import java.nio.charset.Charset;
import java.util.List;
/**
* @since 1.10
*/
public interface ProjectFileSystem extends BatchComponent {
/**
* Source encoding.
* Never null, it returns the default platform charset if it is not defined in project.
* (Maven property 'project.build.sourceEncoding').
*/
Charset getSourceCharset();
/**
* Project root directory.
*/
File getBasedir();
/**
* Build directory. It's "${basedir}/target" by default in Maven projects.
*/
File getBuildDir();
/**
* Directory where classes are placed. It's "${basedir}/target/classes" by default in Maven projects.
*/
File getBuildOutputDir();
/**
* The list of directories for sources
*/
List<File> getSourceDirs();
/**
* Adds a source directory
*
* @return the current object
* @deprecated since 2.6 - ProjectFileSystem should be immutable
* See http://jira.codehaus.org/browse/SONAR-2126
*/
ProjectFileSystem addSourceDir(File dir);
/**
* The list of directories for tests
*/
List<File> getTestDirs();
/**
* Adds a test directory
*
* @return the current object
* @deprecated since 2.6 - ProjectFileSystem should be immutable
* See http://jira.codehaus.org/browse/SONAR-2126
*/
ProjectFileSystem addTestDir(File dir);
/**
* @return the directory where reporting is placed. Default is target/sites
*/
File getReportOutputDir();
/**
* @return the Sonar working directory. Default is "target/sonar"
*/
File getSonarWorkingDirectory();
/**
* Get file from path. It can be absolute or relative to project basedir. For example resolvePath("pom.xml") or
* resolvePath("src/main/java")
*/
File resolvePath(String path);
/**
* Source files, excluding unit tests and files matching project exclusion patterns.
*
* @param langs language filter. Check all files, whatever their language, if null or empty.
* @deprecated since 2.6 use {@link #mainFiles(Language...)} instead.
* See http://jira.codehaus.org/browse/SONAR-2126
*/
@Deprecated
List<File> getSourceFiles(Language... langs);
/**
* Java source files, excluding unit tests and files matching project exclusion patterns. Shortcut for getSourceFiles(Java.INSTANCE)
*
* @deprecated since 2.6 use {@link #mainFiles(Language...)} instead.
* See http://jira.codehaus.org/browse/SONAR-2126
*/
@Deprecated
List<File> getJavaSourceFiles();
/**
* Check if the project has Java files, excluding unit tests and files matching project exclusion patterns.
*
* @deprecated since 2.6 - API should be language agnostic
*/
@Deprecated
boolean hasJavaSourceFiles();
/**
* Unit test files, excluding files matching project exclusion patterns.
*
* @deprecated since 2.6 use {@link #testFiles(Language...)} instead.
* See http://jira.codehaus.org/browse/SONAR-2126
*/
@Deprecated
List<File> getTestFiles(Language... langs);
/**
* Check if the project has unit test files, excluding files matching project exclusion patterns.
*
* @deprecated since 2.6 - use language key instead of Language object
*/
@Deprecated
boolean hasTestFiles(Language lang);
/**
* Save data into a new file of Sonar working directory.
*
* @return the created file
*/
File writeToWorkingDirectory(String content, String fileName) throws IOException;
File getFileFromBuildDirectory(String filename);
Resource toResource(File file);
/**
* Source files, excluding unit tests and files matching project exclusion patterns.
*
* @param langs language filter. If null or empty, will return empty list
* @since 2.6
*/
List<InputFile> mainFiles(String... langs);
/**
* TODO comment me
*
* @param langs language filter. If null or empty, will return empty list
* @since 2.6
*/
List<InputFile> testFiles(String... langs);
}
|