diff options
Diffstat (limited to 'sonar-plugin-api')
5 files changed, 8 insertions, 344 deletions
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/bootstrap/ProjectDefinition.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/bootstrap/ProjectDefinition.java index 2e5b8ec608c..4c08735f062 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/bootstrap/ProjectDefinition.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/bootstrap/ProjectDefinition.java @@ -83,11 +83,19 @@ public class ProjectDefinition { return workDir; } + /** + * @deprecated since 6.1 notion of buildDir is not well defined + */ + @Deprecated public ProjectDefinition setBuildDir(File d) { this.buildDir = d; return this; } + /** + * @deprecated since 6.1 notion of buildDir is not well defined + */ + @Deprecated public File getBuildDir() { return buildDir; } diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/scan/filesystem/FileQuery.java b/sonar-plugin-api/src/main/java/org/sonar/api/scan/filesystem/FileQuery.java deleted file mode 100644 index 0a28f44a3f4..00000000000 --- a/sonar-plugin-api/src/main/java/org/sonar/api/scan/filesystem/FileQuery.java +++ /dev/null @@ -1,150 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2016 SonarSource SA - * mailto:contact AT sonarsource DOT com - * - * This program 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. - * - * This program 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 this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -package org.sonar.api.scan.filesystem; - -import com.google.common.base.Function; -import com.google.common.collect.ArrayListMultimap; -import com.google.common.collect.Collections2; -import com.google.common.collect.ListMultimap; -import com.google.common.collect.Sets; -import org.apache.commons.lang.builder.EqualsBuilder; - -import javax.annotation.Nullable; - -import java.io.FileFilter; -import java.util.Arrays; -import java.util.Collection; -import java.util.Map; -import java.util.Set; - -/** - * @since 3.5 - * @deprecated in 4.2. Replaced by {@link org.sonar.api.batch.fs.FileSystem} and - * {@link org.sonar.api.batch.fs.FilePredicate} - */ -@Deprecated -public class FileQuery { - - private final ListMultimap<String, String> attributes = ArrayListMultimap.create(); - private final Set<String> inclusions = Sets.newHashSet(); - private final Set<String> exclusions = Sets.newHashSet(); - - public static FileQuery on(FileType... types) { - FileQuery query = new FileQuery(); - for (FileType type : types) { - query.on("TYPE", type.typeValue()); - } - return query; - } - - public static FileQuery onSource() { - return onMain(); - } - - /** - * @since 4.2 - */ - public static FileQuery onMain() { - FileQuery query = new FileQuery(); - return query.on("TYPE", "MAIN"); - } - - public static FileQuery onTest() { - FileQuery query = new FileQuery(); - return query.on("TYPE", "TEST"); - } - - private FileQuery() { - } - - public FileQuery on(String attribute, String... values) { - for (String value : values) { - attributes.put(attribute, value); - } - return this; - } - - public Map<String, Collection<String>> attributes() { - return attributes.asMap(); - } - - public Collection<FileType> types() { - return Collections2.transform(attributes.get("TYPE"), new Function<String, FileType>() { - @Override - public FileType apply(@Nullable String input) { - return input != null ? FileType.valueOf(input) : null; - } - }); - } - - public Collection<String> typeAttributes() { - return attributes.get("TYPE"); - } - - public Collection<String> languages() { - return attributes.get("LANG"); - } - - public FileQuery onLanguage(String... languages) { - return on("LANG", languages); - } - - public Collection<String> inclusions() { - return inclusions; - } - - public FileQuery withInclusions(String... inclusions) { - this.inclusions.addAll(Arrays.asList(inclusions)); - return this; - } - - public Collection<String> exclusions() { - return exclusions; - } - - public FileQuery withExclusions(String... exclusions) { - this.exclusions.addAll(Arrays.asList(exclusions)); - return this; - } - - public Collection<FileFilter> filters() { - throw new UnsupportedOperationException("TODO"); - } - - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (obj == this) { - return true; - } - if (obj.getClass() != getClass()) { - return false; - } - FileQuery rhs = (FileQuery) obj; - return new EqualsBuilder() - .append(attributes, rhs.attributes) - .append(exclusions, rhs.exclusions) - .append(inclusions, rhs.inclusions) - .isEquals(); - } - -} diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/scan/filesystem/FileSystemFilter.java b/sonar-plugin-api/src/main/java/org/sonar/api/scan/filesystem/FileSystemFilter.java deleted file mode 100644 index 0a4a43483b6..00000000000 --- a/sonar-plugin-api/src/main/java/org/sonar/api/scan/filesystem/FileSystemFilter.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2016 SonarSource SA - * mailto:contact AT sonarsource DOT com - * - * This program 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. - * - * This program 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 this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -package org.sonar.api.scan.filesystem; - -import org.sonar.api.batch.ScannerSide; -import org.sonar.api.ExtensionPoint; -import org.sonar.api.batch.fs.InputFileFilter; - -import java.io.File; - -/** - * Extension point to exclude some files from project scan. Some use-cases : - * <ul> - * <li>exclude the files that are older than x days</li> - * <li>exclude the files which names start with Generated</li> - * </ul> - * - * @since 3.5 - * @deprecated since 4.2 use {@link InputFileFilter} - */ -@Deprecated -@ScannerSide -@ExtensionPoint -public interface FileSystemFilter { - - /** - * Plugins must not implement this interface. It is provided at runtime. - */ - interface Context { - ModuleFileSystem fileSystem(); - - FileType type(); - - /** - * Changed in 5.1 as we don't keep track of relative path to source dir - * File path relative to module base directory. Never return null. - */ - String relativePath(); - - /** - * Absolute file path. Directory separator is slash, even on windows. Never return null. - */ - String canonicalPath(); - } - - boolean accept(File file, Context context); -} diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/scan/filesystem/FileType.java b/sonar-plugin-api/src/main/java/org/sonar/api/scan/filesystem/FileType.java deleted file mode 100644 index e2221a51497..00000000000 --- a/sonar-plugin-api/src/main/java/org/sonar/api/scan/filesystem/FileType.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2016 SonarSource SA - * mailto:contact AT sonarsource DOT com - * - * This program 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. - * - * This program 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 this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -package org.sonar.api.scan.filesystem; - -/** - * @since 3.5 - * @deprecated in 4.2 - */ -@Deprecated -public enum FileType { - SOURCE("MAIN"), TEST("TEST"), MAIN("MAIN"); - - private String typeValue; - - FileType(String typeValue) { - this.typeValue = typeValue; - } - - public String typeValue() { - return typeValue; - } -} diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/scan/filesystem/ModuleFileSystem.java b/sonar-plugin-api/src/main/java/org/sonar/api/scan/filesystem/ModuleFileSystem.java deleted file mode 100644 index a35ad1e8a5b..00000000000 --- a/sonar-plugin-api/src/main/java/org/sonar/api/scan/filesystem/ModuleFileSystem.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2016 SonarSource SA - * mailto:contact AT sonarsource DOT com - * - * This program 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. - * - * This program 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 this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -package org.sonar.api.scan.filesystem; - -import java.io.File; -import java.nio.charset.Charset; -import java.util.List; -import javax.annotation.CheckForNull; -import org.sonar.api.batch.ScannerSide; -import org.sonar.api.batch.fs.FileSystem; -import org.sonar.api.batch.fs.InputFile; - -/** - * @since 3.5 - * @deprecated in 4.2. Replaced by {@link org.sonar.api.batch.fs.FileSystem} - */ -@Deprecated -@ScannerSide -public interface ModuleFileSystem { - - /** - * Base directory. - */ - File baseDir(); - - /** - * Optional directory used by the build tool to generate various kinds of data (test reports, temp files, ...). - * In Maven, it's given by the property ${project.build.directory}, which value is generally ${project.basedir}/target. - */ - @CheckForNull - File buildDir(); - - /** - * Source directories. - * @deprecated since 4.2 use {@link FileSystem#files(org.sonar.api.batch.fs.FilePredicate)} to get all files with type {@link InputFile.Type#MAIN}. - */ - List<File> sourceDirs(); - - /** - * Test directories. Non-existing directories are excluded. - * Example in Maven : ${project.basedir}/src/test/java - * @deprecated since 4.2 use {@link FileSystem#files(org.sonar.api.batch.fs.FilePredicate)} to get all files with type {@link InputFile.Type#TEST}. - */ - List<File> testDirs(); - - /** - * Optional directories that contain the compiled sources, for example java bytecode. - * Note that : - * <ul> - * <li>Maven projects have only a single binary directory, which is generally ${project.basedir}/target/classes</li> - * <li>Binary directories can be empty</li> - * <li>Test binary directories are not supported yet.</li> - * </ul> - * @deprecated since 4.2 sonar.binaries will be converted to java specific property - */ - List<File> binaryDirs(); - - /** - * Search for files. Never return null. - */ - List<File> files(FileQuery query); - - /** - * Default charset for files of the module. If it's not defined, then - * return the platform default charset. - */ - Charset sourceCharset(); - - /** - * Working directory used by Sonar. This directory can be used for example to - * store intermediary reports. - */ - File workingDir(); -} |