mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
exclude gen roots in android-jps
This commit is contained in:
+1
@@ -0,0 +1 @@
|
||||
org.jetbrains.jps.android.AndroidExcludedJavaSourceRootProvider
|
||||
+38
@@ -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()) {
|
||||
|
||||
Reference in New Issue
Block a user