Skip to content

Commit

Permalink
QFS Java components: (a) Java access JAR source path changed, JAR ren…
Browse files Browse the repository at this point in the history
…amed to qfs-access-<ver>.jar, (b) Hadoop QFS plugin is now built and tested in QFS codebase, (c) Maven2 is used to build java components (instead of Apache Ant); it also pulls hadoop dependencies. Minor modifications to build version detection script.
  • Loading branch information
Thilee committed Oct 19, 2012
1 parent 4f30753 commit 4cb80ff
Show file tree
Hide file tree
Showing 28 changed files with 1,666 additions and 270 deletions.
26 changes: 20 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ release: prep
cd release && \
cmake -D CMAKE_BUILD_TYPE=RelWithDebInfo ../.. && \
make install
if test -x "`which ant 2>/dev/null`"; then ant jar; fi
(./src/java/javabuild.sh clean && ./src/java/javabuild.sh)
if test -x "`which python 2>/dev/null`"; then \
cd build/release && python ../../src/cc/access/kfs_setup.py build; fi

Expand All @@ -42,11 +42,21 @@ debug: prep
cd debug && \
cmake ../.. && \
make install
if test -x "`which ant 2>/dev/null`"; then ant jar; fi
(./src/java/javabuild.sh clean && ./src/java/javabuild.sh)
if test -x "`which python 2>/dev/null`"; then \
cd build/debug && python ../../src/cc/access/kfs_setup.py build; fi

tarball: release
hadoop-jars: release
if test -x "`which mvn 2>/dev/null`"; then \
(./src/java/javabuild.sh clean && \
./src/java/javabuild.sh 0.23.4 && \
./src/java/javabuild.sh 1.0.2 && \
./src/java/javabuild.sh 1.0.4 && \
./src/java/javabuild.sh 1.1.0 && \
./src/java/javabuild.sh 2.0.2-alpha \
); fi

tarball: hadoop-jars
cd build && \
myuname=`uname -s`; \
if [ x"$$myuname" = x'Linux' -a -f /etc/issue ]; then \
Expand All @@ -65,14 +75,18 @@ tarball: release
myflavor=$$myuname ; \
fi ; \
fi ; \
tarname="qfs-$$myflavor-1.0-`uname -m`" ; \
qfsversion=`../src/cc/common/buildversgit.sh -v 2> /dev/null | head -1` ; \
tarname="qfs-$$myflavor-$$qfsversion-`uname -m`" ;\
tarname=`echo "$$tarname" | tr A-Z a-z` ; \
{ test -d tmpreldir || mkdir tmpreldir; } && \
rm -rf "tmpreldir/$$tarname" && \
mkdir "tmpreldir/$$tarname" && \
cp -r release/bin release/lib release/include ../scripts ../webui \
../examples ../benchmarks "tmpreldir/$$tarname/" && \
cp ./qfs-*.jar "tmpreldir/$$tarname/lib/" && \
if ls -1 ./java/qfs-access/qfs-access-*.jar > /dev/null 2>&1; then \
cp ./java/qfs-access/qfs-access*.jar "tmpreldir/$$tarname/lib/"; fi && \
if ls -1 ./java/hadoop-qfs/hadoop-*.jar > /dev/null 2>&1; then \
cp ./java/hadoop-qfs/hadoop-*.jar "tmpreldir/$$tarname/lib/"; fi && \
tar cvfz "$$tarname".tgz -C ./tmpreldir "$$tarname" && \
rm -rf tmpreldir

Expand All @@ -83,4 +97,4 @@ test-release: release
cd build/release && ../../src/test-scripts/kfstest.sh

clean:
rm -rf build/release build/debug build/qfs-*.tgz build/qfs*.jar build/classes
rm -rf build/release build/debug build/qfs-*.tgz build/java
80 changes: 0 additions & 80 deletions build.xml

This file was deleted.

7 changes: 4 additions & 3 deletions examples/java/QfsSample.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,14 @@
*
* \brief A Sample Java program to access QFSAccess APIs. To run this program,
* you need:
* - qfs.jar in your CLASSPATH
* - qfs-access jar in your CLASSPATH
* - libqfs_access.so in your LD_LIBRARY_PATH
* - a QFS deployment
* Eg:
* javac -cp ~/code/qfs/build/<qfs>.jar QfsSample.java
* javac -cp ~/code/qfs/build/java/qfs-access-<ver>.jar QfsSample.java
* LD_LIBRARY_PATH=~/code/qfs/build/lib \
* java -cp .:~/code/qfs/build/<qfs>.jar QfsSample localhost 20000
* java -cp .:~/code/qfs/build/java/qfs-access-<ver>.jar QfsSample \
* localhost 20000
*/


Expand Down
39 changes: 0 additions & 39 deletions src/cc/common/buildVers.py

This file was deleted.

40 changes: 23 additions & 17 deletions src/cc/common/buildversgit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,23 +34,25 @@ if [ x"$1" = x'-g' -o x"$1" = x'-get' ]; then
fi

# Set official release version here.
# kfs_release_version
qfs_release_version="1.0.0"
qfs_source_revision=""

# If git is present override the release version with git tag.
if which git > /dev/null; then
qfs_release_version="$(cd "`dirname "$0"`" 2> /dev/null && git describe --abbrev=0 --tags 2> /dev/null)"
qfs_source_revision="$(cd "`dirname "$0"`" 2> /dev/null && git log -n 1 --pretty=format:%H 2> /dev/null)"
fi

if [ $# -eq 1 -a x"$1" = x'-v' ]; then
if [ x"$kfs_release_version" != x ]; then
echo "$kfs_release_version"
exit
fi
(
cd "`dirname "$0"`" >/dev/null || exit
git log -n 1 --pretty=format:%H
) 2>/dev/null
echo "$qfs_release_version"
echo "$qfs_source_revision"
exit 0
fi

if [ $# -lt 3 ]; then
echo "Usage: $0 <build type> <source dir> <dest file>"
echo "or: $0 -g <kfs executable>"
echo "Usage:"
echo "$0 <build type> <source base dir> <dest file> OR"
echo "$0 -g <qfs executable> to get the version info of executable."
exit 1
fi

Expand All @@ -62,8 +64,8 @@ shift
outfile=$1
shift

if [ x"$kfs_release_version" != x ]; then
kfs_version_prefix="${kfs_release_version}-"
if [ x"$qfs_release_version" != x ]; then
kfs_version_prefix="${qfs_release_version}-"
else
kfs_version_prefix=''
fi
Expand Down Expand Up @@ -100,8 +102,8 @@ while [ $# -gt 0 ]; do
echo "$1"
shift
done
if [ x"$kfs_release_version" != x ]; then
echo "release: $kfs_release_version"
if [ x"$qfs_release_version" != x ]; then
echo "release: $qfs_release_version"
else
echo "release: none"
fi
Expand All @@ -123,6 +125,7 @@ echo KFS_BUILD_INFO_END
} | sed -e 's/\\/\\\\/g' -e 's/"/\\"/g' -e 's/^/"/' -e 's/$/\\n"/'

echo ';
static std::string MakeVersionHash()
{
Hsieh_hash_fcn f;
Expand All @@ -134,13 +137,16 @@ static std::string MakeVersionHash()
}
return ret;
}
const std::string KFS_BUILD_VERSION_STRING(
std::string("'"${kfs_release_version}${lastchangeid}-${buildtype}"'-") +
std::string("'"${qfs_release_version}${lastchangeid}-${buildtype}"'-") +
MakeVersionHash()
);
const std::string KFS_SOURCE_REVISION_STRING(
"'"${kfs_release_version}${remote}/${branch}@$lastchangeid"'"
"'"${qfs_release_version}${remote}/${branch}@$lastchangeid"'"
);
}
'

Expand Down
Loading

0 comments on commit 4cb80ff

Please sign in to comment.