Finding out if changes will be applied

I am trying to modify the Liquibase source code in such a way that the maven goal “updateSQL” will only create an SQL file if changes will be applied i.e. I want to avoid generating an SQL if the file itself will not contain any SQL code.

I have looked at the source code but I have not been able to figure out a good way to perform this check. I am thinking there should be a list of change sets in a class somewhere that one would be able to use to check the size of - if the size is zero, no changes will be applied hence no file should be created. In that case, one could just issue a delete command on the File object.

Does anyone have any ideas?