-
Notifications
You must be signed in to change notification settings - Fork 754
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
Fix thin jar caching when testing the optimized executable #43582
Fix thin jar caching when testing the optimized executable #43582
Conversation
compiler/ballerina-lang/src/main/java/io/ballerina/projects/repos/FileSystemCache.java
Show resolved
Hide resolved
@ayeshLK as of now,
These seems to be external dependencies used in java side. Following is the Could you please check and confirm? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's address the changes separately.
@@ -161,12 +161,20 @@ private void addCodeGeneratedLibraryPaths(PackageContext packageContext, Platfor | |||
} | |||
ModuleContext moduleContext = packageContext.moduleContext(moduleId); | |||
PackageID pkgID = moduleContext.descriptor().moduleCompilationId(); | |||
// DuplicatePkgs are pkgs which are imported by both testable and build projects. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// DuplicatePkgs are pkgs which are imported by both testable and build projects. | |
// Duplicate pkgs are pkgs which are imported by both testable and build projects. |
addOptimizedLibraryPaths(packageContext, scope, libraryPaths, moduleContext, pkgID); | ||
addOptimizedLibraryPaths(packageContext, scope, libraryPaths, moduleContext, isDuplicatePkg); | ||
if (!isDuplicatePkg) { | ||
// If the pkg is not an duplicate pkg, we only need the optimized thin JAR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// If the pkg is not an duplicate pkg, we only need the optimized thin JAR. | |
// If the pkg is not a duplicate pkg, we only need the optimized thin JAR. |
// getPlatformSpecificLibrary gets invoked from TestUtils class and there is no proper way to check whether a | ||
// given module is `optimized`, `unoptimized` or `duplicated optimized`. Maybe we can lift the logic to | ||
// JarResolver somehow. | ||
// TODO Find a cleaner way to handle JarPaths for bal test with dead code elimination. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's create an issue for this.
// TODO Find a cleaner way to handle JarPaths for bal test with dead code elimination. | ||
if (Files.exists(jarFilePath)) { | ||
return Optional.of(jarFilePath); | ||
} else if (Files.exists(optimizedJarFilePath)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can be just an if.
bfe8fe6
into
ballerina-platform:feature-codegen-optimizer
Purpose
$title
Fixes #43579
Approach
When we run the
bal test --eliminate-dead-code
command, we have to duplicate certain modules to avoid false positive test results. During DCE we categorize modules into three categories,target/cache
directory of the project..ballerina
file system cache.target/cache
directory of the project along with a_OPTIMIZED
suffix for the thin jar.The error was due to a bug in the retrieval of the cache locations during test execution.
Check List