1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-10 01:35:39 +02:00

Bug 566710 Copy CIncludeFileEntrys from Docker image

Also copy files included using "-include", by copying and adjusting
ICIncludeFileEntry, entries.


Change-Id: I886b87a39b3cd6a7b2ea59aeaef327ca9bc69e45
This commit is contained in:
Moritz 'Morty' Strübe 2020-09-06 19:50:07 +02:00
parent 17b3e6c1a6
commit 10e74dda52

View file

@ -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;
}