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 */ 020package org.sonar.api.resources; 021 022import org.sonar.api.BatchComponent; 023import org.sonar.api.batch.fs.FileSystem; 024 025import java.io.File; 026import java.io.IOException; 027import java.nio.charset.Charset; 028import java.util.List; 029 030/** 031 * @since 1.10 032 * @deprecated since 3.5 replaced by {@link FileSystem} 033 */ 034@Deprecated 035public interface ProjectFileSystem extends BatchComponent { 036 /** 037 * Source encoding. 038 * Never null, it returns the default platform charset if it is not defined in project. 039 * (Maven property 'project.build.sourceEncoding'). 040 */ 041 Charset getSourceCharset(); 042 043 /** 044 * Project root directory. 045 */ 046 File getBasedir(); 047 048 /** 049 * Build directory. It's "${basedir}/target" by default in Maven projects. 050 */ 051 File getBuildDir(); 052 053 /** 054 * Directory where classes are placed. It's "${basedir}/target/classes" by default in Maven projects. 055 */ 056 File getBuildOutputDir(); 057 058 /** 059 * The list of existing directories with sources 060 */ 061 List<File> getSourceDirs(); 062 063 /** 064 * Adds a source directory 065 * 066 * @return the current object 067 * @deprecated since 2.6 - ProjectFileSystem should be immutable 068 * See http://jira.codehaus.org/browse/SONAR-2126 069 */ 070 @Deprecated 071 ProjectFileSystem addSourceDir(File dir); 072 073 /** 074 * The list of existing directories with tests 075 */ 076 List<File> getTestDirs(); 077 078 /** 079 * Adds a test directory 080 * 081 * @return the current object 082 * @deprecated since 2.6 - ProjectFileSystem should be immutable 083 * See http://jira.codehaus.org/browse/SONAR-2126 084 */ 085 @Deprecated 086 ProjectFileSystem addTestDir(File dir); 087 088 /** 089 * @return the directory where reporting is placed. Default is target/sites 090 */ 091 File getReportOutputDir(); 092 093 /** 094 * @return the Sonar working directory. Default is "target/sonar" 095 */ 096 File getSonarWorkingDirectory(); 097 098 /** 099 * @return file in canonical form from specified path. Path can be absolute or relative to project basedir. 100 * For example resolvePath("pom.xml") or resolvePath("src/main/java") 101 * @deprecated since 5.0 use {@link FileSystem#resolvePath(String)} 102 */ 103 File resolvePath(String path); 104 105 /** 106 * Source files, excluding unit tests and files matching project exclusion patterns. 107 * 108 * @param langs language filter. Check all files, whatever their language, if null or empty. 109 * @deprecated since 2.6 use {@link #mainFiles(String...)} instead. 110 * See http://jira.codehaus.org/browse/SONAR-2126 111 */ 112 @Deprecated 113 List<File> getSourceFiles(Language... langs); 114 115 /** 116 * Java source files, excluding unit tests and files matching project exclusion patterns. Shortcut for getSourceFiles(Java.INSTANCE) 117 * 118 * @deprecated since 2.6 use {@link #mainFiles(String...)} instead. 119 * See http://jira.codehaus.org/browse/SONAR-2126 120 */ 121 @Deprecated 122 List<File> getJavaSourceFiles(); 123 124 /** 125 * Check if the project has Java files, excluding unit tests and files matching project exclusion patterns. 126 * 127 * @deprecated since 2.6 - API should be language agnostic 128 */ 129 @Deprecated 130 boolean hasJavaSourceFiles(); 131 132 /** 133 * Unit test files, excluding files matching project exclusion patterns. 134 * 135 * @deprecated since 2.6 use {@link #testFiles(String...)} instead. 136 * See http://jira.codehaus.org/browse/SONAR-2126 137 */ 138 @Deprecated 139 List<File> getTestFiles(Language... langs); 140 141 /** 142 * Check if the project has unit test files, excluding files matching project exclusion patterns. 143 * 144 * @deprecated since 2.6 - use language key instead of Language object 145 */ 146 @Deprecated 147 boolean hasTestFiles(Language lang); 148 149 /** 150 * Save data into a new file of Sonar working directory. 151 * 152 * @return the created file 153 */ 154 File writeToWorkingDirectory(String content, String fileName) throws IOException; 155 156 File getFileFromBuildDirectory(String filename); 157 158 Resource toResource(File file); 159 160 /** 161 * Source files, excluding unit tests and files matching project exclusion patterns. 162 * 163 * @param langs language filter. If null or empty, will return empty list 164 * @since 2.6 165 */ 166 List<InputFile> mainFiles(String... langs); 167 168 /** 169 * Source files of unit tests. Exclusion patterns are not applied. 170 * 171 * @param langs language filter. If null or empty, will return empty list 172 * @since 2.6 173 */ 174 List<InputFile> testFiles(String... langs); 175 176}