Example 5: Action on build files

The Class

The execModifiedFiles class is a simple example to show how to perform an action for each file updated by the build process.

API Documentation

Click HERE to view the API documentation for this class.

Source Code

Click Formatted HTML or Simple Text to view the source code for the class.

How Does It Work

This class will be registered as a PostProcess observer and will monitor the following events:

These events are triggered when:

Since this contributed tool will be triggered by one or more events, the logic must be placed in the update() method. The logic will create a list of files processed by the build, and perform an action for each file.

The list of files is initialized when the full build starts. As each file is processed, the build post-process trigger is used to add the relative path of each file to the list. At the end of the full build, the name of each file in the list is written to the console.