When the project is created, CDT indexer will use a pre-built PDOM on which rootstrap information is written.
Change-Id: I4360bd90c063262c00e4ceb4c6b2082aa01fe5af
Signed-off-by: Gun Kim <gune.kim@samsung.com>
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.cdt.core; singleton:=true
-Bundle-Version: 5.11.0.qualifier
+Bundle-Version: 5.11.0.201602051005
Bundle-Activator: org.eclipse.cdt.core.CCorePlugin
Bundle-Vendor: %providerName
Bundle-Localization: plugin
* Thomas Corbat (IFS)
* Marc-Andre Laperle (Ericsson)
*******************************************************************************/
+/**
+* 2016-09-07 Gun Kim gune.kim@samsung.com
+* Modifications by S-Core Co., Ltd.
+* 1. Improved CDT indexer's performance when the project is created
+*/
+
package org.eclipse.cdt.internal.core.pdom;
import java.lang.reflect.InvocationTargetException;
private static enum UpdateKind { REQUIRED_SOURCE, REQUIRED_HEADER, ONE_LINKAGE_HEADER, OTHER_HEADER }
private static final Pattern HEADERNAME_PATTERN = Pattern.compile("@headername\\{(?<header>[^\\}]+)\\}"); //$NON-NLS-1$
+ /* Tizen */
+ private boolean isReusage = false;
+ private IScannerInfo scannerInfo;
+ /* ===== */
private static class LinkageTask {
final int fLinkageID;
}
}
+ /* Tizen */
+ public void setReuseBuildOption(boolean isReusage) {
+ this.isReusage = isReusage;
+ }
+ /* ===== */
+
+ /* Tizen */
+// final IScannerInfo scannerInfo = fResolver.getBuildConfiguration(linkageID, contextTu);
private IScannerInfo getScannerInfo(int linkageID, Object contextTu) {
- final IScannerInfo scannerInfo= fResolver.getBuildConfiguration(linkageID, contextTu);
+ if (isReusage) {
+ if (scannerInfo != null) {
+ return scannerInfo;
+ }
+ }
+ scannerInfo = fResolver.getBuildConfiguration(linkageID, contextTu);
+ /* ===== */
if (scannerInfo instanceof ExtendedScannerInfo) {
ExtendedScannerInfo extendedScannerInfo = (ExtendedScannerInfo) scannerInfo;
extendedScannerInfo.setIncludeExportPatterns(getIncludeExportPatterns());
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Gun Kim <gune.kim@samsung.com>
+ * SangHo Park <sangho.p@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+package org.eclipse.cdt.internal.core.pdom;
+
+import org.eclipse.cdt.core.CCorePlugin;
+import org.eclipse.cdt.core.dom.IPDOMIndexer;
+import org.eclipse.cdt.core.dom.IPDOMIndexerTask;
+import org.eclipse.cdt.core.model.ICProject;
+
+/**
+ * This interface is for providing <@code IPDOMIndexerTask> to index source files on project.
+ *
+ * @author Gun Kim <gune.kim@samsung.com>
+ */
+public interface IIndexTaskProvider {
+ public static final String EXTENSION_ID = CCorePlugin.PLUGIN_ID + ".IndexTaskProvider";
+
+ /**
+ * Returns <@code IPDOMIndexerTask> that indexes source files on project.
+ */
+ public IPDOMIndexerTask getPdomIndexerTask(ICProject project, IPDOMIndexer indexer);
+
+}
* Martin Oberhuber (Wind River) - [397652] fix up-to-date check for PDOM
* IBM Corporation
*******************************************************************************/
+/**
+* 2016-09-07 Gun Kim gune.kim@samsung.com
+* Modifications by S-Core Co., Ltd.
+* 1. Improved CDT indexer's performance when the project is created
+*/
package org.eclipse.cdt.internal.core.pdom;
import java.io.File;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExtension;
+/* Tizen */
+import org.eclipse.core.runtime.IExtensionPoint;
+import org.eclipse.core.runtime.IExtensionRegistry;
+/* ===== */
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.ISafeRunnable;
import org.eclipse.core.runtime.IStatus;
private boolean fInShutDown;
boolean fTraceIndexerSetup;
+ /* Tizen */
+ private Set<IIndexTaskProvider> indexTaskProvidsers = new HashSet<IIndexTaskProvider> ();
+ /* ===== */
public PDOMManager() {
PDOM.sDEBUG_LOCKS= "true".equals(Platform.getDebugOption(CCorePlugin.PLUGIN_ID + "/debug/index/locks")); //$NON-NLS-1$//$NON-NLS-2$
fSetupJob= new PDOMSetupJob(this);
fIndexerJob= new PDOMIndexerJob(this);
fNotificationJob= createNotifyJob();
+ /* Tizen */
+ IExtensionRegistry registry = Platform.getExtensionRegistry();
+ IExtensionPoint ep = registry.getExtensionPoint(IIndexTaskProvider.EXTENSION_ID);
+ IExtension[] indexerExt = ep.getExtensions();
+ if (indexerExt == null) {
+ return;
+ }
+ for (IExtension extension : indexerExt) {
+ IConfigurationElement[] elements = extension.getConfigurationElements();
+ for (IConfigurationElement element : elements) {
+ if ("provider".equals(element.getName())) { //$NON-NLS-1$
+ try {
+ indexTaskProvidsers.add((IIndexTaskProvider) element.createExecutableExtension("class"));
+ } catch (CoreException e) {
+ CCorePlugin.log("Failed to get IIndexTaskProvider: " + extension, e);
+ }
+ }
+ }
+ }
+ /* ===== */
}
public Job startup() {
} else {
if (fTraceIndexerSetup)
System.out.println("Indexer: Rebuiding for project " + name); //$NON-NLS-1$
- task= new PDOMRebuildTask(indexer);
+ /* Tizen */
+// task = new PDOMRebuildTask(indexer);
+ for (IIndexTaskProvider provider : indexTaskProvidsers) {
+ task = provider.getPdomIndexerTask(project, indexer);
+ if (task != null) {
+ break;
+ }
+ }
+ if (task == null) {
+ task = new PDOMRebuildTask(indexer);
+ }
+ /* ===== */
}
enqueue(task);
}
* Markus Schorn - initial API and implementation
* Sergey Prigogin (Google)
*******************************************************************************/
+/**
+* 2016-09-07 Gun Kim gune.kim@samsung.com
+* Modifications by S-Core Co., Ltd.
+* 1. Improved CDT indexer's performance when the project is created
+*/
package org.eclipse.cdt.internal.core.pdom.indexer;
import java.util.ArrayList;
fProgressMonitor = null;
}
}
-
+ /* Tizen */
+ public boolean isReuseBuildOption() {
+ return false;
+ }
+ /* ===== */
private void clearIndex(ICProject project, IWritableIndex index) throws CoreException, InterruptedException {
// First clear the pdom
index.acquireWriteLock(fProgressMonitor);
final PDOMIndexerTask pdomIndexerTask = (PDOMIndexerTask) delegate;
pdomIndexerTask.setUpdateFlags(IIndexManager.UPDATE_ALL);
pdomIndexerTask.setWriteInfoToLog();
+ /* Tizen */
+ pdomIndexerTask.setReuseBuildOption(isReuseBuildOption());
+ /* ===== */
}
synchronized (this) {
fDelegate= delegate;
* Markus Schorn - initial API and implementation
* Sergey Prigogin (Google)
******************************************************************************/
+/**
+* 2016-09-07 Gun Kim gune.kim@samsung.com
+* Modifications by S-Core Co., Ltd.
+* 1. Improved CDT indexer's performance when the project is created
+*/
package org.eclipse.cdt.internal.core.pdom.indexer;
import java.io.File;
if (delegate instanceof PDOMIndexerTask) {
final PDOMIndexerTask task = (PDOMIndexerTask) delegate;
task.setUpdateFlags(fUpdateOptions);
+ /* Tizen */
+ task.setReuseBuildOption(isReuseBuildOption());
+ /* ===== */
}
setDelegate(delegate);
}
-
+ /* Tizen */
+ public boolean isReuseBuildOption() {
+ return false;
+ }
+ /* ===== */
private ITranslationUnit getTranslationUnit(IIndexFileLocation location, ICProject project) {
IPath path= IndexLocationFactory.getAbsolutePath(location);
if (path == null)
<extension-point id="LanguageSettingsProvider" name="%LanguageSettingsProvider.name" schema="schema/LanguageSettingsProvider.exsd"/>
<extension-point id="UNCPathConverter" name="%uncPathConverter.name" schema="schema/UNCPathConverter.exsd"/>
<extension-point id="ProblemMarkerFilter" name="%problemMarkerFilter.name" schema="schema/ProblemMarkerFilter.exsd"/>
-
+ <!-- Tizen -->
+ <extension-point id="IndexTaskProvider" name="IndexTaskProvider" schema="schema/IndexTaskProvider.exsd"/>
+ <!-- ===== -->
<extension
point="org.eclipse.cdt.core.templateProcessTypes">
<processType
<relativePath>../../pom.xml</relativePath>
</parent>
- <version>5.11.0-SNAPSHOT</version>
+ <version>5.11.0.201602051005</version>
<artifactId>org.eclipse.cdt.core</artifactId>
<packaging>eclipse-plugin</packaging>
</project>
--- /dev/null
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Tizen -->
+<!--
+2016-09-07 Gun Kim gune.kim@samsung.com
+Addition file by S-Core Co., Ltd.
+1. Improved CDT indexer's performance when the project is created
+-->
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.eclipse.cdt.core" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appInfo>
+ <meta.schema plugin="org.eclipse.cdt.core" id="IndexTaskProvider" name="IndexTaskProvider"/>
+ </appInfo>
+ <documentation>
+ The IndexTaskProvider is used to provide proper IPDOMIndexTask which indexes source files middle of creating project.
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appInfo>
+ <meta.element />
+ </appInfo>
+ </annotation>
+ <complexType>
+ <sequence>
+ <element ref="provider"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute translatable="true"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="provider">
+ <complexType>
+ <attribute name="class" type="string" use="required">
+ <annotation>
+ <documentation>
+ A class which extends org.eclipse.cdt.internal.core.pdom.extensions.IIndexTaskProvider
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="java" basedOn="org.eclipse.cdt.internal.core.pdom.extensions.IIndexTaskProvider:"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="since"/>
+ </appInfo>
+ <documentation>
+ [Enter the first release in which this extension point appears.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="examples"/>
+ </appInfo>
+ <documentation>
+ [Enter extension point usage example here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="apiinfo"/>
+ </appInfo>
+ <documentation>
+ [Enter API information here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="implementation"/>
+ </appInfo>
+ <documentation>
+ [Enter information about supplied implementation of this extension point.]
+ </documentation>
+ </annotation>
+
+
+</schema>
+<!-- ===== -->
\ No newline at end of file
-->
<module>debug/org.eclipse.cdt.debug.core</module>
<module>debug/org.eclipse.cdt.debug.ui</module>
+ <module>core/org.eclipse.cdt.core</module>
<module>core/org.eclipse.cdt.ui</module>
<module>dsf-gdb/org.eclipse.cdt.dsf.gdb</module>
<module>dsf-gdb/org.eclipse.cdt.dsf.gdb.ui</module>