hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From st...@apache.org
Subject hbase git commit: HBASE-12272 Generate Thrift code using a maven profile
Date Thu, 06 Nov 2014 18:33:10 GMT
Repository: hbase
Updated Branches:
  refs/heads/branch-1 c99d89fd6 -> de21812ad


HBASE-12272 Generate Thrift code using a maven profile

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

Conflicts:
	pom.xml
	src/main/docbkx/developer.xml


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/de21812a
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/de21812a
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/de21812a

Branch: refs/heads/branch-1
Commit: de21812ad5b59bb5b99e8589349109dbd2a3183b
Parents: c99d89f
Author: Niels Basjes <nbasjes@bol.com>
Authored: Wed Nov 5 09:59:23 2014 +0100
Committer: stack <stack@apache.org>
Committed: Thu Nov 6 10:32:41 2014 -0800

----------------------------------------------------------------------
 .../org/apache/hadoop/hbase/thrift/package.html |  14 +--
 hbase-thrift/pom.xml                            | 112 +++++++++++++++++++
 .../apache/hadoop/hbase/thrift2/package.html    |   6 +-
 pom.xml                                         |   3 +-
 4 files changed, 120 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/de21812a/hbase-server/src/main/javadoc/org/apache/hadoop/hbase/thrift/package.html
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/javadoc/org/apache/hadoop/hbase/thrift/package.html b/hbase-server/src/main/javadoc/org/apache/hadoop/hbase/thrift/package.html
index e4b4d40..0e2e9b5 100644
--- a/hbase-server/src/main/javadoc/org/apache/hadoop/hbase/thrift/package.html
+++ b/hbase-server/src/main/javadoc/org/apache/hadoop/hbase/thrift/package.html
@@ -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

http://git-wip-us.apache.org/repos/asf/hbase/blob/de21812a/hbase-thrift/pom.xml
----------------------------------------------------------------------
diff --git a/hbase-thrift/pom.xml b/hbase-thrift/pom.xml
index adcce61..3876a4c 100644
--- a/hbase-thrift/pom.xml
+++ b/hbase-thrift/pom.xml
@@ -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. -->

http://git-wip-us.apache.org/repos/asf/hbase/blob/de21812a/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift2/package.html
----------------------------------------------------------------------
diff --git a/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift2/package.html b/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift2/package.html
index 8f6058e..8c40d95 100644
--- a/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift2/package.html
+++ b/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift2/package.html
@@ -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

http://git-wip-us.apache.org/repos/asf/hbase/blob/de21812a/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 2dafb59..c2a3777 100644
--- a/pom.xml
+++ b/pom.xml
@@ -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>


Mime
View raw message