Add new night build scripts

This commit is contained in:
Victor Shcherb 2011-01-23 12:45:18 +01:00
parent 97e2cee178
commit d250880799
7 changed files with 148 additions and 0 deletions

4
build-scripts/.gitignore vendored Normal file
View file

@ -0,0 +1,4 @@
builds/
logs/
osmand-git/
osmand-hg/

44
build-scripts/build_branches.sh Executable file
View file

@ -0,0 +1,44 @@
#!/bin/sh
DIRECTORY=$(cd `dirname $0` && pwd)
GIT_DIR="$DIRECTORY"/osmand-git
GIT_ORIGIN_NAME=origin
BUILD_DIR="$DIRECTORY"/builds
VERSION_FILE=./DataExtractionOSM/src/net/osmand/Version.java
DATE=$(date +%d-%m-%y)
# clean all files in build directory
rm -r "$BUILD_DIR"
mkdir "$BUILD_DIR"
cd "${GIT_DIR}"
git branch -r | while read i
do
cd "${GIT_DIR}"
ch=$(expr index "$i" ">")
if [ $ch = 0 ]; then
BRANCH=${i#"$GIT_ORIGIN_NAME/"}
echo "Checkouting branch and create build for $BRANCH"
## reset all previous changes in working tree
git checkout .
git checkout $BRANCH
sed -e "s/\(APP_DESCRIPTION.*=.*\"\).*\(\".*\)/\1$DATE $BRANCH\2/g" $VERSION_FILE > ${VERSION_FILE}.bak
mv ${VERSION_FILE}.bak ${VERSION_FILE}
## build map creator
cd ./DataExtractionOSM/
ant clean compile build
mv build.zip "$BUILD_DIR/OsmAndMapCreator-$BRANCH-nb-$DATE.zip"
## build osmand app
cd ../OsmAnd/
cp "$DIRECTORY"/local.properties local.properties
rm -r bin
mkdir bin
if [ ! -d assets ]; then
mkdir assets
fi
ant clean debug
mv bin/OsmAnd-debug.apk "$BUILD_DIR/OsmAnd-$BRANCH-nb-$DATE.apk"
fi
done

31
build-scripts/daily_build.sh Executable file
View file

@ -0,0 +1,31 @@
#!/bin/sh
DIRECTORY=$(cd `dirname $0` && pwd)
## VARIABLES ###
LOG_DIR="$DIRECTORY"/logs
DATE=$(date +%d-%m-%y)
LOG_FILE="$LOG_DIR/${DATE}.log"
mkdir $LOG_DIR
# check build already run today
if [ -e "$LOG_FILE" ]; then
echo "Build already ran today"
# exit
fi
touch $LOG_FILE
# 1. Update git directory
"${DIRECTORY}/update_git.sh" &> $LOG_FILE
# 2. Go through branches and generates builds
"${DIRECTORY}/build_branches.sh" &> $LOG_FILE
# 3. upload to ftp server
#"${DIRECTORY}/upload_ftp.sh" &> $LOG_FILE
# 4. Synchronize github with googlecode mercurial
"${DIRECTORY}/sync_git_hg.sh" &> $LOG_FILE

View file

@ -0,0 +1,12 @@
# This file is automatically generated by Android Tools.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file must *NOT* be checked in Version Control Systems,
# as it contains information specific to your local configuration.
# location of the SDK. This is only used by Ant
# For customization when using a Version Control System, please read the
# header note.
sdk.dir=/home/victor/Projects/android-sdk-linux_86
FTP_USER=osmand
FTP_PWD=

19
build-scripts/sync_git_hg.sh Executable file
View file

@ -0,0 +1,19 @@
#!/bin/sh
DIRECTORY=$(cd `dirname $0` && pwd)
GIT_DIR="$DIRECTORY"/osmand-git
GIT_URL=git://github.com/osmandapp/Osmand.git
GIT_ORIGIN_NAME=origin
HG_DIR="$DIRECTORY"/osmand-hg
HG_URL=https://osmand.googlecode.com/hg
BUILD_DIR="$DIRECTORY"/builds
if [ ! -d "$HG_DIR" ]; then
hg clone ${GIT_URL} "${HG_DIR}"
fi
cd "${HG_DIR}"
hg pull "${GIT_URL}"
hg push "${HG_URL}"
echo "Synchronization is ok"

16
build-scripts/update_git.sh Executable file
View file

@ -0,0 +1,16 @@
#!/bin/sh
DIRECTORY=$(cd `dirname $0` && pwd)
GIT_DIR="$DIRECTORY"/osmand-git
GIT_URL=git://github.com/osmandapp/Osmand.git
GIT_ORIGIN_NAME=origin
# initialize git if it is not present (clone it)
if [ ! -d "$GIT_DIR" ]; then
git clone ${GIT_URL} "${GIT_DIR}"
fi
# update git
cd "${GIT_DIR}"
git checkout master
git pull ${GIT_ORIGIN_NAME}

22
build-scripts/upload_ftp.sh Executable file
View file

@ -0,0 +1,22 @@
#!/bin/sh
DIRECTORY=$(cd `dirname $0` && pwd)
FTP_SITE=download.osmand.net
FTP_FOLDER=night-builds
# FTP_USER in local.properties
# FTP_PWD= in local.properties
BUILD_DIR="$DIRECTORY"/builds
. "$DIRECTORY"/local.properties
# 3. upload to ftp server
lftp -c open $FTP_USER,$FTP_PWD $FTP_SITE || ls $FTP_FOLDER || mirror -R $FTP_FOLDER $BUILD_DIR
ftp -n -v $FTP_SITE <<SCRIPT 2>&1
quote USER $FTP_USER
quote PASS $FTP_PWD
cd $FTP_FOLDER
ls
quit