From ca31625e559c2762ecde68ca739f296f427b813a Mon Sep 17 00:00:00 2001 From: Julien HENRY Date: Thu, 3 Apr 2014 12:19:31 +0200 Subject: [PATCH] SONAR-5181 Move parsing of sonar-project.properties files to SQ Runner --- .../batch/bootstrap/BootstrapContainer.java | 17 +- .../scan/DeprecatedProjectReactorBuilder.java | 114 +++++++++++ .../batch/scan/ProjectReactorBuilder.java | 80 +------- .../bootstrap/BootstrapContainerTest.java | 27 +++ .../DeprecatedProjectReactorBuilderTest.java | 191 ++++++++++++++++++ .../batch/scan/ProjectReactorBuilderTest.java | 147 +------------- .../module1/sonar-project.properties | 0 .../module1/sources/Fake.java | 0 .../module2/newBaseDir/src/Fake.java | 0 .../module2/sonar-project.properties | 0 .../sonar-project.properties | 0 .../module1/sonar-project.properties | 0 .../module1/sources/Fake.java | 0 .../module2/newBaseDir/src/Fake.java | 0 .../module2/sonar-project.properties | 0 .../sonar-project.properties | 0 .../any-folder/generated/any-file.properties | 0 .../any-folder/sources/Fake.java | 0 .../sonar-project.properties | 0 .../any-folder/any-file.properties | 0 .../any-folder/sources/Fake.java | 0 .../sonar-project.properties | 0 .../sonar-project.properties | 0 .../build/report.txt | 0 .../sonar-project.properties | 8 + .../sources/Fake.java | 3 + 26 files changed, 380 insertions(+), 207 deletions(-) create mode 100644 sonar-batch/src/main/java/org/sonar/batch/scan/DeprecatedProjectReactorBuilder.java create mode 100644 sonar-batch/src/test/java/org/sonar/batch/scan/DeprecatedProjectReactorBuilderTest.java rename sonar-batch/src/test/resources/org/sonar/batch/scan/{ProjectReactorBuilderTest => DeprecatedProjectReactorBuilderTest}/multi-module-definitions-in-each-module-inherited/module1/sonar-project.properties (100%) rename sonar-batch/src/test/resources/org/sonar/batch/scan/{ProjectReactorBuilderTest => DeprecatedProjectReactorBuilderTest}/multi-module-definitions-in-each-module-inherited/module1/sources/Fake.java (100%) rename sonar-batch/src/test/resources/org/sonar/batch/scan/{ProjectReactorBuilderTest => DeprecatedProjectReactorBuilderTest}/multi-module-definitions-in-each-module-inherited/module2/newBaseDir/src/Fake.java (100%) rename sonar-batch/src/test/resources/org/sonar/batch/scan/{ProjectReactorBuilderTest => DeprecatedProjectReactorBuilderTest}/multi-module-definitions-in-each-module-inherited/module2/sonar-project.properties (100%) rename sonar-batch/src/test/resources/org/sonar/batch/scan/{ProjectReactorBuilderTest => DeprecatedProjectReactorBuilderTest}/multi-module-definitions-in-each-module-inherited/sonar-project.properties (100%) rename sonar-batch/src/test/resources/org/sonar/batch/scan/{ProjectReactorBuilderTest => DeprecatedProjectReactorBuilderTest}/multi-module-definitions-in-each-module/module1/sonar-project.properties (100%) rename sonar-batch/src/test/resources/org/sonar/batch/scan/{ProjectReactorBuilderTest => DeprecatedProjectReactorBuilderTest}/multi-module-definitions-in-each-module/module1/sources/Fake.java (100%) rename sonar-batch/src/test/resources/org/sonar/batch/scan/{ProjectReactorBuilderTest => DeprecatedProjectReactorBuilderTest}/multi-module-definitions-in-each-module/module2/newBaseDir/src/Fake.java (100%) rename sonar-batch/src/test/resources/org/sonar/batch/scan/{ProjectReactorBuilderTest => DeprecatedProjectReactorBuilderTest}/multi-module-definitions-in-each-module/module2/sonar-project.properties (100%) rename sonar-batch/src/test/resources/org/sonar/batch/scan/{ProjectReactorBuilderTest => DeprecatedProjectReactorBuilderTest}/multi-module-definitions-in-each-module/sonar-project.properties (100%) rename sonar-batch/src/test/resources/org/sonar/batch/scan/{ProjectReactorBuilderTest => DeprecatedProjectReactorBuilderTest}/multi-module-with-configfile-and-overwritten-basedir/any-folder/generated/any-file.properties (100%) rename sonar-batch/src/test/resources/org/sonar/batch/scan/{ProjectReactorBuilderTest => DeprecatedProjectReactorBuilderTest}/multi-module-with-configfile-and-overwritten-basedir/any-folder/sources/Fake.java (100%) rename sonar-batch/src/test/resources/org/sonar/batch/scan/{ProjectReactorBuilderTest => DeprecatedProjectReactorBuilderTest}/multi-module-with-configfile-and-overwritten-basedir/sonar-project.properties (100%) rename sonar-batch/src/test/resources/org/sonar/batch/scan/{ProjectReactorBuilderTest => DeprecatedProjectReactorBuilderTest}/multi-module-with-configfile/any-folder/any-file.properties (100%) rename sonar-batch/src/test/resources/org/sonar/batch/scan/{ProjectReactorBuilderTest => DeprecatedProjectReactorBuilderTest}/multi-module-with-configfile/any-folder/sources/Fake.java (100%) rename sonar-batch/src/test/resources/org/sonar/batch/scan/{ProjectReactorBuilderTest => DeprecatedProjectReactorBuilderTest}/multi-module-with-configfile/sonar-project.properties (100%) rename sonar-batch/src/test/resources/org/sonar/batch/scan/{ProjectReactorBuilderTest => DeprecatedProjectReactorBuilderTest}/multi-module-with-unexisting-file/sonar-project.properties (100%) create mode 100644 sonar-batch/src/test/resources/org/sonar/batch/scan/ProjectReactorBuilderTest/simple-project-with-build-dir/build/report.txt create mode 100644 sonar-batch/src/test/resources/org/sonar/batch/scan/ProjectReactorBuilderTest/simple-project-with-build-dir/sonar-project.properties create mode 100644 sonar-batch/src/test/resources/org/sonar/batch/scan/ProjectReactorBuilderTest/simple-project-with-build-dir/sources/Fake.java diff --git a/sonar-batch/src/main/java/org/sonar/batch/bootstrap/BootstrapContainer.java b/sonar-batch/src/main/java/org/sonar/batch/bootstrap/BootstrapContainer.java index 52e3ad64ef3..7464af12e33 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/bootstrap/BootstrapContainer.java +++ b/sonar-batch/src/main/java/org/sonar/batch/bootstrap/BootstrapContainer.java @@ -29,6 +29,7 @@ import org.sonar.api.utils.HttpDownloader; import org.sonar.api.utils.System2; import org.sonar.api.utils.UriReader; import org.sonar.api.utils.internal.TempFolderCleaner; +import org.sonar.batch.bootstrapper.EnvironmentInformation; import org.sonar.batch.components.PastMeasuresLoader; import org.sonar.batch.components.PastSnapshotFinder; import org.sonar.batch.components.PastSnapshotFinderByDate; @@ -36,6 +37,7 @@ import org.sonar.batch.components.PastSnapshotFinderByDays; import org.sonar.batch.components.PastSnapshotFinderByPreviousAnalysis; import org.sonar.batch.components.PastSnapshotFinderByPreviousVersion; import org.sonar.batch.components.PastSnapshotFinderByVersion; +import org.sonar.batch.scan.DeprecatedProjectReactorBuilder; import org.sonar.batch.scan.ProjectReactorBuilder; import org.sonar.core.config.Logback; import org.sonar.core.i18n.DefaultI18n; @@ -97,7 +99,20 @@ public class BootstrapContainer extends ComponentContainer { UriReader.class, new FileCacheProvider(), System2.INSTANCE, - ProjectReactorBuilder.class); + projectReactorBuilder()); + } + + private Class projectReactorBuilder() { + if (isRunnerPre2_4()) { + return DeprecatedProjectReactorBuilder.class; + } + return ProjectReactorBuilder.class; + } + + private boolean isRunnerPre2_4() { + EnvironmentInformation env = this.getComponentByType(EnvironmentInformation.class); + // Starting from SQ Runner 2.4 the key is "SonarQubeRunner" + return env != null && "SonarRunner".equals(env.getKey()); } private void addDatabaseComponents() { diff --git a/sonar-batch/src/main/java/org/sonar/batch/scan/DeprecatedProjectReactorBuilder.java b/sonar-batch/src/main/java/org/sonar/batch/scan/DeprecatedProjectReactorBuilder.java new file mode 100644 index 00000000000..a0c3f5d173b --- /dev/null +++ b/sonar-batch/src/main/java/org/sonar/batch/scan/DeprecatedProjectReactorBuilder.java @@ -0,0 +1,114 @@ +/* + * SonarQube, open source software quality management tool. + * Copyright (C) 2008-2014 SonarSource + * mailto:contact AT sonarsource DOT com + * + * SonarQube 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. + * + * SonarQube 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.batch.scan; + +import org.sonar.api.batch.bootstrap.ProjectDefinition; +import org.sonar.batch.bootstrap.BootstrapSettings; + +import java.io.File; +import java.io.IOException; +import java.util.Map.Entry; +import java.util.Properties; + +/** + * Class that creates a project definition based on a set of properties. This class is intended to work with + * SQ Runner <= 2.3. Starting from SQ Runner 2.4 loading of sonar-project.properties file should not be done by + * the core. + * @deprecated since 4.3 should be removed when we will require SQ Runner 2.4+ + */ +@Deprecated +public class DeprecatedProjectReactorBuilder extends ProjectReactorBuilder { + + private static final String PROPERTY_PROJECT_CONFIG_FILE = "sonar.projectConfigFile"; + + public DeprecatedProjectReactorBuilder(BootstrapSettings settings) { + super(settings); + } + + @Override + protected ProjectDefinition loadChildProject(ProjectDefinition parentProject, Properties moduleProps, String moduleId) { + final File baseDir; + if (moduleProps.containsKey(PROPERTY_PROJECT_BASEDIR)) { + baseDir = resolvePath(parentProject.getBaseDir(), moduleProps.getProperty(PROPERTY_PROJECT_BASEDIR)); + setProjectBaseDir(baseDir, moduleProps, moduleId); + try { + if (!parentProject.getBaseDir().getCanonicalFile().equals(baseDir.getCanonicalFile())) { + tryToFindAndLoadPropsFile(baseDir, moduleProps, moduleId); + } + } catch (IOException e) { + throw new IllegalStateException("Error when resolving baseDir", e); + } + } else if (moduleProps.containsKey(PROPERTY_PROJECT_CONFIG_FILE)) { + baseDir = loadPropsFile(parentProject, moduleProps, moduleId); + } else { + baseDir = new File(parentProject.getBaseDir(), moduleId); + setProjectBaseDir(baseDir, moduleProps, moduleId); + tryToFindAndLoadPropsFile(baseDir, moduleProps, moduleId); + } + + setModuleKeyAndNameIfNotDefined(moduleProps, moduleId, parentProject.getKey()); + + // and finish + checkMandatoryProperties(moduleProps, MANDATORY_PROPERTIES_FOR_CHILD); + validateDirectories(moduleProps, baseDir, moduleId); + + mergeParentProperties(moduleProps, parentProject.getProperties()); + + return defineProject(moduleProps, parentProject); + } + + /** + * @return baseDir + */ + private File loadPropsFile(ProjectDefinition parentProject, Properties moduleProps, String moduleId) { + File propertyFile = resolvePath(parentProject.getBaseDir(), moduleProps.getProperty(PROPERTY_PROJECT_CONFIG_FILE)); + if (propertyFile.isFile()) { + Properties propsFromFile = toProperties(propertyFile); + for (Entry entry : propsFromFile.entrySet()) { + moduleProps.put(entry.getKey(), entry.getValue()); + } + File baseDir = null; + if (moduleProps.containsKey(PROPERTY_PROJECT_BASEDIR)) { + baseDir = resolvePath(propertyFile.getParentFile(), moduleProps.getProperty(PROPERTY_PROJECT_BASEDIR)); + } else { + baseDir = propertyFile.getParentFile(); + } + setProjectBaseDir(baseDir, moduleProps, moduleId); + return baseDir; + } else { + throw new IllegalStateException("The properties file of the module '" + moduleId + "' does not exist: " + propertyFile.getAbsolutePath()); + } + } + + 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 entry : propsFromFile.entrySet()) { + moduleProps.put(entry.getKey(), entry.getValue()); + } + if (moduleProps.containsKey(PROPERTY_PROJECT_BASEDIR)) { + File overwrittenBaseDir = resolvePath(propertyFile.getParentFile(), moduleProps.getProperty(PROPERTY_PROJECT_BASEDIR)); + setProjectBaseDir(overwrittenBaseDir, moduleProps, moduleId); + } + } + } + +} diff --git a/sonar-batch/src/main/java/org/sonar/batch/scan/ProjectReactorBuilder.java b/sonar-batch/src/main/java/org/sonar/batch/scan/ProjectReactorBuilder.java index 17db4e4850a..0dae4d31c28 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/scan/ProjectReactorBuilder.java +++ b/sonar-batch/src/main/java/org/sonar/batch/scan/ProjectReactorBuilder.java @@ -59,9 +59,8 @@ public class ProjectReactorBuilder { */ private static final String MODULE_KEY_PROPERTY = "sonar.moduleKey"; - private static final String PROPERTY_PROJECT_BASEDIR = "sonar.projectBaseDir"; + protected static final String PROPERTY_PROJECT_BASEDIR = "sonar.projectBaseDir"; private static final String PROPERTY_PROJECT_BUILDDIR = "sonar.projectBuildDir"; - private static final String PROPERTY_PROJECT_CONFIG_FILE = "sonar.projectConfigFile"; private static final String PROPERTY_MODULES = "sonar.modules"; /** @@ -91,7 +90,7 @@ public class ProjectReactorBuilder { /** * Array of all mandatory properties required for a child project before its properties get merged with its parent ones. */ - private static final String[] MANDATORY_PROPERTIES_FOR_CHILD = {MODULE_KEY_PROPERTY, CoreProperties.PROJECT_NAME_PROPERTY}; + protected static final String[] MANDATORY_PROPERTIES_FOR_CHILD = {MODULE_KEY_PROPERTY, CoreProperties.PROJECT_NAME_PROPERTY}; /** * Properties that must not be passed from the parent project to its children. @@ -115,7 +114,7 @@ public class ProjectReactorBuilder { return new ProjectReactor(rootProject); } - private ProjectDefinition defineProject(Properties properties, ProjectDefinition parent) { + protected ProjectDefinition defineProject(Properties properties, ProjectDefinition parent) { File baseDir = new File(properties.getProperty(PROPERTY_PROJECT_BASEDIR)); if (properties.containsKey(PROPERTY_MODULES)) { checkMandatoryProperties(properties, MANDATORY_PROPERTIES_FOR_MULTIMODULE_PROJECT); @@ -207,24 +206,14 @@ public class ProjectReactorBuilder { } } - private ProjectDefinition loadChildProject(ProjectDefinition parentProject, Properties moduleProps, String moduleId) { + protected ProjectDefinition loadChildProject(ProjectDefinition parentProject, Properties moduleProps, String moduleId) { final File baseDir; if (moduleProps.containsKey(PROPERTY_PROJECT_BASEDIR)) { - baseDir = getFileFromPath(moduleProps.getProperty(PROPERTY_PROJECT_BASEDIR), parentProject.getBaseDir()); + baseDir = resolvePath(parentProject.getBaseDir(), moduleProps.getProperty(PROPERTY_PROJECT_BASEDIR)); setProjectBaseDir(baseDir, moduleProps, moduleId); - try { - if (!parentProject.getBaseDir().getCanonicalFile().equals(baseDir.getCanonicalFile())) { - tryToFindAndLoadPropsFile(baseDir, moduleProps, moduleId); - } - } catch (IOException e) { - throw new IllegalStateException("Error when resolving baseDir", e); - } - } else if (moduleProps.containsKey(PROPERTY_PROJECT_CONFIG_FILE)) { - baseDir = loadPropsFile(parentProject, moduleProps, moduleId); } else { baseDir = new File(parentProject.getBaseDir(), moduleId); setProjectBaseDir(baseDir, moduleProps, moduleId); - tryToFindAndLoadPropsFile(baseDir, moduleProps, moduleId); } setModuleKeyAndNameIfNotDefined(moduleProps, moduleId, parentProject.getKey()); @@ -238,43 +227,6 @@ public class ProjectReactorBuilder { return defineProject(moduleProps, parentProject); } - /** - * @return baseDir - */ - protected File loadPropsFile(ProjectDefinition parentProject, Properties moduleProps, String moduleId) { - File propertyFile = getFileFromPath(moduleProps.getProperty(PROPERTY_PROJECT_CONFIG_FILE), parentProject.getBaseDir()); - if (propertyFile.isFile()) { - Properties propsFromFile = toProperties(propertyFile); - for (Entry 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); - return baseDir; - } else { - throw new IllegalStateException("The properties file of the module '" + moduleId + "' does not exist: " + propertyFile.getAbsolutePath()); - } - } - - 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 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(); @@ -320,7 +272,7 @@ public class ProjectReactorBuilder { } } - private static void setProjectBaseDir(File baseDir, Properties childProps, String moduleId) { + protected static void setProjectBaseDir(File baseDir, Properties childProps, String moduleId) { if (!baseDir.isDirectory()) { throw new IllegalStateException("The base directory of the module '" + moduleId + "' does not exist: " + baseDir.getAbsolutePath()); } @@ -344,7 +296,7 @@ public class ProjectReactorBuilder { } } - private static void validateDirectories(Properties props, File baseDir, String projectId) { + protected static void validateDirectories(Properties props, File baseDir, String projectId) { if (!props.containsKey(PROPERTY_MODULES)) { // SONARPLUGINS-2285 Not an aggregator project so we can validate that paths are correct if defined @@ -407,7 +359,7 @@ public class ProjectReactorBuilder { // SONARPLUGINS-2295 String[] sourceDirs = getListFromProperty(properties, PROPERTY_SOURCES); for (String path : sourceDirs) { - File sourceFolder = getFileFromPath(path, project.getBaseDir()); + File sourceFolder = resolvePath(project.getBaseDir(), path); if (sourceFolder.isDirectory()) { LOG.warn("/!\\ A multi-module project can't have source folders, so '{}' won't be used for the analysis. " + "If you want to analyse files of this folder, you should create another sub-module and move them inside it.", @@ -471,7 +423,7 @@ public class ProjectReactorBuilder { @VisibleForTesting protected static void checkExistenceOfDirectories(String moduleRef, File baseDir, String[] sourceDirs, String propName) { for (String path : sourceDirs) { - File sourceFolder = getFileFromPath(path, baseDir); + File sourceFolder = resolvePath(baseDir, path); if (!sourceFolder.isDirectory()) { LOG.error("Invalid value of " + propName + " for " + moduleRef); throw new IllegalStateException("The folder '" + path + "' does not exist for '" + moduleRef + @@ -508,7 +460,7 @@ public class ProjectReactorBuilder { return files; } - private static File resolvePath(File baseDir, String path) { + protected static File resolvePath(File baseDir, String path) { File file = new File(path); if (!file.isAbsolute()) { try { @@ -520,18 +472,6 @@ public class ProjectReactorBuilder { return file; } - /** - * Returns the file denoted by the given path, may this path be relative to "baseDir" or absolute. - */ - @VisibleForTesting - protected static File getFileFromPath(String path, File baseDir) { - File propertyFile = new File(path.trim()); - if (!propertyFile.isAbsolute()) { - propertyFile = new File(baseDir, propertyFile.getPath()); - } - return propertyFile; - } - /** * Transforms a comma-separated list String property in to a array of trimmed strings. * diff --git a/sonar-batch/src/test/java/org/sonar/batch/bootstrap/BootstrapContainerTest.java b/sonar-batch/src/test/java/org/sonar/batch/bootstrap/BootstrapContainerTest.java index 21806c54efe..cb611c8ae66 100644 --- a/sonar-batch/src/test/java/org/sonar/batch/bootstrap/BootstrapContainerTest.java +++ b/sonar-batch/src/test/java/org/sonar/batch/bootstrap/BootstrapContainerTest.java @@ -27,6 +27,9 @@ import org.sonar.api.Plugin; import org.sonar.api.SonarPlugin; import org.sonar.api.platform.PluginMetadata; import org.sonar.api.utils.TempFolder; +import org.sonar.batch.bootstrapper.EnvironmentInformation; +import org.sonar.batch.scan.DeprecatedProjectReactorBuilder; +import org.sonar.batch.scan.ProjectReactorBuilder; import org.sonar.core.config.Logback; import java.util.Arrays; @@ -75,6 +78,30 @@ public class BootstrapContainerTest { assertThat(container.getComponentsByType(Plugin.class)).containsOnly(plugin); } + @Test + public void should_add_project_reactor_builder_by_default() { + BootstrapContainer container = BootstrapContainer.create(Lists.newArrayList()); + container.add(new BootstrapProperties(Collections.emptyMap())); + container.doBeforeStart(); + + assertThat(container.getComponentByType(ProjectReactorBuilder.class)).isNotNull().isInstanceOf(ProjectReactorBuilder.class); + + container = BootstrapContainer.create(Lists.newArrayList(new EnvironmentInformation("SonarQubeRunner", "2.4"))); + container.add(new BootstrapProperties(Collections.emptyMap())); + container.doBeforeStart(); + + assertThat(container.getComponentByType(ProjectReactorBuilder.class)).isNotNull().isInstanceOf(ProjectReactorBuilder.class); + } + + @Test + public void should_add_deprecated_project_reactor_builder_if_old_runner() { + BootstrapContainer container = BootstrapContainer.create(Lists.newArrayList(new EnvironmentInformation("SonarRunner", "2.3"))); + container.add(new BootstrapProperties(Collections.emptyMap())); + container.doBeforeStart(); + + assertThat(container.getComponentByType(DeprecatedProjectReactorBuilder.class)).isNotNull().isInstanceOf(DeprecatedProjectReactorBuilder.class); + } + public static class Foo implements BatchExtension { } diff --git a/sonar-batch/src/test/java/org/sonar/batch/scan/DeprecatedProjectReactorBuilderTest.java b/sonar-batch/src/test/java/org/sonar/batch/scan/DeprecatedProjectReactorBuilderTest.java new file mode 100644 index 00000000000..a5fa0efc325 --- /dev/null +++ b/sonar-batch/src/test/java/org/sonar/batch/scan/DeprecatedProjectReactorBuilderTest.java @@ -0,0 +1,191 @@ +/* + * SonarQube, open source software quality management tool. + * Copyright (C) 2008-2014 SonarSource + * mailto:contact AT sonarsource DOT com + * + * SonarQube 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. + * + * SonarQube 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.batch.scan; + +import com.google.common.collect.Maps; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.ExpectedException; +import org.sonar.api.batch.bootstrap.ProjectDefinition; +import org.sonar.api.batch.bootstrap.ProjectReactor; +import org.sonar.batch.bootstrap.BootstrapProperties; +import org.sonar.batch.bootstrap.BootstrapSettings; +import org.sonar.test.TestUtils; + +import java.io.File; +import java.io.IOException; +import java.util.List; +import java.util.Map; +import java.util.Properties; + +import static org.fest.assertions.Assertions.assertThat; + +public class DeprecatedProjectReactorBuilderTest { + + @Rule + public ExpectedException thrown = ExpectedException.none(); + + @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 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()).isEqualTo("Description of Module 1"); + assertThat(module1.getSourceDirs()).contains("sources"); + assertThat(module1.getTestDirs()).contains("tests"); + assertThat(module1.getBinaries()).contains("target/classes"); + // and module properties must have been cleaned + assertThat(module1.getProperties().getProperty("module1.sonar.projectKey")).isNull(); + assertThat(module1.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"); + 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(module2.getProperties().getProperty("module1.sonar.projectKey")).isNull(); + assertThat(module2.getProperties().getProperty("module2.sonar.projectKey")).isNull(); + } + + @Test + public void shouldDefineMultiModuleProjectWithDefinitionsModule1Inherited() throws IOException { + ProjectDefinition rootProject = loadProjectDefinition("multi-module-definitions-in-each-module-inherited"); + + // 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 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-inherited/module1")); + assertThat(module1.getKey()).isEqualTo("com.foo.project:module1"); + assertThat(module1.getName()).isEqualTo("module1"); + 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(module1.getProperties().getProperty("module1.sonar.projectKey")).isNull(); + assertThat(module1.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-inherited/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"); + 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(module2.getProperties().getProperty("module1.sonar.projectKey")).isNull(); + assertThat(module2.getProperties().getProperty("module2.sonar.projectKey")).isNull(); + } + + @Test + public void shouldDefineMultiModuleProjectWithConfigFile() throws IOException { + ProjectDefinition rootProject = loadProjectDefinition("multi-module-with-configfile"); + List 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/any-folder")); + } + + @Test + public void shouldDefineMultiModuleProjectWithConfigFileAndOverwrittenBasedir() throws IOException { + ProjectDefinition rootProject = loadProjectDefinition("multi-module-with-configfile-and-overwritten-basedir"); + List 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 shouldFailIfUnexistingModuleFile() throws IOException { + thrown.expect(IllegalStateException.class); + thrown.expectMessage("The properties file of the module 'module1' does not exist: " + + TestUtils.getResource(this.getClass(), "multi-module-with-unexisting-file").getAbsolutePath() + File.separator + "any-folder" + + File.separator + "any-file.properties"); + + loadProjectDefinition("multi-module-with-unexisting-file"); + } + + private ProjectDefinition loadProjectDefinition(String projectFolder) throws IOException { + Map props = Maps.newHashMap(); + Properties runnerProps = ProjectReactorBuilder.toProperties(TestUtils.getResource(this.getClass(), projectFolder + "/sonar-project.properties")); + for (final String name : runnerProps.stringPropertyNames()) { + props.put(name, runnerProps.getProperty(name)); + } + props.put("sonar.projectBaseDir", TestUtils.getResource(this.getClass(), projectFolder).getAbsolutePath()); + BootstrapProperties bootstrapProps = new BootstrapProperties(props); + ProjectReactor projectReactor = new DeprecatedProjectReactorBuilder(new BootstrapSettings(bootstrapProps)).execute(); + return projectReactor.getRoot(); + } + +} diff --git a/sonar-batch/src/test/java/org/sonar/batch/scan/ProjectReactorBuilderTest.java b/sonar-batch/src/test/java/org/sonar/batch/scan/ProjectReactorBuilderTest.java index da0e9626c1c..dfea7822a7a 100644 --- a/sonar-batch/src/test/java/org/sonar/batch/scan/ProjectReactorBuilderTest.java +++ b/sonar-batch/src/test/java/org/sonar/batch/scan/ProjectReactorBuilderTest.java @@ -152,57 +152,6 @@ public class ProjectReactorBuilderTest { .isEqualTo(new File(TestUtils.getResource(this.getClass(), "multi-module-definitions-all-in-root"), ".sonar/com.foo.project_com.foo.project.module2")); } - @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 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()).isEqualTo("Description of Module 1"); - assertThat(module1.getSourceDirs()).contains("sources"); - assertThat(module1.getTestDirs()).contains("tests"); - assertThat(module1.getBinaries()).contains("target/classes"); - // and module properties must have been cleaned - assertThat(module1.getProperties().getProperty("module1.sonar.projectKey")).isNull(); - assertThat(module1.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"); - 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(module2.getProperties().getProperty("module1.sonar.projectKey")).isNull(); - assertThat(module2.getProperties().getProperty("module2.sonar.projectKey")).isNull(); - } - // SONAR-4876 @Test public void shouldDefineMultiModuleProjectWithModuleKey() throws IOException { @@ -222,57 +171,6 @@ public class ProjectReactorBuilderTest { assertThat(module2.getKey()).isEqualTo("com.foo.project.module2"); } - @Test - public void shouldDefineMultiModuleProjectWithDefinitionsModule1Inherited() throws IOException { - ProjectDefinition rootProject = loadProjectDefinition("multi-module-definitions-in-each-module-inherited"); - - // 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 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-inherited/module1")); - assertThat(module1.getKey()).isEqualTo("com.foo.project:module1"); - assertThat(module1.getName()).isEqualTo("module1"); - 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(module1.getProperties().getProperty("module1.sonar.projectKey")).isNull(); - assertThat(module1.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-inherited/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"); - 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(module2.getProperties().getProperty("module1.sonar.projectKey")).isNull(); - assertThat(module2.getProperties().getProperty("module2.sonar.projectKey")).isNull(); - } - // SONARPLUGINS-2421 @Test public void shouldDefineMultiLanguageProjectWithDefinitionsAllInRootProject() throws IOException { @@ -312,28 +210,6 @@ public class ProjectReactorBuilderTest { assertThat(modules.get(0).getKey()).isEqualTo("com.foo.project:com.foo.project.module1"); } - @Test - public void shouldDefineMultiModuleProjectWithConfigFile() throws IOException { - ProjectDefinition rootProject = loadProjectDefinition("multi-module-with-configfile"); - List 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/any-folder")); - } - - @Test - public void shouldDefineMultiModuleProjectWithConfigFileAndOverwrittenBasedir() throws IOException { - ProjectDefinition rootProject = loadProjectDefinition("multi-module-with-configfile-and-overwritten-basedir"); - List 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(IllegalStateException.class); @@ -343,16 +219,6 @@ public class ProjectReactorBuilderTest { loadProjectDefinition("multi-module-with-unexisting-basedir"); } - @Test - public void shouldFailIfUnexistingModuleFile() throws IOException { - thrown.expect(IllegalStateException.class); - thrown.expectMessage("The properties file of the module 'module1' does not exist: " - + TestUtils.getResource(this.getClass(), "multi-module-with-unexisting-file").getAbsolutePath() + File.separator + "any-folder" - + File.separator + "any-file.properties"); - - loadProjectDefinition("multi-module-with-unexisting-file"); - } - @Test public void shouldFailIfUnexistingSourceFolderInheritedInMultimodule() throws IOException { thrown.expect(IllegalStateException.class); @@ -505,7 +371,7 @@ public class ProjectReactorBuilderTest { @Test public void shouldGetRelativeFile() { - assertThat(ProjectReactorBuilder.getFileFromPath("shouldGetFile/foo.properties", TestUtils.getResource(this.getClass(), "/"))) + assertThat(ProjectReactorBuilder.resolvePath(TestUtils.getResource(this.getClass(), "/"), "shouldGetFile/foo.properties")) .isEqualTo(TestUtils.getResource(this.getClass(), "shouldGetFile/foo.properties")); } @@ -513,7 +379,7 @@ public class ProjectReactorBuilderTest { public void shouldGetAbsoluteFile() { File file = TestUtils.getResource(this.getClass(), "shouldGetFile/foo.properties"); - assertThat(ProjectReactorBuilder.getFileFromPath(file.getAbsolutePath(), TestUtils.getResource(this.getClass(), "/"))) + assertThat(ProjectReactorBuilder.resolvePath(TestUtils.getResource(this.getClass(), "/"), file.getAbsolutePath())) .isEqualTo(file); } @@ -662,6 +528,15 @@ public class ProjectReactorBuilderTest { assertThat(ProjectReactorBuilder.getListFromProperty(props, "prop")).containsOnly("foo", "bar", "toto", "tutu"); } + @Test + public void shouldDefineProjectWithBuildDir() throws IOException { + ProjectDefinition rootProject = loadProjectDefinition("simple-project-with-build-dir"); + File buildDir = rootProject.getBuildDir(); + assertThat(buildDir).isDirectory().exists(); + assertThat(new File(buildDir, "report.txt")).isFile().exists(); + assertThat(buildDir.getName()).isEqualTo("build"); + } + private Properties loadPropsFromFile(String filePath) throws IOException { Properties props = new Properties(); FileInputStream fileInputStream = null; diff --git a/sonar-batch/src/test/resources/org/sonar/batch/scan/ProjectReactorBuilderTest/multi-module-definitions-in-each-module-inherited/module1/sonar-project.properties b/sonar-batch/src/test/resources/org/sonar/batch/scan/DeprecatedProjectReactorBuilderTest/multi-module-definitions-in-each-module-inherited/module1/sonar-project.properties similarity index 100% rename from sonar-batch/src/test/resources/org/sonar/batch/scan/ProjectReactorBuilderTest/multi-module-definitions-in-each-module-inherited/module1/sonar-project.properties rename to sonar-batch/src/test/resources/org/sonar/batch/scan/DeprecatedProjectReactorBuilderTest/multi-module-definitions-in-each-module-inherited/module1/sonar-project.properties diff --git a/sonar-batch/src/test/resources/org/sonar/batch/scan/ProjectReactorBuilderTest/multi-module-definitions-in-each-module-inherited/module1/sources/Fake.java b/sonar-batch/src/test/resources/org/sonar/batch/scan/DeprecatedProjectReactorBuilderTest/multi-module-definitions-in-each-module-inherited/module1/sources/Fake.java similarity index 100% rename from sonar-batch/src/test/resources/org/sonar/batch/scan/ProjectReactorBuilderTest/multi-module-definitions-in-each-module-inherited/module1/sources/Fake.java rename to sonar-batch/src/test/resources/org/sonar/batch/scan/DeprecatedProjectReactorBuilderTest/multi-module-definitions-in-each-module-inherited/module1/sources/Fake.java diff --git a/sonar-batch/src/test/resources/org/sonar/batch/scan/ProjectReactorBuilderTest/multi-module-definitions-in-each-module-inherited/module2/newBaseDir/src/Fake.java b/sonar-batch/src/test/resources/org/sonar/batch/scan/DeprecatedProjectReactorBuilderTest/multi-module-definitions-in-each-module-inherited/module2/newBaseDir/src/Fake.java similarity index 100% rename from sonar-batch/src/test/resources/org/sonar/batch/scan/ProjectReactorBuilderTest/multi-module-definitions-in-each-module-inherited/module2/newBaseDir/src/Fake.java rename to sonar-batch/src/test/resources/org/sonar/batch/scan/DeprecatedProjectReactorBuilderTest/multi-module-definitions-in-each-module-inherited/module2/newBaseDir/src/Fake.java diff --git a/sonar-batch/src/test/resources/org/sonar/batch/scan/ProjectReactorBuilderTest/multi-module-definitions-in-each-module-inherited/module2/sonar-project.properties b/sonar-batch/src/test/resources/org/sonar/batch/scan/DeprecatedProjectReactorBuilderTest/multi-module-definitions-in-each-module-inherited/module2/sonar-project.properties similarity index 100% rename from sonar-batch/src/test/resources/org/sonar/batch/scan/ProjectReactorBuilderTest/multi-module-definitions-in-each-module-inherited/module2/sonar-project.properties rename to sonar-batch/src/test/resources/org/sonar/batch/scan/DeprecatedProjectReactorBuilderTest/multi-module-definitions-in-each-module-inherited/module2/sonar-project.properties diff --git a/sonar-batch/src/test/resources/org/sonar/batch/scan/ProjectReactorBuilderTest/multi-module-definitions-in-each-module-inherited/sonar-project.properties b/sonar-batch/src/test/resources/org/sonar/batch/scan/DeprecatedProjectReactorBuilderTest/multi-module-definitions-in-each-module-inherited/sonar-project.properties similarity index 100% rename from sonar-batch/src/test/resources/org/sonar/batch/scan/ProjectReactorBuilderTest/multi-module-definitions-in-each-module-inherited/sonar-project.properties rename to sonar-batch/src/test/resources/org/sonar/batch/scan/DeprecatedProjectReactorBuilderTest/multi-module-definitions-in-each-module-inherited/sonar-project.properties diff --git a/sonar-batch/src/test/resources/org/sonar/batch/scan/ProjectReactorBuilderTest/multi-module-definitions-in-each-module/module1/sonar-project.properties b/sonar-batch/src/test/resources/org/sonar/batch/scan/DeprecatedProjectReactorBuilderTest/multi-module-definitions-in-each-module/module1/sonar-project.properties similarity index 100% rename from sonar-batch/src/test/resources/org/sonar/batch/scan/ProjectReactorBuilderTest/multi-module-definitions-in-each-module/module1/sonar-project.properties rename to sonar-batch/src/test/resources/org/sonar/batch/scan/DeprecatedProjectReactorBuilderTest/multi-module-definitions-in-each-module/module1/sonar-project.properties diff --git a/sonar-batch/src/test/resources/org/sonar/batch/scan/ProjectReactorBuilderTest/multi-module-definitions-in-each-module/module1/sources/Fake.java b/sonar-batch/src/test/resources/org/sonar/batch/scan/DeprecatedProjectReactorBuilderTest/multi-module-definitions-in-each-module/module1/sources/Fake.java similarity index 100% rename from sonar-batch/src/test/resources/org/sonar/batch/scan/ProjectReactorBuilderTest/multi-module-definitions-in-each-module/module1/sources/Fake.java rename to sonar-batch/src/test/resources/org/sonar/batch/scan/DeprecatedProjectReactorBuilderTest/multi-module-definitions-in-each-module/module1/sources/Fake.java diff --git a/sonar-batch/src/test/resources/org/sonar/batch/scan/ProjectReactorBuilderTest/multi-module-definitions-in-each-module/module2/newBaseDir/src/Fake.java b/sonar-batch/src/test/resources/org/sonar/batch/scan/DeprecatedProjectReactorBuilderTest/multi-module-definitions-in-each-module/module2/newBaseDir/src/Fake.java similarity index 100% rename from sonar-batch/src/test/resources/org/sonar/batch/scan/ProjectReactorBuilderTest/multi-module-definitions-in-each-module/module2/newBaseDir/src/Fake.java rename to sonar-batch/src/test/resources/org/sonar/batch/scan/DeprecatedProjectReactorBuilderTest/multi-module-definitions-in-each-module/module2/newBaseDir/src/Fake.java diff --git a/sonar-batch/src/test/resources/org/sonar/batch/scan/ProjectReactorBuilderTest/multi-module-definitions-in-each-module/module2/sonar-project.properties b/sonar-batch/src/test/resources/org/sonar/batch/scan/DeprecatedProjectReactorBuilderTest/multi-module-definitions-in-each-module/module2/sonar-project.properties similarity index 100% rename from sonar-batch/src/test/resources/org/sonar/batch/scan/ProjectReactorBuilderTest/multi-module-definitions-in-each-module/module2/sonar-project.properties rename to sonar-batch/src/test/resources/org/sonar/batch/scan/DeprecatedProjectReactorBuilderTest/multi-module-definitions-in-each-module/module2/sonar-project.properties diff --git a/sonar-batch/src/test/resources/org/sonar/batch/scan/ProjectReactorBuilderTest/multi-module-definitions-in-each-module/sonar-project.properties b/sonar-batch/src/test/resources/org/sonar/batch/scan/DeprecatedProjectReactorBuilderTest/multi-module-definitions-in-each-module/sonar-project.properties similarity index 100% rename from sonar-batch/src/test/resources/org/sonar/batch/scan/ProjectReactorBuilderTest/multi-module-definitions-in-each-module/sonar-project.properties rename to sonar-batch/src/test/resources/org/sonar/batch/scan/DeprecatedProjectReactorBuilderTest/multi-module-definitions-in-each-module/sonar-project.properties diff --git a/sonar-batch/src/test/resources/org/sonar/batch/scan/ProjectReactorBuilderTest/multi-module-with-configfile-and-overwritten-basedir/any-folder/generated/any-file.properties b/sonar-batch/src/test/resources/org/sonar/batch/scan/DeprecatedProjectReactorBuilderTest/multi-module-with-configfile-and-overwritten-basedir/any-folder/generated/any-file.properties similarity index 100% rename from sonar-batch/src/test/resources/org/sonar/batch/scan/ProjectReactorBuilderTest/multi-module-with-configfile-and-overwritten-basedir/any-folder/generated/any-file.properties rename to sonar-batch/src/test/resources/org/sonar/batch/scan/DeprecatedProjectReactorBuilderTest/multi-module-with-configfile-and-overwritten-basedir/any-folder/generated/any-file.properties diff --git a/sonar-batch/src/test/resources/org/sonar/batch/scan/ProjectReactorBuilderTest/multi-module-with-configfile-and-overwritten-basedir/any-folder/sources/Fake.java b/sonar-batch/src/test/resources/org/sonar/batch/scan/DeprecatedProjectReactorBuilderTest/multi-module-with-configfile-and-overwritten-basedir/any-folder/sources/Fake.java similarity index 100% rename from sonar-batch/src/test/resources/org/sonar/batch/scan/ProjectReactorBuilderTest/multi-module-with-configfile-and-overwritten-basedir/any-folder/sources/Fake.java rename to sonar-batch/src/test/resources/org/sonar/batch/scan/DeprecatedProjectReactorBuilderTest/multi-module-with-configfile-and-overwritten-basedir/any-folder/sources/Fake.java diff --git a/sonar-batch/src/test/resources/org/sonar/batch/scan/ProjectReactorBuilderTest/multi-module-with-configfile-and-overwritten-basedir/sonar-project.properties b/sonar-batch/src/test/resources/org/sonar/batch/scan/DeprecatedProjectReactorBuilderTest/multi-module-with-configfile-and-overwritten-basedir/sonar-project.properties similarity index 100% rename from sonar-batch/src/test/resources/org/sonar/batch/scan/ProjectReactorBuilderTest/multi-module-with-configfile-and-overwritten-basedir/sonar-project.properties rename to sonar-batch/src/test/resources/org/sonar/batch/scan/DeprecatedProjectReactorBuilderTest/multi-module-with-configfile-and-overwritten-basedir/sonar-project.properties diff --git a/sonar-batch/src/test/resources/org/sonar/batch/scan/ProjectReactorBuilderTest/multi-module-with-configfile/any-folder/any-file.properties b/sonar-batch/src/test/resources/org/sonar/batch/scan/DeprecatedProjectReactorBuilderTest/multi-module-with-configfile/any-folder/any-file.properties similarity index 100% rename from sonar-batch/src/test/resources/org/sonar/batch/scan/ProjectReactorBuilderTest/multi-module-with-configfile/any-folder/any-file.properties rename to sonar-batch/src/test/resources/org/sonar/batch/scan/DeprecatedProjectReactorBuilderTest/multi-module-with-configfile/any-folder/any-file.properties diff --git a/sonar-batch/src/test/resources/org/sonar/batch/scan/ProjectReactorBuilderTest/multi-module-with-configfile/any-folder/sources/Fake.java b/sonar-batch/src/test/resources/org/sonar/batch/scan/DeprecatedProjectReactorBuilderTest/multi-module-with-configfile/any-folder/sources/Fake.java similarity index 100% rename from sonar-batch/src/test/resources/org/sonar/batch/scan/ProjectReactorBuilderTest/multi-module-with-configfile/any-folder/sources/Fake.java rename to sonar-batch/src/test/resources/org/sonar/batch/scan/DeprecatedProjectReactorBuilderTest/multi-module-with-configfile/any-folder/sources/Fake.java diff --git a/sonar-batch/src/test/resources/org/sonar/batch/scan/ProjectReactorBuilderTest/multi-module-with-configfile/sonar-project.properties b/sonar-batch/src/test/resources/org/sonar/batch/scan/DeprecatedProjectReactorBuilderTest/multi-module-with-configfile/sonar-project.properties similarity index 100% rename from sonar-batch/src/test/resources/org/sonar/batch/scan/ProjectReactorBuilderTest/multi-module-with-configfile/sonar-project.properties rename to sonar-batch/src/test/resources/org/sonar/batch/scan/DeprecatedProjectReactorBuilderTest/multi-module-with-configfile/sonar-project.properties diff --git a/sonar-batch/src/test/resources/org/sonar/batch/scan/ProjectReactorBuilderTest/multi-module-with-unexisting-file/sonar-project.properties b/sonar-batch/src/test/resources/org/sonar/batch/scan/DeprecatedProjectReactorBuilderTest/multi-module-with-unexisting-file/sonar-project.properties similarity index 100% rename from sonar-batch/src/test/resources/org/sonar/batch/scan/ProjectReactorBuilderTest/multi-module-with-unexisting-file/sonar-project.properties rename to sonar-batch/src/test/resources/org/sonar/batch/scan/DeprecatedProjectReactorBuilderTest/multi-module-with-unexisting-file/sonar-project.properties diff --git a/sonar-batch/src/test/resources/org/sonar/batch/scan/ProjectReactorBuilderTest/simple-project-with-build-dir/build/report.txt b/sonar-batch/src/test/resources/org/sonar/batch/scan/ProjectReactorBuilderTest/simple-project-with-build-dir/build/report.txt new file mode 100644 index 00000000000..e69de29bb2d diff --git a/sonar-batch/src/test/resources/org/sonar/batch/scan/ProjectReactorBuilderTest/simple-project-with-build-dir/sonar-project.properties b/sonar-batch/src/test/resources/org/sonar/batch/scan/ProjectReactorBuilderTest/simple-project-with-build-dir/sonar-project.properties new file mode 100644 index 00000000000..35b33996ea7 --- /dev/null +++ b/sonar-batch/src/test/resources/org/sonar/batch/scan/ProjectReactorBuilderTest/simple-project-with-build-dir/sonar-project.properties @@ -0,0 +1,8 @@ +sonar.projectKey=com.foo.project +sonar.projectName=Foo Project +sonar.projectVersion=1.0-SNAPSHOT +sonar.projectDescription=Description of Foo Project +sonar.projectBuildDir=build + +sonar.sources=sources + diff --git a/sonar-batch/src/test/resources/org/sonar/batch/scan/ProjectReactorBuilderTest/simple-project-with-build-dir/sources/Fake.java b/sonar-batch/src/test/resources/org/sonar/batch/scan/ProjectReactorBuilderTest/simple-project-with-build-dir/sources/Fake.java new file mode 100644 index 00000000000..b2722353bea --- /dev/null +++ b/sonar-batch/src/test/resources/org/sonar/batch/scan/ProjectReactorBuilderTest/simple-project-with-build-dir/sources/Fake.java @@ -0,0 +1,3 @@ +package org.sonar.runner.batch.ProjectReactorBuilderTest.simple + +Fake -- 2.39.5