hadoop-yarn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sur...@apache.org
Subject svn commit: r1435379 - in /hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common: pom.xml scripts/saveVersion.sh src/main/java/org/apache/hadoop/yarn/util/YarnVersionInfo.java src/main/resources/yarn-version-info.properties
Date Fri, 18 Jan 2013 22:32:49 GMT
Author: suresh
Date: Fri Jan 18 22:32:49 2013
New Revision: 1435379

URL: http://svn.apache.org/viewvc?rev=1435379&view=rev
Log:
HADOOP-8924. Revert r1435372 that missed some files

Added:
    hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/scripts/saveVersion.sh
      - copied unchanged from r1435371, hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/scripts/saveVersion.sh
Removed:
    hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/resources/yarn-version-info.properties
Modified:
    hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/pom.xml
    hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/util/YarnVersionInfo.java

Modified: hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/pom.xml
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/pom.xml?rev=1435379&r1=1435378&r2=1435379&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/pom.xml (original)
+++ hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/pom.xml Fri Jan
18 22:32:49 2013
@@ -45,29 +45,6 @@
   </dependencies>
 
   <build>
-    <!--
-    Include all files in src/main/resources.  By default, do not apply property
-    substitution (filtering=false), but do apply property substitution to
-    yarn-version-info.properties (filtering=true).  This will substitute the
-    version information correctly, but prevent Maven from altering other files
-    like yarn-default.xml.
-    -->
-    <resources>
-      <resource>
-        <directory>${basedir}/src/main/resources</directory>
-        <excludes>
-          <exclude>yarn-version-info.properties</exclude>
-        </excludes>
-        <filtering>false</filtering>
-      </resource>
-      <resource>
-        <directory>${basedir}/src/main/resources</directory>
-        <includes>
-          <include>yarn-version-info.properties</include>
-        </includes>
-        <filtering>true</filtering>
-      </resource>
-    </resources>
     <plugins>
      <plugin>
         <groupId>org.apache.rat</groupId>
@@ -88,27 +65,6 @@
         </configuration>
       </plugin>
       <plugin>
-        <groupId>org.apache.hadoop</groupId>
-        <artifactId>hadoop-maven-plugins</artifactId>
-        <executions>
-          <execution>
-            <id>version-info</id>
-            <goals>
-              <goal>version-info</goal>
-            </goals>
-            <configuration>
-              <source>
-                <directory>${basedir}/src/main</directory>
-                <includes>
-                  <include>java/**/*.java</include>
-                  <include>proto/**/*.proto</include>
-                </includes>
-              </source>
-            </configuration>
-          </execution>
-        </executions>
-      </plugin>
-      <plugin>
         <artifactId>maven-jar-plugin</artifactId>
         <executions>
           <execution>
@@ -171,6 +127,20 @@
               <goal>exec</goal>
             </goals>
           </execution>
+          <execution>
+            <id>generate-version</id>
+            <phase>generate-sources</phase>
+            <configuration>
+              <executable>scripts/saveVersion.sh</executable>
+              <arguments>
+                <argument>${project.version}</argument>
+                <argument>${project.build.directory}</argument>
+              </arguments>
+            </configuration>
+            <goals>
+              <goal>exec</goal>
+            </goals>
+          </execution>
         </executions>
       </plugin>
 

Modified: hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/util/YarnVersionInfo.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/util/YarnVersionInfo.java?rev=1435379&r1=1435378&r2=1435379&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/util/YarnVersionInfo.java
(original)
+++ hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/util/YarnVersionInfo.java
Fri Jan 18 22:32:49 2013
@@ -20,7 +20,7 @@ package org.apache.hadoop.yarn.util;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.hadoop.util.VersionInfo;
+import org.apache.hadoop.yarn.YarnVersionAnnotation;
 import org.apache.hadoop.classification.InterfaceAudience;
 import org.apache.hadoop.classification.InterfaceStability;
 
@@ -30,20 +30,31 @@ import org.apache.hadoop.classification.
  */
 @InterfaceAudience.Private
 @InterfaceStability.Unstable
-public class YarnVersionInfo extends VersionInfo {
+public class YarnVersionInfo {
   private static final Log LOG = LogFactory.getLog(YarnVersionInfo.class);
 
-  private static YarnVersionInfo YARN_VERSION_INFO = new YarnVersionInfo();
+  private static Package myPackage;
+  private static YarnVersionAnnotation version;
+  
+  static {
+    myPackage = YarnVersionAnnotation.class.getPackage();
+    version = myPackage.getAnnotation(YarnVersionAnnotation.class);
+  }
 
-  protected YarnVersionInfo() {
-    super("yarn");
+  /**
+   * Get the meta-data for the Yarn package.
+   * @return
+   */
+  static Package getPackage() {
+    return myPackage;
   }
+  
   /**
    * Get the Yarn version.
    * @return the Yarn version string, eg. "0.6.3-dev"
    */
   public static String getVersion() {
-    return YARN_VERSION_INFO._getVersion();
+    return version != null ? version.version() : "Unknown";
   }
   
   /**
@@ -51,7 +62,7 @@ public class YarnVersionInfo extends Ver
    * @return the revision number, eg. "451451"
    */
   public static String getRevision() {
-    return YARN_VERSION_INFO._getRevision();
+    return version != null ? version.revision() : "Unknown";
   }
 
   /**
@@ -59,7 +70,7 @@ public class YarnVersionInfo extends Ver
    * @return The branch name, e.g. "trunk" or "branches/branch-0.20"
    */
   public static String getBranch() {
-    return YARN_VERSION_INFO._getBranch();
+    return version != null ? version.branch() : "Unknown";
   }
 
   /**
@@ -67,7 +78,7 @@ public class YarnVersionInfo extends Ver
    * @return the compilation date in unix date format
    */
   public static String getDate() {
-    return YARN_VERSION_INFO._getDate();
+    return version != null ? version.date() : "Unknown";
   }
   
   /**
@@ -75,14 +86,14 @@ public class YarnVersionInfo extends Ver
    * @return the username of the user
    */
   public static String getUser() {
-    return YARN_VERSION_INFO._getUser();
+    return version != null ? version.user() : "Unknown";
   }
   
   /**
    * Get the subversion URL for the root Yarn directory.
    */
   public static String getUrl() {
-    return YARN_VERSION_INFO._getUrl();
+    return version != null ? version.url() : "Unknown";
   }
 
   /**
@@ -90,7 +101,7 @@ public class YarnVersionInfo extends Ver
    * built.
    **/
   public static String getSrcChecksum() {
-    return YARN_VERSION_INFO._getSrcChecksum();
+    return version != null ? version.srcChecksum() : "Unknown";
   }
 
   /**
@@ -98,11 +109,14 @@ public class YarnVersionInfo extends Ver
    * revision, user and date. 
    */
   public static String getBuildVersion(){
-    return YARN_VERSION_INFO._getBuildVersion();
+    return YarnVersionInfo.getVersion() + 
+    " from " + YarnVersionInfo.getRevision() +
+    " by " + YarnVersionInfo.getUser() + 
+    " source checksum " + YarnVersionInfo.getSrcChecksum();
   }
   
   public static void main(String[] args) {
-    LOG.debug("version: "+ getVersion());
+    LOG.debug("version: "+ version);
     System.out.println("Yarn " + getVersion());
     System.out.println("Subversion " + getUrl() + " -r " + getRevision());
     System.out.println("Compiled by " + getUser() + " on " + getDate());



Mime
View raw message