Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id F3DB7200B83 for ; Sat, 3 Sep 2016 01:51:21 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id F261B160ACB; Fri, 2 Sep 2016 23:51:21 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 1C247160A8C for ; Sat, 3 Sep 2016 01:51:20 +0200 (CEST) Received: (qmail 67898 invoked by uid 500); 2 Sep 2016 23:51:20 -0000 Mailing-List: contact commits-help@hbase.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@hbase.apache.org Delivered-To: mailing list commits@hbase.apache.org Received: (qmail 67887 invoked by uid 99); 2 Sep 2016 23:51:20 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 02 Sep 2016 23:51:20 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 296CDDFF58; Fri, 2 Sep 2016 23:51:20 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: appy@apache.org To: commits@hbase.apache.org Message-Id: <9d6da99986974000b4670adc614c01d5@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: hbase git commit: HBASE-16538 Changes the way version information is stored during build. Instead of writing package-info.java with VersionAnnotation, saveVersion.sh now writes Version.java with static members. Date: Fri, 2 Sep 2016 23:51:20 +0000 (UTC) archived-at: Fri, 02 Sep 2016 23:51:22 -0000 Repository: hbase Updated Branches: refs/heads/0.98 0ac78f440 -> f4aa4046f HBASE-16538 Changes the way version information is stored during build. Instead of writing package-info.java with VersionAnnotation, saveVersion.sh now writes Version.java with static members. Change-Id: I009f440fa049f409e10cb3f1c3afb483bc2aa876 Project: http://git-wip-us.apache.org/repos/asf/hbase/repo Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/f4aa4046 Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/f4aa4046 Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/f4aa4046 Branch: refs/heads/0.98 Commit: f4aa4046f2f7a7ccc3ba81ad5566b6a84ee2b436 Parents: 0ac78f4 Author: Apekshit Sharma Authored: Thu Sep 1 18:18:48 2016 -0700 Committer: Apekshit Sharma Committed: Fri Sep 2 16:46:39 2016 -0700 ---------------------------------------------------------------------- .../apache/hadoop/hbase/VersionAnnotation.java | 66 -------------------- .../apache/hadoop/hbase/util/VersionInfo.java | 34 +++------- hbase-common/src/saveVersion.sh | 14 +++-- 3 files changed, 19 insertions(+), 95 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hbase/blob/f4aa4046/hbase-common/src/main/java/org/apache/hadoop/hbase/VersionAnnotation.java ---------------------------------------------------------------------- diff --git a/hbase-common/src/main/java/org/apache/hadoop/hbase/VersionAnnotation.java b/hbase-common/src/main/java/org/apache/hadoop/hbase/VersionAnnotation.java deleted file mode 100644 index f3137ae..0000000 --- a/hbase-common/src/main/java/org/apache/hadoop/hbase/VersionAnnotation.java +++ /dev/null @@ -1,66 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.hadoop.hbase; - -import java.lang.annotation.*; - -import org.apache.hadoop.hbase.classification.InterfaceAudience; - -/** - * A package attribute that captures the version of hbase that was compiled. - * Copied down from hadoop. All is same except name of interface. - */ -@Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.PACKAGE) -@InterfaceAudience.Private -public @interface VersionAnnotation { - - /** - * Get the Hadoop version - * @return the version string "0.6.3-dev" - */ - String version(); - - /** - * Get the username that compiled Hadoop. - */ - String user(); - - /** - * Get the date when Hadoop was compiled. - * @return the date in unix 'date' format - */ - String date(); - - /** - * Get the url for the subversion repository. - */ - String url(); - - /** - * Get the subversion revision. - * @return the revision number as a string (eg. "451451") - */ - String revision(); - - /** - * Get a checksum of the source files from which HBase was compiled. - * @return a string that uniquely identifies the source - **/ - String srcChecksum(); -} http://git-wip-us.apache.org/repos/asf/hbase/blob/f4aa4046/hbase-common/src/main/java/org/apache/hadoop/hbase/util/VersionInfo.java ---------------------------------------------------------------------- diff --git a/hbase-common/src/main/java/org/apache/hadoop/hbase/util/VersionInfo.java b/hbase-common/src/main/java/org/apache/hadoop/hbase/util/VersionInfo.java index 8061b4d..2b1fce7 100644 --- a/hbase-common/src/main/java/org/apache/hadoop/hbase/util/VersionInfo.java +++ b/hbase-common/src/main/java/org/apache/hadoop/hbase/util/VersionInfo.java @@ -22,41 +22,25 @@ import org.apache.commons.logging.LogFactory; import java.io.PrintStream; import java.io.PrintWriter; +import org.apache.commons.logging.Log; +import org.apache.hadoop.hbase.Version; import org.apache.hadoop.hbase.classification.InterfaceAudience; import org.apache.hadoop.hbase.classification.InterfaceStability; -import org.apache.hadoop.hbase.VersionAnnotation; -import org.apache.commons.logging.Log; /** - * This class finds the package info for hbase and the VersionAnnotation - * information. Taken from hadoop. Only name of annotation is different. + * This class finds the Version information for HBase. */ @InterfaceAudience.Public @InterfaceStability.Evolving public class VersionInfo { private static final Log LOG = LogFactory.getLog(VersionInfo.class.getName()); - private static Package myPackage; - private static VersionAnnotation version; - - static { - myPackage = VersionAnnotation.class.getPackage(); - version = myPackage.getAnnotation(VersionAnnotation.class); - } - - /** - * Get the meta-data for the hbase package. - * @return package - */ - static Package getPackage() { - return myPackage; - } /** * Get the hbase version. * @return the hbase version string, eg. "0.6.3-dev" */ public static String getVersion() { - return version != null ? version.version() : "Unknown"; + return Version.version; } /** @@ -64,7 +48,7 @@ public class VersionInfo { * @return the revision number, eg. "451451" */ public static String getRevision() { - return version != null ? version.revision() : "Unknown"; + return Version.revision; } /** @@ -72,7 +56,7 @@ public class VersionInfo { * @return the compilation date in unix date format */ public static String getDate() { - return version != null ? version.date() : "Unknown"; + return Version.date; } /** @@ -80,7 +64,7 @@ public class VersionInfo { * @return the username of the user */ public static String getUser() { - return version != null ? version.user() : "Unknown"; + return Version.user; } /** @@ -88,7 +72,7 @@ public class VersionInfo { * @return the url */ public static String getUrl() { - return version != null ? version.url() : "Unknown"; + return Version.url; } static String[] versionReport() { @@ -105,7 +89,7 @@ public class VersionInfo { * @return a string that uniquely identifies the source **/ public static String getSrcChecksum() { - return version != null ? version.srcChecksum() : "Unknown"; + return Version.srcChecksum; } public static void writeTo(PrintWriter out) { http://git-wip-us.apache.org/repos/asf/hbase/blob/f4aa4046/hbase-common/src/saveVersion.sh ---------------------------------------------------------------------- diff --git a/hbase-common/src/saveVersion.sh b/hbase-common/src/saveVersion.sh index 890dc5a..4c21829 100644 --- a/hbase-common/src/saveVersion.sh +++ b/hbase-common/src/saveVersion.sh @@ -55,13 +55,19 @@ fi popd mkdir -p "$outputDirectory/org/apache/hadoop/hbase" -cat >"$outputDirectory/org/apache/hadoop/hbase/package-info.java" <"$outputDirectory/org/apache/hadoop/hbase/Version.java" <