aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-ws-generator
diff options
context:
space:
mode:
authorDavid Rautureau <david.rautureau@sonarsource.com>2018-02-08 15:01:19 +0100
committerDavid Rautureau <david.rautureau@sonarsource.com>2018-03-09 11:33:38 +0100
commit1a17e4302e4b63de6b4ce7c049441803b9471524 (patch)
tree031bcfbf302c7909c5b45a7c31f1bbc00a2fce34 /sonar-ws-generator
parent21fbe3697bdb6e66016ef8d0bea49da574e02e7d (diff)
downloadsonarqube-1a17e4302e4b63de6b4ce7c049441803b9471524.tar.gz
sonarqube-1a17e4302e4b63de6b4ce7c049441803b9471524.zip
Move To Gradle
Diffstat (limited to 'sonar-ws-generator')
-rw-r--r--sonar-ws-generator/build.gradle23
-rw-r--r--sonar-ws-generator/pom.xml88
-rwxr-xr-xsonar-ws-generator/run.sh10
-rw-r--r--sonar-ws-generator/src/main/java/org/sonarqube/wsgenerator/ApiDefinitionDownloader.java9
-rw-r--r--sonar-ws-generator/src/main/java/org/sonarqube/wsgenerator/Helper.java2
5 files changed, 35 insertions, 97 deletions
diff --git a/sonar-ws-generator/build.gradle b/sonar-ws-generator/build.gradle
new file mode 100644
index 00000000000..01c9b640ea6
--- /dev/null
+++ b/sonar-ws-generator/build.gradle
@@ -0,0 +1,23 @@
+sonarqube {
+ skipProject = true
+}
+
+dependencies {
+ compile 'com.google.code.gson:gson:2.8.2'
+ compile 'com.google.guava:guava'
+ compile 'org.apache.velocity:velocity:1.7'
+ compile 'org.slf4j:log4j-over-slf4j'
+ compile 'org.sonarsource.orchestrator:sonar-orchestrator'
+ compile project(':sonar-ws')
+
+ compileOnly 'com.google.code.findbugs:jsr305'
+}
+
+task fatJar(type: Jar) {
+ manifest {
+ attributes 'Main-Class': 'org.sonarqube.wsgenerator.Generator'
+ }
+ classifier = 'jar-with-dependencies'
+ from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
+ with jar
+}
diff --git a/sonar-ws-generator/pom.xml b/sonar-ws-generator/pom.xml
deleted file mode 100644
index 80a7bc25329..00000000000
--- a/sonar-ws-generator/pom.xml
+++ /dev/null
@@ -1,88 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.sonarsource.sonarqube</groupId>
- <artifactId>sonarqube</artifactId>
- <version>7.1-SNAPSHOT</version>
- </parent>
-
- <artifactId>sonar-ws-generator</artifactId>
- <name>SonarQube :: Web Service :: Generator</name>
- <description>Generate source files of sonar-ws</description>
-
- <properties>
- <sonar.exclusions>src/**/*</sonar.exclusions>
- </properties>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.velocity</groupId>
- <artifactId>velocity</artifactId>
- <version>1.7</version>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>log4j-over-slf4j</artifactId>
- <version>1.7.25</version>
- </dependency>
- <dependency>
- <groupId>org.sonarsource.orchestrator</groupId>
- <artifactId>sonar-orchestrator</artifactId>
- </dependency>
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>sonar-ws</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>com.google.code.gson</groupId>
- <artifactId>gson</artifactId>
- <version>2.8.2</version>
- </dependency>
- <dependency>
- <groupId>com.google.guava</groupId>
- <artifactId>guava</artifactId>
- </dependency>
- <dependency>
- <groupId>com.google.code.findbugs</groupId>
- <artifactId>jsr305</artifactId>
- <scope>provided</scope>
- </dependency>
- </dependencies>
-
- <profiles>
- <profile>
- <id>run-ws-generator</id>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-assembly-plugin</artifactId>
- <executions>
- <execution>
- <id>assemble-all</id>
- <phase>package</phase>
- <goals>
- <goal>single</goal>
- </goals>
- <configuration>
- <descriptorRefs>
- <descriptorRef>jar-with-dependencies</descriptorRef>
- </descriptorRefs>
- <archive>
- <manifest>
- <mainClass>org.sonarqube.wsgenerator.Generator</mainClass>
- </manifest>
- </archive>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- </profile>
- </profiles>
-
-</project>
diff --git a/sonar-ws-generator/run.sh b/sonar-ws-generator/run.sh
index f785bcb4032..ddc5a73bc82 100755
--- a/sonar-ws-generator/run.sh
+++ b/sonar-ws-generator/run.sh
@@ -3,7 +3,9 @@ set -euo pipefail
SCRIPTPATH="$( cd "$(dirname "$0")" ; pwd -P )"
-cd $SCRIPTPATH
-mvn clean package -Prun-ws-generator
-java -jar target/sonar-ws-generator-*-SNAPSHOT-jar-with-dependencies.jar
-cp -R target/generated-sources/results/org/sonarqube/ws/client/* ../sonar-ws/src/main/java/org/sonarqube/ws/client
+pushd $SCRIPTPATH/..
+pwd
+./gradlew :sonar-ws-generator:build :sonar-ws-generator:fatJar
+popd
+java -jar build/libs/sonar-ws-generator-*-SNAPSHOT-jar-with-dependencies.jar
+cp -R build/generated-sources/results/org/sonarqube/ws/client/* ../sonar-ws/src/main/java/org/sonarqube/ws/client
diff --git a/sonar-ws-generator/src/main/java/org/sonarqube/wsgenerator/ApiDefinitionDownloader.java b/sonar-ws-generator/src/main/java/org/sonarqube/wsgenerator/ApiDefinitionDownloader.java
index 29e210241fa..8c232851c21 100644
--- a/sonar-ws-generator/src/main/java/org/sonarqube/wsgenerator/ApiDefinitionDownloader.java
+++ b/sonar-ws-generator/src/main/java/org/sonarqube/wsgenerator/ApiDefinitionDownloader.java
@@ -20,6 +20,7 @@
package org.sonarqube.wsgenerator;
import com.sonar.orchestrator.Orchestrator;
+import com.sonar.orchestrator.OrchestratorBuilder;
import com.sonar.orchestrator.http.HttpCall;
import com.sonar.orchestrator.http.HttpResponse;
import com.sonar.orchestrator.locator.FileLocation;
@@ -32,10 +33,10 @@ public class ApiDefinitionDownloader {
}
public static String downloadApiDefinition() {
- Orchestrator orchestrator = Orchestrator
- .builderEnv()
- .setZipFile(FileLocation.byWildcardMavenFilename(new File("../sonar-application/target"), "sonarqube-*.zip").getFile())
- .build();
+ OrchestratorBuilder builder = Orchestrator.builderEnv();
+ builder.setZipFile(FileLocation.byWildcardMavenFilename(new File("../sonar-application/build/distributions"), "sonar-application-*.zip").getFile())
+ .setOrchestratorProperty("orchestrator.workspaceDir", "build");
+ Orchestrator orchestrator = builder.build();
orchestrator.start();
try {
diff --git a/sonar-ws-generator/src/main/java/org/sonarqube/wsgenerator/Helper.java b/sonar-ws-generator/src/main/java/org/sonarqube/wsgenerator/Helper.java
index f76decd69a6..0d12506fd38 100644
--- a/sonar-ws-generator/src/main/java/org/sonarqube/wsgenerator/Helper.java
+++ b/sonar-ws-generator/src/main/java/org/sonarqube/wsgenerator/Helper.java
@@ -37,7 +37,7 @@ import static java.util.Arrays.asList;
public class Helper {
static final Set<String> PATH_EXCLUSIONS = new HashSet<>(asList("api/orchestrator"));
- private static final String OUTPUT_DIR = "target/generated-sources/results";
+ private static final String OUTPUT_DIR = "build/generated-sources/results";
private final Map<String, List<String[]>> responseTypes;
public Helper() {