1 /* <lambda>null2 * Copyright (C) 2024 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.tools.metalava 18 19 import com.android.tools.metalava.model.provider.Capability 20 import com.android.tools.metalava.model.source.SourceModelProvider 21 import com.android.tools.metalava.model.testing.BaseModelProviderRunner 22 import com.android.tools.metalava.model.testing.CodebaseCreatorConfig 23 24 /** 25 * A [BaseModelProviderRunner] that will retrieve [SourceModelProvider]s from the 26 * [SourceModelProvider] and run the tests against them. 27 */ 28 class DriverTestRunner(clazz: Class<*>) : 29 BaseModelProviderRunner<SourceModelProvider, DriverTest>( 30 clazz = clazz, 31 codebaseCreatorConfigsGetter = { getSourceModelProviders() }, 32 baselineResourcePath = "source-model-provider-baseline.txt", 33 minimumCapabilities = setOf(Capability.JAVA, Capability.DOCUMENTATION), 34 ) { 35 companion object { getSourceModelProvidersnull36 fun getSourceModelProviders(): List<CodebaseCreatorConfig<SourceModelProvider>> { 37 return SourceModelProvider.implementations.flatMap { provider -> 38 provider.modelOptionsList.map { modelOptions -> 39 CodebaseCreatorConfig( 40 creator = provider, 41 modelOptions = modelOptions, 42 ) 43 } 44 } 45 } 46 } 47 } 48