From ce7fabebc2b29fb9e4674f111cf337306cd3bc29 Mon Sep 17 00:00:00 2001 From: Paul Gschwendtner Date: Thu, 30 Sep 2021 19:48:54 +0200 Subject: [PATCH] build: simplify logic for integration test starlark macro (#43431) Simplifies the `last_segment_name` computation in the integration test Starlark macro we use. The last segment name could be computed in a shorter way and this has come up while being at it (through review; so this commit addresses that). PR Close #43431 --- integration/angular_integration_test.bzl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/integration/angular_integration_test.bzl b/integration/angular_integration_test.bzl index 9bc5fab3083..f55c2dd4a5d 100644 --- a/integration/angular_integration_test.bzl +++ b/integration/angular_integration_test.bzl @@ -76,7 +76,7 @@ def npm_package_archives(): """ for name in npm_packages_to_archive: label_name = _npm_package_archive_label(name) - last_segment_name = name if name.find("/") == -1 else name.split("/")[-1] + last_segment_name = name.split("/")[-1] result += """pkg_tar( name = "{label_name}", srcs = ["//{name}:{last_segment_name}__all_files"], @@ -143,7 +143,7 @@ def _angular_integration_test(name, **kwargs): if pkg in use_view_engine_packages: npm_packages["@npm//:" + _npm_package_archive_label("%s-12" % pkg)] = pkg else: - last_segment_name = pkg if pkg.find("/") == -1 else pkg.split("/")[-1] + last_segment_name = pkg.split("/")[-1] npm_packages["//packages/%s:npm_package_archive" % last_segment_name] = pkg npm_integration_test(