diff options
author | Sébastien Lesaint <sebastien.lesaint@sonarsource.com> | 2019-01-16 14:19:36 +0100 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2019-02-11 09:11:46 +0100 |
commit | 47ebff25c379b9162943121a49278553967f2dfe (patch) | |
tree | 4d5bf3e095021ce397261f97c5d9113c76225bc9 /sonar-plugin-api/src/main/java/org/sonar/api/batch | |
parent | 3373e5778af7c9e5b02aa23b07c7c2c8592e5da5 (diff) | |
download | sonarqube-47ebff25c379b9162943121a49278553967f2dfe.tar.gz sonarqube-47ebff25c379b9162943121a49278553967f2dfe.zip |
SONAR-11631 replace Component.version by Metadata.projectVersion
in scanner report
Diffstat (limited to 'sonar-plugin-api/src/main/java/org/sonar/api/batch')
-rw-r--r-- | sonar-plugin-api/src/main/java/org/sonar/api/batch/bootstrap/ProjectDefinition.java | 23 | ||||
-rw-r--r-- | sonar-plugin-api/src/main/java/org/sonar/api/batch/fs/internal/AbstractProjectOrModule.java | 13 |
2 files changed, 19 insertions, 17 deletions
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/bootstrap/ProjectDefinition.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/bootstrap/ProjectDefinition.java index a846b206bc1..cad32b8d980 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/bootstrap/ProjectDefinition.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/bootstrap/ProjectDefinition.java @@ -48,8 +48,6 @@ public class ProjectDefinition { public static final String TESTS_PROPERTY = "sonar.tests"; - public static final String BUILD_DIR_PROPERTY = "sonar.buildDir"; - private static final char SEPARATOR = ','; private File baseDir; @@ -149,7 +147,7 @@ public class ProjectDefinition { return this; } - public ProjectDefinition setVersion(String s) { + public ProjectDefinition setProjectVersion(String s) { properties.put(CoreProperties.PROJECT_VERSION_PROPERTY, StringUtils.defaultString(s)); return this; } @@ -191,12 +189,29 @@ public class ProjectDefinition { return null; } + /** + * @deprecated since 7.7, use {@link #getOriginalProjectVersion()} instead + */ + @Deprecated @CheckForNull public String getOriginalVersion() { - return properties.get(CoreProperties.PROJECT_VERSION_PROPERTY); + return getOriginalProjectVersion(); } + /** + * @deprecated since 7.7, use {@link #getProjectVersion()} instead + */ + @Deprecated public String getVersion() { + return getProjectVersion(); + } + + @CheckForNull + public String getOriginalProjectVersion() { + return properties.get(CoreProperties.PROJECT_VERSION_PROPERTY); + } + + public String getProjectVersion() { String version = properties.get(CoreProperties.PROJECT_VERSION_PROPERTY); if (StringUtils.isBlank(version)) { version = "not provided"; diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/fs/internal/AbstractProjectOrModule.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/fs/internal/AbstractProjectOrModule.java index 8bdb040b0f0..caae97c3494 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/fs/internal/AbstractProjectOrModule.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/fs/internal/AbstractProjectOrModule.java @@ -43,9 +43,7 @@ public abstract class AbstractProjectOrModule extends DefaultInputComponent { private final Path baseDir; private final Path workDir; private final String name; - private final String version; private final String originalName; - private final String originalVersion; private final String description; private final String keyWithBranch; private final String branch; @@ -61,8 +59,6 @@ public abstract class AbstractProjectOrModule extends DefaultInputComponent { this.workDir = initWorkingDir(definition); this.name = definition.getName(); this.originalName = definition.getOriginalName(); - this.version = definition.getVersion(); - this.originalVersion = definition.getOriginalVersion(); this.description = definition.getDescription(); this.keyWithBranch = definition.getKeyWithBranch(); this.branch = definition.getBranch(); @@ -146,15 +142,6 @@ public abstract class AbstractProjectOrModule extends DefaultInputComponent { } @CheckForNull - public String getOriginalVersion() { - return originalVersion; - } - - public String getVersion() { - return version; - } - - @CheckForNull public String getOriginalName() { return originalName; } |