1. Yuri Denshchik
  2. PowerBuilder
  3. Wednesday, 10 January 2018 06:08 AM UTC

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

Accepted Answer
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Wednesday, 10 January 2018 14:41 PM UTC
  2. PowerBuilder
  3. # Permalink

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

Comment
  1. Yuri Denshchik
  2. Wednesday, 10 January 2018 17:28 PM UTC
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 .

  1. Helpful
There are no comments made yet.
Michael Kramer Accepted Answer Pending Moderation
  1. Wednesday, 10 January 2018 14:56 PM UTC
  2. PowerBuilder
  3. # 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

Comment
  1. Michael Kramer
  2. Wednesday, 10 January 2018 15:05 PM UTC
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

  1. Helpful
There are no comments made yet.
Olan Knight Accepted Answer Pending Moderation
  1. Wednesday, 10 January 2018 15:00 PM UTC
  2. PowerBuilder
  3. # 2

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 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
.
.
.
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%
.
.
.
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

 

Comment
There are no comments made yet.
Gary Collins Accepted Answer Pending Moderation
  1. Wednesday, 10 January 2018 17:19 PM UTC
  2. PowerBuilder
  3. # 3

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.

Comment
There are no comments made yet.
Sylvain BOESSINGER Accepted Answer Pending Moderation
  1. Tuesday, 30 April 2019 11:04 AM UTC
  2. PowerBuilder
  3. # 4

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

 

Hi Chris, Hi All,
I'm looking for an orca script sample to export an object from a pbl, modify it to change a value, then reimport it into the pbl and finally compile all the app.

It would be a great help if you have some :)

Thanks in advance
S.

Comment
  1. Roland Smith
  2. Tuesday, 30 April 2019 15:12 PM UTC
ORCAScript is designed to rebuild the entire target from source files. It cannot be used to automatically update code.

My PBSearch tool has a Global Search and Replace function that will do a check-out on all the objects that are changed.

http://www.topwizprogramming.com/pbsearch.html
  1. Helpful
  1. Chris Pollach @Appeon
  2. Tuesday, 30 April 2019 19:01 PM UTC
You could use the LibraryExport ( ) command to get any object's source code. Then the LibraryImport() command to return the changed object;s source code. Unfortunately, Sybase crippled the LibraryImport() command to only work with DataWindow only object classes.



Another alternative though would be to use Roland's ORCA-API feature that allows a PB Application to manipulate any PB Application's libraries, objects, source code, etc. The API is much more robust than the ORCAScript feature.

FYI: http://www.topwizprogramming.com/pborcapi.html



  1. Helpful
  1. Sylvain BOESSINGER
  2. Friday, 3 May 2019 13:37 PM UTC
Hi Roland, Chris,

Thank you for sharing methods and great apps !

I forgot to precise that I'm looking for an automation that could be capable to export, modify, import and compile many apps.

I already wrote a powershell script that generate apps with the PB17 compiler. I just need find how to modify the application object of each app to update the release number (a global variable - we have a system with auto update based on comparison of the release number in the app and a release number in database).



Best,
  1. Helpful
There are no comments made yet.
Roland Smith Accepted Answer Pending Moderation
  1. Tuesday, 30 April 2019 15:09 PM UTC
  2. PowerBuilder
  3. # 5

I think most people either use OrcaScript or PowerGen.

I also have a PB Bootstrap product available:

http://www.topwizprogramming.com/bootstrap.html

 

Comment
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.