use of com.android.tools.idea.gradle.project.model.NdkModuleModel in project android by JetBrains.
the class AndroidModuleNode method getChildren.
@NotNull
public static Collection<AbstractTreeNode> getChildren(@NotNull AndroidFacet facet, @NotNull ViewSettings settings, @NotNull AndroidProjectViewPane pane, @NotNull List<IdeaSourceProvider> providers) {
Project project = facet.getModule().getProject();
List<AbstractTreeNode> result = Lists.newArrayList();
AndroidModuleModel androidModuleModel = AndroidModuleModel.get(facet);
HashMultimap<AndroidSourceType, VirtualFile> sourcesByType = getSourcesBySourceType(providers, androidModuleModel);
NdkModuleModel ndkModuleModel = NdkModuleModel.get(facet.getModule());
for (AndroidSourceType sourceType : sourcesByType.keySet()) {
if (sourceType == AndroidSourceType.CPP && ndkModuleModel != null) {
// Native sources will be added separately from NativeAndroidGradleModel.
continue;
}
if (sourceType == AndroidSourceType.MANIFEST) {
result.add(new AndroidManifestsGroupNode(project, facet, settings, sourcesByType.get(sourceType)));
continue;
}
if (sourceType == AndroidSourceType.RES) {
result.add(new AndroidResFolderNode(project, facet, settings, sourcesByType.get(sourceType), pane));
continue;
}
if (sourceType == AndroidSourceType.SHADERS) {
if (androidModuleModel == null || !androidModuleModel.getFeatures().isShadersSupported()) {
continue;
}
}
result.add(new AndroidSourceTypeNode(project, facet, settings, sourceType, sourcesByType.get(sourceType), pane));
}
if (ndkModuleModel != null) {
result.add(new AndroidJniFolderNode(project, ndkModuleModel, settings));
}
return result;
}
use of com.android.tools.idea.gradle.project.model.NdkModuleModel in project android by JetBrains.
the class AndroidJniFolderNode method hashCode.
@Override
public int hashCode() {
int result = super.hashCode();
NdkModuleModel model = getModel();
return 31 * result + model.hashCode();
}
use of com.android.tools.idea.gradle.project.model.NdkModuleModel in project android by JetBrains.
the class GradleProjectSyncData method createFrom.
@Nullable
@VisibleForTesting
static GradleProjectSyncData createFrom(@NotNull Project project) throws IOException {
GradleProjectSyncData data = new GradleProjectSyncData();
File rootDirPath = getBaseDirPath(project);
Module[] modules = ModuleManager.getInstance(project).getModules();
for (Module module : modules) {
GradleFacet gradleFacet = GradleFacet.getInstance(module);
if (gradleFacet != null) {
GradleModuleModel gradleModuleModel = gradleFacet.getGradleModuleModel();
if (gradleModuleModel != null) {
data.addFileChecksum(rootDirPath, gradleModuleModel.getBuildFile());
} else {
LOG.warn(String.format("Trying to create project data from a not initialized project '%1$s'. Abort.", project.getName()));
return null;
}
}
if (isGradleProjectModule(module)) {
data.addFileChecksum(rootDirPath, getGradleBuildFile(module));
data.addFileChecksum(rootDirPath, getGradleSettingsFile(rootDirPath));
data.addFileChecksum(rootDirPath, new File(rootDirPath, FN_GRADLE_PROPERTIES));
data.addFileChecksum(rootDirPath, new File(rootDirPath, FN_LOCAL_PROPERTIES));
data.addFileChecksum(rootDirPath, getGradleUserSettingsFile());
}
NdkModuleModel ndkModuleModel = NdkModuleModel.get(module);
if (ndkModuleModel != null) {
for (File externalBuildFile : ndkModuleModel.getAndroidProject().getBuildFiles()) {
data.addFileChecksum(rootDirPath, externalBuildFile);
}
}
}
GradleSyncState syncState = GradleSyncState.getInstance(project);
data.myLastGradleSyncTimestamp = syncState.getSummary().getSyncTimestamp();
return data;
}
use of com.android.tools.idea.gradle.project.model.NdkModuleModel in project android by JetBrains.
the class NdkModuleModelDataService method importData.
@Override
protected void importData(@NotNull Collection<DataNode<NdkModuleModel>> toImport, @NotNull Project project, @NotNull IdeModifiableModelsProvider modelsProvider, @NotNull Map<String, NdkModuleModel> modelsByName) {
for (Module module : modelsProvider.getModules()) {
NdkModuleModel ndkModuleModel = modelsByName.get(module.getName());
myModuleSetup.setUpModule(module, modelsProvider, ndkModuleModel, null, null);
}
}
use of com.android.tools.idea.gradle.project.model.NdkModuleModel in project android by JetBrains.
the class BuildVariantUpdater method doUpdate.
@Nullable
private Module doUpdate(@NotNull Project project, @NotNull String moduleName, @NotNull String variant, @NotNull List<AndroidFacet> affectedAndroidFacets, @NotNull List<NdkFacet> affectedNativeAndroidFacets) {
Module moduleToUpdate = findModule(project, moduleName);
if (moduleToUpdate == null) {
logAndShowUpdateFailure(variant, String.format("Cannot find module '%1$s'.", moduleName));
return null;
}
AndroidFacet androidFacet = AndroidFacet.getInstance(moduleToUpdate);
NdkFacet ndkFacet = NdkFacet.getInstance(moduleToUpdate);
if (androidFacet == null && ndkFacet == null) {
String msg = String.format("Cannot find 'Android' or 'Native-Android-Gradle' facets in module '%1$s'.", moduleToUpdate.getName());
logAndShowUpdateFailure(variant, msg);
}
if (ndkFacet != null) {
NdkModuleModel ndkModuleModel = getNativeAndroidModel(ndkFacet, variant);
if (ndkModuleModel == null || !updateSelectedVariant(ndkFacet, ndkModuleModel, variant)) {
return null;
}
affectedNativeAndroidFacets.add(ndkFacet);
}
if (androidFacet != null) {
AndroidModuleModel androidModel = getAndroidModel(androidFacet, variant);
if (androidModel == null || !updateSelectedVariant(androidFacet, androidModel, variant, affectedAndroidFacets)) {
return null;
}
affectedAndroidFacets.add(androidFacet);
}
return moduleToUpdate;
}
Aggregations