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

test perf, eliminate deploy jars from test classpath #391

Merged
merged 1 commit into from
Jan 6, 2022

Conversation

plaird
Copy link
Contributor

@plaird plaird commented Jan 6, 2022

Found the major culprit for #381

When Bazel builds a java_test target, it can in some cases produce two jars, the normal test jar (with just the compiled test classes) and sometimes a _deploy.jar which is a self contained runnable test executable. The deploy jar has all the deps built in.

For our internal test case, the tests each have 300+ dependencies, so the deploy jars were huge. When launching the tests from Eclipse, Eclipse spawns a new JVM and passes in the proper classpath via the -classpath arg. Also, the Eclipse test launcher is bundled inside. There is no need for the huge bloated deploy jars. So the fix in this PR is to prevent the deploy jars from being added to the test classpath.

Also, when running a whole suite of tests at the same time, we created a union classpath of all tests. That meant the test runner had 100 deploy jars built in (because there are 100 tests in this package).

Also reverted my change to use Sets to hold classpath elements. Classpaths are order sensitive. Packages should not have overlapping dependencies (two jars with the same class) but some packages don't follow best practices. Reverting to using Lists to maintain order is prudent.

@@ -299,6 +320,15 @@ public ParamFileResult findParamFilesForTestClassname(BazelWorkspace bazelWorksp
}

for (String jarPath : jarPaths) {
if (!includeDeployJars && jarPath.endsWith("_deploy.jar")) {
Copy link
Contributor Author

@plaird plaird Jan 6, 2022

Choose a reason for hiding this comment

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

This if statement is the key to this PR.

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.

1 participant