黑莓手机 - 为更复杂的应用程序的Ant构建脚本 [英] BlackBerry - Ant build script for more complex apps

查看:207
本文介绍了黑莓手机 - 为更复杂的应用程序的Ant构建脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法为我们的生产应用Ant构建脚本。

I am having trouble creating an Ant build script for our production apps.

我一直在阅读了很多关于Ant和 BB-ANT-工具的。我按照蚂蚁和放很多计算器的问题; BB(在评论下面引用连接问题)。我想用一个脚本比平常更复杂的帮助的Hello World!风格的应用程序。我现在的构建过程是在Eclipse中完全运行,手动完成。

I have been reading a lot about Ant, and bb-ant-tools. I have followed many stackoverflow questions on Ant & BB (referenced below in comments to "link" the questions). I would like help with a script more complex than the usual "Hello World!" style apps. My current build process is run entirely in Eclipse, and done manually.

有关这个问题,我想问一下如何使用Ant构建一个使用2(或更多)不同的库项目(这也需要待建)工程,不使用Eclipse呢?

For this question, I would like to ask how to use Ant to build a project that uses 2 (or more) different library projects (which also need to be built), without using Eclipse at all?

我已经安装了Ant,BB-Ant的工具。我已经建立和放大器;部署在设备中的基本的Hello World,用以下基本的例子这些工具。我创建了一个构建脚本和一些属性文件;但是当我运行的脚本,最终产品不电话(手机UI冻结启动屏幕上)上运行。

I have Ant, bb-ant-tools installed. I have built & deployed on device a basic Hello World, using these tools following basic examples. I have created a build script, and some property files; but when I run the scripts, the end product does not run on the phone (phone UI freezes on the launch screen).

我有3生成脚本,每个库和一个用于主应用程序。这些是相同的,除了项目名称(和在某些时候可以合并成一个共同的进口脚本)。每3 Java项目都有与此相关的一个Ant属性文件。我也用3种常见的属性文件定义常量,存放在JDE和放信息;在code签约密码。

I have 3 build scripts, one for each library, and one for the main app. These are identical, except for the project name (and could be combined into one common imported script at some point). Each of the 3 java projects has an Ant properties file related to it. I also use 3 common properties files for defining constants, storing info on the JDE & the code signing password.


  • common.properties:

  • common.properties:

jde.home=C:/development/tools/bb-jde/jde4.5/components
sigtool.jde = ${jde.home} 
sigtool.password = xxx_pass_xxx


  • project.properties(对SOAP库):

  • project.properties (for SOAP library):

    output=MySOAP
    type=midlet
    


  • project.properties(用于内部SDK库):

  • project.properties (for internal SDK library):

    output=MySDK
    type=midlet
    


  • 更新1:我的库属性文件,因为战后初期更新。 previously我设置 =类型库(基于RIM的文档)。基于在这篇文章中概述我的研究(黑莓手机 - 使用自己的项目自己的JAR文件),我试图改变为键入=的MIDlet 。这给了更好的结果(至少在我的平台BB JDE 5.0)。

    Update 1: I have updated the library property files since initial post. Previously I set type=library (based on RIM documentation). Based on my research outlined in this post (BlackBerry - use own JAR file in own project), I tried changing to type=midlet. This gives better results (at least on my platform BB JDE 5.0).


    • project.properties(我的应用程序):

    • project.properties (for my app):

    output=MyApp
    title=App
    type=cldc
    vendor=Richard
    version=1.0.7
    description=A nice app
    icon=icon.png
    


  • 的build.xml(除了在顶部的名称都是一样的,和2库脚本不具有内部import.jars声明文件集):

  • build.xml (all the same except for the name at the top, and the 2 library scripts do not have filesets declared inside import.jars):

    <?xml version="1.0" encoding="ISO-8859-1"?>
    <project name="MyApp" default="build">
    
        <!-- BLACKBERRY ANT TOOLS -->
        <property name="bb-ant-tools.home" location="C:/development/tools/bb-ant-tools" />
        <taskdef resource="bb-ant-defs.xml" classpath="${bb-ant-tools.home}/bb-ant-tools.jar" />
    
        <!-- CONFIG FILES -->
        <property file="${common.basedir}/common.properties" />
        <property prefix="project" file="project.properties" />
    
        <!-- FOLDERS -->
        <property name="dest.dir" location="build" />
    
        <!-- this is empty in the library scripts -->
        <path id="import.jars">
            <fileset dir="../MySDK/build" includes="*.jar" />
            <fileset dir="../MySOAP/build" includes="*.jar" />
        </path>
    
        <path id="src.files">
            <fileset dir="src" includes="**/*" />
            <fileset dir="res" includes="**/*" />
        </path>
    
        <!-- TARGET ACTIONS -->
    
        <target name="build" depends="">
            <mkdir dir="${dest.dir}" />
    
            <!-- work around a bug requiring app icons to be in the output folder -->
            <copy file="${basedir}/res/icon.png" tofile="${dest.dir}/icon.png" />
    
            <rapc 
                    jdehome="${jde.home}"
                    output="${project.output}" 
                    destdir="${dest.dir}" >
    
                <import refid="import.jars" />
                <src refid="src.files" />
                <jdp file="${basedir}/project.properties" />
            </rapc>
        </target>
    
        <target name="sign" depends="build">
            <sigtool
                    codfile="${dest.dir}/${project.output}.cod" 
                    jdehome="${sigtool.jde}" 
                    password="${sigtool.password}" />
        </target>
    
        <target name="clean">
            <delete dir="${dest.dir}" />
        </target>
    
    </project>
    


  • 更新2:我已经更新了的build.xml 从最初的职位。目标建立现在复制应用程序图标到生成输出文件夹( $ {dest.dir} )来解决一个臭虫BB-ANT-工具/ RAPC。

    Update 2: I have updated the build.xml since the initial post. Target build now copies the app icon into the build output folder (${dest.dir}) to work around a bug in bb-ant-tools / rapc.

    所以这是一个非常简单的Ant脚本,除了:

    So this is a very simple Ant script, except:


      从主
    1. 我想知道如何触发子建关
      应用程序版本(我的回答下面涉及这一点)。

    2. 最大的一个,就是从这个结果输出不
      不行。

    1. I would like to know how to trigger the sub-builds off from the main app build (my answer below deals with that).
    2. The big one, is that the resulting output from this does not work.

    FWIW我发现下面的热门资源,并列出他们,使他们不必添加为答案,并帮助任何人在未来寻找信息:


    FWIW I have found the following popular resources, and list them so that they need not be added as answers, and to help anyone in the future looking for info:


    • <一个href=\"https://supportweb.cs.bham.ac.uk/documentation/tutorials/docsystem/build/tutorials/ant/ant.html\">Basic蚂蚁教程

    <一个href=\"http://otomato.word$p$pss.com/2010/11/25/automating-eclipse-based-blackberry-project-with-ant/\">Automating基于Eclipse的黑莓项目蚂蚁

    如何使用RAPC从RIM

    jarjar工具

    和许多答案在这里计算器 - 见下面我的意见

    and many answers here on stackoverflow - see my comments below

    推荐答案

    这是我使用在多个项目的。

    This is what I'm using across multiple projects.

    <macrodef name="compile">
        <attribute name="buildversion" />
        <attribute name="description" />
        <sequential>
            <mkdir dir="${build.dir}" />
    
            <rapc output="${cod.name}_bbminterface"  destdir="${build.dir}" verbose="false" quiet="true" nowarn="true">
                <src>
                    <fileset dir="${bbminterface.src.dir}"/>
                </src>
                <import location="./lib/net_rim_bb_qm_platform.jar" />
                <jdp type="library" title="${app.name}_bbminterface" vendor="my vendor" version="@{buildversion}">
                    <entry title="${app.name}_bbminterface" description=""/>    
                </jdp>
            </rapc>
            <rapc output="${cod.name}_bbmimpl" destdir="${build.dir}" verbose="false" quiet="true" nowarn="true">
                <src>
                    <fileset dir="${bbmimpl.src.dir}"/>
                </src>
                <import location="./lib/net_rim_bb_qm_platform.jar" />
                <import location="${build.dir}/${cod.name}_bbminterface.jar" />
                <jdp type="library" title="${app.name}_bbmimpl" vendor="my vendor" version="@{buildversion}" runonstartup="true" startuptier="6">
                    <entry title="${app.name}_bbmimpl" description="" runonstartup="true" startuptier="6"/> 
                </jdp>
            </rapc>
    
            <rapc output="${cod.name}" destdir="${build.dir}" verbose="false">
    
                <src>
                    <fileset dir="${tmpsrc.dir}" />
                </src>
                <src>
                    <fileset dir="${res.dir}" />
                </src>
                <src>
    
                    <fileset file="${lib.dir}/paymentapi.jar" />
                </src>
                <import location="./lib/net_rim_bb_qm_platform.jar" />
                <import location="${build.dir}/${cod.name}_bbminterface.jar"/>
    
                <jdp type="cldc" title="${app.name}" vendor="my vendor" icon="../res/icon.png" version="@{buildversion}" description="@{description}" startuptier="7" ribbonposition="0">
                    <entry title="${app.name}" icon="../res/icon.png" description="@{description}" runonstartup="true" arguments="boot" systemmodule="true" startuptier="7" ribbonposition="0" />
                    <entry title="${app.name}" icon="../res/icon.png" description="@{description}" arguments="daemon" runonstartup="true" systemmodule="true" startuptier="7" ribbonposition="0" />
                </jdp>
            </rapc>
        </sequential>
    </macrodef>
    

    这是编译code。我们编译了一些库,然后该应用程序,连接刚才创建的库。

    This is the compilation code. We're compiling a few libraries and then the application, linking the just created libraries.

    然后签名:

    <target name="sign" description="Sign the cod file">
        <sigtool codfile="${build.dir}/${cod.name}_bbminterface.cod" password=""/>
        <sigtool codfile="${build.dir}/${cod.name}_bbmimpl.cod" password=""/>
        <sigtool codfile="${build.dir}/${cod.name}.cod" password="" />
    </target>
    

    然后上传到我们的OTA服务器:
        
            
            
                
                    
                        
                    
                
            
        

    And then uploading to our OTA server:

    这篇关于黑莓手机 - 为更复杂的应用程序的Ant构建脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆