blob: a8c22cdbf8e0025b6cf7ccf94c927a46bba3a964 [file] [log] [blame]
Jooyung Han21e9b922021-06-26 04:14:16 +09001// Copyright 2021, The Android Open Source Project
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15//! Payload disk image
16
Andrew Walbrancc0db522021-07-12 17:03:42 +000017use android_system_virtualizationservice::aidl::android::system::virtualizationservice::{
Jiyong Parkc2a49cc2021-10-15 00:02:12 +090018 DiskImage::DiskImage, Partition::Partition, VirtualMachineAppConfig::DebugLevel::DebugLevel,
19 VirtualMachineAppConfig::VirtualMachineAppConfig,
Andrew Walbrancc0db522021-07-12 17:03:42 +000020 VirtualMachineRawConfig::VirtualMachineRawConfig,
21};
22use android_system_virtualizationservice::binder::ParcelFileDescriptor;
Inseob Kima5a262f2021-11-17 19:41:03 +090023use anyhow::{anyhow, bail, Context, Result};
Jooyung Han53cf7992021-10-18 19:38:41 +090024use binder::wait_for_interface;
Alan Stokesbf20c6a2022-01-04 12:30:50 +000025use log::{info, warn};
Jooyung Han21e9b922021-06-26 04:14:16 +090026use microdroid_metadata::{ApexPayload, ApkPayload, Metadata};
Jooyung Han5dc42172021-10-05 16:43:47 +090027use microdroid_payload_config::{ApexConfig, VmPayloadConfig};
Jooyung Han9900f3d2021-07-06 10:27:54 +090028use once_cell::sync::OnceCell;
Jooyung Han5dc42172021-10-05 16:43:47 +090029use packagemanager_aidl::aidl::android::content::pm::IPackageManagerNative::IPackageManagerNative;
Alan Stokesbf20c6a2022-01-04 12:30:50 +000030use regex::Regex;
Jooyung Han44b02ab2021-07-16 03:19:13 +090031use serde::Deserialize;
32use serde_xml_rs::from_reader;
Alan Stokesbf20c6a2022-01-04 12:30:50 +000033use std::collections::HashSet;
Jooyung Han44b02ab2021-07-16 03:19:13 +090034use std::fs::{File, OpenOptions};
Jooyung Han21e9b922021-06-26 04:14:16 +090035use std::path::{Path, PathBuf};
Alan Stokesbf20c6a2022-01-04 12:30:50 +000036use std::process::Command;
Andrew Walbrancc0db522021-07-12 17:03:42 +000037use vmconfig::open_parcel_file;
38
39/// The list of APEXes which microdroid requires.
40// TODO(b/192200378) move this to microdroid.json?
Inseob Kimb4868e62021-11-09 17:28:23 +090041const MICRODROID_REQUIRED_APEXES: [&str; 1] = ["com.android.os.statsd"];
42const MICRODROID_REQUIRED_APEXES_DEBUG: [&str; 1] = ["com.android.adbd"];
Jooyung Han21e9b922021-06-26 04:14:16 +090043
Jooyung Han44b02ab2021-07-16 03:19:13 +090044const APEX_INFO_LIST_PATH: &str = "/apex/apex-info-list.xml";
45
Jooyung Han5dc42172021-10-05 16:43:47 +090046const PACKAGE_MANAGER_NATIVE_SERVICE: &str = "package_native";
47
Jooyung Han73bac242021-07-02 10:25:49 +090048/// Represents the list of APEXes
Jooyung Han9d7cd7d2021-10-12 17:44:14 +090049#[derive(Clone, Debug, Deserialize)]
Jooyung Han9900f3d2021-07-06 10:27:54 +090050struct ApexInfoList {
Jooyung Han44b02ab2021-07-16 03:19:13 +090051 #[serde(rename = "apex-info")]
Jooyung Han73bac242021-07-02 10:25:49 +090052 list: Vec<ApexInfo>,
53}
54
Jooyung Han9d7cd7d2021-10-12 17:44:14 +090055#[derive(Clone, Debug, Deserialize)]
Jooyung Han73bac242021-07-02 10:25:49 +090056struct ApexInfo {
Jooyung Han44b02ab2021-07-16 03:19:13 +090057 #[serde(rename = "moduleName")]
Jooyung Han73bac242021-07-02 10:25:49 +090058 name: String,
Jooyung Han44b02ab2021-07-16 03:19:13 +090059 #[serde(rename = "modulePath")]
Jooyung Han73bac242021-07-02 10:25:49 +090060 path: PathBuf,
Jooyung Han9d7cd7d2021-10-12 17:44:14 +090061
62 #[serde(default)]
Alan Stokes46ac3862021-12-21 15:31:47 +000063 has_classpath_jar: bool,
Jooyung Han73bac242021-07-02 10:25:49 +090064}
65
66impl ApexInfoList {
67 /// Loads ApexInfoList
Jooyung Han9900f3d2021-07-06 10:27:54 +090068 fn load() -> Result<&'static ApexInfoList> {
69 static INSTANCE: OnceCell<ApexInfoList> = OnceCell::new();
70 INSTANCE.get_or_try_init(|| {
Jooyung Han44b02ab2021-07-16 03:19:13 +090071 let apex_info_list = File::open(APEX_INFO_LIST_PATH)
72 .context(format!("Failed to open {}", APEX_INFO_LIST_PATH))?;
Jooyung Han9d7cd7d2021-10-12 17:44:14 +090073 let mut apex_info_list: ApexInfoList = from_reader(apex_info_list)
Jooyung Han44b02ab2021-07-16 03:19:13 +090074 .context(format!("Failed to parse {}", APEX_INFO_LIST_PATH))?;
Jooyung Han9d7cd7d2021-10-12 17:44:14 +090075
Alan Stokesbf20c6a2022-01-04 12:30:50 +000076 // For active APEXes, we run derive_classpath and parse its output to see if it
77 // contributes to the classpath(s). (This allows us to handle any new classpath env
78 // vars seamlessly.)
79 let classpath_vars = run_derive_classpath()?;
80 let classpath_apexes = find_apex_names_in_classpath(&classpath_vars)?;
81
Jooyung Han9d7cd7d2021-10-12 17:44:14 +090082 for apex_info in apex_info_list.list.iter_mut() {
Alan Stokesbf20c6a2022-01-04 12:30:50 +000083 apex_info.has_classpath_jar = classpath_apexes.contains(&apex_info.name);
Jooyung Han9d7cd7d2021-10-12 17:44:14 +090084 }
Alan Stokesbf20c6a2022-01-04 12:30:50 +000085
Jooyung Han44b02ab2021-07-16 03:19:13 +090086 Ok(apex_info_list)
Jooyung Han9900f3d2021-07-06 10:27:54 +090087 })
Jooyung Han73bac242021-07-02 10:25:49 +090088 }
89
Jooyung Han9d7cd7d2021-10-12 17:44:14 +090090 /// Returns the list of apex names matching with the predicate
91 fn get_matching(&self, predicate: fn(&ApexInfo) -> bool) -> Vec<String> {
92 self.list.iter().filter(|info| predicate(info)).map(|info| info.name.clone()).collect()
93 }
94
Jooyung Han73bac242021-07-02 10:25:49 +090095 fn get_path_for(&self, apex_name: &str) -> Result<PathBuf> {
96 Ok(self
97 .list
98 .iter()
99 .find(|apex| apex.name == apex_name)
100 .ok_or_else(|| anyhow!("{} not found.", apex_name))?
101 .path
102 .clone())
103 }
Jooyung Han21e9b922021-06-26 04:14:16 +0900104}
105
Jooyung Han5dc42172021-10-05 16:43:47 +0900106struct PackageManager {
Jooyung Han5dc42172021-10-05 16:43:47 +0900107 // TODO(b/199146189) use IPackageManagerNative
108 apex_info_list: &'static ApexInfoList,
109}
110
111impl PackageManager {
112 fn new() -> Result<Self> {
Jooyung Han5dc42172021-10-05 16:43:47 +0900113 let apex_info_list = ApexInfoList::load()?;
Jooyung Han53cf7992021-10-18 19:38:41 +0900114 Ok(Self { apex_info_list })
Jooyung Han5dc42172021-10-05 16:43:47 +0900115 }
116
Jooyung Han9d7cd7d2021-10-12 17:44:14 +0900117 fn get_apex_list(&self, prefer_staged: bool) -> Result<ApexInfoList> {
Jooyung Han53cf7992021-10-18 19:38:41 +0900118 // get the list of active apexes
Jooyung Han9d7cd7d2021-10-12 17:44:14 +0900119 let mut list = self.apex_info_list.clone();
Jooyung Han53cf7992021-10-18 19:38:41 +0900120 // When prefer_staged, we override ApexInfo by consulting "package_native"
Jooyung Han5dc42172021-10-05 16:43:47 +0900121 if prefer_staged {
Jooyung Han53cf7992021-10-18 19:38:41 +0900122 let pm =
123 wait_for_interface::<dyn IPackageManagerNative>(PACKAGE_MANAGER_NATIVE_SERVICE)
124 .context("Failed to get service when prefer_staged is set.")?;
125 let staged = pm.getStagedApexModuleNames()?;
Jooyung Han9d7cd7d2021-10-12 17:44:14 +0900126 for apex_info in list.list.iter_mut() {
127 if staged.contains(&apex_info.name) {
Jooyung Han53cf7992021-10-18 19:38:41 +0900128 let staged_apex_info = pm.getStagedApexInfo(&apex_info.name)?;
Jooyung Han9d7cd7d2021-10-12 17:44:14 +0900129 if let Some(staged_apex_info) = staged_apex_info {
130 apex_info.path = PathBuf::from(staged_apex_info.diskImagePath);
Alan Stokes46ac3862021-12-21 15:31:47 +0000131 apex_info.has_classpath_jar = staged_apex_info.hasClassPathJars;
Jooyung Han9d7cd7d2021-10-12 17:44:14 +0900132 }
133 }
Jooyung Han5dc42172021-10-05 16:43:47 +0900134 }
135 }
Jooyung Han9d7cd7d2021-10-12 17:44:14 +0900136 Ok(list)
Jooyung Han5dc42172021-10-05 16:43:47 +0900137 }
138}
139
Andrew Walbrancc0db522021-07-12 17:03:42 +0000140fn make_metadata_file(
Jooyung Han21e9b922021-06-26 04:14:16 +0900141 config_path: &str,
Jooyung Han5e0f2062021-10-12 14:00:46 +0900142 apex_names: &[String],
Jooyung Han21e9b922021-06-26 04:14:16 +0900143 temporary_directory: &Path,
Andrew Walbrancc0db522021-07-12 17:03:42 +0000144) -> Result<ParcelFileDescriptor> {
Jooyung Han21e9b922021-06-26 04:14:16 +0900145 let metadata_path = temporary_directory.join("metadata");
146 let metadata = Metadata {
Andrew Walbrancc0db522021-07-12 17:03:42 +0000147 version: 1,
Jooyung Han5e0f2062021-10-12 14:00:46 +0900148 apexes: apex_names
Jooyung Han21e9b922021-06-26 04:14:16 +0900149 .iter()
Jooyung Han19c1d6c2021-08-06 14:08:16 +0900150 .enumerate()
Jooyung Han5e0f2062021-10-12 14:00:46 +0900151 .map(|(i, apex_name)| ApexPayload {
152 name: apex_name.clone(),
Jooyung Han19c1d6c2021-08-06 14:08:16 +0900153 partition_name: format!("microdroid-apex-{}", i),
154 ..Default::default()
155 })
Jooyung Han21e9b922021-06-26 04:14:16 +0900156 .collect(),
157 apk: Some(ApkPayload {
Jooyung Han35edb8f2021-07-01 16:17:16 +0900158 name: "apk".to_owned(),
159 payload_partition_name: "microdroid-apk".to_owned(),
160 idsig_partition_name: "microdroid-apk-idsig".to_owned(),
Jooyung Han21e9b922021-06-26 04:14:16 +0900161 ..Default::default()
162 })
163 .into(),
164 payload_config_path: format!("/mnt/apk/{}", config_path),
165 ..Default::default()
166 };
Andrew Walbrancc0db522021-07-12 17:03:42 +0000167
168 // Write metadata to file.
169 let mut metadata_file = OpenOptions::new()
170 .create_new(true)
171 .read(true)
172 .write(true)
173 .open(&metadata_path)
174 .with_context(|| format!("Failed to open metadata file {:?}", metadata_path))?;
Jooyung Han21e9b922021-06-26 04:14:16 +0900175 microdroid_metadata::write_metadata(&metadata, &mut metadata_file)?;
176
Andrew Walbrancc0db522021-07-12 17:03:42 +0000177 // Re-open the metadata file as read-only.
178 open_parcel_file(&metadata_path, false)
179}
180
181/// Creates a DiskImage with partitions:
182/// metadata: metadata
183/// microdroid-apex-0: apex 0
184/// microdroid-apex-1: apex 1
185/// ..
186/// microdroid-apk: apk
187/// microdroid-apk-idsig: idsig
Inseob Kima5a262f2021-11-17 19:41:03 +0900188/// extra-apk-0: additional apk 0
189/// extra-idsig-0: additional idsig 0
190/// extra-apk-1: additional apk 1
191/// extra-idsig-1: additional idsig 1
192/// ..
Andrew Walbrancc0db522021-07-12 17:03:42 +0000193fn make_payload_disk(
Inseob Kima5a262f2021-11-17 19:41:03 +0900194 app_config: &VirtualMachineAppConfig,
Andrew Walbrancc0db522021-07-12 17:03:42 +0000195 apk_file: File,
196 idsig_file: File,
Jooyung Han9d7cd7d2021-10-12 17:44:14 +0900197 vm_payload_config: &VmPayloadConfig,
Andrew Walbrancc0db522021-07-12 17:03:42 +0000198 temporary_directory: &Path,
199) -> Result<DiskImage> {
Inseob Kima5a262f2021-11-17 19:41:03 +0900200 if vm_payload_config.extra_apks.len() != app_config.extraIdsigs.len() {
201 bail!(
202 "payload config has {} apks, but app config has {} idsigs",
203 vm_payload_config.extra_apks.len(),
204 app_config.extraIdsigs.len()
205 );
206 }
207
Jooyung Han9d7cd7d2021-10-12 17:44:14 +0900208 let pm = PackageManager::new()?;
209 let apex_list = pm.get_apex_list(vm_payload_config.prefer_staged)?;
210
211 // collect APEX names from config
Inseob Kima5a262f2021-11-17 19:41:03 +0900212 let apexes = collect_apex_names(&apex_list, &vm_payload_config.apexes, app_config.debugLevel);
Jooyung Han9d7cd7d2021-10-12 17:44:14 +0900213 info!("Microdroid payload APEXes: {:?}", apexes);
214
Inseob Kima5a262f2021-11-17 19:41:03 +0900215 let metadata_file = make_metadata_file(&app_config.configPath, &apexes, temporary_directory)?;
Jooyung Han21e9b922021-06-26 04:14:16 +0900216 // put metadata at the first partition
217 let mut partitions = vec![Partition {
Jooyung Han14e5a8e2021-07-06 20:48:38 +0900218 label: "payload-metadata".to_owned(),
Jooyung Han631d5882021-07-29 06:34:05 +0900219 image: Some(metadata_file),
Jooyung Han21e9b922021-06-26 04:14:16 +0900220 writable: false,
221 }];
222
Jooyung Han21e9b922021-06-26 04:14:16 +0900223 for (i, apex) in apexes.iter().enumerate() {
Jooyung Han9d7cd7d2021-10-12 17:44:14 +0900224 let apex_path = apex_list.get_path_for(apex)?;
Andrew Walbrancc0db522021-07-12 17:03:42 +0000225 let apex_file = open_parcel_file(&apex_path, false)?;
Jooyung Han95884632021-07-06 22:27:54 +0900226 partitions.push(Partition {
227 label: format!("microdroid-apex-{}", i),
Jooyung Han631d5882021-07-29 06:34:05 +0900228 image: Some(apex_file),
Jooyung Han95884632021-07-06 22:27:54 +0900229 writable: false,
230 });
Jooyung Han21e9b922021-06-26 04:14:16 +0900231 }
Jooyung Han95884632021-07-06 22:27:54 +0900232 partitions.push(Partition {
233 label: "microdroid-apk".to_owned(),
Jooyung Han631d5882021-07-29 06:34:05 +0900234 image: Some(ParcelFileDescriptor::new(apk_file)),
Jooyung Han95884632021-07-06 22:27:54 +0900235 writable: false,
236 });
237 partitions.push(Partition {
238 label: "microdroid-apk-idsig".to_owned(),
Jooyung Han631d5882021-07-29 06:34:05 +0900239 image: Some(ParcelFileDescriptor::new(idsig_file)),
Jooyung Han95884632021-07-06 22:27:54 +0900240 writable: false,
241 });
Jooyung Han21e9b922021-06-26 04:14:16 +0900242
Inseob Kima5a262f2021-11-17 19:41:03 +0900243 // we've already checked that extra_apks and extraIdsigs are in the same size.
244 let extra_apks = &vm_payload_config.extra_apks;
245 let extra_idsigs = &app_config.extraIdsigs;
246 for (i, (extra_apk, extra_idsig)) in extra_apks.iter().zip(extra_idsigs.iter()).enumerate() {
247 partitions.push(Partition {
248 label: format!("extra-apk-{}", i),
249 image: Some(ParcelFileDescriptor::new(File::open(PathBuf::from(&extra_apk.path))?)),
250 writable: false,
251 });
252
253 partitions.push(Partition {
254 label: format!("extra-idsig-{}", i),
255 image: Some(ParcelFileDescriptor::new(extra_idsig.as_ref().try_clone()?)),
256 writable: false,
257 });
258 }
259
Jooyung Han21e9b922021-06-26 04:14:16 +0900260 Ok(DiskImage { image: None, partitions, writable: false })
261}
Andrew Walbrancc0db522021-07-12 17:03:42 +0000262
Alan Stokesbf20c6a2022-01-04 12:30:50 +0000263fn run_derive_classpath() -> Result<String> {
264 let result = Command::new("/apex/com.android.sdkext/bin/derive_classpath")
265 .arg("/proc/self/fd/1")
266 .output()
267 .context("Failed to run derive_classpath")?;
268
269 if !result.status.success() {
270 bail!("derive_classpath returned {}", result.status);
271 }
272
273 String::from_utf8(result.stdout).context("Converting derive_classpath output")
274}
275
276fn find_apex_names_in_classpath(classpath_vars: &str) -> Result<HashSet<String>> {
277 // Each line should be in the format "export <var name> <paths>", where <paths> is a
278 // colon-separated list of paths to JARs. We don't care about the var names, and we're only
279 // interested in paths that look like "/apex/<apex name>/<anything>" so we know which APEXes
280 // contribute to at least one var.
281 let mut apexes = HashSet::new();
282
283 let pattern = Regex::new(r"^export [^ ]+ ([^ ]+)$").context("Failed to construct Regex")?;
284 for line in classpath_vars.lines() {
285 if let Some(captures) = pattern.captures(line) {
286 if let Some(paths) = captures.get(1) {
287 apexes.extend(paths.as_str().split(':').filter_map(|path| {
288 let path = path.strip_prefix("/apex/")?;
289 Some(path[..path.find('/')?].to_owned())
290 }));
291 continue;
292 }
293 }
294 warn!("Malformed line from derive_classpath: {}", line);
295 }
296
297 Ok(apexes)
Jooyung Han5e0f2062021-10-12 14:00:46 +0900298}
299
300// Collect APEX names from config
Inseob Kimb4868e62021-11-09 17:28:23 +0900301fn collect_apex_names(
302 apex_list: &ApexInfoList,
303 apexes: &[ApexConfig],
304 debug_level: DebugLevel,
305) -> Vec<String> {
Alan Stokes46ac3862021-12-21 15:31:47 +0000306 // Process pseudo names like "{CLASSPATH}".
Jooyung Han5e0f2062021-10-12 14:00:46 +0900307 // For now we have following pseudo APEX names:
Alan Stokes46ac3862021-12-21 15:31:47 +0000308 // - {CLASSPATH}: represents APEXes contributing to any derive_classpath environment variable
Jooyung Han5e0f2062021-10-12 14:00:46 +0900309 let mut apex_names: Vec<String> = apexes
310 .iter()
311 .flat_map(|apex| match apex.name.as_str() {
Alan Stokes46ac3862021-12-21 15:31:47 +0000312 "{CLASSPATH}" => apex_list.get_matching(|apex| apex.has_classpath_jar),
Jooyung Han5e0f2062021-10-12 14:00:46 +0900313 _ => vec![apex.name.clone()],
314 })
315 .collect();
316 // Add required APEXes
317 apex_names.extend(MICRODROID_REQUIRED_APEXES.iter().map(|name| name.to_string()));
Inseob Kimb4868e62021-11-09 17:28:23 +0900318 if debug_level != DebugLevel::NONE {
319 apex_names.extend(MICRODROID_REQUIRED_APEXES_DEBUG.iter().map(|name| name.to_string()));
320 }
Jooyung Han5e0f2062021-10-12 14:00:46 +0900321 apex_names.sort();
322 apex_names.dedup();
323 apex_names
324}
325
Andrew Walbrancc0db522021-07-12 17:03:42 +0000326pub fn add_microdroid_images(
327 config: &VirtualMachineAppConfig,
328 temporary_directory: &Path,
329 apk_file: File,
330 idsig_file: File,
Jiyong Park8d081812021-07-23 17:45:04 +0900331 instance_file: File,
Jooyung Han5dc42172021-10-05 16:43:47 +0900332 vm_payload_config: &VmPayloadConfig,
Andrew Walbrancc0db522021-07-12 17:03:42 +0000333 vm_config: &mut VirtualMachineRawConfig,
334) -> Result<()> {
Andrew Walbrancc0db522021-07-12 17:03:42 +0000335 vm_config.disks.push(make_payload_disk(
Inseob Kima5a262f2021-11-17 19:41:03 +0900336 config,
Andrew Walbrancc0db522021-07-12 17:03:42 +0000337 apk_file,
338 idsig_file,
Jooyung Han9d7cd7d2021-10-12 17:44:14 +0900339 vm_payload_config,
Andrew Walbrancc0db522021-07-12 17:03:42 +0000340 temporary_directory,
341 )?);
342
Jiyong Parkacf31b02021-11-04 20:45:14 +0900343 vm_config.disks[1].partitions.push(Partition {
344 label: "vbmeta".to_owned(),
345 image: Some(open_parcel_file(
346 Path::new("/apex/com.android.virt/etc/fs/microdroid_vbmeta_bootconfig.img"),
347 false,
348 )?),
349 writable: false,
350 });
Jiyong Parkc2a49cc2021-10-15 00:02:12 +0900351 let bootconfig_image = "/apex/com.android.virt/etc/microdroid_bootconfig.".to_owned()
352 + match config.debugLevel {
353 DebugLevel::NONE => "normal",
354 DebugLevel::APP_ONLY => "app_debuggable",
355 DebugLevel::FULL => "full_debuggable",
356 _ => return Err(anyhow!("unsupported debug level: {:?}", config.debugLevel)),
357 };
358 vm_config.disks[1].partitions.push(Partition {
359 label: "bootconfig".to_owned(),
360 image: Some(open_parcel_file(Path::new(&bootconfig_image), false)?),
361 writable: false,
362 });
Andrew Walbrancc0db522021-07-12 17:03:42 +0000363
Jiyong Park8d081812021-07-23 17:45:04 +0900364 // instance image is at the second partition in the second disk.
365 vm_config.disks[1].partitions.push(Partition {
366 label: "vm-instance".to_owned(),
Jooyung Han631d5882021-07-29 06:34:05 +0900367 image: Some(ParcelFileDescriptor::new(instance_file)),
Jiyong Park8d081812021-07-23 17:45:04 +0900368 writable: true,
369 });
370
Andrew Walbrancc0db522021-07-12 17:03:42 +0000371 Ok(())
372}
Jooyung Han5e0f2062021-10-12 14:00:46 +0900373
374#[cfg(test)]
375mod tests {
376 use super::*;
377 #[test]
Alan Stokesbf20c6a2022-01-04 12:30:50 +0000378 fn test_find_apex_names_in_classpath() {
379 let vars = r#"
380export FOO /apex/unterminated
381export BAR /apex/valid.apex/something
382wrong
383export EMPTY
384export OTHER /foo/bar:/baz:/apex/second.valid.apex/:gibberish:"#;
385 let expected = vec!["valid.apex", "second.valid.apex"];
386 let expected: HashSet<_> = expected.into_iter().map(ToString::to_string).collect();
387
388 assert_eq!(find_apex_names_in_classpath(vars).unwrap(), expected);
Jooyung Han5e0f2062021-10-12 14:00:46 +0900389 }
390}