exclude gen roots in android-jps

This commit is contained in:
Eugene Kudelevsky
2012-10-29 16:46:29 +04:00
parent e37dc65f87
commit df403553da
4 changed files with 42 additions and 2 deletions
@@ -0,0 +1 @@
org.jetbrains.jps.android.AndroidExcludedJavaSourceRootProvider
@@ -0,0 +1,38 @@
package org.jetbrains.jps.android;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.util.io.FileUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.jps.android.model.JpsAndroidModuleExtension;
import org.jetbrains.jps.builders.java.ExcludedJavaSourceRootProvider;
import org.jetbrains.jps.model.module.JpsModule;
import org.jetbrains.jps.model.module.JpsModuleSourceRoot;
import java.io.IOException;
/**
* @author Eugene.Kudelevsky
*/
public class AndroidExcludedJavaSourceRootProvider extends ExcludedJavaSourceRootProvider {
private static final Logger LOG = Logger.getInstance("#org.jetbrains.jps.android.AndroidExcludedJavaSourceRootProvider");
@Override
public boolean isExcludedFromCompilation(@NotNull JpsModule module, @NotNull JpsModuleSourceRoot root) {
final JpsAndroidModuleExtension extension = AndroidJpsUtil.getExtension(module);
if (extension == null) {
return false;
}
try {
for (String genDir : AndroidJpsUtil.getGenDirs(extension)) {
if (FileUtil.pathsEqual(genDir, root.getFile().getPath())) {
return true;
}
}
}
catch (IOException e) {
LOG.info(e);
}
return false;
}
}
@@ -652,7 +652,7 @@ public class AndroidJpsUtil {
}
@Nullable
@NotNull
public static Set<String> getGenDirs(@NotNull JpsAndroidModuleExtension extension) throws IOException {
final Set<String> result = new HashSet<String>();
File dir = extension.getAaptGenDir();
@@ -72,7 +72,8 @@ public class AndroidPrecompileTask implements CompileTask {
public boolean execute(CompileContext context) {
final Project project = context.getProject();
// todo: add gen roots to excludes in android-jps and then remove this line
// in out-of-process mode gen roots will be excluded by AndroidExcludedJavaSourceRootProvider
// we do it here for internal mode and also to make there roots 'visibly excluded' in IDE settings
createGenModulesAndSourceRoots(project);
if (!CompilerWorkspaceConfiguration.getInstance(project).useOutOfProcessBuild()) {