/*
* Sonar Runner
* Copyright (C) 2011 SonarSource
* dev@sonar.codehaus.org
*
* 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 02
*/
package org.sonar.runner;
import java.io.File;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import java.util.Properties;
/**
*
* Sonar Runner class that can be used to launch Sonar analyses.
*
*
* Configuration is all done through properties:
*
*
*
"sonar.projectDir": the base directory of the project to analyse (this can also be passed via the {@link #create(Properties, File)} constructor)
*
"sonar.working.directory": the working directory, which is "${sonar.projectDir}/.sonar" by default.
*
"sonar.verbose": if set to "true", more information is displayed in the log
*
"sonar.environment.information.key" and "sonar.environment.information.version": can be used to overwrite environment information (can also be
* set via {@link #setEnvironmentInformation(String, String)} method)
*
... plus all the other Sonar and Sonar plugins properties.
*
*
* @since 1.1
*/
public final class Runner {
/**
* Old property used to activate debug level for logging.
*
* @deprecated Replaced by sonar.verbose since 1.2
*/
@Deprecated
public static final String PROPERTY_OLD_DEBUG_MODE = "runner.debug";
/**
* Property used to increase logging information.
*
* @since 1.2
*/
public static final String PROPERTY_VERBOSE = "sonar.verbose";
/**
* Property used to specify the working directory for the runner. May be a relative or absolute path.
*
* @since 1.4
*/
public static final String PROPERTY_WORK_DIRECTORY = "sonar.working.directory";
/**
* Default value of the working directory.
*/
public static final String DEF_VALUE_WORK_DIRECTORY = ".sonar";
/**
* Property used to specify the base directory of the project to analyse.
*
* @since 1.5
*/
public static final String PROPERTY_SONAR_PROJECT_BASEDIR = "sonar.projectBaseDir";
/**
* Property used to specify the name of the tool that will run a Sonar analysis.
*
* @since 1.5
*/
public static final String PROPERTY_ENVIRONMENT_INFORMATION_KEY = "sonar.environment.information.key";
/**
* Property used to specify the version of the tool that will run a Sonar analysis.
*
* @since 1.5
*/
public static final String PROPERTY_ENVIRONMENT_INFORMATION_VERSION = "sonar.environment.information.version";
/**
* Array of prefixes of versions of Sonar without support of this runner.
*/
private static final String[] UNSUPPORTED_VERSIONS = {"1", "2.0", "2.1", "2.2", "2.3", "2.4", "2.5", "2.6", "2.7", "2.8", "2.9", "2.10"};
private File projectDir;
private File workDir;
private String[] unmaskedPackages;
private List