Skip to content

Rework in Kotlin - #123

Merged
tinder-maxwellelliott merged 14 commits into
Tinder:masterfrom
Malinskiy:feature/kotlin
May 17, 2022
Merged

Rework in Kotlin#123
tinder-maxwellelliott merged 14 commits into
Tinder:masterfrom
Malinskiy:feature/kotlin

Conversation

@Malinskiy

@Malinskiy Malinskiy commented May 13, 2022

Copy link
Copy Markdown
Contributor

Here is a non-exhaustive list of stuff done in the branch:

  1. Rewrite in Kotlin
  2. New heuristic for picking up source targets during hash calculation even when the target was not returned by bazel query
  3. Moved integration test into the main codebase and just in general more tests. New coverage is 84%
  4. Further parallelisation of source with hashing + target hashing (~20% faster for a large monorepo). Concurrency races are now solved
  5. Reworked commands since get-impacted-targets doesn’t even need bazel in the first place, so less arguments. This changes the way you access the CLI though

Malinskiy added 11 commits May 2, 2022 15:04
There is an edge-case where the rules are depending on each other's digests, but they're hashed in parallel, so threads will not see the result of a previous hashing iteration. To overcome this we synchronise access using ConcurrentHashMap for the ruleHashes
* separate concerns
* parallelise as much as possible
* rework CLI interface (generate-hashes is not a subcommand of root command really)
* remove redundant interfaces (there is only 1 implementation for each, no need for abstractions)
* preprocess arguments
@Malinskiy Malinskiy changed the title Feature/kotlin Rework May 13, 2022
@Malinskiy Malinskiy changed the title Rework Rework in Kotlin May 13, 2022
@Malinskiy
Malinskiy force-pushed the feature/kotlin branch 2 times, most recently from 4e3e798 to 75030c0 Compare May 13, 2022 13:36
@Malinskiy

Copy link
Copy Markdown
Contributor Author

I tried to setup the codecoverage for the project, but JRE8 is incompatible with the coverage code in the bazel apparently, so this in theory would only work for JRE11. Problem is that the output of code coverage $(bazel info output_path)/_coverage/_coverage_report.dat is always empty on the Github Runner and I can't reproduce this locally (where it passes without issues). Will try to tackle it next week

@Malinskiy

Copy link
Copy Markdown
Contributor Author

Turns out that using latest version of bazel, i.e. Using unreleased version at commit d46269fe2397b4612a654543ba6fed45c2cdbdea doesn't produce the coverage data. I've replaced the ci config for now with the latest stable @tinder-maxwellelliott . What do you want to do? We can leave it at stable or wait until it's fixed upstream. Don't know if bazel is aware of this though, haven't checked.

As for the coverage - I tried using the commenting action, but it doesn't work with forked repositories since GITHUB_TOKEN has read-only access to the main repo from an action running for a fork. A better way may be to use something like coveralls, I believe they support lcov format but I'm not sure if this would make any difference to the permissions problem

Malinskiy added 3 commits May 17, 2022 19:54
* separate matrix jobs into jre8 and jre11. JRE8 doesn't support coverage with the latest bazel (coverage reporter class is compiled for JRE11)
* latest upstream bazel breaks code coverage even for JRE11. use latest stable version
@Malinskiy

Copy link
Copy Markdown
Contributor Author

Cleaned up the history a bit: there was a lot of trial and error involved in making this work

@tinder-maxwellelliott

Copy link
Copy Markdown
Collaborator

I tried to setup the codecoverage for the project, but JRE8 is incompatible with the coverage code in the bazel apparently, so this in theory would only work for JRE11. Problem is that the output of code coverage $(bazel info output_path)/_coverage/_coverage_report.dat is always empty on the Github Runner and I can't reproduce this locally (where it passes without issues). Will try to tackle it next week

Can we create a separate workflow for JRE11 and then get coverage data on that at least? I think its good to have a test run on idk8, but we don't need coverage from both

@Malinskiy

Copy link
Copy Markdown
Contributor Author

@tinder-maxwellelliott that is exactly what’s done in this PR https://github.com/Tinder/bazel-diff/actions/runs/2337802484
coverage archive is available only from the jre11

@tinder-maxwellelliott tinder-maxwellelliott left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Looking great!

Comment thread BUILD
name = "bazel-diff",
actual = "//src/main/java/com/bazel_diff:bazel-diff"
)
#alias(

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Feel free to delete, I do not use these aliases

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

sure, will create another PR tomorrow

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Comment thread artifacts.bzl
Comment on lines 10 to 13
"info.picocli:picocli:jar:4.3.2",
"com.google.code.gson:gson:jar:2.8.6",
"com.google.guava:guava:29.0-jre",
"org.apache.commons:commons-pool2:2.11.1",

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Should we go through these and upgrade them as well?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yeah, will raise another PR then

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@tinder-maxwellelliott

Copy link
Copy Markdown
Collaborator

@tinder-maxwellelliott that is exactly what’s done in this PR https://github.com/Tinder/bazel-diff/actions/runs/2337802484
coverage archive is available only from the jre11

🤦🏻 saw that as I was reviewing

@tinder-maxwellelliott
tinder-maxwellelliott merged commit 06a75b8 into Tinder:master May 17, 2022
@Malinskiy

Copy link
Copy Markdown
Contributor Author

We should also update the readme with the new command bazel-diff generate-hashes. Both have less options, e.g. get-impacted-targets doesn't need bazel info anymore since it's not even used for the diff logic

@tinder-maxwellelliott

Copy link
Copy Markdown
Collaborator

Will do, testing in our repo now and will update accordingly

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.

2 participants