Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Print version and revision before each command #757

Merged
merged 6 commits into from
May 2, 2020

Conversation

jan-goral
Copy link
Contributor

@jan-goral jan-goral commented Apr 30, 2020

Fixes #740

Checklist

  • release_notes.md updated

@jan-goral jan-goral added this to the May 2020 milestone Apr 30, 2020
@jan-goral jan-goral self-assigned this Apr 30, 2020
@jan-goral jan-goral force-pushed the 740-print-version-always branch from 3569cc9 to 337648c Compare April 30, 2020 19:34
@jan-goral jan-goral marked this pull request as ready for review April 30, 2020 19:36
@codecov-io
Copy link

codecov-io commented Apr 30, 2020

Codecov Report

Merging #757 into master will decrease coverage by 0.09%.
The diff coverage is 85.71%.

Impacted file tree graph

@@             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(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 { ... }.

bootstraponline
bootstraponline previously approved these changes May 1, 2020
pawelpasterz
pawelpasterz previously approved these changes May 1, 2020
@bootstraponline bootstraponline dismissed stale reviews from pawelpasterz and themself via 247446c May 2, 2020 04:28
@pawelpasterz pawelpasterz merged commit b8987aa into master May 2, 2020
@pawelpasterz pawelpasterz deleted the 740-print-version-always branch May 2, 2020 12:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Print the version of Flank on each test run
4 participants