Merge remote-tracking branch 'origin/master'

This commit is contained in:
Ekaterina Tuzova
2012-10-02 18:46:13 +04:00
7 changed files with 39 additions and 33 deletions
Binary file not shown.
Binary file not shown.
+12 -24
View File
@@ -18,6 +18,8 @@
#include <errno.h>
#include <limits.h>
#include <mntent.h>
#include <paths.h>
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
@@ -362,45 +364,31 @@ static bool register_roots(array* new_roots, array* unwatchable, array* mounts)
}
static bool is_watchable(const char* dev, const char* mnt, const char* fs) {
static bool is_watchable(const char* mnt, const char* fs) {
// don't watch special and network filesystems
return !(strncmp(mnt, "/dev", 4) == 0 || strncmp(mnt, "/proc", 5) == 0 || strncmp(mnt, "/sys", 4) == 0 ||
strncmp(fs, "fuse.", 5) == 0 || strcmp(fs, "cifs") == 0 || strcmp(fs, "nfs") == 0);
strncmp(fs, "fuse.", 5) == 0 || strcmp(fs, "cifs") == 0 || strcmp(fs, MNTTYPE_NFS) == 0 || strcmp(fs, MNTTYPE_SWAP) == 0);
}
#define MTAB_DELIMS " \t"
static array* unwatchable_mounts() {
FILE* mtab = fopen("/etc/mtab", "r");
FILE* mtab = setmntent(_PATH_MOUNTED, "r");
if (mtab == NULL) {
mtab = fopen("/proc/mounts", "r");
}
if (mtab == NULL) {
userlog(LOG_ERR, "neither /etc/mtab nor /proc/mounts can be read");
userlog(LOG_ERR, "cannot open " _PATH_MOUNTED);
return NULL;
}
array* mounts = array_create(20);
CHECK_NULL(mounts, NULL);
char* line;
while ((line = read_line(mtab)) != NULL) {
userlog(LOG_DEBUG, "mtab: %s", line);
char* dev = strtok(line, MTAB_DELIMS);
char* point = strtok(NULL, MTAB_DELIMS);
char* fs = strtok(NULL, MTAB_DELIMS);
if (dev == NULL || point == NULL || fs == NULL) {
userlog(LOG_ERR, "can't parse mount line");
return NULL;
}
if (!is_watchable(dev, point, fs)) {
CHECK_NULL(array_push(mounts, strdup(point)), NULL);
struct mntent* ent;
while ((ent = getmntent(mtab)) != NULL) {
userlog(LOG_DEBUG, "mtab: %s : %s", ent->mnt_dir, ent->mnt_type);
if (strcmp(ent->mnt_type, MNTTYPE_IGNORE) != 0 && !is_watchable(ent->mnt_dir, ent->mnt_type)) {
CHECK_NULL(array_push(mounts, strdup(ent->mnt_dir)), NULL);
}
}
fclose(mtab);
endmntent(mtab);
return mounts;
}
+1
View File
@@ -81,6 +81,7 @@
description="Attach debugger to Android process"
icon="AndroidIcons.AttachDebugger">
<add-to-group group-id="ToolbarRunGroup" anchor="after" relative-to-action="RunnerActions"/>
<add-to-group group-id="RunMenu"/>
</action>
<action id="AndroidExtractStyleAction" class="org.jetbrains.android.refactoring.AndroidExtractStyleAction" text="St_yle..."
description="Pull out style-related attributes from layout and extract them as a new style">
@@ -102,14 +102,17 @@ public class AndroidExternalApklibExtractingCompiler implements SourceGenerating
for (GenerationItem item : generatedItems) {
final MyGenerationItem genItem = (MyGenerationItem)item;
final File contentRoot = new File(genItem.getGenContentRootPath());
final VirtualFile vContentRoot = LocalFileSystem.getInstance().findFileByIoFile(contentRoot);
final File srcRoot = new File(genItem.getGenContentRootPath() + '/' +
AndroidMavenUtil.APK_LIB_ARTIFACT_SOURCE_ROOT);
final VirtualFile vSrcRoot = LocalFileSystem.getInstance().findFileByIoFile(srcRoot);
if (vSrcRoot != null) {
AndroidCompileUtil.markDirtyAndRefresh(vSrcRoot, true);
AndroidUtils.collectFiles(vSrcRoot, visited, generatedVFiles);
if (vContentRoot != null) {
vContentRoot.refresh(false, true);
final VirtualFile vSrcRoot = vContentRoot.findChild(AndroidMavenUtil.APK_LIB_ARTIFACT_SOURCE_ROOT);
if (vSrcRoot != null) {
AndroidCompileUtil.markDirty(vSrcRoot, true);
AndroidUtils.collectFiles(vSrcRoot, visited, generatedVFiles);
}
}
}
@@ -385,7 +385,7 @@ public class AndroidRootUtil {
@Nullable
public static String getBuildconfigGenSourceRootPath(@NotNull AndroidFacet facet) {
// todo: return correct path for mavenized module when it'll be supported
return getAptGenSourceRootPath(facet);
return getAidlGenSourceRootPath(facet);
}
@Nullable
@@ -22,10 +22,13 @@ import com.intellij.util.ArrayUtil;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.idea.maven.model.MavenArtifact;
import org.jetbrains.idea.maven.model.MavenConstants;
import org.jetbrains.idea.maven.model.MavenId;
import org.jetbrains.idea.maven.project.MavenProject;
import java.util.Collection;
import java.util.List;
/**
* @author Eugene.Kudelevsky
@@ -56,7 +59,9 @@ public class AndroidMavenUtil {
boolean resultUnderApp = false;
for (MavenProject p : allProjects) {
if (p.findDependencies(mavenId).size() > 0) {
final List<MavenArtifact> dependencies = p.findDependencies(mavenId);
if (dependencies.size() > 0 && containsCompileDependency(dependencies)) {
final VirtualFile projectDir = p.getDirectoryFile();
final boolean app = APK_PACKAGING_TYPE.equals(p.getPackaging());
if (path == null || !resultUnderApp && app) {
@@ -72,6 +77,15 @@ public class AndroidMavenUtil {
return path;
}
private static boolean containsCompileDependency(Collection<MavenArtifact> dependencies) {
for (MavenArtifact dependency : dependencies) {
if (MavenConstants.SCOPE_COMPILE.equals(dependency.getScope())) {
return true;
}
}
return false;
}
@NotNull
public static String getModuleNameForExtApklibArtifact(MavenId mavenId) {
return APKLIB_MODULE_PREFIX + getMavenIdStringForFileName(mavenId);