Post install script for app extensions stopped working

The script described here https://github.com/PureLayout/PureLayout/wiki/App-Extensions used to work perfectly until some recent changes on CocoaPods. On CocoaPods 1.8.0 ~ 1.8.4 the script fails to enter the conditional block, meaning that the GCC_PREPROCESSOR_DEFINITIONS are never set.

While debugging the script, I found out that the APPLICATION_EXTENSION_API_ONLY flag value is not set during the execution (it's blank).

If I revert the CocoaPods version to 1.7.5, the script works fine.

Any ideas?