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.

Advertisements

One thought on “OrcaScript setting version number into exe

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s