ddimitrov
(Dimitar Dimitrov)
May 26, 2021, 3:14am
1
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.
ddimitrov
(Dimitar Dimitrov)
May 30, 2021, 7:31am
2
After getting no reply of acknowledgement in the forum, I reported this as:
opened 07:30AM - 30 May 21 UTC
a:feature
to-triage
### Expected Behavior
In many projects we do not specify a version and let ou… r CI infra to provide it with `-Pversion=...`
We'd like to also be able to specify `-Dstatus=...` to override the default status.
### Current Behavior
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")
```
### Context
Some of our builds have conditional behavior, which makes sense to model as build status, except that we are triggering it with nonstandard property (i.e. `myCompanyBuildStatus`). Using `status` in the same way we use `version` would make it cleaner and more intuitive.