Skip to content

Commit

Permalink
fix: Skip android projects from importing (#1439)
Browse files Browse the repository at this point in the history
  • Loading branch information
jdneo authored Oct 24, 2023
1 parent cb3849c commit 4c107d6
Showing 1 changed file with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import java.io.File;
import java.net.URI;
import java.util.Arrays;
import java.util.Collection;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -54,6 +55,7 @@ public class GradleBuildServerProjectImporter extends AbstractProjectImporter {
public static final String BUILD_GRADLE_KTS_DESCRIPTOR = "build.gradle.kts";
public static final String SETTINGS_GRADLE_DESCRIPTOR = "settings.gradle";
public static final String SETTINGS_GRADLE_KTS_DESCRIPTOR = "settings.gradle.kts";
public static final String ANDROID_MANIFEST = "AndroidManifest.xml";

@Override
public boolean applies(IProgressMonitor monitor) throws OperationCanceledException, CoreException {
Expand All @@ -76,6 +78,16 @@ public boolean applies(IProgressMonitor monitor) throws OperationCanceledExcepti
}

for (java.nio.file.Path directory : directories) {
// we don't support android
BasicFileDetector androidDetector = new BasicFileDetector(directory, ANDROID_MANIFEST)
.includeNested(false)
.addExclusions("**/build") //default gradle build dir
.addExclusions("**/bin");
Collection<java.nio.file.Path> androidDirectories = androidDetector.scan(monitor);
if (!androidDirectories.isEmpty()) {
return false;
}

IProject project = ProjectUtils.getProjectFromUri(directory.toUri().toString());
// skip this importer if any of the project in workspace is already
// imported by other importers.
Expand Down

0 comments on commit 4c107d6

Please sign in to comment.