如何使用cmd在Windows中打包ANE文件?

时间:2013-07-04 23:07:26

标签: shell batch-file air cmd flash-builder

我想使用命令行和adt命令将我的原生扩展名.jar(Android JAVA端)和.swc(ActionScript端)文件打包到Windows 7中的ANE(Air Native Extension)文件中,我有两个.sh文件(可以通过运行它来打包ANE文件的Mac OS)我不知道如何编写.bat或.sh文件,所以我无法找到如何将.sh转换为.bat文件所以我'我正在寻找一些帮助,将.sh命令转换为Windows用户的.bat命令。我认为它可以帮助这么多的空中开发人员.... :)

Build.sh:

adt="/Applications/Adobe Flash Builder 4.7/eclipse/plugins/com.adobe.flash.compiler_4.7.0.349722/AIRSDK/bin/adt"
nativedir="/Users/markhood/Documents/Eclipse64/ANESample_java"

echo "********************************************************************"
echo " - creating ANE package"

rm -rf Android-ARM/*
rm -f SampleASExtension.ane library.swf
mkdir -p Android-ARM

unzip ../ANESample/bin/ANESample.swc library.swf
cp library.swf Android-ARM
cp "$nativedir"/ANESample.jar Android-ARM
cp -r "$nativedir"/res Ansion.xml -swc ../ANESample/bin/ANESample.swc -platform Android-ARM -C Android-ARM .ndroid-ARM

"$adt" -package -target ane SampleASExtension.ane extension.xml -swc ../ANESample/bin/ANESample.swc -platform Android-ARM -C Android-ARM .

#"$adt" -package -storetype PKCS12 -keystore cer.p12 -storepass password -target ane SampleASExtension.ane exte

BuildANE.sh

# path to YOUR Android SDK
export AIR_ANDROID_SDK_HOME="/Users/leebrimelow/Documents/SDKs/android-sdk/"

# path to the ADT tool in Flash Builder sdks
ADT="/Applications/Adobe Flash Builder 4.5/sdks/4.5.0/bin/adt"

# native project folder
NATIVE_FOLDER=jar

# AS lib folder
LIB_FOLDER=lib

# app folder
APP_PROJECT=NotifyApp

# name of ANE file
ANE_NAME=notification.ane

# JAR filename
JAR_NAME=notification.jar

# APK name
APK_NAME=NotifyApp.apk

# cert path
CERT_NAME=cert.p12

# cert password
CERT_PASS=password

#===================================================================

echo "****** preparing ANE package sources *******"

rm ${ANE_NAME}
rm -rf ./build/ane
mkdir -p ./build/ane
mkdir -p ./build/ane/Android-ARM
mkdir -p ./build/ane/Android-ARM/res

#copy resources
cp -R ./${NATIVE_FOLDER}/res/* ./build/ane/Android-ARM/res

# create the JAR file
jar cf ./build/ane/Android-ARM/${JAR_NAME} -C ./${NATIVE_FOLDER}/bin .

# grab the extension descriptor and SWC library 
cp ./${LIB_FOLDER}/src/extension.xml ./build/ane/
cp ./${LIB_FOLDER}/bin/*.swc ./build/ane/
unzip ./build/ane/*.swc -d ./build/ane
mv ./build/ane/library.swf ./build/ane/Android-ARM


echo "****** creating ANE package *******"

"$ADT" -package -storetype PKCS12 -keystore ./cert.p12 -storepass password -tsa none \
        -target ane \
    ${ANE_NAME} \
    ./build/ane/extension.xml \
    -swc ./build/ane/*.swc \
    -platform Android-ARM \
    -C ./build/ane/Android-ARM/ .

echo "****** ANE package created *******"

echo "****** preparing APK package sources *******"

rm ${APK_NAME}
rm -rf ./build/apk
mkdir -p ./build/apk

cp ./${APP_PROJECT}/bin-debug/${APP_PROJECT}-app.xml ./build/apk
cp ./${APP_PROJECT}/bin-debug/${APP_PROJECT}.swf ./build/apk

echo "****** creating APK package *******"

cd ./build/apk

"$ADT" -package -target apk -storetype PKCS12 -keystore ../../${CERT_NAME} -storepass ${CERT_PASS} \
    ../../${APK_NAME} \
    ./${APP_PROJECT}-app.xml \
    ./${APP_PROJECT}.swf -extdir ../..
cd ../..

echo "****** APK package created *******"

adb uninstall air.${APP_PROJECT}.debug
adb install ${APK_NAME}

1 个答案:

答案 0 :(得分:0)

我建议用ANT构建它。它更容易在Mac和Windows之间转换。以PushWoosh的ANE构建脚本为例。它们做得很好,易于使用。 https://github.com/shaders/push-notifications-sdk/tree/master/SDK%20Sample%20Projects/AdobeAir/ANE-Pushwoosh/build