From 10e74dda5225ac378729ceaaaf02c2f5341343db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moritz=20=27Morty=27=20Str=C3=BCbe?= Date: Sun, 6 Sep 2020 19:50:07 +0200 Subject: [PATCH] Bug 566710 Copy CIncludeFileEntrys from Docker image Also copy files included using "-include", by copying and adjusting ICIncludeFileEntry, entries. Change-Id: I886b87a39b3cd6a7b2ea59aeaef327ca9bc69e45 --- .../ContainerCommandLauncherFactory.java | 21 +++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/docker/launcher/ContainerCommandLauncherFactory.java b/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/docker/launcher/ContainerCommandLauncherFactory.java index 28359b5d233..23579188a1a 100644 --- a/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/docker/launcher/ContainerCommandLauncherFactory.java +++ b/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/docker/launcher/ContainerCommandLauncherFactory.java @@ -27,8 +27,10 @@ import org.eclipse.cdt.core.ICommandLauncherFactory2; import org.eclipse.cdt.core.build.ICBuildConfiguration; import org.eclipse.cdt.core.build.IToolChain; import org.eclipse.cdt.core.model.CoreModel; +import org.eclipse.cdt.core.settings.model.CIncludeFileEntry; import org.eclipse.cdt.core.settings.model.CIncludePathEntry; import org.eclipse.cdt.core.settings.model.ICConfigurationDescription; +import org.eclipse.cdt.core.settings.model.ICIncludeFileEntry; import org.eclipse.cdt.core.settings.model.ICIncludePathEntry; import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry; import org.eclipse.cdt.core.settings.model.extension.CConfigurationData; @@ -41,6 +43,7 @@ import org.eclipse.cdt.managedbuilder.internal.dataprovider.BuildConfigurationDa import org.eclipse.core.resources.IProject; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.Path; import org.eclipse.core.runtime.Platform; import org.eclipse.linuxtools.docker.ui.launch.ContainerLauncher; @@ -163,6 +166,9 @@ public class ContainerCommandLauncherFactory implements ICommandLauncherFactory, for (ICLanguageSettingEntry entry : entries) { if (entry instanceof ICIncludePathEntry) { paths.add(entry.getValue()); + } else if (entry instanceof ICIncludeFileEntry) { + paths.add(new org.eclipse.core.runtime.Path(entry.getValue()).removeLastSegments(1) + .toString()); } } if (paths.size() > 0) { @@ -374,12 +380,19 @@ public class ContainerCommandLauncherFactory implements ICommandLauncherFactory, entry.getFlags()); newEntries.add(newEntry); continue; - } else { - newEntries.add(entry); } - } else { - newEntries.add(entry); } + if (entry instanceof ICIncludeFileEntry) { + IPath p = new Path(((ICIncludeFileEntry) entry).getName()); + if (copiedVolumes.contains(p.removeLastSegments(1).toString())) { + IPath newPath = hostDir.append(entry.getName()); + CIncludeFileEntry newEntry = new CIncludeFileEntry(newPath.toString(), + entry.getFlags()); + newEntries.add(newEntry); + continue; + } + } + newEntries.add(entry); } return newEntries; }