package org.sonar.runner; | package org.sonar.runner; | ||||
import org.sonar.runner.bootstrapper.utils.PrivateIOUtils; | |||||
import org.sonar.runner.bootstrapper.BootstrapException; | import org.sonar.runner.bootstrapper.BootstrapException; | ||||
import org.sonar.runner.internal.PrivateIOUtils; | |||||
import org.sonar.runner.utils.SonarRunnerVersion; | import org.sonar.runner.utils.SonarRunnerVersion; | ||||
import java.io.File; | import java.io.File; | ||||
private static boolean debugMode = false; | private static boolean debugMode = false; | ||||
/** | |||||
* Entry point of the program. | |||||
*/ | |||||
public static void main(String[] args) { | public static void main(String[] args) { | ||||
long startTime = System.currentTimeMillis(); | long startTime = System.currentTimeMillis(); | ||||
try { | try { |
public final class Runner { | public final class Runner { | ||||
/** | /** | ||||
* Old property used to activate debug level for logging. | |||||
* | |||||
* @deprecated Replaced by sonar.verbose since 1.2 | * @deprecated Replaced by sonar.verbose since 1.2 | ||||
*/ | */ | ||||
@Deprecated | @Deprecated | ||||
public static final String PROPERTY_OLD_DEBUG_MODE = "runner.debug"; | public static final String PROPERTY_OLD_DEBUG_MODE = "runner.debug"; | ||||
/** | /** | ||||
* Property used to increase logging information. | |||||
* | |||||
* @since 1.2 | * @since 1.2 | ||||
*/ | */ | ||||
public static final String PROPERTY_VERBOSE = "sonar.verbose"; | 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 | * @since 1.4 | ||||
*/ | */ | ||||
public static final String PROPERTY_WORK_DIRECTORY = "sonar.working.directory"; | 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"; | public static final String DEF_VALUE_WORK_DIRECTORY = ".sonar"; | ||||
/** | /** | ||||
* Property used to specify the base directory of the project to analyse. | |||||
* | |||||
* @since 1.5 | * @since 1.5 | ||||
*/ | */ | ||||
public static final String PROPERTY_PROJECT_DIR = "sonar.projectDir"; | public static final String PROPERTY_PROJECT_DIR = "sonar.projectDir"; | ||||
/** | /** | ||||
* Property used to specify the name of the tool that will run a Sonar analysis. | |||||
* | |||||
* @since 1.5 | * @since 1.5 | ||||
*/ | */ | ||||
public static final String PROPERTY_ENVIRONMENT_INFORMATION_KEY = "sonar.environment.information.key"; | 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 | * @since 1.5 | ||||
*/ | */ | ||||
public static final String PROPERTY_ENVIRONMENT_INFORMATION_VERSION = "sonar.environment.information.version"; | public static final String PROPERTY_ENVIRONMENT_INFORMATION_VERSION = "sonar.environment.information.version"; |
package org.sonar.runner; | package org.sonar.runner; | ||||
/** | /** | ||||
* Exception thrown by the Sonar Runner when something bad happens. | |||||
* | |||||
* @since 1.2 | * @since 1.2 | ||||
*/ | */ | ||||
public class RunnerException extends RuntimeException { | public class RunnerException extends RuntimeException { | ||||
private static final long serialVersionUID = 4810407777585753030L; | private static final long serialVersionUID = 4810407777585753030L; | ||||
/** | |||||
* See {@link RuntimeException} | |||||
*/ | |||||
public RunnerException(String message) { | public RunnerException(String message) { | ||||
super(message); | super(message); | ||||
} | } | ||||
/** | |||||
* See {@link RuntimeException} | |||||
*/ | |||||
public RunnerException(Throwable cause) { | public RunnerException(Throwable cause) { | ||||
super(cause); | super(cause); | ||||
} | } | ||||
/** | |||||
* See {@link RuntimeException} | |||||
*/ | |||||
public RunnerException(String message, Throwable cause) { | public RunnerException(String message, Throwable cause) { | ||||
super(message, cause); | super(message, cause); | ||||
} | } |
*/ | */ | ||||
package org.sonar.runner.bootstrapper; | package org.sonar.runner.bootstrapper; | ||||
/** | |||||
* Exception thrown by the bootstrapper when something bad happens. | |||||
*/ | |||||
public class BootstrapException extends RuntimeException { | public class BootstrapException extends RuntimeException { | ||||
private static final long serialVersionUID = -4974995497654796971L; | |||||
/** | |||||
* See {@link RuntimeException} | |||||
*/ | |||||
public BootstrapException(String message) { | public BootstrapException(String message) { | ||||
super(message); | super(message); | ||||
} | } | ||||
/** | |||||
* See {@link RuntimeException} | |||||
*/ | |||||
public BootstrapException(Throwable cause) { | public BootstrapException(Throwable cause) { | ||||
super(cause); | super(cause); | ||||
} | } | ||||
/** | |||||
* See {@link RuntimeException} | |||||
*/ | |||||
public BootstrapException(String message, Throwable cause) { | public BootstrapException(String message, Throwable cause) { | ||||
super(message, cause); | super(message, cause); | ||||
} | } |
*/ | */ | ||||
package org.sonar.runner.bootstrapper; | package org.sonar.runner.bootstrapper; | ||||
import org.sonar.runner.internal.PrivateIOUtils; | |||||
import org.sonar.runner.bootstrapper.utils.PrivateIOUtils; | |||||
import org.sonar.runner.utils.SonarRunnerVersion; | import org.sonar.runner.utils.SonarRunnerVersion; | ||||
import java.io.File; | import java.io.File; | ||||
import java.util.ArrayList; | import java.util.ArrayList; | ||||
import java.util.List; | import java.util.List; | ||||
/** | |||||
* Bootstrapper used to download everything from the server and create the correct classloader required to execute a Sonar analysis in isolation. | |||||
*/ | |||||
public class Bootstrapper { | public class Bootstrapper { | ||||
private static final String VERSION_PATH = "/api/server/version"; | private static final String VERSION_PATH = "/api/server/version"; |
* License along with this program; if not, write to the Free Software | * License along with this program; if not, write to the Free Software | ||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 | ||||
*/ | */ | ||||
package org.sonar.runner.internal; | |||||
package org.sonar.runner.bootstrapper.utils; | |||||
import java.io.Closeable; | import java.io.Closeable; | ||||
import java.io.File; | import java.io.File; |
* Internal package that provides utils for internal purposes. | * Internal package that provides utils for internal purposes. | ||||
* Should not be used by consumers. | * Should not be used by consumers. | ||||
*/ | */ | ||||
package org.sonar.runner.internal; | |||||
package org.sonar.runner.bootstrapper.utils; |
import org.sonar.api.utils.SonarException; | import org.sonar.api.utils.SonarException; | ||||
import org.sonar.batch.Batch; | import org.sonar.batch.Batch; | ||||
import org.sonar.batch.bootstrapper.EnvironmentInformation; | import org.sonar.batch.bootstrapper.EnvironmentInformation; | ||||
import org.sonar.runner.Main; | |||||
import org.sonar.runner.Runner; | import org.sonar.runner.Runner; | ||||
import java.io.File; | import java.io.File; | ||||
} | } | ||||
/** | /** | ||||
* This method invoked from {@link Main}. Do not rename it. | |||||
* Main entry point. | |||||
*/ | */ | ||||
public void execute() { | public void execute() { | ||||
File baseDir = new File(propertiesFromRunner.getProperty(Runner.PROPERTY_PROJECT_DIR)); | File baseDir = new File(propertiesFromRunner.getProperty(Runner.PROPERTY_PROJECT_DIR)); |
*/ | */ | ||||
package org.sonar.runner.utils; | package org.sonar.runner.utils; | ||||
import org.sonar.runner.internal.PrivateIOUtils; | |||||
import org.sonar.runner.bootstrapper.utils.PrivateIOUtils; | |||||
import java.io.IOException; | import java.io.IOException; | ||||
import java.io.InputStream; | import java.io.InputStream; |
import org.junit.Rule; | import org.junit.Rule; | ||||
import org.junit.Test; | import org.junit.Test; | ||||
import org.junit.rules.ExpectedException; | import org.junit.rules.ExpectedException; | ||||
import org.sonar.runner.bootstrapper.BootstrapClassLoader; | |||||
import static org.fest.assertions.Assertions.assertThat; | import static org.fest.assertions.Assertions.assertThat; | ||||
package org.sonar.runner.bootstrapper; | package org.sonar.runner.bootstrapper; | ||||
import org.junit.Test; | import org.junit.Test; | ||||
import org.sonar.runner.bootstrapper.Bootstrapper; | |||||
import java.io.File; | import java.io.File; | ||||
import java.io.IOException; | import java.io.IOException; |
*/ | */ | ||||
package org.sonar.runner.model; | package org.sonar.runner.model; | ||||
import org.sonar.runner.Runner; | |||||
import org.sonar.runner.model.Launcher; | |||||
import org.apache.commons.configuration.BaseConfiguration; | import org.apache.commons.configuration.BaseConfiguration; | ||||
import org.apache.commons.configuration.Configuration; | import org.apache.commons.configuration.Configuration; | ||||
import org.junit.Test; | import org.junit.Test; | ||||
import org.sonar.runner.Runner; | |||||
import java.util.Properties; | import java.util.Properties; | ||||
*/ | */ | ||||
package org.sonar.runner.utils; | package org.sonar.runner.utils; | ||||
import org.sonar.runner.utils.SonarRunnerVersion; | |||||
import org.junit.Test; | import org.junit.Test; | ||||
import static org.fest.assertions.Assertions.assertThat; | import static org.fest.assertions.Assertions.assertThat; |