diff options
author | Simon Brandhof <simon.brandhof@gmail.com> | 2012-09-11 16:48:17 +0200 |
---|---|---|
committer | Simon Brandhof <simon.brandhof@gmail.com> | 2012-09-11 16:48:17 +0200 |
commit | 959d97841d2e36760bf9a4caa78bdfdd6e48abd2 (patch) | |
tree | f86bd1796a146d771df7255bcf2e79d59f7dbbf6 /src | |
parent | bb8231b100be8242c79244c5ad342ddd53805866 (diff) | |
parent | 324d44738cd6edf783ed519e3ec300e6ed3a9c30 (diff) | |
download | sonar-scanner-cli-959d97841d2e36760bf9a4caa78bdfdd6e48abd2.tar.gz sonar-scanner-cli-959d97841d2e36760bf9a4caa78bdfdd6e48abd2.zip |
Merge remote-tracking branch 'origin/master'
Diffstat (limited to 'src')
18 files changed, 212 insertions, 71 deletions
diff --git a/src/main/java/org/sonar/runner/Runner.java b/src/main/java/org/sonar/runner/Runner.java index d911b0b..f2cd606 100644 --- a/src/main/java/org/sonar/runner/Runner.java +++ b/src/main/java/org/sonar/runner/Runner.java @@ -29,6 +29,8 @@ import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.net.URL; +import java.util.ArrayList; +import java.util.List; import java.util.Properties; /** @@ -106,10 +108,13 @@ public final class Runner { private File projectDir; private File workDir; + private String[] unmaskedPackages; + private List<Object> containerExtensions = new ArrayList<Object>(); private Properties properties; private Runner(Properties props) { this.properties = props; + this.unmaskedPackages = new String[0]; // set the default values for the Sonar Runner - they can be overriden with #setEnvironmentInformation this.properties.put(PROPERTY_ENVIRONMENT_INFORMATION_KEY, "Runner"); this.properties.put(PROPERTY_ENVIRONMENT_INFORMATION_VERSION, SonarRunnerVersion.getVersion()); @@ -204,7 +209,8 @@ public final class Runner { 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()); + getClass().getClassLoader(), + unmaskedPackages); } static boolean isUnsupportedVersion(String version) { @@ -230,8 +236,8 @@ public final class Runner { try { Thread.currentThread().setContextClassLoader(sonarClassLoader); Class<?> launcherClass = sonarClassLoader.findClass("org.sonar.runner.internal.batch.Launcher"); - Constructor<?> constructor = launcherClass.getConstructor(Properties.class); - Object launcher = constructor.newInstance(getProperties()); + Constructor<?> constructor = launcherClass.getConstructor(Properties.class, List.class); + Object launcher = constructor.newInstance(getProperties(), containerExtensions); Method method = launcherClass.getMethod("execute"); method.invoke(launcher); } catch (InvocationTargetException e) { @@ -255,4 +261,13 @@ public final class Runner { this.properties.put(PROPERTY_ENVIRONMENT_INFORMATION_KEY, key); this.properties.put(PROPERTY_ENVIRONMENT_INFORMATION_VERSION, version); } + + public void setUnmaskedPackages(String... unmaskedPackages) { + this.unmaskedPackages = unmaskedPackages; + } + + public void addContainerExtension(Object extension) { + containerExtensions.add(extension); + } + } diff --git a/src/main/java/org/sonar/runner/internal/batch/Launcher.java b/src/main/java/org/sonar/runner/internal/batch/Launcher.java index 2137567..502e5cf 100644 --- a/src/main/java/org/sonar/runner/internal/batch/Launcher.java +++ b/src/main/java/org/sonar/runner/internal/batch/Launcher.java @@ -39,6 +39,7 @@ import org.sonar.batch.bootstrapper.EnvironmentInformation; import org.sonar.runner.Runner; import java.io.InputStream; +import java.util.List; import java.util.Properties; /** @@ -48,9 +49,11 @@ import java.util.Properties; public class Launcher { private Properties propertiesFromRunner; + private List<Object> containerExtensions; - public Launcher(Properties properties) { + public Launcher(Properties properties, List<Object> containerExtensions) { this.propertiesFromRunner = properties; + this.containerExtensions = containerExtensions; } /** @@ -64,13 +67,22 @@ public class Launcher { } private void executeBatch(ProjectDefinition project, Configuration initialConfiguration) { - ProjectReactor reactor = new ProjectReactor(project); + setContainerExtensionsOnProject(project); String envKey = propertiesFromRunner.getProperty(Runner.PROPERTY_ENVIRONMENT_INFORMATION_KEY); String envVersion = propertiesFromRunner.getProperty(Runner.PROPERTY_ENVIRONMENT_INFORMATION_VERSION); - Batch batch = Batch.create(reactor, initialConfiguration, new EnvironmentInformation(envKey, envVersion)); + Batch batch = Batch.create(new ProjectReactor(project), initialConfiguration, new EnvironmentInformation(envKey, envVersion)); batch.execute(); } + private void setContainerExtensionsOnProject(ProjectDefinition projectDefinition) { + for (Object extension : containerExtensions) { + projectDefinition.addContainerExtension(extension); + } + for (ProjectDefinition module : projectDefinition.getSubProjects()) { + setContainerExtensionsOnProject(module); + } + } + private void initLogging(Configuration initialConfiguration) { LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory(); JoranConfigurator jc = new JoranConfigurator(); diff --git a/src/main/java/org/sonar/runner/internal/batch/SonarProjectBuilder.java b/src/main/java/org/sonar/runner/internal/batch/SonarProjectBuilder.java index efbb3d2..6af0ed5 100644 --- a/src/main/java/org/sonar/runner/internal/batch/SonarProjectBuilder.java +++ b/src/main/java/org/sonar/runner/internal/batch/SonarProjectBuilder.java @@ -152,12 +152,7 @@ public final class SonarProjectBuilder { if (parentProps.containsKey(PROPERTY_MODULES)) { for (String module : SonarRunnerUtils.getListFromProperty(parentProps, PROPERTY_MODULES)) { Properties moduleProps = extractModuleProperties(module, parentProps); - ProjectDefinition childProject = null; - if (moduleProps.containsKey(PROPERTY_PROJECT_CONFIG_FILE)) { - childProject = loadChildProjectFromPropertyFile(parentProject, moduleProps, module); - } else { - childProject = loadChildProjectFromProperties(parentProject, moduleProps, module); - } + ProjectDefinition childProject = loadChildProject(parentProject, moduleProps, module); // check the unicity of the child key checkUnicityOfChildKey(childProject, parentProject); // the child project may have children as well @@ -168,52 +163,76 @@ public final class SonarProjectBuilder { } } - private ProjectDefinition loadChildProjectFromProperties(ProjectDefinition parentProject, Properties childProps, String moduleId) { - setProjectKeyIfNotDefined(childProps, moduleId); - checkMandatoryProperties(moduleId, childProps, MANDATORY_PROPERTIES_FOR_CHILD); - mergeParentProperties(childProps, parentProject.getProperties()); + private ProjectDefinition loadChildProject(ProjectDefinition parentProject, Properties moduleProps, String moduleId) { + setProjectKeyIfNotDefined(moduleProps, moduleId); - File baseDir = null; - if (childProps.containsKey(PROPERTY_PROJECT_BASEDIR)) { - baseDir = getFileFromPath(childProps.getProperty(PROPERTY_PROJECT_BASEDIR), parentProject.getBaseDir()); + if (moduleProps.containsKey(PROPERTY_PROJECT_BASEDIR)) { + File baseDir = getFileFromPath(moduleProps.getProperty(PROPERTY_PROJECT_BASEDIR), parentProject.getBaseDir()); + setProjectBaseDir(baseDir, moduleProps, moduleId); + tryToFindAndLoadPropsFile(baseDir, moduleProps, moduleId); + } else if (moduleProps.containsKey(PROPERTY_PROJECT_CONFIG_FILE)) { + loadPropsFile(parentProject, moduleProps, moduleId); } else { - baseDir = new File(parentProject.getBaseDir(), moduleId); + File baseDir = new File(parentProject.getBaseDir(), moduleId); + setProjectBaseDir(baseDir, moduleProps, moduleId); + tryToFindAndLoadPropsFile(baseDir, moduleProps, moduleId); } - setProjectBaseDirOnProperties(childProps, moduleId, baseDir); - prefixProjectKeyWithParentKey(childProps, parentProject.getKey()); - return defineProject(childProps); + // and finish + checkMandatoryProperties(moduleId, moduleProps, MANDATORY_PROPERTIES_FOR_CHILD); + mergeParentProperties(moduleProps, parentProject.getProperties()); + + prefixProjectKeyWithParentKey(moduleProps, parentProject.getKey()); + + return defineProject(moduleProps); } - private ProjectDefinition loadChildProjectFromPropertyFile(ProjectDefinition parentProject, Properties moduleProps, String moduleId) { + protected void loadPropsFile(ProjectDefinition parentProject, Properties moduleProps, String moduleId) { File propertyFile = getFileFromPath(moduleProps.getProperty(PROPERTY_PROJECT_CONFIG_FILE), parentProject.getBaseDir()); - if (!propertyFile.isFile()) { + if (propertyFile.isFile()) { + Properties propsFromFile = toProperties(propertyFile); + for (Entry<Object, Object> entry : propsFromFile.entrySet()) { + moduleProps.put(entry.getKey(), entry.getValue()); + } + File baseDir = null; + if (moduleProps.containsKey(PROPERTY_PROJECT_BASEDIR)) { + baseDir = getFileFromPath(moduleProps.getProperty(PROPERTY_PROJECT_BASEDIR), propertyFile.getParentFile()); + } else { + baseDir = propertyFile.getParentFile(); + } + setProjectBaseDir(baseDir, moduleProps, moduleId); + } else { throw new RunnerException("The properties file of the module '" + moduleId + "' does not exist: " + propertyFile.getAbsolutePath()); } - Properties childProps = new Properties(); + } + + private void tryToFindAndLoadPropsFile(File baseDir, Properties moduleProps, String moduleId) { + File propertyFile = new File(baseDir, "sonar-project.properties"); + if (propertyFile.isFile()) { + Properties propsFromFile = toProperties(propertyFile); + for (Entry<Object, Object> entry : propsFromFile.entrySet()) { + moduleProps.put(entry.getKey(), entry.getValue()); + } + if (moduleProps.containsKey(PROPERTY_PROJECT_BASEDIR)) { + File overwrittenBaseDir = getFileFromPath(moduleProps.getProperty(PROPERTY_PROJECT_BASEDIR), propertyFile.getParentFile()); + setProjectBaseDir(overwrittenBaseDir, moduleProps, moduleId); + } + } + } + + @VisibleForTesting + protected static Properties toProperties(File propertyFile) { + Properties propsFromFile = new Properties(); FileInputStream fileInputStream = null; try { fileInputStream = new FileInputStream(propertyFile); - childProps.load(fileInputStream); + propsFromFile.load(fileInputStream); } catch (IOException e) { throw new RunnerException("Impossible to read the property file: " + propertyFile.getAbsolutePath(), e); } finally { IOUtils.closeQuietly(fileInputStream); } - - checkMandatoryProperties(moduleId, childProps, MANDATORY_PROPERTIES_FOR_CHILD); - mergeParentProperties(childProps, parentProject.getProperties()); - - File baseDir = null; - if (childProps.containsKey(PROPERTY_PROJECT_BASEDIR)) { - baseDir = getFileFromPath(childProps.getProperty(PROPERTY_PROJECT_BASEDIR), propertyFile.getParentFile()); - } else { - baseDir = propertyFile.getParentFile(); - } - setProjectBaseDirOnProperties(childProps, moduleId, baseDir); - prefixProjectKeyWithParentKey(childProps, parentProject.getKey()); - - return defineProject(childProps); + return propsFromFile; } @VisibleForTesting @@ -238,7 +257,7 @@ public final class SonarProjectBuilder { childProps.put(PROPERTY_PROJECT_KEY, parentKey + ":" + childKey); } - private static void setProjectBaseDirOnProperties(Properties childProps, String moduleId, File baseDir) { + private static void setProjectBaseDir(File baseDir, Properties childProps, String moduleId) { if (!baseDir.isDirectory()) { throw new RunnerException("The base directory of the module '" + moduleId + "' does not exist: " + baseDir.getAbsolutePath()); } @@ -258,7 +277,8 @@ public final class SonarProjectBuilder { } } if (missing.length() != 0) { - throw new RunnerException("You must define the following mandatory properties for '" + moduleId + "': " + missing); + String projectKey = props.getProperty(PROPERTY_PROJECT_KEY); + throw new RunnerException("You must define the following mandatory properties for '" + (projectKey == null ? moduleId : projectKey) + "': " + missing); } } diff --git a/src/test/java/org/sonar/runner/internal/batch/LauncherTest.java b/src/test/java/org/sonar/runner/internal/batch/LauncherTest.java index 489b005..979a517 100644 --- a/src/test/java/org/sonar/runner/internal/batch/LauncherTest.java +++ b/src/test/java/org/sonar/runner/internal/batch/LauncherTest.java @@ -19,7 +19,7 @@ */ package org.sonar.runner.internal.batch; - +import com.google.common.collect.Lists; import org.apache.commons.configuration.BaseConfiguration; import org.apache.commons.configuration.Configuration; import org.junit.Test; @@ -60,7 +60,7 @@ public class LauncherTest { @Test public void shouldDetermineVerboseMode() { Properties properties = new Properties(); - Launcher launcher = new Launcher(properties); + Launcher launcher = new Launcher(properties, Lists.newArrayList()); assertThat(launcher.isDebug()).isFalse(); properties.setProperty(Runner.PROPERTY_VERBOSE, "true"); assertThat(launcher.isDebug()).isTrue(); @@ -69,7 +69,7 @@ public class LauncherTest { @Test public void shouldSupportDeprecatedDebugProperty() { Properties properties = new Properties(); - Launcher launcher = new Launcher(properties); + Launcher launcher = new Launcher(properties, Lists.newArrayList()); properties.setProperty(Runner.PROPERTY_OLD_DEBUG_MODE, "true"); assertThat(launcher.isDebug()).isTrue(); } diff --git a/src/test/java/org/sonar/runner/internal/batch/SonarProjectBuilderTest.java b/src/test/java/org/sonar/runner/internal/batch/SonarProjectBuilderTest.java index 2e7d596..d4b4cb5 100644 --- a/src/test/java/org/sonar/runner/internal/batch/SonarProjectBuilderTest.java +++ b/src/test/java/org/sonar/runner/internal/batch/SonarProjectBuilderTest.java @@ -19,7 +19,6 @@ */ package org.sonar.runner.internal.batch; -import org.apache.commons.io.IOUtils; import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; @@ -28,7 +27,6 @@ import org.sonar.runner.RunnerException; import org.sonar.test.TestUtils; import java.io.File; -import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.util.List; @@ -78,8 +76,8 @@ public class SonarProjectBuilderTest { } @Test - public void shouldDefineMultiModuleProject() throws IOException { - ProjectDefinition rootProject = loadProjectDefinition("multi-module"); + public void shouldDefineMultiModuleProjectWithDefinitionsAllInRootProject() throws IOException { + ProjectDefinition rootProject = loadProjectDefinition("multi-module-definitions-all-in-root"); // CHECK ROOT assertThat(rootProject.getKey()).isEqualTo("com.foo.project"); @@ -100,6 +98,7 @@ public class SonarProjectBuilderTest { // Module 1 ProjectDefinition module1 = modules.get(0); + assertThat(module1.getBaseDir().getCanonicalFile()).isEqualTo(TestUtils.getResource(this.getClass(), "multi-module-definitions-all-in-root/module1")); assertThat(module1.getKey()).isEqualTo("com.foo.project:com.foo.project.module1"); assertThat(module1.getName()).isEqualTo("Foo Module 1"); assertThat(module1.getVersion()).isEqualTo("1.0-SNAPSHOT"); @@ -114,6 +113,58 @@ public class SonarProjectBuilderTest { // Module 2 ProjectDefinition module2 = modules.get(1); + assertThat(module2.getBaseDir().getCanonicalFile()).isEqualTo(TestUtils.getResource(this.getClass(), "multi-module-definitions-all-in-root/module2")); + assertThat(module2.getKey()).isEqualTo("com.foo.project:com.foo.project.module2"); + assertThat(module2.getName()).isEqualTo("Foo Module 2"); + assertThat(module2.getVersion()).isEqualTo("1.0-SNAPSHOT"); + assertThat(module2.getDescription()).isEqualTo("Description of Module 2"); + assertThat(module2.getSourceDirs()).contains("src"); + assertThat(module2.getTestDirs()).contains("tests"); + assertThat(module2.getBinaries()).contains("target/classes"); + // and module properties must have been cleaned + assertThat(rootProject.getProperties().getProperty("module1.sonar.projectKey")).isNull(); + assertThat(rootProject.getProperties().getProperty("module2.sonar.projectKey")).isNull(); + } + + @Test + public void shouldDefineMultiModuleProjectWithDefinitionsAllInEachModule() throws IOException { + ProjectDefinition rootProject = loadProjectDefinition("multi-module-definitions-in-each-module"); + + // CHECK ROOT + assertThat(rootProject.getKey()).isEqualTo("com.foo.project"); + assertThat(rootProject.getName()).isEqualTo("Foo Project"); + assertThat(rootProject.getVersion()).isEqualTo("1.0-SNAPSHOT"); + assertThat(rootProject.getDescription()).isEqualTo("Description of Foo Project"); + // root project must not contain some properties - even if they are defined in the root properties file + assertThat(rootProject.getSourceDirs().contains("sources")).isFalse(); + assertThat(rootProject.getTestDirs().contains("tests")).isFalse(); + assertThat(rootProject.getBinaries().contains("target/classes")).isFalse(); + // and module properties must have been cleaned + assertThat(rootProject.getProperties().getProperty("module1.sonar.projectKey")).isNull(); + assertThat(rootProject.getProperties().getProperty("module2.sonar.projectKey")).isNull(); + + // CHECK MODULES + List<ProjectDefinition> modules = rootProject.getSubProjects(); + assertThat(modules.size()).isEqualTo(2); + + // Module 1 + ProjectDefinition module1 = modules.get(0); + assertThat(module1.getBaseDir().getCanonicalFile()).isEqualTo(TestUtils.getResource(this.getClass(), "multi-module-definitions-in-each-module/module1")); + assertThat(module1.getKey()).isEqualTo("com.foo.project:com.foo.project.module1"); + assertThat(module1.getName()).isEqualTo("Foo Module 1"); + assertThat(module1.getVersion()).isEqualTo("1.0-SNAPSHOT"); + // Description should not be inherited from parent if not set + assertThat(module1.getDescription()).isNull(); + assertThat(module1.getSourceDirs()).contains("sources"); + assertThat(module1.getTestDirs()).contains("tests"); + assertThat(module1.getBinaries()).contains("target/classes"); + // and module properties must have been cleaned + assertThat(rootProject.getProperties().getProperty("module1.sonar.projectKey")).isNull(); + assertThat(rootProject.getProperties().getProperty("module2.sonar.projectKey")).isNull(); + + // Module 2 + ProjectDefinition module2 = modules.get(1); + assertThat(module2.getBaseDir().getCanonicalFile()).isEqualTo(TestUtils.getResource(this.getClass(), "multi-module-definitions-in-each-module/module2/newBaseDir")); assertThat(module2.getKey()).isEqualTo("com.foo.project:com.foo.project.module2"); assertThat(module2.getName()).isEqualTo("Foo Module 2"); assertThat(module2.getVersion()).isEqualTo("1.0-SNAPSHOT"); @@ -146,6 +197,17 @@ public class SonarProjectBuilderTest { } @Test + public void shouldDefineMultiModuleProjectWithConfigFileAndOverwrittenBasedir() throws IOException { + ProjectDefinition rootProject = loadProjectDefinition("multi-module-with-configfile-and-overwritten-basedir"); + List<ProjectDefinition> modules = rootProject.getSubProjects(); + assertThat(modules.size()).isEqualTo(1); + ProjectDefinition module = modules.get(0); + assertThat(module.getKey()).isEqualTo("com.foo.project:com.foo.project.module1"); + // verify the base directory that has been changed in this config file + assertThat(module.getBaseDir().getCanonicalFile()).isEqualTo(TestUtils.getResource(this.getClass(), "multi-module-with-configfile-and-overwritten-basedir/any-folder")); + } + + @Test public void shouldFailIfUnexistingModuleBaseDir() throws IOException { thrown.expect(RunnerException.class); thrown.expectMessage("The base directory of the module 'module1' does not exist: " @@ -275,26 +337,6 @@ public class SonarProjectBuilderTest { assertThat(childProps.getProperty("mod2.sonar.projectkey")).isNull(); } - private ProjectDefinition loadProjectDefinition(String projectFolder) throws FileNotFoundException, IOException { - Properties props = loadPropsFromFile(projectFolder + "/sonar-project.properties"); - props.put("sonar.projectBaseDir", TestUtils.getResource(this.getClass(), projectFolder).getAbsolutePath()); - ProjectDefinition projectDefinition = SonarProjectBuilder.create(props) - .generateProjectDefinition(); - return projectDefinition; - } - - private Properties loadPropsFromFile(String filePath) throws FileNotFoundException, IOException { - Properties props = new Properties(); - FileInputStream fileInputStream = null; - try { - fileInputStream = new FileInputStream(TestUtils.getResource(this.getClass(), filePath)); - props.load(fileInputStream); - } finally { - IOUtils.closeQuietly(fileInputStream); - } - return props; - } - @Test public void shouldInitWorkDir() { SonarProjectBuilder builder = SonarProjectBuilder.create(new Properties()); @@ -377,4 +419,20 @@ public class SonarProjectBuilderTest { assertThat(props.getProperty("sonar.projectKey")).isEqualTo("foo"); } + @Test + public void shouldFailToLoadPropertiesFile() throws Exception { + thrown.expect(RunnerException.class); + thrown.expectMessage("Impossible to read the property file"); + + SonarProjectBuilder.toProperties(new File("foo.properties")); + } + + private ProjectDefinition loadProjectDefinition(String projectFolder) throws FileNotFoundException, IOException { + Properties props = SonarProjectBuilder.toProperties(TestUtils.getResource(this.getClass(), projectFolder + "/sonar-project.properties")); + props.put("sonar.projectBaseDir", TestUtils.getResource(this.getClass(), projectFolder).getAbsolutePath()); + ProjectDefinition projectDefinition = SonarProjectBuilder.create(props) + .generateProjectDefinition(); + return projectDefinition; + } + } diff --git a/src/test/resources/org/sonar/runner/internal/batch/SonarProjectBuilderTest/multi-module/module1/sources/Fake.java b/src/test/resources/org/sonar/runner/internal/batch/SonarProjectBuilderTest/multi-module-definitions-all-in-root/module1/sources/Fake.java index 5967658..5967658 100644 --- a/src/test/resources/org/sonar/runner/internal/batch/SonarProjectBuilderTest/multi-module/module1/sources/Fake.java +++ b/src/test/resources/org/sonar/runner/internal/batch/SonarProjectBuilderTest/multi-module-definitions-all-in-root/module1/sources/Fake.java diff --git a/src/test/resources/org/sonar/runner/internal/batch/SonarProjectBuilderTest/multi-module/module2/src/Fake.java b/src/test/resources/org/sonar/runner/internal/batch/SonarProjectBuilderTest/multi-module-definitions-all-in-root/module2/src/Fake.java index 5967658..5967658 100644 --- a/src/test/resources/org/sonar/runner/internal/batch/SonarProjectBuilderTest/multi-module/module2/src/Fake.java +++ b/src/test/resources/org/sonar/runner/internal/batch/SonarProjectBuilderTest/multi-module-definitions-all-in-root/module2/src/Fake.java diff --git a/src/test/resources/org/sonar/runner/internal/batch/SonarProjectBuilderTest/multi-module/sonar-project.properties b/src/test/resources/org/sonar/runner/internal/batch/SonarProjectBuilderTest/multi-module-definitions-all-in-root/sonar-project.properties index 4e29926..4e29926 100644 --- a/src/test/resources/org/sonar/runner/internal/batch/SonarProjectBuilderTest/multi-module/sonar-project.properties +++ b/src/test/resources/org/sonar/runner/internal/batch/SonarProjectBuilderTest/multi-module-definitions-all-in-root/sonar-project.properties diff --git a/src/test/resources/org/sonar/runner/internal/batch/SonarProjectBuilderTest/multi-module-definitions-in-each-module/module1/sonar-project.properties b/src/test/resources/org/sonar/runner/internal/batch/SonarProjectBuilderTest/multi-module-definitions-in-each-module/module1/sonar-project.properties new file mode 100644 index 0000000..460d349 --- /dev/null +++ b/src/test/resources/org/sonar/runner/internal/batch/SonarProjectBuilderTest/multi-module-definitions-in-each-module/module1/sonar-project.properties @@ -0,0 +1,2 @@ +sonar.projectKey=com.foo.project.module1 +sonar.projectName=Foo Module 1 diff --git a/src/test/resources/org/sonar/runner/internal/batch/SonarProjectBuilderTest/multi-module-definitions-in-each-module/module1/sources/Fake.java b/src/test/resources/org/sonar/runner/internal/batch/SonarProjectBuilderTest/multi-module-definitions-in-each-module/module1/sources/Fake.java new file mode 100644 index 0000000..5967658 --- /dev/null +++ b/src/test/resources/org/sonar/runner/internal/batch/SonarProjectBuilderTest/multi-module-definitions-in-each-module/module1/sources/Fake.java @@ -0,0 +1 @@ +Fake
\ No newline at end of file diff --git a/src/test/resources/org/sonar/runner/internal/batch/SonarProjectBuilderTest/multi-module-definitions-in-each-module/module2/newBaseDir/src/Fake.java b/src/test/resources/org/sonar/runner/internal/batch/SonarProjectBuilderTest/multi-module-definitions-in-each-module/module2/newBaseDir/src/Fake.java new file mode 100644 index 0000000..5967658 --- /dev/null +++ b/src/test/resources/org/sonar/runner/internal/batch/SonarProjectBuilderTest/multi-module-definitions-in-each-module/module2/newBaseDir/src/Fake.java @@ -0,0 +1 @@ +Fake
\ No newline at end of file diff --git a/src/test/resources/org/sonar/runner/internal/batch/SonarProjectBuilderTest/multi-module-definitions-in-each-module/module2/sonar-project.properties b/src/test/resources/org/sonar/runner/internal/batch/SonarProjectBuilderTest/multi-module-definitions-in-each-module/module2/sonar-project.properties new file mode 100644 index 0000000..d25a9e9 --- /dev/null +++ b/src/test/resources/org/sonar/runner/internal/batch/SonarProjectBuilderTest/multi-module-definitions-in-each-module/module2/sonar-project.properties @@ -0,0 +1,6 @@ +sonar.projectKey=com.foo.project.module2 +sonar.projectName=Foo Module 2 +# redefine some properties +sonar.projectBaseDir=newBaseDir +sonar.projectDescription=Description of Module 2 +sonar.sources=src diff --git a/src/test/resources/org/sonar/runner/internal/batch/SonarProjectBuilderTest/multi-module-definitions-in-each-module/sonar-project.properties b/src/test/resources/org/sonar/runner/internal/batch/SonarProjectBuilderTest/multi-module-definitions-in-each-module/sonar-project.properties new file mode 100644 index 0000000..4744284 --- /dev/null +++ b/src/test/resources/org/sonar/runner/internal/batch/SonarProjectBuilderTest/multi-module-definitions-in-each-module/sonar-project.properties @@ -0,0 +1,11 @@ +sonar.projectKey=com.foo.project +sonar.projectName=Foo Project +sonar.projectVersion=1.0-SNAPSHOT +sonar.projectDescription=Description of Foo Project + +sonar.sources=sources +sonar.tests=tests +sonar.binaries=target/classes + +sonar.modules=module1,\ + module2 diff --git a/src/test/resources/org/sonar/runner/internal/batch/SonarProjectBuilderTest/multi-module-with-configfile/any-folder/generated/any-file.properties b/src/test/resources/org/sonar/runner/internal/batch/SonarProjectBuilderTest/multi-module-with-configfile-and-overwritten-basedir/any-folder/generated/any-file.properties index c50d50b..c50d50b 100644 --- a/src/test/resources/org/sonar/runner/internal/batch/SonarProjectBuilderTest/multi-module-with-configfile/any-folder/generated/any-file.properties +++ b/src/test/resources/org/sonar/runner/internal/batch/SonarProjectBuilderTest/multi-module-with-configfile-and-overwritten-basedir/any-folder/generated/any-file.properties diff --git a/src/test/resources/org/sonar/runner/internal/batch/SonarProjectBuilderTest/multi-module-with-configfile-and-overwritten-basedir/any-folder/sources/Fake.java b/src/test/resources/org/sonar/runner/internal/batch/SonarProjectBuilderTest/multi-module-with-configfile-and-overwritten-basedir/any-folder/sources/Fake.java new file mode 100644 index 0000000..5967658 --- /dev/null +++ b/src/test/resources/org/sonar/runner/internal/batch/SonarProjectBuilderTest/multi-module-with-configfile-and-overwritten-basedir/any-folder/sources/Fake.java @@ -0,0 +1 @@ +Fake
\ No newline at end of file diff --git a/src/test/resources/org/sonar/runner/internal/batch/SonarProjectBuilderTest/multi-module-with-configfile-and-overwritten-basedir/sonar-project.properties b/src/test/resources/org/sonar/runner/internal/batch/SonarProjectBuilderTest/multi-module-with-configfile-and-overwritten-basedir/sonar-project.properties new file mode 100644 index 0000000..c1640b1 --- /dev/null +++ b/src/test/resources/org/sonar/runner/internal/batch/SonarProjectBuilderTest/multi-module-with-configfile-and-overwritten-basedir/sonar-project.properties @@ -0,0 +1,12 @@ +sonar.projectKey=com.foo.project +sonar.projectName=Foo Project +sonar.projectVersion=1.0-SNAPSHOT +sonar.projectDescription=Description of Foo Project + +sonar.sources=sources +sonar.tests=tests +sonar.binaries=target/classes + +sonar.modules=module1 + +module1.sonar.projectConfigFile=any-folder/generated/any-file.properties diff --git a/src/test/resources/org/sonar/runner/internal/batch/SonarProjectBuilderTest/multi-module-with-configfile/any-folder/any-file.properties b/src/test/resources/org/sonar/runner/internal/batch/SonarProjectBuilderTest/multi-module-with-configfile/any-folder/any-file.properties new file mode 100644 index 0000000..460d349 --- /dev/null +++ b/src/test/resources/org/sonar/runner/internal/batch/SonarProjectBuilderTest/multi-module-with-configfile/any-folder/any-file.properties @@ -0,0 +1,2 @@ +sonar.projectKey=com.foo.project.module1 +sonar.projectName=Foo Module 1 diff --git a/src/test/resources/org/sonar/runner/internal/batch/SonarProjectBuilderTest/multi-module-with-configfile/sonar-project.properties b/src/test/resources/org/sonar/runner/internal/batch/SonarProjectBuilderTest/multi-module-with-configfile/sonar-project.properties index c1640b1..e246f8c 100644 --- a/src/test/resources/org/sonar/runner/internal/batch/SonarProjectBuilderTest/multi-module-with-configfile/sonar-project.properties +++ b/src/test/resources/org/sonar/runner/internal/batch/SonarProjectBuilderTest/multi-module-with-configfile/sonar-project.properties @@ -9,4 +9,4 @@ sonar.binaries=target/classes sonar.modules=module1 -module1.sonar.projectConfigFile=any-folder/generated/any-file.properties +module1.sonar.projectConfigFile=any-folder/any-file.properties |