Rocket Uniface Support Resources

 View Only

Creating UARs using ProcScript

  • 1.  Creating UARs using ProcScript

    ROCKETEER
    Posted 09-28-2020 12:18

    Creating UARs using ProcScript

    With the patch 10.3.02.038 we’ve introduced two new $ude ProcScript functions for looking up runtime resources and copying them to a archive (UAR) file. These are:

    By combining these two $ude functions, you can package runtime resources into one or more deployment archive files, which enables you to improve your development and deployment workflow. You can:

    • Build your own archiving mechanism, in combination with the IDE custom menu/worksheet plug-ins, that might be very useful to maintain application and/or patch distributions.
    • Script your build environments to automatically generate deployment archives

    $ude("lookup")

    Use $ude("lookup") function to check whether a compiled runtime object, symbol table, or script listing exists. This is similar to $ude("exist"), but $ude("lookup") returns a Uniface list of existing resources, symbol tables, or script listings. Sub-lists specify the resources in this format:

    "TYPE=ObjectType!;NAME=ObjectName!;LIBRARY=LibraryName!;LANGUAGE=Language!;CLASS=Class"

    For example:

    vResultList = $ude("lookup", "resources_output;form", "MYFORM*")

    List returned in vResultList:

    "TYPE=Form!;NAME=MYFORM1!;LIBRARY=!;LANGUAGE=!;CLASS=;TYPE=Form!;NAME=MYFORM2!;LIBRARY=!;LANGUAGE=!;CLASS="

    $ude("archive")

    You can use $ude("archive") to copy the compiled runtime objects to a Uniface Archive (UAR) using the list returned by $ude("lookup").

    There are two ways to do this:

    1. One object at a time

    One way to copy objects to a Uniface archive is by resource type:

    $ude("archive",ResourceType, ResourceName, ArchiveFile {, OptionList})

    For example (using the value of vResultList from the $ude("lookup") example):

    vArchive = "myarchive.uar"
    forlist vObject in vResultList
      vType = $valuepart($itemnr(1, vObject)) ; TYPE
      vName = $valuepart($itemnr(2, vObject)) ; NAME
      putitem/id vOptions, "LIBRARY", $valuepart($itemnr(3, vObject))
      putitem/id vOptions, "LANGUAGE", $valuepart($itemnr(4, vObject))
      putitem/id vOptions, "CLASS", $valuepart($itemnr(5, vObject))
      vReturn = $ude("archive", vType, vName, vArchive, vOptions)
    endfor
    lflush $concat(vArchive, ":")

    The archive file is kept open so each call to $ude("archive") adds an object to the file. To close the file and complete the transaction, use flush or lflush.

    2. Using a list of objects

    The other way to copy objects to a Uniface archive is by using the list option. Hereby the list of objects can be used that is returned by $ude("lookup"). In addition, a description can be added to the archive file.

    For example (again with the value of vResultList from the previous example):

    vArchive = "myarchive.uar"
    putitem/id vOptions, "description", "My Form Archive"
    vReturn = $ude("archive", "list", vResultList, vArchive, vOptions)

    The description of the archive is (e.g.) shown in the output of the /who command line switch.

    It is important to note that an existing archive file is overwritten with no prompt unless the option "append=true" is specified. Here’s an example of how to add several lists of runtime objects to a Uniface archive:

    vResultList = $ude("lookup", "resources_output;form", "*")
    vArchive = "components.uar"
    putitem/id vOptions, "description", "Archive with components"
    vReturn = $ude("archive", "list", vResultList, vArchive, vOptions)
    vOptions = "append=true"
    vResultList = $ude("lookup", "resources_output;service", "*")
    vReturn = $ude("archive", "list", vResultList, vArchive, vOptions)
    vResultList = $ude("lookup", "resources_output;report", "*")
    vReturn = $ude("archive", "list", vResultList, vArchive, vOptions)
    ; ...