Print version and revision before each command#757
Conversation
3569cc9 to
337648c
Compare
Codecov Report
@@ Coverage Diff @@
## master #757 +/- ##
============================================
- Coverage 78.22% 78.13% -0.10%
Complexity 665 665
============================================
Files 125 125
Lines 2774 2776 +2
Branches 399 399
============================================
- Hits 2170 2169 -1
- Misses 350 351 +1
- Partials 254 256 +2 |
| shouldRunAfter(tasks.processResources) | ||
| doLast { | ||
| File("${project.buildDir}/resources/main/version.txt").writeText("local_snapshot") | ||
| File("${project.buildDir}/resources/main/revision.txt").writeText( |
There was a problem hiding this comment.
The bitrise job does this:
echo "$BITRISE_GIT_TAG" > ./test_runner/src/main/resources/version.txt
echo "$GIT_CLONE_COMMIT_HASH" > ./test_runner/src/main/resources/revision.txt
and then the gradle commands are run. I think this may break the bitrise release job.
There was a problem hiding this comment.
Thanks for info. So I will use BITRISE_IO env for turning off this task when running on bitrise.
| if (!runningOnBitrise) doLast { | ||
| File("${project.buildDir}/resources/main/version.txt").writeText("local_snapshot") | ||
| File("${project.buildDir}/resources/main/revision.txt").writeText( | ||
| String(Runtime.getRuntime().exec("git rev-parse HEAD").inputStream.readBytes()) |
There was a problem hiding this comment.
should we exec on a background thread? here's an example:
https://github.com/bootstraponline/gradle_enterprise_example/blob/master/app/enterprise.gradle.kts#L152
also probably better to use exec { ... } instead of Runtime directly.
There was a problem hiding this comment.
Running on background from your example requires GradleEnterprisePlugin, TBH I have no experience with build scan. Any way, adding GradleEnterprisePlugin looks like standalone tasks, not a part of another. Also Updating those two files is pretty fast so it don't much impact on build time.
Ok, I will use exec { ... }.
247446c
Fixes #740
Checklist