use of com.android.tools.idea.gradle.model.java.JavaModuleContentRoot in project android by JetBrains.
the class ContentRootsModuleSetupStep method findContentEntries.
@NotNull
private static List<ContentEntry> findContentEntries(@NotNull ModifiableRootModel moduleModel, @NotNull JavaModuleModel javaModuleModel) {
removeExistingContentEntries(moduleModel);
List<ContentEntry> contentEntries = new ArrayList<>();
for (JavaModuleContentRoot contentRoot : javaModuleModel.getContentRoots()) {
File rootDirPath = contentRoot.getRootDirPath();
ContentEntry contentEntry = moduleModel.addContentEntry(pathToIdeaUrl(rootDirPath));
contentEntries.add(contentEntry);
}
return contentEntries;
}
use of com.android.tools.idea.gradle.model.java.JavaModuleContentRoot in project android by JetBrains.
the class JavaContentEntriesSetup method execute.
@Override
public void execute(@NotNull List<ContentEntry> contentEntries) {
boolean isTopLevelJavaModule = isGradleProjectModule(getModule());
File buildFolderPath = myJavaModuleModel.getBuildFolderPath();
boolean buildFolderExcluded = buildFolderPath != null;
for (JavaModuleContentRoot contentRoot : myJavaModuleModel.getContentRoots()) {
if (contentRoot == null) {
continue;
}
addSourceFolders(contentRoot.getSourceDirPaths(), contentEntries, SOURCE, false);
addSourceFolders(contentRoot.getGenSourceDirPaths(), contentEntries, SOURCE, true);
addSourceFolders(contentRoot.getResourceDirPaths(), contentEntries, RESOURCE, false);
addSourceFolders(contentRoot.getTestDirPaths(), contentEntries, TEST_SOURCE, false);
addSourceFolders(contentRoot.getGenTestDirPaths(), contentEntries, TEST_SOURCE, true);
addSourceFolders(contentRoot.getTestResourceDirPaths(), contentEntries, TEST_RESOURCE, false);
for (File excluded : contentRoot.getExcludeDirPaths()) {
ContentEntry contentEntry = findParentContentEntry(excluded, contentEntries);
if (contentEntry != null) {
if (isTopLevelJavaModule && buildFolderExcluded) {
// We need to "undo" the implicit exclusion of "build" folder for top-level module.
if (filesEqual(excluded, buildFolderPath)) {
buildFolderExcluded = true;
continue;
}
}
addExcludedFolder(contentEntry, excluded);
}
}
}
addOrphans();
}
Aggregations