1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
|
#!/bin/bash
scriptsdir=`dirname $0`
topsrcdir=`cd $scriptsdir/.. && pwd`
targetfile=$topsrcdir/src/com/fluendo/jst/SourceInfo.java
# this script updates the SourceInfo class
branch=`$scriptsdir/get-branch`
revision=`$scriptsdir/get-revision`
# if branch and revision are unknown, and the file already exists, leave it
# alone
if test "x$branch" = "x(unknown)" && test "x$revision" = "x(unknown)"
then
if test -e $targetfile
then
echo "Unknown revision information, leaving existing file"
exit
fi
fi
# if the file is not newer than the .git directory, leave it alone
if test ! -d $topsrcdir/.git
then
if test -e $targetfile
then
echo "No top-level .git directory, leaving file alone."
exit
fi
fi
# don't compare with .git dir; local modifications should also trigger
# a revision update
echo "Updating SourceInfo file, branch $branch, revision $revision"
# write the file
cat > $targetfile <<END
package com.fluendo.jst;
public class SourceInfo
{
public String revision = "${revision}";
public String branch = "${branch}";
public SourceInfo() {
}
}
END
|