@@ -35,4 +35,4 @@ exec "$JAVA_CMD" \ | |||
-classpath $JAVA_CLASSPATH \ | |||
"-Drunner.home=${SONAR_RUNNER_HOME}" \ | |||
"-Dproject.home=${PROJECT_HOME}" \ | |||
org.sonar.runner.Main "$@" | |||
org.sonar.runner.internal.Main "$@" |
@@ -70,7 +70,7 @@ echo %SONAR_RUNNER_HOME% | |||
set PROJECT_HOME=%CD% | |||
%JAVA_EXEC% %SONAR_RUNNER_OPTS% -classpath "%SONAR_RUNNER_HOME%\lib\sonar-runner.jar" "-Drunner.home=%SONAR_RUNNER_HOME%" "-Dproject.home=%PROJECT_HOME%" org.sonar.runner.Main %* | |||
%JAVA_EXEC% %SONAR_RUNNER_OPTS% -classpath "%SONAR_RUNNER_HOME%\lib\sonar-runner.jar" "-Drunner.home=%SONAR_RUNNER_HOME%" "-Dproject.home=%PROJECT_HOME%" org.sonar.runner.internal.Main %* | |||
@@ -19,9 +19,9 @@ | |||
*/ | |||
package org.sonar.runner; | |||
import org.sonar.runner.bootstrapper.BootstrapClassLoader; | |||
import org.sonar.runner.bootstrapper.BootstrapException; | |||
import org.sonar.runner.bootstrapper.Bootstrapper; | |||
import org.sonar.runner.internal.bootstrapper.BootstrapClassLoader; | |||
import org.sonar.runner.internal.bootstrapper.BootstrapException; | |||
import org.sonar.runner.internal.bootstrapper.Bootstrapper; | |||
import org.sonar.runner.utils.SonarRunnerVersion; | |||
import java.io.File; | |||
@@ -141,7 +141,7 @@ public final class Runner { | |||
delegateExecution(createClassLoader(bootstrapper)); | |||
} | |||
protected String getSonarServerURL() { | |||
public String getSonarServerURL() { | |||
return properties.getProperty("sonar.host.url", "http://localhost:9000"); | |||
} | |||
@@ -174,14 +174,14 @@ public final class Runner { | |||
/** | |||
* @return the project base directory | |||
*/ | |||
protected File getProjectDir() { | |||
public File getProjectDir() { | |||
return projectDir; | |||
} | |||
/** | |||
* @return work directory, default is ".sonar" in project directory | |||
*/ | |||
protected File getWorkDir() { | |||
public File getWorkDir() { | |||
return workDir; | |||
} | |||
@@ -201,7 +201,7 @@ public final class Runner { | |||
} | |||
private BootstrapClassLoader createClassLoader(Bootstrapper bootstrapper) { | |||
URL url = Main.class.getProtectionDomain().getCodeSource().getLocation(); | |||
URL url = getClass().getProtectionDomain().getCodeSource().getLocation(); | |||
return bootstrapper.createClassLoader( | |||
new URL[] {url}, // Add JAR with Sonar Runner - it's a Jar which contains this class | |||
getClass().getClassLoader()); | |||
@@ -229,7 +229,7 @@ public final class Runner { | |||
ClassLoader oldContextClassLoader = Thread.currentThread().getContextClassLoader(); | |||
try { | |||
Thread.currentThread().setContextClassLoader(sonarClassLoader); | |||
Class<?> launcherClass = sonarClassLoader.findClass("org.sonar.runner.model.Launcher"); | |||
Class<?> launcherClass = sonarClassLoader.findClass("org.sonar.runner.internal.batch.Launcher"); | |||
Constructor<?> constructor = launcherClass.getConstructor(Properties.class); | |||
Object launcher = constructor.newInstance(getProperties()); | |||
Method method = launcherClass.getMethod("execute"); |
@@ -18,11 +18,15 @@ | |||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 | |||
*/ | |||
package org.sonar.runner; | |||
package org.sonar.runner.internal; | |||
import org.sonar.runner.bootstrapper.utils.PrivateIOUtils; | |||
import org.sonar.runner.internal.bootstrapper.BootstrapException; | |||
import org.sonar.runner.Runner; | |||
import org.sonar.runner.RunnerException; | |||
import org.sonar.runner.internal.bootstrapper.utils.PrivateIOUtils; | |||
import org.sonar.runner.bootstrapper.BootstrapException; | |||
import org.sonar.runner.utils.SonarRunnerVersion; | |||
import java.io.File; |
@@ -18,7 +18,7 @@ | |||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 | |||
*/ | |||
package org.sonar.runner.model; | |||
package org.sonar.runner.internal.batch; | |||
import ch.qos.logback.classic.LoggerContext; | |||
import ch.qos.logback.classic.joran.JoranConfigurator; |
@@ -18,7 +18,7 @@ | |||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 | |||
*/ | |||
package org.sonar.runner.model; | |||
package org.sonar.runner.internal.batch; | |||
import com.google.common.annotations.VisibleForTesting; | |||
import com.google.common.collect.Lists; |
@@ -21,4 +21,4 @@ | |||
* Internal package that creates the project definition and launches the analyses based on it. | |||
* Should not be used by consumers. | |||
*/ | |||
package org.sonar.runner.model; | |||
package org.sonar.runner.internal.batch; |
@@ -17,7 +17,7 @@ | |||
* 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.bootstrapper; | |||
package org.sonar.runner.internal.bootstrapper; | |||
import java.io.IOException; | |||
import java.net.URL; |
@@ -17,7 +17,7 @@ | |||
* 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.bootstrapper; | |||
package org.sonar.runner.internal.bootstrapper; | |||
/** | |||
* Exception thrown by the bootstrapper when something bad happens. |
@@ -17,9 +17,9 @@ | |||
* 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.bootstrapper; | |||
package org.sonar.runner.internal.bootstrapper; | |||
import org.sonar.runner.bootstrapper.utils.PrivateIOUtils; | |||
import org.sonar.runner.internal.bootstrapper.utils.PrivateIOUtils; | |||
import org.sonar.runner.utils.SonarRunnerVersion; | |||
@@ -21,4 +21,4 @@ | |||
* Internal package that provides API to bootstrap Sonar Batch. | |||
* Should not be used by consumers. | |||
*/ | |||
package org.sonar.runner.bootstrapper; | |||
package org.sonar.runner.internal.bootstrapper; |
@@ -17,7 +17,7 @@ | |||
* 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.bootstrapper.utils; | |||
package org.sonar.runner.internal.bootstrapper.utils; | |||
import java.io.Closeable; | |||
import java.io.File; |
@@ -21,4 +21,4 @@ | |||
* Internal package that provides utils for internal purposes. | |||
* Should not be used by consumers. | |||
*/ | |||
package org.sonar.runner.bootstrapper.utils; | |||
package org.sonar.runner.internal.bootstrapper.utils; |
@@ -0,0 +1,23 @@ | |||
/* | |||
* Sonar Standalone 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 | |||
*/ | |||
/** | |||
* API package of the Sonar Runner. | |||
*/ | |||
package org.sonar.runner; |
@@ -19,7 +19,7 @@ | |||
*/ | |||
package org.sonar.runner.utils; | |||
import org.sonar.runner.bootstrapper.utils.PrivateIOUtils; | |||
import org.sonar.runner.internal.bootstrapper.utils.PrivateIOUtils; | |||
import java.io.IOException; | |||
import java.io.InputStream; |
@@ -19,11 +19,12 @@ | |||
*/ | |||
package org.sonar.runner; | |||
import org.sonar.runner.internal.bootstrapper.BootstrapException; | |||
import org.sonar.runner.internal.bootstrapper.Bootstrapper; | |||
import org.junit.Rule; | |||
import org.junit.Test; | |||
import org.junit.rules.ExpectedException; | |||
import org.sonar.runner.bootstrapper.BootstrapException; | |||
import org.sonar.runner.bootstrapper.Bootstrapper; | |||
import org.sonar.test.TestUtils; | |||
import java.io.File; |
@@ -18,9 +18,12 @@ | |||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 | |||
*/ | |||
package org.sonar.runner; | |||
package org.sonar.runner.internal; | |||
import org.sonar.runner.internal.Main; | |||
import org.junit.Test; | |||
import org.sonar.runner.Runner; | |||
import java.io.File; | |||
import java.util.Properties; | |||
@@ -39,7 +42,7 @@ public class MainTest { | |||
@Test | |||
public void shouldParseArguments() { | |||
Properties props = Main.parseArguments(new String[] { "-D", "foo=bar", "--define", "hello=world", "-Dboolean" }); | |||
Properties props = Main.parseArguments(new String[] {"-D", "foo=bar", "--define", "hello=world", "-Dboolean"}); | |||
assertThat(props.size(), is(3)); | |||
assertThat(props.getProperty("foo"), is("bar")); | |||
assertThat(props.getProperty("hello"), is("world")); | |||
@@ -48,7 +51,7 @@ public class MainTest { | |||
@Test | |||
public void shouldEnableDebugMode() { | |||
Properties props = Main.parseArguments(new String[] { "-X" }); | |||
Properties props = Main.parseArguments(new String[] {"-X"}); | |||
assertThat(props.getProperty(Runner.PROPERTY_VERBOSE), is("true")); | |||
} | |||
@@ -60,7 +63,7 @@ public class MainTest { | |||
@Test | |||
public void shouldLoadRunnerSettingsByHome() throws Exception { | |||
File home = new File(getClass().getResource("/org/sonar/runner/MainTest/shouldLoadRunnerSettingsByHome/").toURI()); | |||
File home = new File(getClass().getResource("/org/sonar/runner/internal/bootstrapper/MainTest/shouldLoadRunnerSettingsByHome/").toURI()); | |||
Properties args = new Properties(); | |||
args.setProperty("runner.home", home.getCanonicalPath()); | |||
@@ -79,7 +82,7 @@ public class MainTest { | |||
@Test | |||
public void shouldLoadRunnerSettingsByDirectPath() throws Exception { | |||
File settings = new File(getClass().getResource("/org/sonar/runner/MainTest/shouldLoadRunnerSettingsByDirectPath/other-conf.properties").toURI()); | |||
File settings = new File(getClass().getResource("/org/sonar/runner/internal/bootstrapper/MainTest/shouldLoadRunnerSettingsByDirectPath/other-conf.properties").toURI()); | |||
Properties args = new Properties(); | |||
args.setProperty("runner.settings", settings.getCanonicalPath()); | |||
Properties props = Main.loadRunnerProperties(args); | |||
@@ -89,8 +92,8 @@ public class MainTest { | |||
@Test | |||
public void shouldLoadCompleteConfiguration() throws Exception { | |||
File runnerHome = new File(getClass().getResource("/org/sonar/runner/MainTest/shouldLoadCompleteConfiguration/runner").toURI()); | |||
File projectHome = new File(getClass().getResource("/org/sonar/runner/MainTest/shouldLoadCompleteConfiguration/project").toURI()); | |||
File runnerHome = new File(getClass().getResource("/org/sonar/runner/internal/bootstrapper/MainTest/shouldLoadCompleteConfiguration/runner").toURI()); | |||
File projectHome = new File(getClass().getResource("/org/sonar/runner/internal/bootstrapper/MainTest/shouldLoadCompleteConfiguration/project").toURI()); | |||
Properties props = Main.loadProperties(new String[] { | |||
"-D", "runner.home=" + runnerHome.getCanonicalPath(), | |||
"-D", "project.home=" + projectHome.getCanonicalPath() |
@@ -17,7 +17,8 @@ | |||
* 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.model; | |||
package org.sonar.runner.internal.batch; | |||
import org.apache.commons.configuration.BaseConfiguration; | |||
import org.apache.commons.configuration.Configuration; |
@@ -17,7 +17,7 @@ | |||
* 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.model; | |||
package org.sonar.runner.internal.batch; | |||
import org.apache.commons.io.IOUtils; | |||
import org.junit.Rule; | |||
@@ -238,12 +238,12 @@ public class SonarProjectBuilderTest { | |||
@Test | |||
public void shouldGetRelativeFile() { | |||
assertThat(SonarProjectBuilder.getFileFromPath("shouldGetFile/foo.properties", TestUtils.getResource(this.getClass(), "/"))) | |||
.isEqualTo(TestUtils.getResource("org/sonar/runner/model/SonarProjectBuilderTest/shouldGetFile/foo.properties")); | |||
.isEqualTo(TestUtils.getResource(this.getClass(), "shouldGetFile/foo.properties")); | |||
} | |||
@Test | |||
public void shouldGetAbsoluteFile() { | |||
File file = TestUtils.getResource("org/sonar/runner/model/SonarProjectBuilderTest/shouldGetFile/foo.properties"); | |||
File file = TestUtils.getResource(this.getClass(), "shouldGetFile/foo.properties"); | |||
assertThat(SonarProjectBuilder.getFileFromPath(file.getAbsolutePath(), TestUtils.getResource(this.getClass(), "/"))) | |||
.isEqualTo(file); |
@@ -17,7 +17,9 @@ | |||
* 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.bootstrapper; | |||
package org.sonar.runner.internal.bootstrapper; | |||
import org.sonar.runner.internal.bootstrapper.BootstrapClassLoader; | |||
import org.junit.Rule; | |||
import org.junit.Test; |
@@ -17,7 +17,9 @@ | |||
* 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.bootstrapper; | |||
package org.sonar.runner.internal.bootstrapper; | |||
import org.sonar.runner.internal.bootstrapper.Bootstrapper; | |||
import org.junit.Test; | |||