::直接複製貼上再改掉紅色部分就可以用了
::================================================================
:: config.bat
@echo off
:: title
SET TITLE=xxx
:: *flex sdk & air sdk 路徑
SET SDK_PATH=C:\Program Files\FlashDevelop\Tools\flexsdk
:: compc 路徑
SET COMPC_PATH="%SDK_PATH%\bin\compc.bat"
:: 輸入as路徑 ,要打包的目錄
SET SRC_PATH=../actionscript/android
SET INCLUDE_PATH="%SDK_PATH%\frameworks\libs\air"
SET ASDOC="%SDK_PATH%\bin\aasdoc"
:: 壓縮軟體
SET DECOMPRESS="C:\Program Files\7-Zip\7z.exe"
:: *輸出swc檔名
SET EXTENSION_SWC=%TITLE%.swc
:: ANE--------------------------------------------
SET DEST_ANE=%TITLE%.ane
:: extension.xml描述檔
SET EXTENSION_XML=extension.xml
SET EXTENSION_ID=com.xxx
:: 使用的library.swf
SET EXTENSION_LIBRARY=library.swf
:: ADT批次檔 路徑
SET ADT_PATH="%SDK_PATH%\bin\adt.bat"
:: *android使用的jar檔 檔名不可有底線
SET NATIVE_ANDROID=xxx.jar
SET JAR_CLASS=com.xxx
:: ios用的.a檔
SET NATIVE_IOS=
SET IOS_INIT=
SET IOS_FINAL=
:: windows用的dll檔
SET NATIVE_WIN=
:: 輸出版本號
SET E_VERSION=1.0.0
:: 使用的名稱空間
SET AIR_NAMESPACE="http://ns.adobe.com/air/extension/3.1"
::================================================================
::buildAne.bat
:: @author zp
@echo off
call config.bat
set TMP_CMD=exCmd.bat
set CALL_CMD=call %TMP_CMD%
echo 建立指令暫存檔
echo %%EXECUTE%%>exCmd.bat
echo.
echo 開始建立swc檔
if exist "%EXTENSION_SWC%" del "%EXTENSION_SWC%"
set EXECUTE=%COMPC_PATH% -optimize -source-path %SRC_PATH% -include-sources %SRC_PATH% -external-library-path %INCLUDE_PATH% -output "%EXTENSION_SWC%"
%CALL_CMD%
if not exist "%EXTENSION_SWC%" goto onFail
echo.
echo 截取library.swf
%DECOMPRESS% e %EXTENSION_SWC% -y
del catalog.xml
::set EXTENSION_XML=cc.xml
echo.
echo 檢查 描述檔 %EXTENSION_XML%
set TMP_XML=extension.xml
if not exist "%EXTENSION_XML%" (
echo 描述檔 %EXTENSION_XML% 不存在
set EXTENSION_XML=%TMP_XML%
echo 置作描述檔 %TMP_XML%
echo ^<extension xmlns=%AIR_NAMESPACE%^> >%TMP_XML%
echo ^<id^>%EXTENSION_ID%^</id^> >>%TMP_XML%
echo ^<versionNumber^>%E_VERSION%^</versionNumber^> >>%TMP_XML%
echo ^<platforms^> >>%TMP_XML%
::Android-ARM
if not "%NATIVE_ANDROID%"=="" (
echo %TMP_XML%加入Android-ARM
if "%JAR_CLASS%"=="" goto onFail
echo ^<platform name="Android-ARM"^> >>%TMP_XML%
echo ^<applicationDeployment^> >>%TMP_XML%
echo ^<nativeLibrary^>%NATIVE_ANDROID%^</nativeLibrary^> >>%TMP_XML%
echo ^<initializer^>%JAR_CLASS%^</initializer^> >>%TMP_XML%
echo ^<finalizer^>%JAR_CLASS%^</finalizer^> >>%TMP_XML%
echo ^</applicationDeployment^> >>%TMP_XML%
echo ^</platform^> >>%TMP_XML%
)
::iPhone-ARM
if not "%NATIVE_IOS%"=="" (
echo %TMP_XML%加入iPhone-ARM
if "%IOS_INIT%"=="" goto onFail
if "%IOS_FINAL%"=="" goto onFail
echo ^<platform name="iPhone-ARM"^> >>%TMP_XML%
echo ^<applicationDeployment^> >>%TMP_XML%
echo ^<nativeLibrary^>%NATIVE_IOS%^</nativeLibrary^> >>%TMP_XML%
echo ^<initializer^>%IOS_INIT%^</initializer^> >>%TMP_XML%
echo ^<finalizer^>%IOS_FINAL%^</finalizer^> >>%TMP_XML%
echo ^</applicationDeployment^> >>%TMP_XML%
echo ^</platform^> >>%TMP_XML%
)
::Windows-x86
if not "%NATIVE_WIN%"=="" (
echo %TMP_XML%加入Windows-x86
echo ^<platform name="Windows-x86"^> >>%TMP_XML%
echo ^<applicationDeployment^> >>%TMP_XML%
echo ^<nativeLibrary^>%NATIVE_WIN%^</nativeLibrary^> >>%TMP_XML%
echo ^<initializer^>initializer^</initializer^> >>%TMP_XML%
echo ^<finalizer^>finalizer^</finalizer^> >>%TMP_XML%
echo ^</applicationDeployment^> >>%TMP_XML%
echo ^</platform^> >>%TMP_XML%
)
::default
echo %TMP_XML%加入default
echo ^<platform name="default"^> >>%TMP_XML%
echo ^<applicationDeployment/^> >>%TMP_XML%
echo ^</platform^> >>%TMP_XML%
echo ^</platforms^> >>%TMP_XML%
echo ^</extension^> >>%TMP_XML%
)
if not exist "%EXTENSION_XML%" goto onFail
SET ALL_PLATFORM=
::Windows-x86
if not "%NATIVE_WIN%"=="" (
SET ALL_PLATFORM=%ALL_PLATFORM% -platform Windows-x86 library.swf %NATIVE_WIN%
)
::iPhone-ARM
if not "%NATIVE_IOS%"=="" (
SET ALL_PLATFORM=%ALL_PLATFORM% -platform iPhone-ARM library.swf %NATIVE_IOS%
)
::Android-ARM
if not "%NATIVE_ANDROID%"=="" (
SET ALL_PLATFORM=%ALL_PLATFORM% -platform Android-ARM library.swf %NATIVE_ANDROID%
)
::default
SET ALL_PLATFORM=%ALL_PLATFORM% -platform default library.swf
echo.
echo 建立ANE 使用 描述檔 %EXTENSION_XML%
if exist "%DEST_ANE%" del "%DEST_ANE%"
set EXECUTE=%ADT_PATH% -package -target ane %DEST_ANE% %EXTENSION_XML% -swc %EXTENSION_SWC% %ALL_PLATFORM%
%CALL_CMD%
if not exist "%DEST_ANE%" goto onFail
echo.
echo 建立ASDOC
set EXECUTE=%ASDOC% -doc-sources %SRC_PATH% -main-title "%TITLE% API Documentation" -window-title "%TITLE% API Documentation" -output "%V_BATPATH%docs" -keep-xml=true -skip-xsl=true
%CALL_CMD%
echo.
echo 合併asdoc ane
set EXECUTE=%DECOMPRESS% a -tzip "%DEST_ANE%" "docs"
%CALL_CMD%
echo.
echo 刪除多餘檔案
del "library.swf"
del "%EXTENSION_SWC%"
del "%TMP_CMD%"
rd /s /q "docs"
echo.
echo 輸出完成
echo.
pause
exit
:onFail
echo.
echo 輸出失敗
echo.
echo 刪除多餘檔案
del "library.swf"
del "%EXTENSION_SWC%"
del "%TMP_CMD%"
echo.
pause
沒有留言:
張貼留言