Build Program: Pre/Post Process

The Class

The set_copyright_year class is a simple example of an observer that listens for both the pre-process and post-process events of the Incremental Build / Program.

API Documentation

Click HERE to view the API documentation for this class. The complete documentation for all of the classes can be found in the API Reference.

Source Code

Click HERE to view the source code for the class.

Do the Work

The update() method has been modified to perform specific actions for the pre/post processes.

Pre-Process
Post-Process
update:
enter aPvxState 

    local psMajor$,psMinor$,enfState

    ! Get the Major/Minor codes that identify the current action
    psMajor$=aPvxState'getMajor$(), \
    psMinor$=aPvxState'getMinor$()

    ! Get the current state of processing for the ProvideX Event Manager
    enfState=aPvxState'getArgumentValue(_pvxConstants'_iEventNotificationFlag$)

    /*
     * This observer is for the program build event only; all other events
     * should be ignored.
     */
    switch psMajor$ + "|" + psMinor$

    ! Build a ProvideX program
    case _pvxConstants'Incremental_Build$ + "|" + _pvxConstants'BuildType_BuildOne$
    case _pvxConstants'Incremental_Build_Alt_Exe$ + "|" + _pvxConstants'BuildType_BuildOne$

        switch enfState

        case _pvxConstants'_idePreProcess
            isModified = _obj'update_copyright_year(aPvxState, outFile$)

            ! Set the current source file to the new output file
            if isModified {
                _obj'setCurrentSource(aPvxState, outFile$)
            }
            break

        case _pvxConstants'_idePostProcess

            ! write status message
            oReqClient = NEW( "pvxrequestclient")
            oReqClient'print(_obj'getDescription$()+": " + tbl(isModified, "no change", "updated"))
            drop object oReqClient

            break
        end switch
        break
    end switch
return 0