cocos2d-xのantのbuild.xml設定 ②assetsのコピー
cocos2d-xのantのbuild.xml設定 ①ndk-build - はたはたのメモでbuild-native.shで行っていたビルドをantコマンドでできるようになった。
今回はassetsをコピーをするタスクを追加する。
assetsはアプリ内で読み込む画像やフォントなどのデータを置いておくディレクトリで、Resourceディレクトリから持ってくる必要がある。
プロジェクトディレクトリにあるResourcesからデータをコピーするassets-copyタスクは以下のようになる。
<!-- assets-copy --> <target name="assets-copy" depends="assets-clean" description="Copy files from a resource to assets."> <mkdir dir="assets" /> <copy todir="assets"> <fileset dir="../Resources" /> </copy> </target> <!-- assets-clean --> <target name="assets-clean" description="Removes assets files."> <delete dir="assets" /> </target> <target name="-pre-build" depends="update-version,assets-copy,ndk-build" /> <target name="cleanall" depends="assets-clean,ndk-clean,clean" description="Removes all output files created by other targets." />
これでビルドするたびにResourcesからassetsにデータがコピーされ、build-native.shを使わずにビルドできるようになった。