Tag: OrcaScript

Use NotePad++ to create orca build script quickly

When creating orcascipt, usually I start from the existing PBT file which contains the huge lib list:

LibList "myapp_appl.pbl\\myapp_appl.pbl;myapp_attachment.pbl\\myapp_attachment.pbl;myapp_br.pbl\\myapp_br.pbl;myapp_casefile.pbl\\myapp_casefile.pbl;myapp_casefile_related.pbl\\myapp_casefile_related.pbl;myapp_dddw.pbl\\myapp_dddw.pbl;myapp_disciplinary_action.pbl\\myapp_disciplinary_action.pbl;myapp_licensee.pbl\\myapp_licensee.pbl;myapp_list.pbl\\myapp_list.pbl;myapp_mass_entry.pbl\\myapp_mass_entry.pbl;myapp_registration.pbl\\myapp_registration.pbl;myapp_report.pbl\\myapp_report.pbl;myapp_resource.pbl\\myapp_resource.pbl;myapp_schedule.pbl\\myapp_schedule.pbl;myapp_security.pbl\\myapp_security.pbl;myapp_ticket.pbl\\myapp_ticket.pbl;im_lls_rc_dws.pbl\\im_lls_rc_dws.pbl;im_lls_rc_rpt_dws.pbl\\im_lls_rc_rpt_dws.pbl;pies_shared.pbl\\pies_shared.pbl;reg_01.pbl\\reg_01.pbl;"

I want the orca format like this:

build executable "myapp.exe" "myapp.ico" "myapp.pbr" "yyyyyyyyyyyyyyyyyyy"

build Library "myapp_appl.pbl\myapp_appl.pbl" "" PBD
build Library "myapp_attachment.pbl\myapp_attachment.pbl" "" PBD
build Library "myapp_br.pbl\myapp_br.pbl" "" PBD
build Library "myapp_casefile.pbl\myapp_casefile.pbl" "" PBD
build Library "myapp_casefile_related.pbl\myapp_casefile_related.pbl" "" PBD
build Library "myapp_dddw.pbl\myapp_dddw.pbl" "" PBD
build Library "myapp_disciplinary_action.pbl\myapp_disciplinary_action.pbl" "" PBD
build Library "myapp_licensee.pbl\myapp_licensee.pbl" "" PBD
build Library "myapp_list.pbl\myapp_list.pbl" "" PBD
build Library "myapp_mass_entry.pbl\myapp_mass_entry.pbl" "" PBD
build Library "myapp_registration.pbl\myapp_registration.pbl" "" PBD
build Library "myapp_report.pbl\myapp_report.pbl" "" PBD
build Library "myapp_resource.pbl\myapp_resource.pbl" "" PBD
build Library "myapp_schedule.pbl\myapp_schedule.pbl" "" PBD
build Library "myapp_security.pbl\myapp_security.pbl" "" PBD
build Library "myapp_ticket.pbl\myapp_ticket.pbl" "" PBD
build Library "im_lls_rc_dws.pbl\im_lls_rc_dws.pbl" "" PBD
build Library "im_lls_rc_rpt_dws.pbl\im_lls_rc_rpt_dws.pbl" "" PBD
build Library "pies_shared.pbl\pies_shared.pbl" "" PBD
build Library "reg_01.pbl\reg_01.pbl" "" PBD

Here is how I did it in minutes of work, using NotePad++ relace with regexp:

  1. Replace step 1, this is easy, replace all \\ with \, and ‘;’ with “\n”
  2. Replace step 2, using regexp, replace all
    ^(.*)
    with
    build Library “\1” “” PBD
  3. Done.

Notepad++ reference: http://notepad-plus.sourceforge.net/uk/regExpList.php

Advertisement

OrcaScript setting version number into exe

From Sybase’s manual, OrcaScript can set version info into exe,


set exeinfo property <fileversion | fileversionnum | productversion |    productversionnum> versionString
set exeinfo property <companyname | productname | copyright | description>    propertyString

Here is a post talking about how to read this exe info from PB through API . To use this code in PB 9 or later, you should change it to ansi or GetFileVersionInfoSizeW() andGetFileVersionInfoW() API functions.

Because OrcaScript should be able to pass variable through ‘/D’ switch, but my experience is that there are some keywords you should avoid, like ‘version’ (undocumented)

My ant task to pass args.

<project name="build" default="build"
       basedir="../">

    <target name="build" depends="delete_last_build">
        <exec executable="orcascr100.exe" failonerror="true" >
            <arg line='/D version="1.2.3.4" ${basedir}/build/build.orca' />
         </exec>        

        <antcall target="deploy" />
    </target>

    <target name="delete_last_build">
        <delete>
            <fileset dir="${basedir}/Executable" includes="*.exe"  />
            <fileset dir="${basedir}/Executable" includes="*.pbd"  />
        </delete>
    </target>

    <target name="deploy">
        <move todir="${basedir}/Executable">
            <fileset dir="${basedir}/" includes="*.exe"  />
            <fileset dir="${basedir}/" includes="*.pbd"  />
        </move>
    </target>

 </project>

My orca:

start session

set lib_list = “C:\workspaces\pbunit\pb102\pbunit.pbl;”
set lib_list += “C:\workspaces\pbunit\pb102\pbunitfunc.pbl;”
set lib_list += “C:\workspaces\pbunit\pb102\pbunitui.pbl;”

set main_pbl = “C:\workspaces\pbunit\pb102\pbunitui.pbl”

;**********************************************************************
; Set up the Application
;**********************************************************************
set liblist lib_list
set application main_pbl “pbunit”

build application FULL

;**********************************************************************
; Now build the exe and PBD
;**********************************************************************

set exeinfo property companyname “Frank Mao”
; The variable name should avoid keywords, like “version”
set exeinfo property fileversion version_num
build executable “pbunit.exe” “pbunit.ico” “pbunit.pbr” “yyy”

build Library “pbunit.pbl” “” PBD
build Library “pbunitfunc.pbl” “” PBD
build Library “pbunitui.pbl” “” PBD

end session

The challenge for me is, I have to pass both fileversion and fileversionnum to orca, one is string, the other one is 4 integers. If I set version number is this way,

set exeinfo property fileversion  “7.1.0.41”
set exeinfo property fileversionnum  “7,1,0,42”
set exeinfo property productversionnum  “7,1,0,43”
set exeinfo property productversion  “7.1.0.44”

I got

pbunit_version1

Notice the one with coma being converted to dots. fileversionnum really means 4 parts of fileversionnum, must be in the format of “1,2,3,4”.

Or I can just pass the version in coma way, the File version shown on the top is in dot format, while the one in “Other version information” will still in coma way. Who cares? And how many people can tell the difference?

Strange. File version and File version number are totally different concept. They can be different.

Bruce Armstrong’s 5 years old article is still very usesful for orca users.

Moving to TFS

Our current VSS works fine, but we are going to move to TFS anyway. The reasons are:

  1. VSS has no permission configuration, a developer can change any work item in source repository.
  2. VSS has no policy. Like code review before check in.
  3. VSS is slow. No real server behind.

But, the test result on TFS is good as we expected.

  1. No sharing anymore.
    We figured out Microsoft is trying to promote Branching and Merging instead of simple sharing. So our cooperation code will need 3branches at least: one for DEV, one for Acceptance, and one for Production/Release. All other projects will branch the latest version of Production/Release. Until the cooperation code is merging (for us, it’s just a deploy or copying) into the Acceptance/Production/Release branch, outside developer won’t see those unstable/untested code. Fine, I like this idea. Bye bye, sharing.
  2. Explore client.
    This is the new client for developer. If developer’s machine already has VisualStudio installed, it will become a plugin, otherwise it’s a standalone application looks like VisualStudio, but only TFS view in it.
  3. MSSCCI provider.
    It’s needed for PB developing. For orcascript, I had to modify registry to shorten the string name, because Orcascript only can handle 34 chars in SCC name. Thanks to Ronarld Smith’s post.

    scc set connect property provider “Microsoft Team Foundation Server”
    scc set connect property userid “DomainName\LoginId”
    scc set connect property project “$/ProjectName”
    scc set connect property auxproject “http://tfs-servername:portnumber&#8221;
    scc set connect property localprojpath “C:\work_dir\”
    scc set connect property logfile “buildfromsource.log”
    scc set connect property logappend false

  4. Dreamweaver.
    Doesn’t support.
  5. EClipse.
    There is a plugin develped by TeamPrise. Not free.
  6. Slow Refresh in PowerBuilder.
    It seems this is a big problem for those PB+TFS developers, for me it’s 4 times slower than VSS. Why?
  7. CC.net plugin.
    It’s available. Check the help file in CC.net.
    Watch out the wrong example there:

    <deleteWorkspace>false</workspace>