HBASE-12272 Generate Thrift code using a maven profile

Signed-off-by: stack <stack@apache.org>

Conflicts:
	pom.xml
	src/main/docbkx/developer.xml
This commit is contained in:
Niels Basjes 2014-11-05 09:59:23 +01:00 committed by stack
parent c99d89fd63
commit de21812ad5
4 changed files with 120 additions and 15 deletions

View File

@ -33,15 +33,15 @@ It combines a software stack with a code generation engine to build services
that work efficiently and seamlessly between C++, Java, Python, PHP, Ruby,
Erlang, Perl, Haskell, C#, Cocoa, Smalltalk, and OCaml."</blockquote>
<h2><a name="description">Description</a></h2>
<p><i>Important note:</i> We tried to deprecate this Thrift interface and replace it
<h2>Important note</h2>
<p><b><u>We tried to deprecate this Thrift interface and replace it
with the Interface defined over in the thrift2 package only this package will not die.
Folks keep adding to it and fixing it up so its around for another while until someone
takes command and drives this package out of existence replacing it w/ an Interface that
better matches the hbase API (this package was modelled on old HBase API long since dropped).
</p>
</u></b></p>
<h2><a name="description">Description</a></h2>
<p>The org.apache.hadoop.hbase.thrift.generated.Hbase.Iface HBase API is defined in the
file <a href="doc-files/index.html">Hbase.thrift</a> (Click the former to see the
thrift generated documentation of thrift interface). A server-side implementation of the API is in
@ -93,11 +93,7 @@ These are the command line arguments the Thrift server understands in addition t
<p>The files were generated by running the commands under the hbase checkout dir:
<pre>
thrift -strict --gen java:hashcode ./hbase-server/src/main/resources/org/apache/hadoop/hbase/thrift/Hbase.thrift
# Move the generated files into place their expected location under hbase
mv gen-java/org/apache/hadoop/hbase/thrift/generated/* hbase-server/src/main/java/org/apache/hadoop/hbase/thrift/generated/
# Remove the gen-java file made by thrift
rm -rf gen-java
mvn compile -Pcompile-thrift
</pre>
<p>The 'thrift' binary is the Thrift compiler, and it is distributed as a part

View File

@ -230,6 +230,7 @@
<artifactId>jasper-runtime</artifactId>
</dependency>
</dependencies>
<profiles>
<!-- Skip the tests in this module -->
<profile>
@ -244,6 +245,117 @@
<surefire.skipSecondPart>true</surefire.skipSecondPart>
</properties>
</profile>
<!--
Profile for regenerating the thrift java classes.
The generated files are to be committed to version control.
Activate using:
mvn compile -Dcompile-thrift
-->
<profile>
<id>compile-thrift</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>1.3.1</version>
<executions>
<execution>
<id>enforce-thrift-version</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<requireProperty>
<property>thrift.version</property>
<message>"The Thrift version must be specified."</message>
<regex>0\.9\.0</regex>
<regexMessage>
-
-
[FATAL] ==========================================================================================
[FATAL] HBase Thrift requires the thrift generator version 0.9.0.
[FATAL] Setting it to something else needs to be reviewed for wire and behavior compatibility.
[FATAL] ==========================================================================================
-
-
</regexMessage>
</requireProperty>
</rules>
<fail>true</fail>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<executions>
<execution>
<id>check-thrift-version</id>
<phase>generate-sources</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>sh</executable>
<workingDirectory>${basedir}</workingDirectory>
<arguments>
<argument>-c</argument>
<argument>${thrift.path} -version | \
fgrep 'Thrift version ${thrift.version}' &amp;&amp; exit 0;
echo "========== [FATAL] Need Thrift version ${thrift.version} ==========";
exit 1</argument>
</arguments>
</configuration>
</execution>
<execution>
<id>thrift</id>
<phase>generate-sources</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>${thrift.path}</executable>
<workingDirectory>${basedir}</workingDirectory>
<arguments>
<argument>-strict</argument>
<argument>--gen</argument>
<argument>java:hashcode</argument>
<argument>-out</argument>
<argument>${basedir}/src/main/java</argument>
<argument>${basedir}/src/main/resources/org/apache/hadoop/hbase/thrift/Hbase.thrift</argument>
</arguments>
</configuration>
</execution>
<execution>
<id>thrift2</id>
<phase>generate-sources</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>${thrift.path}</executable>
<workingDirectory>${basedir}</workingDirectory>
<arguments>
<argument>-strict</argument>
<argument>--gen</argument>
<argument>java:hashcode</argument>
<argument>-out</argument>
<argument>${basedir}/src/main/java</argument>
<argument>${basedir}/src/main/resources/org/apache/hadoop/hbase/thrift2/hbase.thrift</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<!-- profile against Hadoop 1.1.x: This is the default. It has to have the same
activation property as the parent Hadoop 1.1.x profile to make sure it gets run at
the same time. -->

View File

@ -91,11 +91,7 @@ These are the command line arguments the Thrift server understands in addition t
<p>HBase currently uses version 0.9.0 of Apache Thrift.</p>
<p>The files were generated by running the commands under the hbase checkout dir:
<pre>
thrift -strict --gen java:hashcode ./hbase-thrift/src/main/resources/org/apache/hadoop/hbase/thrift2/hbase.thrift
# Move the generated files into place their expected location under hbase
mv gen-java/org/apache/hadoop/hbase/thrift2/generated/* hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift2/generated/
# Remove the gen-java file made by thrift
rm -rf gen-java
mvn compile -Pcompile-thrift
</pre>
<p>The 'thrift' binary is the Thrift compiler, and it is distributed separately from HBase

View File

@ -513,7 +513,7 @@
<!--Allocate some direct memory for direct memory tests-->
<argLine>${hbase-surefire.argLine} ${argLine}</argLine>
<redirectTestOutputToFile>${test.output.tofile}</redirectTestOutputToFile>
<systemPropertyVariables>
<systemPropertyVariables>
<jacoco-agent.destfile>target/jacoco.exec</jacoco-agent.destfile>
</systemPropertyVariables>
</configuration>
@ -1011,6 +1011,7 @@
<log4j.version>1.2.17</log4j.version>
<mockito-all.version>1.10.8</mockito-all.version>
<protobuf.version>2.5.0</protobuf.version>
<thrift.path>thrift</thrift.path>
<thrift.version>0.9.0</thrift.version>
<zookeeper.version>3.4.6</zookeeper.version>
<slf4j.version>1.7.7</slf4j.version>