Skip to content

Commit

Permalink
Merge branch 'release/V2.13.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
gquerret committed May 1, 2021
2 parents 3291601 + 88da045 commit d93e065
Show file tree
Hide file tree
Showing 46 changed files with 709 additions and 349 deletions.
16 changes: 8 additions & 8 deletions coverage-report/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>eu.rssw.openedge.parsers</groupId>
<artifactId>coverage-report</artifactId>
<version>2.12.1</version>
<version>2.13.0</version>

<name>JaCoCo report</name>
<description>Fake module for code coverage report in SonarQube</description>
Expand All @@ -20,37 +20,37 @@
<dependency>
<groupId>eu.rssw.openedge.rcode</groupId>
<artifactId>rcode-reader</artifactId>
<version>2.12.1</version>
<version>2.13.0</version>
</dependency>
<dependency>
<groupId>eu.rssw.sonar.openedge</groupId>
<artifactId>sonar-openedge-plugin</artifactId>
<version>2.12.1</version>
<version>2.13.0</version>
</dependency>
<dependency>
<groupId>eu.rssw.openedge.parsers</groupId>
<artifactId>proparse</artifactId>
<version>2.12.1</version>
<version>2.13.0</version>
</dependency>
<dependency>
<groupId>eu.rssw.openedge.parsers</groupId>
<artifactId>profiler-parser</artifactId>
<version>2.12.1</version>
<version>2.13.0</version>
</dependency>
<dependency>
<groupId>eu.rssw.openedge.parsers</groupId>
<artifactId>database-parser</artifactId>
<version>2.12.1</version>
<version>2.13.0</version>
</dependency>
<dependency>
<groupId>eu.rssw.openedge.parsers</groupId>
<artifactId>listing-parser</artifactId>
<version>2.12.1</version>
<version>2.13.0</version>
</dependency>
<dependency>
<groupId>eu.rssw.openedge.checks</groupId>
<artifactId>openedge-checks</artifactId>
<version>2.12.1</version>
<version>2.13.0</version>
</dependency>
</dependencies>

Expand Down
8 changes: 4 additions & 4 deletions database-parser/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>eu.rssw.openedge.parsers</groupId>
<artifactId>database-parser</artifactId>
<version>2.12.1</version>
<version>2.13.0</version>

<name>OpenEdge database definition lexer and parser</name>
<description>OpenEdge dump files parser</description>
Expand Down Expand Up @@ -51,12 +51,12 @@
<dependency>
<groupId>org.antlr</groupId>
<artifactId>antlr4-runtime</artifactId>
<version>4.9</version>
<version>4.9.2</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>29.0-jre</version>
<version>30.1.1-jre</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
Expand Down Expand Up @@ -112,7 +112,7 @@
<plugin>
<groupId>org.antlr</groupId>
<artifactId>antlr4-maven-plugin</artifactId>
<version>4.9</version>
<version>4.9.2</version>
<executions>
<execution>
<goals>
Expand Down
4 changes: 2 additions & 2 deletions listing-parser/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>eu.rssw.openedge.parsers</groupId>
<artifactId>listing-parser</artifactId>
<version>2.12.1</version>
<version>2.13.0</version>

<name>OpenEdge listing so-called parser</name>
<description>OpenEdge listing files parser</description>
Expand Down Expand Up @@ -49,7 +49,7 @@
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>29.0-jre</version>
<version>30.1.1-jre</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
Expand Down
6 changes: 3 additions & 3 deletions openedge-checks/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>eu.rssw.openedge.checks</groupId>
<artifactId>openedge-checks</artifactId>
<version>2.12.1</version>
<version>2.13.0</version>

<name>OpenEdge checks</name>
<description>OpenEdge checks</description>
Expand Down Expand Up @@ -55,12 +55,12 @@
<dependency>
<groupId>eu.rssw.openedge.parsers</groupId>
<artifactId>database-parser</artifactId>
<version>2.12.1</version>
<version>2.13.0</version>
</dependency>
<dependency>
<groupId>eu.rssw.openedge.parsers</groupId>
<artifactId>proparse</artifactId>
<version>2.12.1</version>
<version>2.13.0</version>
</dependency>
<dependency>
<groupId>org.testng</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,15 @@
*/
package org.sonar.plugins.openedge.api;

import java.util.Objects;

import org.sonar.api.SonarProduct;
import org.sonar.api.scanner.ScannerSide;
import org.sonar.api.server.ServerSide;
import org.sonarsource.api.sonarlint.SonarLintSide;

import com.google.common.base.Strings;

/**
* Implement this interface to register licenses
*/
Expand All @@ -35,19 +39,26 @@ public interface LicenseRegistration {
/**
* Register set of licenses
*/
default void register(Registrar registrar) { }
default void register(Registrar registrar) {
}

interface Registrar {
/**
* Register customer license for a given permanentID and rules repository
* Register customer license for a given permanentID and rules repository
*/
@Deprecated
public void registerLicense(String permanentId, String customerName, String salt, String repoName, LicenseType type,
byte[] signature, long expirationDate);
default void registerLicense(String permanentId, String customerName, String salt, String repoName,
LicenseType type, byte[] signature, long expirationDate) {
registerLicense(1, permanentId.replace("sonarlint-", ""),
permanentId.startsWith("sonarlint") ? SonarProduct.SONARLINT : SonarProduct.SONARQUBE, customerName, salt,
repoName, type, signature, expirationDate, 0);
}

@Deprecated
public void registerLicense(String permanentId, SonarProduct product, String customerName, String salt,
String repoName, LicenseType type, byte[] signature, long expirationDate);
default void registerLicense(String permanentId, SonarProduct product, String customerName, String salt,
String repoName, LicenseType type, byte[] signature, long expirationDate) {
registerLicense(1, permanentId, product, customerName, salt, repoName, type, signature, expirationDate, 0);
}

public void registerLicense(int version, String permanentId, SonarProduct product, String customerName, String salt,
String repoName, LicenseType type, byte[] signature, long expirationDate, long lines);
Expand All @@ -65,18 +76,8 @@ public class License {
private String salt;
private byte[] signature;

public License(int version, String permanentId, SonarProduct product, String customerName, String salt, String repoName,
LicenseType type, byte[] signature, long expirationDate, long lines) {
this.version = version;
this.permanentId = permanentId;
this.product = product;
this.customerName = customerName;
this.repositoryName = repoName;
this.salt = salt;
this.type = type;
this.signature = signature;
this.expirationDate = expirationDate;
this.lines = lines;
private License() {
// Use Builder pattern
}

public int getVersion() {
Expand Down Expand Up @@ -118,9 +119,114 @@ public LicenseType getType() {
public long getLines() {
return lines;
}

@Override
public boolean equals(Object obj) {
if (obj == this) {
return true;
}

if (obj == null)
return false;
if (this.getClass() == obj.getClass()) {
License other = (License) obj;

return customerName.equals(other.customerName) && (product == other.product)
&& permanentId.equals(other.permanentId) && repositoryName.equals(other.repositoryName)
&& (expirationDate == other.expirationDate) && (salt.equals(other.salt)) && (type == other.type)
&& (lines == other.lines);
}
return false;
}

@Override
public int hashCode() {
return Objects.hash(customerName, product, permanentId, repositoryName, expirationDate, salt, type, lines);
}

public static class Builder {
private int version = 1;
private String permanentId = "";
private String customerName = "";
private String repositoryName = "";
private String salt= "";
private SonarProduct product;
private LicenseType type;
private long expirationDate;
private long lines;
private byte[] signature;

public Builder setVersion(int version) {
this.version = version;
return this;
}

public Builder setPermanentId(String permanentId) {
this.permanentId = Strings.nullToEmpty(permanentId);
return this;
}

public Builder setCustomerName(String customerName) {
this.customerName = Strings.nullToEmpty(customerName);
return this;
}

public Builder setRepositoryName(String repositoryName) {
this.repositoryName = Strings.nullToEmpty(repositoryName);
return this;
}

public Builder setSalt(String salt) {
this.salt = Strings.nullToEmpty(salt);
return this;
}

public Builder setProduct(SonarProduct product) {
this.product = product == null ? SonarProduct.SONARQUBE : product;
return this;
}

public Builder setType(LicenseType type) {
this.type = type == null ? LicenseType.EVALUATION : type;
return this;
}

public Builder setExpirationDate(long expirationDate) {
this.expirationDate = expirationDate;
return this;
}

public Builder setLines(long lines) {
this.lines = lines;
return this;
}

public Builder setSignature(byte[] signature) {
this.signature = (signature == null) || (signature.length != 256) ? new byte[0] : signature;
return this;
}

public License build() {
License license = new License();
license.version = version;
license.permanentId = permanentId;
license.customerName = customerName;
license.repositoryName = repositoryName;
license.salt = salt;
license.product = product;
license.type = type;
license.expirationDate = expirationDate;
license.lines = lines;
license.signature = signature;

return license;
}
}
}

public enum LicenseType {
EVALUATION, COMMERCIAL, PARTNER;
EVALUATION,
COMMERCIAL,
PARTNER;
}
}
8 changes: 4 additions & 4 deletions openedge-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>eu.rssw.sonar.openedge</groupId>
<artifactId>sonar-openedge-plugin</artifactId>
<version>2.12.1</version>
<version>2.13.0</version>
<packaging>sonar-plugin</packaging>

<name>OpenEdge plugin for SonarQube</name>
Expand Down Expand Up @@ -60,17 +60,17 @@
<dependency>
<groupId>eu.rssw.openedge.checks</groupId>
<artifactId>openedge-checks</artifactId>
<version>2.12.1</version>
<version>2.13.0</version>
</dependency>
<dependency>
<groupId>eu.rssw.openedge.parsers</groupId>
<artifactId>listing-parser</artifactId>
<version>2.12.1</version>
<version>2.13.0</version>
</dependency>
<dependency>
<groupId>eu.rssw.openedge.parsers</groupId>
<artifactId>profiler-parser</artifactId>
<version>2.12.1</version>
<version>2.13.0</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
import org.sonar.plugins.openedge.sensor.OpenEdgeProparseSensor;
import org.sonar.plugins.openedge.sensor.OpenEdgeSensor;
import org.sonar.plugins.openedge.sensor.OpenEdgeWarningsSensor;
import org.sonar.plugins.openedge.web.OpenEdgeWebService;

public class OpenEdgePlugin implements Plugin {
private static final String CATEGORY_OPENEDGE = "OpenEdge";
Expand Down Expand Up @@ -74,11 +73,6 @@ public void define(Context context) {
// Decorators
context.addExtensions(CommonMetricsDecorator.class, CommonDBMetricsDecorator.class);

// Web service handler
if (context.getRuntime().getProduct() == SonarProduct.SONARQUBE) {
context.addExtension(OpenEdgeWebService.class);
}

// Properties
context.addExtension(PropertyDefinition.builder(Constants.SKIP_RCODE) //
.name("Skip rcode parsing") //
Expand All @@ -90,16 +84,6 @@ public void define(Context context) {
.defaultValue(Boolean.FALSE.toString()) //
.build());

context.addExtension(PropertyDefinition.builder(Constants.OE_ANALYTICS) //
.name("Enable analytics") //
.description("Ping remote server for usage analytics") //
.type(PropertyType.BOOLEAN) //
.category(CATEGORY_OPENEDGE) //
.subCategory(SUBCATEGORY_GENERAL) //
.onQualifiers(Qualifiers.PROJECT) //
.defaultValue(Boolean.TRUE.toString()) //
.build());

context.addExtension(PropertyDefinition.builder(Constants.SKIP_PROPARSE_PROPERTY) //
.name("Skip Proparse step") //
.description("Don't generate syntax tree and skip lint rules") //
Expand Down
Loading

0 comments on commit d93e065

Please sign in to comment.