001 /* 002 * SonarQube, open source software quality management tool. 003 * Copyright (C) 2008-2014 SonarSource 004 * mailto:contact AT sonarsource DOT com 005 * 006 * SonarQube is free software; you can redistribute it and/or 007 * modify it under the terms of the GNU Lesser General Public 008 * License as published by the Free Software Foundation; either 009 * version 3 of the License, or (at your option) any later version. 010 * 011 * SonarQube is distributed in the hope that it will be useful, 012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 014 * Lesser General Public License for more details. 015 * 016 * You should have received a copy of the GNU Lesser General Public License 017 * along with this program; if not, write to the Free Software Foundation, 018 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 019 */ 020 package org.sonar.api.resources; 021 022 import org.sonar.api.BatchComponent; 023 024 import java.io.File; 025 import java.io.IOException; 026 import java.nio.charset.Charset; 027 import java.util.List; 028 029 /** 030 * @since 1.10 031 * @deprecated since 3.5 replaced by {@link org.sonar.api.scan.filesystem.ModuleFileSystem} 032 */ 033 @Deprecated 034 public interface ProjectFileSystem extends BatchComponent { 035 /** 036 * Source encoding. 037 * Never null, it returns the default platform charset if it is not defined in project. 038 * (Maven property 'project.build.sourceEncoding'). 039 */ 040 Charset getSourceCharset(); 041 042 /** 043 * Project root directory. 044 */ 045 File getBasedir(); 046 047 /** 048 * Build directory. It's "${basedir}/target" by default in Maven projects. 049 */ 050 File getBuildDir(); 051 052 /** 053 * Directory where classes are placed. It's "${basedir}/target/classes" by default in Maven projects. 054 */ 055 File getBuildOutputDir(); 056 057 /** 058 * The list of existing directories with sources 059 */ 060 List<File> getSourceDirs(); 061 062 /** 063 * Adds a source directory 064 * 065 * @return the current object 066 * @deprecated since 2.6 - ProjectFileSystem should be immutable 067 * See http://jira.codehaus.org/browse/SONAR-2126 068 */ 069 @Deprecated 070 ProjectFileSystem addSourceDir(File dir); 071 072 /** 073 * The list of existing directories with tests 074 */ 075 List<File> getTestDirs(); 076 077 /** 078 * Adds a test directory 079 * 080 * @return the current object 081 * @deprecated since 2.6 - ProjectFileSystem should be immutable 082 * See http://jira.codehaus.org/browse/SONAR-2126 083 */ 084 @Deprecated 085 ProjectFileSystem addTestDir(File dir); 086 087 /** 088 * @return the directory where reporting is placed. Default is target/sites 089 */ 090 File getReportOutputDir(); 091 092 /** 093 * @return the Sonar working directory. Default is "target/sonar" 094 */ 095 File getSonarWorkingDirectory(); 096 097 /** 098 * @return file in canonical form from specified path. Path can be absolute or relative to project basedir. 099 * For example resolvePath("pom.xml") or resolvePath("src/main/java") 100 */ 101 File resolvePath(String path); 102 103 /** 104 * Source files, excluding unit tests and files matching project exclusion patterns. 105 * 106 * @param langs language filter. Check all files, whatever their language, if null or empty. 107 * @deprecated since 2.6 use {@link #mainFiles(String...)} instead. 108 * See http://jira.codehaus.org/browse/SONAR-2126 109 */ 110 @Deprecated 111 List<File> getSourceFiles(Language... langs); 112 113 /** 114 * Java source files, excluding unit tests and files matching project exclusion patterns. Shortcut for getSourceFiles(Java.INSTANCE) 115 * 116 * @deprecated since 2.6 use {@link #mainFiles(String...)} instead. 117 * See http://jira.codehaus.org/browse/SONAR-2126 118 */ 119 @Deprecated 120 List<File> getJavaSourceFiles(); 121 122 /** 123 * Check if the project has Java files, excluding unit tests and files matching project exclusion patterns. 124 * 125 * @deprecated since 2.6 - API should be language agnostic 126 */ 127 @Deprecated 128 boolean hasJavaSourceFiles(); 129 130 /** 131 * Unit test files, excluding files matching project exclusion patterns. 132 * 133 * @deprecated since 2.6 use {@link #testFiles(String...)} instead. 134 * See http://jira.codehaus.org/browse/SONAR-2126 135 */ 136 @Deprecated 137 List<File> getTestFiles(Language... langs); 138 139 /** 140 * Check if the project has unit test files, excluding files matching project exclusion patterns. 141 * 142 * @deprecated since 2.6 - use language key instead of Language object 143 */ 144 @Deprecated 145 boolean hasTestFiles(Language lang); 146 147 /** 148 * Save data into a new file of Sonar working directory. 149 * 150 * @return the created file 151 */ 152 File writeToWorkingDirectory(String content, String fileName) throws IOException; 153 154 File getFileFromBuildDirectory(String filename); 155 156 Resource toResource(File file); 157 158 /** 159 * Source files, excluding unit tests and files matching project exclusion patterns. 160 * 161 * @param langs language filter. If null or empty, will return empty list 162 * @since 2.6 163 */ 164 List<InputFile> mainFiles(String... langs); 165 166 /** 167 * Source files of unit tests. Exclusion patterns are not applied. 168 * 169 * @param langs language filter. If null or empty, will return empty list 170 * @since 2.6 171 */ 172 List<InputFile> testFiles(String... langs); 173 174 }