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
diff --git a/runtime/runtime.cc b/runtime/runtime.cc
index 64970e1..483e2ab 100644
--- a/runtime/runtime.cc
+++ b/runtime/runtime.cc
@@ -1281,16 +1281,8 @@
void Runtime::InitializeApexVersions() {
std::vector<std::string_view> bcp_apexes;
for (std::string_view jar : Runtime::Current()->GetBootClassPathLocations()) {
- if (LocationIsOnApex(jar)) {
- size_t start = jar.find('/', 1);
- if (start == std::string::npos) {
- continue;
- }
- size_t end = jar.find('/', start + 1);
- if (end == std::string::npos) {
- continue;
- }
- std::string_view apex = jar.substr(start + 1, end - start - 1);
+ std::string_view apex = ApexNameFromLocation(jar);
+ if (!apex.empty()) {
bcp_apexes.push_back(apex);
}
}