1 /* 2 * Copyright (C) 2021 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package com.android.csuite.core; 18 19 import com.android.tradefed.config.Option; 20 import com.android.tradefed.config.Option.Importance; 21 22 import com.google.common.annotations.VisibleForTesting; 23 24 import java.io.IOException; 25 import java.util.HashMap; 26 import java.util.Map; 27 import java.util.stream.Stream; 28 29 /** Accepts template mapping from command line option. */ 30 public class CommandLineTemplateMappingProvider implements TemplateMappingProvider { 31 @VisibleForTesting static final String TEMPLATE_MAPPING_OPTION = "template-mapping"; 32 33 @Option( 34 name = TEMPLATE_MAPPING_OPTION, 35 description = "Optional template mapping for modules.", 36 importance = Importance.NEVER) 37 private Map<String, String> mTemplateMappings = new HashMap<>(); 38 39 @Override get()40 public Stream<Map.Entry<String, String>> get() throws IOException { 41 return mTemplateMappings.entrySet().stream(); 42 } 43 } 44