Build application from source code

1
0
-1

I look for possibility to build PB Application from source code using PB native tools. Please correct me if I wrong. To build application, the source *.sr*  files have to be imported into .pbl files.  The only way to do that natively is to use PBORCA script. That requires PBG file for each PBL library. Because PBG file could easily go out of sync, I wonder if there a way to import all *.sr* files from each directory into PBL library without using PBG file?

 

Thank you,

Yuri

Question Tags: 

Answers

Chris Pollach answered Build application from source code

1
0
-1

Hi Yuri;

    The only ways to import PB object source files is to either: a) use the IDE, b) ORCA API, or ORCAScript. PB does have a LibraryImport () function but Sybase purposely  handicapped it to only work on DataWindow objects. Mainly because they wanted revenue from selling (Licensing) ORCA. This limitation has never been lifted on the LibraryImport() command. If it were, you could easily write  SCM (Source Code Management) utilities of your own - all in PB. Feel free to open a support ticket to see if Engineering can lift this restriction on the command.

Regards ... Chris

Yuri Denshchik's picture

Thank you Chris and all who replied to me. 

It seems to be easy to generate my own PBR file, so I will create it myself before running ORCA's import .

Michael Kramer answered Build application from source code

1
0
-1

Hi Yuri,

It is possible to create a PBG file (file format: See PB Help) from either a PBL file or a folder in the file system.

  • Create from PBL file
    • Use LibraryDirectory(fileName, DirAll!) to obtain list of all classes in the PBL file
    • Create PBG content from that list
  • Create from file folder
    • Use DirList( * ) to populate ListBox with list of files in a specific folder
    • Create PBG content from that list

Some 3rd party tools may implement similar functionality.

HTH  /Michael

Michael Kramer's picture

Hi Yuri, (edit to my original reply),

PBG file is required. PowerBuilder's Get-Latest uses PBG file as the "List of Contents" for the PBL file.

So it is quite annoying when the PBG file gets out-of-sync.

However, it is fairly straightforward to create a PBG file matching the list of files in a file folder. See the second option in my original reply.

 

HTH  /Michael

Olan Knight answered Build application from source code

1
0
-1

There are two ways to make this easy.
1. This simple answer is bad for source control:  keep all of your PBLs in a single folder. Then compiling the code is simple and there's no risk of losing a PBL.

 

2. The other method is to use a BATCH file to copy all of your files from their various folders into a COMPILE folder. It works like this:
    a) first delete all of the old files from c:\compile (or wherever you put your compile folder)

   b) copy the PBLs, PBRs, DLLs, images, and whatever else you need from the various development folders into the COMPILE folder.

       Alternately, you can keep the DLLs and images in separate folders and have the PATH environment valiable include those folders.

   c) Run the batch file.

   d) Change the TARGET file in the PB IDE to point to the code in the COMPILE folder

   e) Deploy the code in the COMPILE folder

 

Later -

Olan

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Sample batch file:

@echo off
color e2

;rem    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
;rem    Update the yourAPP files in C:\Build12
;rem    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
;rem
;rem    Author:     Olan Knight
;rem    Date:       17-JUL-2012
;rem    Version:    1.01
;rem    
;rem    The purpose of this batch file is to copy the current PBLs
;rem    from the C:\Apps12 folder into your C:\Apps12\Build12 folder.
;rem    
;rem    Note that everyone needs to have the exact same directory
;rem    structure in order for us to implement source control software.
;rem    Do NOT change the structure of the C:\Apps12 directory.
;rem      
;rem    KEEP YOUR WORKSPACE AND TARGETS AT THE "C:\Apps12\Build12" LEVEL!!!
;rem   
;rem    Note: Remember that the RESOURCES file is still on the M drive
;rem        so your PATH variable must include the Resources folder.
;rem    ----------------------------------------------------------------

echo.
echo.
echo "Press enter to continue or <CTRL>c to quit"
echo.
pause " "

set DeleteFlags=/s /f /q
set CopyFlags=/s /k /r /y


;rem  =======================================================================
;rem  =======================================================================

echo.
echo.
echo.
echo.
echo  Copying the yourAPP libraries....
echo.
echo.

set   sourcepath=C:\Apps12\yourAPP
set   targetpath=C:\Apps12\Build12\yourAPP

echo.
echo.
echo  Delete the yourAPP files from "%targetpath%"...
;rem  ---------------------------------------------------
del  "%targetpath%"\CSGI_yourAPP\*.*       %DeleteFlags% > NUL
del  "%targetpath%"\yourAPP\*.*            %DeleteFlags% > NUL
del  "%targetpath%"\yourAPP_asap\*.*       %DeleteFlags% > NUL
.
. <other app PBLs>
.
del  "%targetpath%"\yourAPP_usage\*.*      %DeleteFlags% > NUL
del  "%targetpath%"\yourAPP_wc\*.*         %DeleteFlags% > NUL

del  "%targetpath%"\*.pbr                  %DeleteFlags% > NUL
del  "%targetpath%"\*.exe                  %DeleteFlags% > NUL


echo  Copy the YOURAPP files from "%sourcepath%" into "%targetpath%...    
;rem  --------------------------------------------------------------------
xcopy "%sourcepath%"\CSGI_yourAPP\*.PBL        "%targetpath%"\CSGI_yourAPP\*.*        %CopyFlags%
xcopy "%sourcepath%"\yourAPP\*.PBL             "%targetpath%"\yourAPP\*.*             %CopyFlags%
xcopy "%sourcepath%"\yourAPP_asap\*.PBL        "%targetpath%"\yourAPP_asap\*.*        %CopyFlags%
.
. <other app PBLs>
.
xcopy "%sourcepath%"\yourAPP_usage\*.PBL       "%targetpath%"\yourAPP_usage\*.*       %CopyFlags%
xcopy "%sourcepath%"\yourAPP_wc\*.PBL          "%targetpath%"\yourAPP_wc\*.*          %CopyFlags%

xcopy "%sourcepath%"\*.PBR                     "%targetpath%"\*.*                     %CopyFlags%

echo  Change the file attributes of the new C drive yourAPP files....
attrib   -r "%targetpath%"\*.*   /s

;rem  =======================================================================
;rem  =======================================================================


color a2

pause
echo on

 

Gary Collins answered Build application from source code

1
0
-1

I find myself wondering how the PBG file would get out of sync, since out pbg's are under source control along with everything else, but...

You could write a script to create your PBG file and then use AutoCompile (PBC170.exe) to build your target.  The PBG file syntax is pretty simple, as is the target (.PBT) syntax.  With the .pbt, .pbg's, and .sr*'s, you can build your PBL's with PBC170.