use of com.android.builder.model.BuildTypeContainer in project android by JetBrains.
the class DynamicResourceValueRepository method getMap.
@Override
@NonNull
protected Map<ResourceType, ListMultimap<String, ResourceItem>> getMap() {
if (mItems.isEmpty()) {
// TODO: b/23032391
AndroidModuleModel androidModel = AndroidModuleModel.get(myFacet);
if (androidModel == null) {
return mItems;
}
Variant selectedVariant = androidModel.getSelectedVariant();
// Reverse overlay order because when processing lower order ones, we ignore keys already processed
BuildTypeContainer buildType = androidModel.findBuildType(selectedVariant.getBuildType());
if (buildType != null) {
addValues(buildType.getBuildType().getResValues());
}
// flavors and default config:
addValues(selectedVariant.getMergedFlavor().getResValues());
}
return mItems;
}
use of com.android.builder.model.BuildTypeContainer in project android by JetBrains.
the class MoveToDebugManifestQuickFix method apply.
@Override
public void apply(@NotNull PsiElement startElement, @NotNull PsiElement endElement, @NotNull AndroidQuickfixContexts.Context context) {
final XmlAttribute attribute = PsiTreeUtil.getParentOfType(startElement, XmlAttribute.class);
if (attribute != null) {
XmlTag parent = attribute.getParent();
if (parent != null && parent.getName().equals(TAG_USES_PERMISSION)) {
Module module = getModule(parent);
assert MOCK_LOCATION_PERMISSION.equals(parent.getAttributeValue(ATTR_NAME, ANDROID_URI));
parent.delete();
if (module != null) {
AndroidFacet facet = AndroidFacet.getInstance(module);
if (facet != null) {
VirtualFile mainManifest = facet.getMainIdeaSourceProvider().getManifestFile();
// TODO: b/22928250
AndroidModuleModel androidModel = AndroidModuleModel.get(facet);
if (androidModel != null && mainManifest != null && mainManifest.getParent() != null && mainManifest.getParent().getParent() != null) {
final VirtualFile src = mainManifest.getParent().getParent();
for (BuildTypeContainer container : androidModel.getAndroidProject().getBuildTypes()) {
BuildType buildType = container.getBuildType();
if (buildType.isDebuggable()) {
addManifest(module, src, buildType.getName());
return;
}
}
Messages.showErrorDialog(module.getProject(), "Did not find a debug build type", "Move Permission");
}
}
}
}
}
}
use of com.android.builder.model.BuildTypeContainer in project android by JetBrains.
the class ContentRootSourcePaths method storeExpectedSourcePaths.
/**
* Stores the expected paths of all the source and test directories in the given {@code AndroidProject}.
*
* @param androidProject the given {@code AndroidProject}.
*/
public void storeExpectedSourcePaths(@NotNull AndroidProjectStub androidProject) {
VariantStub selectedVariant = androidProject.getFirstVariant();
Assert.assertNotNull(selectedVariant);
addGeneratedDirPaths(selectedVariant);
for (String flavorName : selectedVariant.getProductFlavors()) {
ProductFlavorContainerStub flavor = androidProject.findProductFlavor(flavorName);
if (flavor != null) {
addSourceDirPaths(flavor);
}
}
String buildTypeName = selectedVariant.getBuildType();
BuildTypeContainer buildType = androidProject.findBuildType(buildTypeName);
if (buildType != null) {
addSourceDirPaths(buildType.getSourceProvider(), false);
}
addSourceDirPaths(androidProject.getDefaultConfig());
}
use of com.android.builder.model.BuildTypeContainer in project android by JetBrains.
the class AndroidModuleModelTest method testFindBuildType.
public void testFindBuildType() throws Exception {
String buildTypeName = "debug";
BuildTypeContainer buildType = myAndroidModel.findBuildType(buildTypeName);
assertNotNull(buildType);
assertSame(myAndroidProject.findBuildType(buildTypeName), buildType);
}
Aggregations