PowerBuilder命令行编译详解[1]

PowerBuilder命令行编译详解[1]

www.educity.cn   发布者:bin0725   来源: 网络转载   发布日期:2013年05月28日   

  公司的系统是使用PB9.0 + SQLServer2000开发的,采用Visual Source safe6进行版本控制。由于项目客户化需求的影响,系统经常要进行更新和编译。每次的工作流程就是:先在负责编译的机器上打开VSS,下载需要更新的PBL到本地,然后找到源程序所在目录,将目录及其所有子文件的"只读"属性去掉(因为在VSS上Get Last Version时会自动将文件设置成只读,PB就无法编译了)。接着打开PB开始编译,编译完成后,由于各个PBL是按模块放在不同的目录中的,所以生成的PBD也不在一个文件夹中,这时我还需要通过搜索的形式找出所有PBD来复制到发布目录。这样的重复性工作干几次就让人烦了。最终我考虑通过批处理的形式来减少重复劳动。

  首先,VSS的GetLastVersion现在我是找不到可以批处理的方法的,去除只读属性也可以在命令行模式下用Attrib命令来解决,对于已生成的PBD复制到同一目录,我写了一个批处理文件,专门把那些固定模块目录下的PBD复制到发布目录,无非是一些Copy命令而已,没什么可说的。问题的关键就在于,要控制PB自动打开程序,编译,完成后自动进入打开负责复制PBD的批处理文件。早些时间由于抽不出空,也没用过PB的命令行模式,所以一直迟迟没写好这个文件。现在经过摸索,结合CSDN上一些大侠们的指导,终于试验成功。现写出其过程供各位斧正。

  对于命令行编译,PB的帮助中是这样描述的:

  From a command line

  When you deploy or build a workspace from a command line, PowerBuilder starts, completes the build, and exits as soon as the operation is completed. To retain a log file for the session, you can send the contents of the Output window to a file. Table 1-4 shows command-line options for building and deploying targets and workspaces.

  As with other command-line options, you need only use the initial letter or letters of the option name as long as the option is uniquely identified. The deploy, fullbuild, and incrementalbuild options can be used only with the workspace option. You need to create projects and specify build and deploy options for the workspace in PowerBuilder before you start a build from the command line. Deploy builds the projects in the target in the order listed on the Deploy page of the target's properties dialog box.

  Example

  This example assumes that the location of the PowerBuilder executable file is in your system path. It opens the workspace called CDShop, builds and deploys the targets in the workspace according to your specifications in the workspace and target properties, records the content of the Output window in the file D:/tmp/cdshop.out, and exits PowerBuilder:

  pb90 /w D:/CDShop/CDShop.pbw /d /ou D:/tmp/cdshop.out

  其实上文说了一堆,意思无非就是,我们可以在命令行模式下执行PB9,通过一些参数,可以控制PB自己编译指定的工作区,然后自动退出。这也确实是我需要的功能。我马上开始在命令行模式下测试,有的机器并不能直接打PB90.exe来执行,这需要设置系统的环境变量,将PB9所在目录放入Path路径中,具体方法就不介绍了。或者你直接按PB9完整的路径输入也行。至于后面的参数,/w后面挂指定的工作区名称,然后是//deploy或者/fullbuild、/incrementalbuild.这三个参数的意思分别是执行发布、完全编译或增量编译。任选其一即可。但是需要注意的是,这里我们要用/deploy参数。为什么呢,如果你用的是fullbuild或者是increamentbuild参数,PB只会"编译"而不会生成PBD或者DLL.以前自己在PB中进行编译的时候,一直以为Deploy就是Build,因为在Deploy Project的时候会有一个参数是完全编译或者增量编译,所以一直搞不清楚Deploy和Build的区别,在网上见其它兄弟也有这样的疑问。这次我通过试验,发现确实二者是有区别的。如果你不用Deploy而直接Build完了,复制到用户那里程序还是旧的就不好办了。那么我们挂上参数后,PB怎么知道是执行哪一个Project的Deploy呢。设置如下:

  在工作区下的子结点是Target,右键单击该Target,在弹出的菜单中选择Proterties,也就是属性,并在弹出的属性窗口中选择Deploy页。如下图:

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值