Java FFI: Fix build collision when many builds/rules compile the same Java class - #2861
Open
xymus wants to merge 2 commits into
Open
Java FFI: Fix build collision when many builds/rules compile the same Java class#2861xymus wants to merge 2 commits into
xymus wants to merge 2 commits into
Conversation
Returning lines allows the caller and printer to insert the tabs automatically at the beginning of each line. Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
…ava class When building Java FFI clients with any concurrency, even with only `make -j n`, different rules could target the same java file to class file in parallel. It causes failures when one tries to read a class while it's being written and still only a partial file. For collisions between two builds sharing a build folder, we now compile the java file to a class file in a temporary directory per main target. This folder sits under the compile dir and gets cleared with it. Once the class file is compiled, we move it over to the normal build folder. The atomic move avoids clients reading partially generated files. For collisions inside the same build, we pass `-implicit:none ` so only the target of the command is being built, and none of its dependencies. This still allows us to build the java files in parallel but avoids the repeated writes. Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Test Results 67 files 337 suites 16m 11s ⏱️ Results for commit 233cd6c. ♻️ This comment has been updated with latest results. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When building Java FFI clients with any concurrency, even with only
make -j n, different rules could target compiling the same java file to class file in parallel. It causes failures when one tries to read a class while it's being written and still only a partial file.For collisions between two builds sharing a build folder, we now compile the java file to a class file in a temporary directory per main target. This folder sits under the compile dir and gets cleared with it. Once the class file is compiled, we move it over to the normal build folder. The atomic move avoids clients reading partially generated files.
For collisions inside the same build, we pass
-implicit:noneso only the target of the command is being built, and none of its dependencies. This still allows us to build the java files in parallel but avoids the repeated writes.