use of com.android.tools.idea.gradle.project.model.NdkModuleModel in project android by JetBrains.
the class BuildVariantView method getVariantNames.
@Nullable
private static Collection<String> getVariantNames(@NotNull Module module) {
AndroidModuleModel androidModel = AndroidModuleModel.get(module);
if (androidModel != null) {
return androidModel.getVariantNames();
}
NdkModuleModel ndkModuleModel = NdkModuleModel.get(module);
if (ndkModuleModel != null) {
return ndkModuleModel.getVariantNames();
}
return null;
}
use of com.android.tools.idea.gradle.project.model.NdkModuleModel in project android by JetBrains.
the class NdkModuleNode method getNativeSourceNodes.
@NotNull
public static Collection<AbstractTreeNode> getNativeSourceNodes(@NotNull Project project, @NotNull NdkModuleModel ndkModuleModel, @NotNull ViewSettings viewSettings) {
NativeAndroidProject nativeAndroidProject = ndkModuleModel.getAndroidProject();
Collection<String> sourceFileExtensions = nativeAndroidProject.getFileExtensions().keySet();
NdkModuleModel.NdkVariant variant = ndkModuleModel.getSelectedVariant();
Multimap<String, NativeArtifact> nativeLibraries = HashMultimap.create();
for (NativeArtifact artifact : variant.getArtifacts()) {
String artifactOutputFileName = artifact.getOutputFile().getName();
nativeLibraries.put(artifactOutputFileName, artifact);
}
if (nativeLibraries.keySet().size() == 1) {
return getSourceDirectoryNodes(project, nativeLibraries.values(), viewSettings, sourceFileExtensions);
}
List<AbstractTreeNode> children = Lists.newArrayList();
for (String name : nativeLibraries.keySet()) {
String nativeLibraryType = "";
String nativeLibraryName = trimEnd(name, ".so");
if (nativeLibraryName.length() < name.length()) {
nativeLibraryType = "Shared Library";
} else {
nativeLibraryName = trimEnd(name, ".a");
if (nativeLibraryName.length() < name.length()) {
nativeLibraryType = "Static Library";
}
}
nativeLibraryName = trimStart(nativeLibraryName, "lib");
children.add(new NativeAndroidLibraryNode(project, nativeLibraryName, nativeLibraryType, nativeLibraries.get(name), viewSettings, sourceFileExtensions));
}
return children;
}
use of com.android.tools.idea.gradle.project.model.NdkModuleModel in project android by JetBrains.
the class AndroidGradleProjectResolverIdeaTest method testPopulateModuleContentRootsWithNativeAndroidProject.
public void testPopulateModuleContentRootsWithNativeAndroidProject() {
ProjectData project = myProjectResolver.createProject();
DataNode<ProjectData> projectNode = new DataNode<>(PROJECT, project, null);
DataNode<ModuleData> moduleDataNode = myProjectResolver.createModule(myNativeAndroidModuleModel, projectNode);
myProjectResolver.populateModuleContentRoots(myNativeAndroidModuleModel, moduleDataNode);
// Verify module does not have AndroidGradleModel.
Collection<DataNode<AndroidModuleModel>> androidModelNodes = getChildren(moduleDataNode, ANDROID_MODEL);
assertThat(androidModelNodes).isEmpty();
// Verify module has NativeAndroidGradleModel.
Collection<DataNode<NdkModuleModel>> ndkModuleModelNodes = getChildren(moduleDataNode, NDK_MODEL);
assertThat(ndkModuleModelNodes).hasSize(1);
DataNode<NdkModuleModel> nativeAndroidModelNode = getFirstItem(ndkModuleModelNodes);
assertNotNull(nativeAndroidModelNode);
assertSame(myNativeAndroidProject, nativeAndroidModelNode.getData().getAndroidProject());
// Verify module has IdeaGradleProject.
Collection<DataNode<GradleModuleModel>> gradleModelNodes = getChildren(moduleDataNode, GRADLE_MODULE_MODEL);
assertThat(gradleModelNodes).hasSize(1);
DataNode<GradleModuleModel> gradleModelNode = getFirstItem(gradleModelNodes);
assertNotNull(gradleModelNode);
assertEquals(myNativeAndroidModuleModel.getGradleProject().getPath(), gradleModelNode.getData().getGradlePath());
}
Aggregations