diff options
author | 2022-01-06 14:09:00 +0000 | |
---|---|---|
committer | 2022-01-07 13:47:55 +0000 | |
commit | a2e3936e53ff326d201623b539ebcd12cecc4bee (patch) | |
tree | c519f71b235b8d9385d428506d46a6b369a2fe36 /libartbase/base/file_utils.cc | |
parent | 0628e784532303b27e062ed957494bfd7e858bd9 (diff) |
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
Diffstat (limited to 'libartbase/base/file_utils.cc')
-rw-r--r-- | libartbase/base/file_utils.cc | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/libartbase/base/file_utils.cc b/libartbase/base/file_utils.cc index 8159b0cf66..bc08f309bb 100644 --- a/libartbase/base/file_utils.cc +++ b/libartbase/base/file_utils.cc @@ -661,6 +661,18 @@ bool LocationIsOnApex(std::string_view full_path) { return android::base::StartsWith(full_path, kApexDefaultPath); } +std::string_view ApexNameFromLocation(std::string_view full_path) { + if (!android::base::StartsWith(full_path, kApexDefaultPath)) { + return {}; + } + size_t start = strlen(kApexDefaultPath); + size_t end = full_path.find('/', start); + if (end == std::string_view::npos) { + return {}; + } + return full_path.substr(start, end - start); +} + bool LocationIsOnSystem(const std::string& location) { #ifdef _WIN32 UNUSED(location); |