aboutsummaryrefslogtreecommitdiffstats
path: root/pom.xml
diff options
context:
space:
mode:
authorEvgeny Mandrikov <mandrikov@gmail.com>2015-10-15 05:25:27 +0200
committerSimon Brandhof <simon.brandhof@sonarsource.com>2015-10-29 16:12:28 +0100
commitd7d20c58c771f3be6cc44b37dc5b741443beca03 (patch)
tree076800627d16da483866b467b52eba151d8f8f4b /pom.xml
parentbed7d7f1897ab5f0e2bfa0e4e6ac61e3d413c5dc (diff)
downloadsonarqube-d7d20c58c771f3be6cc44b37dc5b741443beca03.tar.gz
sonarqube-d7d20c58c771f3be6cc44b37dc5b741443beca03.zip
Execute Protocol Buffer compiler during build
Dependency for compiler selected based on platform. Supported platforms are Windows/Linux x86/64 and Mac OS. Configuration in root POM to avoid duplication. This also makes version of compiler consistent with version of library. Previously it was 3.0.0-a3 and 3.0.0-beta-1 respectively, now both are 3.0.0-beta-1. And removes all existing auto generated files and scripts for their creation as well as their traces (such as comments and exclusions for SonarQube).
Diffstat (limited to 'pom.xml')
-rw-r--r--pom.xml146
1 files changed, 145 insertions, 1 deletions
diff --git a/pom.xml b/pom.xml
index 7f9a0fbf8e7..de59e81549c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -65,6 +65,10 @@
<slf4j.version>1.7.12</slf4j.version>
<tomcat.version>8.0.18</tomcat.version>
<elasticsearch.version>1.7.2</elasticsearch.version>
+
+ <protobuf.version>3.0.0-beta-1</protobuf.version>
+ <protobuf.compiler>${settings.localRepository}/com/google/protobuf/protoc/${protobuf.version}/protoc-${protobuf.version}-${os.detected.classifier}.exe</protobuf.compiler>
+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.min.version>3.2</maven.min.version>
<jdk.min.version>1.7</jdk.min.version>
@@ -88,6 +92,11 @@
<artifactId>wagon-webdav</artifactId>
<version>1.0-beta-2</version>
</extension>
+ <extension>
+ <groupId>kr.motd.maven</groupId>
+ <artifactId>os-maven-plugin</artifactId>
+ <version>1.4.1.Final</version>
+ </extension>
</extensions>
<pluginManagement>
@@ -1100,7 +1109,7 @@
<dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java</artifactId>
- <version>3.0.0-beta-1</version>
+ <version>${protobuf.version}</version>
</dependency>
<dependency>
<groupId>net.jpountz.lz4</groupId>
@@ -1348,6 +1357,141 @@
</profile>
<profile>
+ <id>protobuf-compile</id>
+ <activation>
+ <file>
+ <exists>src/main/protobuf</exists>
+ </file>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>protobuf-compile</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ <configuration>
+ <target>
+ <fileset id="fileset" dir="${project.basedir}/src/main/protobuf">
+ <include name="*.proto"/>
+ </fileset>
+ <pathconvert refid="fileset" property="protos" pathsep=" "/>
+ <mkdir dir="${project.build.directory}/generated-sources/protobuf"/>
+ <chmod file="${protobuf.compiler}" perm="u+x"/>
+ <exec failonerror="true" executable="${protobuf.compiler}">
+ <arg value="--proto_path=${project.basedir}/src/main/protobuf"/>
+ <arg value="--java_out=${project.build.directory}/generated-sources/protobuf"/>
+ <arg line="${protos}"/>
+ </exec>
+ </target>
+ </configuration>
+ </execution>
+ </executions>
+ <dependencies>
+ <dependency>
+ <groupId>com.google.protobuf</groupId>
+ <artifactId>protoc</artifactId>
+ <version>${protobuf.version}</version>
+ <classifier>${os.detected.classifier}</classifier>
+ <type>exe</type>
+ </dependency>
+ </dependencies>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>protobuf-compile</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>add-source</goal>
+ </goals>
+ <configuration>
+ <sources>
+ <source>${project.build.directory}/generated-sources/protobuf</source>
+ </sources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ <profile>
+ <id>protobuf-test-compile</id>
+ <activation>
+ <file>
+ <exists>src/test/protobuf</exists>
+ </file>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>protobuf-test-compile</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ <configuration>
+ <target>
+ <fileset id="fileset" dir="${project.basedir}/src/test/protobuf">
+ <include name="*.proto"/>
+ </fileset>
+ <pathconvert refid="fileset" property="protos" pathsep=" "/>
+ <mkdir dir="${project.build.directory}/generated-test-sources/protobuf"/>
+ <chmod file="${protobuf.compiler}" perm="u+x"/>
+ <exec failonerror="true" executable="${protobuf.compiler}">
+ <arg value="--proto_path=${project.basedir}/src/test/protobuf"/>
+ <arg value="--java_out=${project.build.directory}/generated-test-sources/protobuf"/>
+ <arg line="${protos}"/>
+ </exec>
+ </target>
+ </configuration>
+ </execution>
+ </executions>
+ <dependencies>
+ <dependency>
+ <groupId>com.google.protobuf</groupId>
+ <artifactId>protoc</artifactId>
+ <version>${protobuf.version}</version>
+ <classifier>${os.detected.classifier}</classifier>
+ <type>exe</type>
+ </dependency>
+ </dependencies>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>protobuf-test-compile</id>
+ <phase>generate-test-sources</phase>
+ <goals>
+ <goal>add-test-source</goal>
+ </goals>
+ <configuration>
+ <sources>
+ <source>${project.build.directory}/generated-test-sources/protobuf</source>
+ </sources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+
+ <profile>
<id>m2e</id>
<activation>
<!-- This profile is active only when used from Eclipse m2e and is used only to store settings. -->