From 9a7bfa228c66f78a6297c531c8199f97ba79bb80 Mon Sep 17 00:00:00 2001 From: "Vladislav.Soroka" Date: Fri, 26 Dec 2014 18:26:13 +0300 Subject: [PATCH] gradle: debug logging for imported projects paths added (cherry picked from commit f525ad3) --- .../data/ExternalProjectDataService.java | 14 +++++++++++++- .../project/data/ExternalProjectSerializer.java | 17 ++++++++++++----- 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/plugins/gradle/src/org/jetbrains/plugins/gradle/service/project/data/ExternalProjectDataService.java b/plugins/gradle/src/org/jetbrains/plugins/gradle/service/project/data/ExternalProjectDataService.java index 06e3790de334..8f41ea7ea49f 100644 --- a/plugins/gradle/src/org/jetbrains/plugins/gradle/service/project/data/ExternalProjectDataService.java +++ b/plugins/gradle/src/org/jetbrains/plugins/gradle/service/project/data/ExternalProjectDataService.java @@ -26,6 +26,7 @@ import com.intellij.openapi.module.Module; import com.intellij.openapi.project.Project; import com.intellij.openapi.util.Pair; import com.intellij.openapi.util.io.FileUtil; +import com.intellij.util.Function; import com.intellij.util.containers.ConcurrentFactoryMap; import com.intellij.util.containers.ContainerUtil; import gnu.trove.TObjectHashingStrategy; @@ -122,7 +123,18 @@ public class ExternalProjectDataService implements ProjectDataService, ExternalProject>, Object>() { + @Override + public Object fun(Map.Entry, ExternalProject> entry) { + return Pair.create(entry.getKey(), entry.getValue().getProjectDir()); + } + })); + } + return externalProject; } public void saveExternalProject(@NotNull ExternalProject externalProject) { diff --git a/plugins/gradle/src/org/jetbrains/plugins/gradle/service/project/data/ExternalProjectSerializer.java b/plugins/gradle/src/org/jetbrains/plugins/gradle/service/project/data/ExternalProjectSerializer.java index 8828b9ef5880..67ba1c808ccf 100644 --- a/plugins/gradle/src/org/jetbrains/plugins/gradle/service/project/data/ExternalProjectSerializer.java +++ b/plugins/gradle/src/org/jetbrains/plugins/gradle/service/project/data/ExternalProjectSerializer.java @@ -178,6 +178,8 @@ public class ExternalProjectSerializer { output = new Output(new FileOutputStream(configurationFile)); myKryo.writeObject(output, externalProject); + + LOG.debug("Data saved for imported project from: " + externalProjectPath); } catch (FileNotFoundException e) { LOG.error(e); @@ -189,13 +191,15 @@ public class ExternalProjectSerializer { @Nullable public ExternalProject load(@NotNull ProjectSystemId externalSystemId, File externalProjectPath) { + LOG.debug("Attempt to load project data from: " + externalProjectPath); + ExternalProject externalProject = null; Input input = null; try { final File configurationFile = getProjectConfigurationFile(externalSystemId, externalProjectPath.getPath()); - if (!configurationFile.isFile()) return null; - - input = new Input(new FileInputStream(configurationFile)); - return myKryo.readObject(input, DefaultExternalProject.class); + if (configurationFile.isFile()) { + input = new Input(new FileInputStream(configurationFile)); + externalProject = myKryo.readObject(input, DefaultExternalProject.class); + } } catch (Exception e) { LOG.error(e); @@ -204,7 +208,10 @@ public class ExternalProjectSerializer { StreamUtil.closeStream(input); } - return null; + if (externalProject != null) { + LOG.debug("Loaded project: " + externalProject.getProjectDir()); + } + return externalProject; } private static File getProjectConfigurationFile(ProjectSystemId externalSystemId, String externalProjectPath) {