Return-Path: X-Original-To: apmail-geode-commits-archive@minotaur.apache.org Delivered-To: apmail-geode-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 079F0180BA for ; Fri, 26 Jun 2015 22:10:29 +0000 (UTC) Received: (qmail 90490 invoked by uid 500); 26 Jun 2015 22:10:29 -0000 Delivered-To: apmail-geode-commits-archive@geode.apache.org Received: (qmail 90452 invoked by uid 500); 26 Jun 2015 22:10:28 -0000 Mailing-List: contact commits-help@geode.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@geode.incubator.apache.org Delivered-To: mailing list commits@geode.incubator.apache.org Received: (qmail 90443 invoked by uid 99); 26 Jun 2015 22:10:28 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 26 Jun 2015 22:10:28 +0000 X-ASF-Spam-Status: No, hits=-2001.4 required=5.0 tests=ALL_TRUSTED,RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO mail.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with SMTP; Fri, 26 Jun 2015 22:08:18 +0000 Received: (qmail 89632 invoked by uid 99); 26 Jun 2015 22:10:04 -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, 26 Jun 2015 22:10:04 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id BF9BDE01E2; Fri, 26 Jun 2015 22:10:04 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: mbretl@apache.org To: commits@geode.incubator.apache.org Message-Id: <1e29afa800b44bbbbf8793ce4e5097b7@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: incubator-geode git commit: [GEODE-42] Remove hardcoded versioning from GemFireVersion.properties file Date: Fri, 26 Jun 2015 22:10:04 +0000 (UTC) X-Virus-Checked: Checked by ClamAV on apache.org Repository: incubator-geode Updated Branches: refs/heads/develop dbab0cef4 -> 121978388 [GEODE-42] Remove hardcoded versioning from GemFireVersion.properties file The version information was hardcoded in the initial drop of the Geode code base. This change allows the build to get source revision information from Git, if available. If source information is not available, then value is 'UNKNOWN'. Tested with and without Git workspace. Reviewed by: amb Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/12197838 Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/12197838 Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/12197838 Branch: refs/heads/develop Commit: 121978388681ea418eefd09269f8015f5eac7dca Parents: dbab0ce Author: mbretl Authored: Fri Jun 26 15:05:07 2015 -0700 Committer: mbretl Committed: Fri Jun 26 15:05:07 2015 -0700 ---------------------------------------------------------------------- gemfire-core/build.gradle | 44 ++++++++++++++++++++++++++++++++++++++---- 1 file changed, 40 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/12197838/gemfire-core/build.gradle ---------------------------------------------------------------------- diff --git a/gemfire-core/build.gradle b/gemfire-core/build.gradle index a03954a..0fff1e6 100755 --- a/gemfire-core/build.gradle +++ b/gemfire-core/build.gradle @@ -64,10 +64,46 @@ dependencies { // Creates the version properties file and writes it to the classes dir task createVersionPropertiesFile << { - ext.gitBranch = 'master' - ext.commitId = '1366ff2d4fcbf54bfad684e9ba9822db2a2b0ff5' - ext.sourceDate = '2015-04-06 14:54:51 -0700' - + + def gitFolder = new File ("${rootProject.projectDir}/.git") + if ( gitFolder.exists() ) { + new ByteArrayOutputStream().withStream { gitBranchStream -> + def result = exec { + standardOutput = gitBranchStream + executable = "git" + args = ['rev-parse', '--abbrev-ref', 'HEAD'] + } + ext.gitBranchString = gitBranchStream.toString() + ext.gitBranch = ext.gitBranchString.trim() + } + + new ByteArrayOutputStream().withStream { commitStream -> + def result = exec { + standardOutput = commitStream + executable = "git" + args = ['rev-parse', 'HEAD'] + } + ext.commitIdString = commitStream.toString() + ext.commitId = ext.commitIdString.trim() + } + + new ByteArrayOutputStream().withStream { sourceDateStream -> + def result = exec { + standardOutput = sourceDateStream + executable = "git" + args = ['show', '-s', '--format=%ci', "${ext.commitId}"] + } + ext.sourceDateString = sourceDateStream.toString() + ext.sourceDate = ext.sourceDateString.trim() + } + } + else { + // Not in SCM workspace, use default values + ext.gitBranch = 'UNKNOWN' + ext.commitId = 'UNKNOWN' + ext.sourceDate = new Date().format('yyyy-MM-dd HH:mm:ss Z') + } + ext.osArch = System.getProperty('os.arch') ext.osName = System.getProperty('os.name') ext.osVersion = System.getProperty('os.version')