use of com.android.tools.idea.gradle.stubs.android.VariantStub 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.tools.idea.gradle.stubs.android.VariantStub in project android by JetBrains.
the class AndroidJunitPatcherTest method setUpIdeaAndroidProject.
private void setUpIdeaAndroidProject() {
myAndroidProject = TestProjects.createBasicProject();
VariantStub variant = myAndroidProject.getFirstVariant();
assertNotNull(variant);
AndroidModuleModel androidModel = new AndroidModuleModel(myAndroidProject.getName(), myAndroidProject.getRootDir(), myAndroidProject, variant.getName());
myFacet.setAndroidModel(androidModel);
for (Module module : ModuleManager.getInstance(getProject()).getModules()) {
TestArtifactSearchScopes.initializeScope(module);
}
}
use of com.android.tools.idea.gradle.stubs.android.VariantStub in project android by JetBrains.
the class ProjectResourceRepositoryTest method addArchiveLibraries.
private void addArchiveLibraries() {
// Add in some Android projects too
// make it a Gradle project
myFacet.getProperties().ALLOW_USER_CONFIGURATION = false;
AndroidProjectStub androidProject = TestProjects.createFlavorsProject();
VariantStub variant = androidProject.getFirstVariant();
assertNotNull(variant);
File rootDir = androidProject.getRootDir();
AndroidModuleModel androidModel = new AndroidModuleModel(androidProject.getName(), rootDir, androidProject, variant.getName());
myFacet.setAndroidModel(androidModel);
File bundle = new File(rootDir, "bundle.aar");
File libJar = new File(rootDir, "bundle_aar" + File.separatorChar + "library.jar");
AndroidLibraryStub library = new AndroidLibraryStub(bundle, libJar);
variant.getMainArtifact().getDependencies().addLibrary(library);
}
Aggregations