Automatically compile, sign, and publish ant scripts on Blackberry

Source: Internet
Author: User
Tags echo message

All rights reserved. You are welcome to reprint it. Please note: sinfrancisHttp://mdev.cc

Bb projects can be compiled and released using ant, but installation is required.(-_-!!! And B cannot be connected together. Je prompts that B is suspected of being installed)BB-ANT-TOOLS: http://bb-ant-tools.sourceforge.net/

Recently, Python + ant is used to automatically publish the desired BB file through user requests.Program, The following is part of the ant Script: the detailed explanation is in the comment

Build. properties resource file

XMLCode

    • App. Name = test
    • Bin. dir =$ {jde. Home} Bin
    • Iconicon.pathpolicicon.png
    • Jde. Home = d \:/javassetools/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_ub/jdk1.6.0 _ 18/
    • Output. dir = outputdir
    • Password = 123456
    • Simulate. type = 9500.bat
    • Simulator. dir =$ {jde. Home} Simulator

App.name=testbin.dir?==jde.home=binicon.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_ub/jdk1.6.0 _ 18/output. dir = outputdirpassword = 123456simulate. type = 9500. batsimulator. dir =$ {jde. home} Simulator

Build. xml

XML Code

  • <? XML
    Version = "1.0"
    Encoding = "UTF-8"?>
  • <Project
    Name = "$ {description }"
    Default = "simulate"
    Basedir = ".">
  • <! -- Load the variable file -->
  • <Property
    File = "build. properties">
  • </Property>
  • <! -- Define the task Syntax -->
  • <Taskdef
    Resource = "bb-ant-defs.xml"
    Classpath = "lib/bb-ant-tools.jar"
    />
  • <! -- Debug status -->
  • <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>
  • <! -- Start the simulator -->
  • <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>
  • <! -- Release status -->
  • <Target
    Name = "deploy"
    Depends = "sign"
    Description = "builds and deploys project">
  • <! -- Copy the compiled installation file to the simulator directory -->
  • <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>
  • <! -- Compile and use jde home and 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 = ".">
  • <! -- The RRC rrh file must be included here, which is an international resource file of BB. The system automatically compiles the file; otherwise, an error occurs. -->
  • <Include
    Name = "src/**/*. Java"
    />
  • <Include
    Name = "src/**/*. RRC"
    />
  • <Include
    Name = "src/**/*. rrh"
    />
  • <Include
    Name = "Res /*.*"
    />
  • </Fileset>
  • </Src>
  • </RAPC>
  • </Target>
  • <! -- Initialize the directory -->
  • <Target
    Name = "init"
    >
  • <Echo
    Message = "init output directory...">
  • </Echo>
  • <Mkdir
    Dir = "$ {output. dir }"
    />
  • </Target>
  • <! -- Sign all files -->
  • <Target
    Name = "sign"
    Depends = "build">
  • <Sigtool
    Codfile = "$ {output. dir}/$ {book. name}. COD"
    Password = "$ {password }"
    Forceclose = "true"
    Close = "true"/>
  • </Target>
  • </Project>

<? XML version = "1.0" encoding = "UTF-8"?> <Project name = "$ {description}" default = "simulate" basedir = "."> <! -- Load the variable file --> <property file = "build. properties"> </property> <! -- Define the task Syntax --> <taskdef resource = "bb-ant-defs.xml" classpath = "lib/bb-ant-tools.jar"/> <! -- Debug status --> <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> <! -- Start the simulator --> <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> <! -- Release status --> <target name = "deploy" depends = "sign" Description = "builds and deploys project"> <! -- Copy the compiled installation file to the simulator directory --> <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> <! -- Compile and use jde home, java home and so on --> <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 "runo Nstartup = "false" startuptier = "7" ribbonposition = "0"> </jdp> <SRC> <fileset dir = "."> <! -- The RRC rrh file must be included here, which is an international resource file of BB. The system automatically compiles the file. Otherwise, an error occurs --> <include name = "src /**/*. java "/> <include name =" src /**/*. RRC "/> <include name =" src /**/*. rrh "/> <include name =" Res /*. * "/> </fileset> </src> </rAPC> </Target> <! -- Initialize the directory --> <target name = "init"> <echo message = "init output directory ..... "> </echo> <mkdir dir =" $ {output. dir} "/> </Target> <! -- Sign all files --> <target name = "sign" depends = "build"> <sigtool codfile = "$ {output. dir}/$ {book. name }. cod "Password =" $ {password} "forceclose =" true "Close =" true "/> </Target> </Project>

This article is transferred from www.35java.com

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.