Review Board 1.7.22


SQOOP-835 Sqoop2: Do not recreate package-info.java each compilation

Review Request #9054 - Created Jan. 22, 2013 and submitted

Jarek Cecho
SQOOP-835
Reviewers
Sqoop
sqoop-sqoop2
I've changed the script as suggested on the jira.
I've tested the build to ensure that the file won't be recreated each time.

Diff revision 1 (Latest)

  1. common/src/saveVersion.sh: Loading...
common/src/saveVersion.sh
Revision 38661a34d9ef306d71c368fff96835779c560c25 New Change
[20] 18 lines
[+20]
19
# limitations under the License.
19
# limitations under the License.
20

    
   
20

   
21
unset LANG
21
unset LANG
22
unset LC_CTYPE
22
unset LC_CTYPE
23
version=$1
23
version=$1
24
outputDirectory=$2
24
targetDirectory=$2

    
   
25
outputDirectory="$targetDirectory/org/apache/sqoop/common"

    
   
26
outputFile="$outputDirectory/package-info.java"
25
user=`whoami`
27
user=`whoami`
26
date=`date`
28
date=`date`
27
cwd=`pwd`
29
cwd=`pwd`

    
   
30

   

    
   
31
# Exit if target file already exists

    
   
32
if [ -e $outputFile ]; then

    
   
33
  exit 0

    
   
34
fi

    
   
35

   

    
   
36
# Create version annotation
28
if [ -d .svn ]; then
37
if [ -d .svn ]; then
29
  revision=`svn info | sed -n -e 's/Last Changed Rev: \(.*\)/\1/p'`
38
  revision=`svn info | sed -n -e 's/Last Changed Rev: \(.*\)/\1/p'`
30
  url=`svn info | sed -n -e 's/URL: \(.*\)/\1/p'`
39
  url=`svn info | sed -n -e 's/URL: \(.*\)/\1/p'`
31
elif [ -d ../.git ]; then
40
elif [ -d ../.git ]; then
32
  revision=`git log -1 --pretty=format:"%H"`
41
  revision=`git log -1 --pretty=format:"%H"`
33
  hostname=`hostname`
42
  hostname=`hostname`
34
  url="git://${hostname}${cwd}"
43
  url="git://${hostname}${cwd}"
35
else
44
else
36
  revision="Unknown"
45
  revision="Unknown"
37
  url="file://$cwd"
46
  url="file://$cwd"
38
fi
47
fi
39
mkdir -p "$outputDirectory/org/apache/sqoop/common"
48
mkdir -p $outputDirectory
40
cat >"$outputDirectory/org/apache/sqoop/common/package-info.java" <<EOF
49
cat > $outputFile <<EOF
41
/*
50
/*
42
 * Generated by src/saveVersion.sh
51
 * Generated by src/saveVersion.sh
43
 */
52
 */
44
@VersionAnnotation(version="$version", revision="$revision",
53
@VersionAnnotation(version="$version", revision="$revision",
45
                   user="$user", date="$date", url="$url")
54
                   user="$user", date="$date", url="$url")
46
package org.apache.sqoop.common;
55
package org.apache.sqoop.common;
47
EOF
56
EOF
  1. common/src/saveVersion.sh: Loading...