Specifying project status on the command line

In many projects we do not specify a version and let our CI infra to provide it with -Pversion=...

Now we are trying to apply the same pattern with project status, and it doesn’t seem to work:

Consider the build:

logger.lifecycle("before: $status")
if (status=='release') status = 'snapshot'
logger.lifecycle("after: $status")

The expectation is that if we run with -Pstatus=release the project will have status release, in all other cases - snapshot. In practice, the status is always snapshot

This works, but is way overwrought:

logger.lifecycle("before: $status")
project.status = (ext.properties.status ?: gradle.startParameter.projectProperties.get('status'))=='release' ? 'release' : 'snapshot'
logger.lifecycle("after: $status")

I would appreciate any suggestions how to structure this, or if I should raise an issue.

After getting no reply of acknowledgement in the forum, I reported this as: