From a2e3936e53ff326d201623b539ebcd12cecc4bee Mon Sep 17 00:00:00 2001 From: Alan Stokes Date: Thu, 6 Jan 2022 14:09:00 +0000 Subject: Ignore changes to irrelevant APEXes When reading the list of APEXes, ignore any APEXes that do not contain any compilable JARs. Changes to such APEXes now do not and should not trigger recompilation. This is helpful for the CompOS use case, since it doesn't even see these APEXes. As part of this, extract existing code to determine APEX name from location and make it resuable. Bug: 210473615 Test: atest art_standalone_libartbase_tests Test: Presubmits Change-Id: I3f64e6228f091cabce33a292058f960787780f62 --- libartbase/base/file_utils_test.cc | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'libartbase/base/file_utils_test.cc') diff --git a/libartbase/base/file_utils_test.cc b/libartbase/base/file_utils_test.cc index 913eedee03..dff4478549 100644 --- a/libartbase/base/file_utils_test.cc +++ b/libartbase/base/file_utils_test.cc @@ -330,4 +330,15 @@ TEST_F(FileUtilsTest, GetSystemOdexFilenameForApex) { GetSystemOdexFilenameForApex(apex_jar.c_str(), InstructionSet::kArm)); } +TEST_F(FileUtilsTest, ApexNameFromLocation) { + EXPECT_EQ("", ApexNameFromLocation("")); + EXPECT_EQ("", ApexNameFromLocation("/apex/com.android.foo")); + EXPECT_EQ("", ApexNameFromLocation("/apex//something")); + EXPECT_EQ("com.android.foo", ApexNameFromLocation("/apex/com.android.foo/")); + EXPECT_EQ("", ApexNameFromLocation("apex/com.android.foo/")); + EXPECT_EQ("foo", ApexNameFromLocation("/apex/foo/something.jar")); + EXPECT_EQ("", ApexNameFromLocation("/bar/foo/baz")); + EXPECT_EQ("", ApexNameFromLocation("/apexx/foo/baz")); +} + } // namespace art -- cgit v1.2.3-59-g8ed1b