From b9c18a7a15ddd1857010b470ad6282e3d8d3d628 Mon Sep 17 00:00:00 2001 From: Tom Dyas Date: Mon, 16 May 2022 17:54:09 -0400 Subject: [PATCH] jvm: fix incorrect check for root-only `ClasspathEntryRequest` implementations (#15494) The conditional logic which checked for a root-only `ClasspathEntryRequest` implementation in a non-root position looked at a loop variable which could be unrelated to the compatible `ClasspathEntryRequest` implementation at issue. Solution: Check the root-only status of the compatible `ClasspathEntryRequest` implementation and avoid checking the loop variable. h/t to @stuhood for spotting the bug. https://github.com/pantsbuild/example-kotlin/pull/1#issuecomment-1127985443 [ci skip-rust] [ci skip-build-wheels] --- src/python/pants/jvm/compile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/python/pants/jvm/compile.py b/src/python/pants/jvm/compile.py index 7be5771f4aa..0424b8d5c20 100644 --- a/src/python/pants/jvm/compile.py +++ b/src/python/pants/jvm/compile.py @@ -118,7 +118,7 @@ def for_targets( consume_only.append(impl) if len(compatible) == 1: - if not root and impl.root_only: + if not root and compatible[0].root_only: raise ClasspathRootOnlyWasInner( "The following targets had dependees, but can only be used as roots in a " f"build graph:\n{component.bullet_list()}"