evilvoid 2010-07-23
版权所有,欢迎转载,转载请注明 : SinFrancis http://mdev.cc
BB的项目可以使用Ant进行编译,并进行发布,不过需要安装 (-_-!!!装和B 不能连在一起,JE提示有装 B 的嫌疑) BB-ANT-TOOLS : http://bb-ant-tools.sourceforge.net/
最近是使用python + ant 的形式通过用户请求自动发布用户想要的BB程序,以下是部分的ANT脚本:详细的解释均在注释中
BUILD.PROPERTIES资源文件
app.name=Test bin.dir=${jde.home}bin icon.path=icon.png jde.home=D\:/eclipsetools/bb/eclipse-jee-galileo-SR2-win32-BB1.1/eclipse/plugins/net.rim.ejde.componentpack4.7.0_4.7.0.53/components/ jdk.home=C\:/Java_1.6_U18/jdk1.6.0_18/ output.dir=outputDir password=123456 simulate.type=9500.bat simulator.dir=${jde.home}simulator
Build.xml
<?xml version="1.0" encoding="UTF-8"?> <project name="${description}" default="simulate" basedir="."> <!-- 加载变量文件 --> <property file="build.properties"> </property> <!-- 定义任务语法 --> <taskdef resource="bb-ant-defs.xml" classpath="lib/bb-ant-tools.jar" /> <!-- 调试状态 --> <target name="debug" depends="deploy" description="Builds, Deploys Project and Launches Remote Debug Server"> <exec executable="cmd.exe" dir="${bin.dir}" spawn="true"> <arg value="/c" /> <arg value="jdwp.bat" /> </exec> </target> <!-- 启动模拟器 --> <target name="simulate" depends="deploy" description="Builds, Deploys Project and Launches Simulator"> <exec executable="cmd.exe" dir="${simulator.dir}" spawn="true"> <arg value="/c" /> <arg value="${simulate.type}" /> </exec> </target> <!-- 发布状态 --> <target name="deploy" depends="sign" description="Builds and Deploys Project"> <!-- 拷贝编译完成的安装文件到模拟器的目录中去 --> <copy todir="${simulator.dir}" overwrite="true"> <fileset dir="${output.dir}"> <include name="*.cod" /> <include name="*.debug" /> <include name="*.csl" /> <include name="*.cso" /> </fileset> </copy> </target> <!-- 编译 ,需要使用JDE HOME,JAVA HOME等--> <target name="build" description="Builds Project" depends="init"> <rapc jdehome="${jde.home}" jdkhome="${jdk.home}" destdir="${output.dir}" output="${app.name}" quiet="false"> <jdp type="cldc" vendor="Vendor=Research In Motion Ltd." version="Version=0.9" description="eParadise Application" arguments="" icon="${icon.path}" focusicon="false" systemmodule="false" runonstartup="false" startuptier="7" ribbonposition="0" > </jdp> <src> <fileset dir="."> <!-- 这里要包含rrc rrh文件,这里是BB的国际化资源文件,系统会自动进行编译,否则会有错误出现 --> <include name="src/**/*.java" /> <include name="src/**/*.rrc" /> <include name="src/**/*.rrh" /> <include name="res/*.*" /> </fileset> </src> </rapc> </target> <!-- 初始化目录 --> <target name="init" > <echo message="Init output directory....."> </echo> <mkdir dir="${output.dir}" /> </target> <!-- 签名所有文件 --> <target name="sign" depends="build"> <sigtool codfile="${output.dir}/${book.name}.cod" password="${password}" forceclose="true" close="true"/> </target> </project>
注意:在linux系统上需要安装一下lib配合WTK使用才能成功编译BB程序:
* ibXpm (libxpm-dev) * libXt (libxt-dev) * libX11 (libx11-dev) * libICE (libice-dev) * libSM (libsm-dev) * libpthread (libc6-dev) * libm (libc6-dev) * libnsl (libc6-dev) * libstdc++6-dev
http://www.oracle.com/technetwork/java/download-135801.html