1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-03 07:05:24 +02:00

Bug 579668 - Regression in Docker header file support

- fix CBuildConfiguration.getScannerInformation() method to look to
  see if the toolchain is a ContainerGCCToolChain but the include paths
  have nothing pointing to the special HEADERS directory for copying
  over Image headers to the host in which case do a fix-up by
  calculating the scanner info again and massaging the include paths
  as needed

Change-Id: If6f76ef6ffb1bc5958377c565e4847989d5de0db
This commit is contained in:
Jeff Johnston 2022-04-14 20:47:03 -04:00
parent 8dc7748433
commit 8221562d8b

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2015, 2019 QNX Software Systems and others.
* Copyright (c) 2015, 2022 QNX Software Systems and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@ -729,7 +729,24 @@ public abstract class CBuildConfiguration extends PlatformObject implements ICBu
synchronized (scannerInfoLock) {
info = scannerInfoCache.getScannerInfo(resource);
}
if (info == null || info.getIncludePaths().length == 0) {
// Following is a kludge to fix Bug 579668 whereby sometimes a timing
// bug occurs and scanner info for a project that specifies a container target
// has not initialized the include paths correctly to point to copied includes
// from the image target. We check to see if org.eclipse.cdt.docker.launcher is
// found in the include paths which is the .plugin directory where we copy headers
// to in the .metadata folder.
boolean needsFixing = false;
if (info != null && info.getIncludePaths().length > 0 && toolChain != null
&& toolChain.getId().startsWith("gcc-img-sha")) { //$NON-NLS-1$
needsFixing = true;
for (String includePath : info.getIncludePaths()) {
if (includePath.contains("org.eclipse.cdt.docker.launcher")) { //$NON-NLS-1$
needsFixing = false;
break;
}
}
}
if (info == null || info.getIncludePaths().length == 0 || needsFixing) {
ICElement celement = CCorePlugin.getDefault().getCoreModel().create(resource);
if (celement instanceof ITranslationUnit) {
try {