@NonNull Map<BaseVariantData, BaseVariant> map,
@NonNull BaseVariantData<?> variantData,
@Nullable TestVariantData testVariantData) {
BaseVariant variantApi = variantFactory.createVariantApi(variantData);
TestVariantImpl testVariant = null;
if (testVariantData != null) {
testVariant = basePlugin.getInstantiator().newInstance(TestVariantImpl.class, testVariantData, basePlugin);
// add the test output.
ApplicationVariantFactory.createApkOutputApiObjects(basePlugin, testVariantData, testVariant);
}
if (testVariant != null) {
((TestedVariant) variantApi).setTestVariant(testVariant);
testVariant.setTestedVariant(variantApi);
}
extension.addVariant(variantApi);
map.put(variantData, variantApi);