diff options
author | Simon Brandhof <simon.brandhof@sonarsource.com> | 2017-11-23 17:19:32 +0100 |
---|---|---|
committer | Daniel Schwarz <bartfastiel@users.noreply.github.com> | 2017-11-29 20:24:11 +0100 |
commit | 435dd4e81a8506bad599a4fdc9ad1d7bcb6e9bb0 (patch) | |
tree | 5030bc4e384b319ebc37f3c763ee0aaa03d311ba /sonar-ws-generator/src | |
parent | a1629c2cc959c72932c0d483457005de8dc55ad0 (diff) | |
download | sonarqube-435dd4e81a8506bad599a4fdc9ad1d7bcb6e9bb0.tar.gz sonarqube-435dd4e81a8506bad599a4fdc9ad1d7bcb6e9bb0.zip |
Exclude some WS from code generation
Diffstat (limited to 'sonar-ws-generator/src')
-rw-r--r-- | sonar-ws-generator/src/main/java/org/sonarqube/wsgenerator/CodeFormatter.java | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/sonar-ws-generator/src/main/java/org/sonarqube/wsgenerator/CodeFormatter.java b/sonar-ws-generator/src/main/java/org/sonarqube/wsgenerator/CodeFormatter.java index 8a610263887..1d062a2f9aa 100644 --- a/sonar-ws-generator/src/main/java/org/sonarqube/wsgenerator/CodeFormatter.java +++ b/sonar-ws-generator/src/main/java/org/sonarqube/wsgenerator/CodeFormatter.java @@ -30,7 +30,10 @@ import java.io.InputStream; import java.io.InputStreamReader; import java.io.StringWriter; import java.io.Writer; +import java.util.Arrays; +import java.util.HashSet; import java.util.Properties; +import java.util.Set; import org.apache.commons.io.FileUtils; import org.apache.velocity.VelocityContext; import org.apache.velocity.app.VelocityEngine; @@ -39,6 +42,10 @@ import static java.nio.charset.StandardCharsets.UTF_8; public class CodeFormatter { + private static final Set<String> PATH_EXCLUSIONS = new HashSet<>(Arrays.asList( + "api/components", "api/issues", "api/measures", "api/organizations", "api/permissions", "api/projects", + "api/project_analyses", "api/qualityprofiles", "api/rules", "api/settings", "api/users", "api/user_groups")); + public static void format(String json) { JsonObject jsonElement = new Gson().fromJson(json, JsonObject.class); JsonArray webServices = (JsonArray) jsonElement.get("webServices"); @@ -47,13 +54,17 @@ public class CodeFormatter { for (JsonElement webServiceElement : webServices) { JsonObject webService = (JsonObject) webServiceElement; + String webServicePath = webService.get("path").getAsString(); + + if (PATH_EXCLUSIONS.contains(webServicePath)) { + continue; + } VelocityContext webServiceContext = new VelocityContext(); webServiceContext.put("webService", webServiceElement); webServiceContext.put("helper", helper); String webServiceCode = applyTemplate("webService.vm", webServiceContext); - String webServicePath = webService.get("path").getAsString(); writeSourceFile(helper.file(webServicePath), webServiceCode); writeSourceFile(helper.packageInfoFile(webServicePath), applyTemplate("package-info.vm", webServiceContext)); |