熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> PB編程 >> 正文

PowerBuilder命令行編譯詳解[1]

2022-06-13   來源: PB編程 

  公司的系統是使用PB + SQLServer開發的采用Visual Source safe進行版本控制由於項目客戶化需求的影響系統經常要進行更新和編譯每次的工作流程就是先在負責編譯的機器上打開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 shows commandline options for building and deploying targets and workspaces

  As with other commandline 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 targets 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/cdshopout and exits PowerBuilder:

  pb /w D:/CDShop/CDShoppbw /d /ou D:/tmp/cdshopout

  其實上文說了一堆意思無非就是我們可以在命令行模式下執行PB通過一些參數可以控制PB自己編譯指定的工作區然後自動退出這也確實是我需要的功能我馬上開始在命令行模式下測試有的機器並不能直接打PBexe來執行這需要設置系統的環境變量將PB所在目錄放入Path路徑中具體方法就不介紹了或者你直接按PB完整的路徑輸入也行至於後面的參數/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頁如下圖

[]  []  


From:http://tw.wingwit.com/Article/program/PB/201311/24586.html
    推薦文章
    Copyright © 2005-2022 電腦知識網 Computer Knowledge   All rights reserved.