开发学院手机开发Android 开发 Android Java Jar包整合Shell脚本 阅读

Android Java Jar包整合Shell脚本

 2010-09-15 00:11:00 来源:WEB开发网   
核心提示:用法:./my_script.sh android_root_path dist_full.jar脚本:#!/bin/bash# ./update_full_jar.sh android_root_dir ./dest_name.jar#MYSRC=/home/baozaochao/work/_s7_eclair_sv

用法:

./my_script.sh android_root_path dist_full.jar

脚本:

#!/bin/bash

# ./update_full_jar.sh android_root_dir ./dest_name.jar

#MYSRC=/home/baozaochao/work/_s7_eclair_svn_C00_bak/out/target/common/obj/JAVA_LIBRARIES/

#MYDST=/home/baozaochao/work/jars/dst/

MYDST=/tmp/__jar__temp/

ENDPATH=out/target/common/obj/JAVA_LIBRARIES/

CUR_PATH=$PWD

if [ ! -d "$1$ENDPATH" ];then

echo The directory $1 is not root of the project.

echo The commond like ./update_full_jar.sh projectRootPath/ buildToPath/

exit 1

fi

MYSRC="$PWD"/$1$ENDPATH

echo $MYSRC

if [ "$2" = "" ];then

echo The second parameter is required.

echo The commond like ./update_full_jar.sh projectRootPath/ dest.jar

exit 2

fi

JARDST=$2

JARDST="$PWD"/${JARDST%/}/

echo $JARDST

#exit 0

if [ -d "$MYDST" ];then

rm -rf $MYDST

fi

mkdir $MYDST

cd $MYDST

for dir in `ls $MYSRC`

do

if [ -d "$MYSRC$dir" ];then

src="$MYSRC$dir"/classes.jar

src2="$MYSRC$dir"/javalib.jar

dst=$MYDST${dir%_intermediates}.jar

if [ -f "$src" ];then

#echo #$src

cp $src $dst

jar xvf $dst

rm $dst -f

#break

elif [ -f "$src2" ];then

echo $src2

cp $src2 $dst

jar xvf $dst

rm $dst -f

#break

fi

fi

done

jar cvf "$JARDST" * && echo **** Build "$JARDST" success. **** && rm -rf $MYDST

Tags:Android Java Jar

编辑录入:coldstar [复制链接] [打 印]
[]
  • 好
  • 好的评价 如果觉得好,就请您
      0%(0)
  • 差
  • 差的评价 如果觉得差,就请您
      0%(0)
赞助商链接