5
0
mirror of https://github.com/apache/sqoop.git synced 2025-05-04 05:20:22 +08:00

Allow explicitly-set git hash in version info.

From: Aaron Kimball <aaron@cloudera.com>

git-svn-id: https://svn.apache.org/repos/asf/incubator/sqoop/trunk@1149926 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Andrew Bayer 2011-07-22 20:04:00 +00:00
parent f1faa0e375
commit 2308b6ec4e
2 changed files with 11 additions and 3 deletions

View File

@ -32,7 +32,8 @@
<property name="Name" value="Sqoop" /> <property name="Name" value="Sqoop" />
<property name="version" value="1.1.0-SNAPSHOT" /> <property name="version" value="1.1.0-SNAPSHOT" />
<property name="artifact.name" value="${name}-${version}" /> <property name="artifact.name" value="${name}-${version}" />
<property name="dest.jar" value="${artifact.name}.jar"/> <property name="dest.jar" value="${artifact.name}.jar" />
<property name="git.hash" value="" />
<!-- locations in the source tree --> <!-- locations in the source tree -->
<property name="base.src.dir" location="${basedir}/src" /> <property name="base.src.dir" location="${basedir}/src" />
@ -252,6 +253,7 @@
dir="${basedir}" failonerror="true"> dir="${basedir}" failonerror="true">
<arg value="${build.dir}" /> <arg value="${build.dir}" />
<arg value="${version}" /> <arg value="${version}" />
<arg value="${git.hash}" />
</exec> </exec>
</target> </target>

View File

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/bash
# #
# Licensed to Cloudera, Inc. under one or more # Licensed to Cloudera, Inc. under one or more
# contributor license agreements. See the NOTICE file distributed with # contributor license agreements. See the NOTICE file distributed with
@ -21,16 +21,22 @@
# Arguments are: # Arguments are:
# path to the root of the build directory # path to the root of the build directory
# the version number # the version number
# the git hash of the current checkout. If empty, auto-detect.
# #
# e.g., $ write-version-info.sh ./build/ 1.0.0 # e.g., $ write-version-info.sh ./build/ 1.0.0
buildroot=$1 buildroot=$1
version=$2 version=$2
specifiedgithash=$3
outputdir=${buildroot}/src/com.cloudera.sqoop outputdir=${buildroot}/src/com.cloudera.sqoop
outputfile=${outputdir}/SqoopVersion.java outputfile=${outputdir}/SqoopVersion.java
signature=`git log -1 --pretty=format:%H` signature=$specifiedgithash
if [ -z "$signature" ]; then
signature=`git log -1 --pretty=format:%H`
fi
host=`hostname` host=`hostname`
compiledate=`date` compiledate=`date`