mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Bug 481978 - Big overhaul of new build system to work with Qt.
Moved new build system to it's own plug-ins. Cleaned up the root build configuration and toolchain classes and use them for Qt local run builds. Also hooks Qt local run launch delegate to launch target manager and associated delegate interface. Change-Id: I0c0f711ee53005edd399f6d24ba96658d606e1e5
This commit is contained in:
parent
ef76cdac14
commit
e3496e1246
120 changed files with 2490 additions and 1371 deletions
7
build/org.eclipse.cdt.build.core.tests/.classpath
Normal file
7
build/org.eclipse.cdt.build.core.tests/.classpath
Normal file
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
|
||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
28
build/org.eclipse.cdt.build.core.tests/.project
Normal file
28
build/org.eclipse.cdt.build.core.tests/.project
Normal file
|
@ -0,0 +1,28 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>org.eclipse.cdt.build.core.tests</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.pde.ManifestBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.pde.SchemaBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.pde.PluginNature</nature>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
|
@ -0,0 +1,7 @@
|
|||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
||||
org.eclipse.jdt.core.compiler.compliance=1.8
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.source=1.8
|
12
build/org.eclipse.cdt.build.core.tests/META-INF/MANIFEST.MF
Normal file
12
build/org.eclipse.cdt.build.core.tests/META-INF/MANIFEST.MF
Normal file
|
@ -0,0 +1,12 @@
|
|||
Manifest-Version: 1.0
|
||||
Bundle-ManifestVersion: 2
|
||||
Bundle-Name: Tests
|
||||
Bundle-SymbolicName: org.eclipse.cdt.build.core.tests
|
||||
Bundle-Version: 1.0.0.qualifier
|
||||
Bundle-Activator: org.eclipse.cdt.build.core.tests.Activator
|
||||
Bundle-Vendor: Eclipse CDT
|
||||
Require-Bundle: org.eclipse.core.runtime,
|
||||
org.junit;bundle-version="4.12.0",
|
||||
org.eclipse.cdt.build.core;bundle-version="1.0.0"
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
|
||||
Bundle-ActivationPolicy: lazy
|
4
build/org.eclipse.cdt.build.core.tests/build.properties
Normal file
4
build/org.eclipse.cdt.build.core.tests/build.properties
Normal file
|
@ -0,0 +1,4 @@
|
|||
source.. = src/
|
||||
output.. = bin/
|
||||
bin.includes = META-INF/,\
|
||||
.
|
39
build/org.eclipse.cdt.build.core.tests/pom.xml
Normal file
39
build/org.eclipse.cdt.build.core.tests/pom.xml
Normal file
|
@ -0,0 +1,39 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
|
||||
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>org.eclipse.cdt</groupId>
|
||||
<artifactId>cdt-parent</artifactId>
|
||||
<version>8.8.0-SNAPSHOT</version>
|
||||
<relativePath>../../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
<artifactId>org.eclipse.cdt.build.core.tests</artifactId>
|
||||
<packaging>eclipse-test-plugin</packaging>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.eclipse.tycho</groupId>
|
||||
<artifactId>tycho-surefire-plugin</artifactId>
|
||||
<version>${tycho-version}</version>
|
||||
<configuration>
|
||||
<!-- Need UI harness for quick fix tests -->
|
||||
<useUIHarness>true</useUIHarness>
|
||||
<argLine>${tycho.testArgLine} ${base.ui.test.vmargs}</argLine>
|
||||
<testFailureIgnore>true</testFailureIgnore>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<artifactId>org.eclipse.platform.feature.group</artifactId>
|
||||
<type>p2-installable-unit</type>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
|
@ -0,0 +1,29 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2015 QNX Software Systems and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.build.core.tests;
|
||||
|
||||
import org.osgi.framework.BundleActivator;
|
||||
import org.osgi.framework.BundleContext;
|
||||
|
||||
public class Activator implements BundleActivator {
|
||||
|
||||
private static BundleContext context;
|
||||
|
||||
static BundleContext getContext() {
|
||||
return context;
|
||||
}
|
||||
|
||||
public void start(BundleContext bundleContext) throws Exception {
|
||||
Activator.context = bundleContext;
|
||||
}
|
||||
|
||||
public void stop(BundleContext bundleContext) throws Exception {
|
||||
Activator.context = null;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2015 QNX Software Systems and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.build.core.tests;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
public class GCCTests {
|
||||
|
||||
@Test
|
||||
public void tryGCCDiscovery() throws IOException {
|
||||
long start = System.currentTimeMillis();
|
||||
System.out.println("Time: " + (System.currentTimeMillis() - start));
|
||||
}
|
||||
|
||||
}
|
7
build/org.eclipse.cdt.build.core/.classpath
Normal file
7
build/org.eclipse.cdt.build.core/.classpath
Normal file
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
|
||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
28
build/org.eclipse.cdt.build.core/.project
Normal file
28
build/org.eclipse.cdt.build.core/.project
Normal file
|
@ -0,0 +1,28 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>org.eclipse.cdt.build.core</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.pde.ManifestBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.pde.SchemaBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.pde.PluginNature</nature>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
|
@ -0,0 +1,7 @@
|
|||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
||||
org.eclipse.jdt.core.compiler.compliance=1.8
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.source=1.8
|
15
build/org.eclipse.cdt.build.core/META-INF/MANIFEST.MF
Normal file
15
build/org.eclipse.cdt.build.core/META-INF/MANIFEST.MF
Normal file
|
@ -0,0 +1,15 @@
|
|||
Manifest-Version: 1.0
|
||||
Bundle-ManifestVersion: 2
|
||||
Bundle-Name: Core
|
||||
Bundle-SymbolicName: org.eclipse.cdt.build.core;singleton:=true
|
||||
Bundle-Version: 1.0.0.qualifier
|
||||
Bundle-Activator: org.eclipse.cdt.build.core.internal.Activator
|
||||
Bundle-Vendor: Eclipse CDT
|
||||
Require-Bundle: org.eclipse.core.runtime,
|
||||
org.eclipse.core.resources;bundle-version="3.10.0",
|
||||
org.eclipse.cdt.core;bundle-version="5.12.0",
|
||||
com.google.gson,
|
||||
org.eclipse.launchbar.core;bundle-version="2.0.0"
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
|
||||
Bundle-ActivationPolicy: lazy
|
||||
Export-Package: org.eclipse.cdt.build.core
|
24
build/org.eclipse.cdt.build.core/about.html
Normal file
24
build/org.eclipse.cdt.build.core/about.html
Normal file
|
@ -0,0 +1,24 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml"><head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>About</title></head>
|
||||
|
||||
<body lang="EN-US">
|
||||
<h2>About This Content</h2>
|
||||
|
||||
<p>June 22, 2007</p>
|
||||
<h3>License</h3>
|
||||
|
||||
<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise
|
||||
indicated below, the Content is provided to you under the terms and conditions of the
|
||||
Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available
|
||||
at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
|
||||
For purposes of the EPL, "Program" will mean the Content.</p>
|
||||
|
||||
<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
|
||||
being redistributed by another party ("Redistributor") and different terms and conditions may
|
||||
apply to your use of any object code in the Content. Check the Redistributor's license that was
|
||||
provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
|
||||
indicated below, the terms and conditions of the EPL still apply to any source code in the Content
|
||||
and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
|
||||
|
||||
</body></html>
|
7
build/org.eclipse.cdt.build.core/build.properties
Normal file
7
build/org.eclipse.cdt.build.core/build.properties
Normal file
|
@ -0,0 +1,7 @@
|
|||
source.. = src/
|
||||
output.. = bin/
|
||||
bin.includes = META-INF/,\
|
||||
.,\
|
||||
plugin.xml,\
|
||||
about.html,\
|
||||
schema/
|
6
build/org.eclipse.cdt.build.core/plugin.xml
Normal file
6
build/org.eclipse.cdt.build.core/plugin.xml
Normal file
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<?eclipse version="3.4"?>
|
||||
<plugin>
|
||||
<extension-point id="toolChainType" name="Tool Chain Type" schema="schema/toolChainType.exsd"/>
|
||||
<extension-point id="toolChainProvider" name="Tool Chain Provider" schema="schema/toolChainProvider.exsd"/>
|
||||
</plugin>
|
17
build/org.eclipse.cdt.build.core/pom.xml
Normal file
17
build/org.eclipse.cdt.build.core/pom.xml
Normal file
|
@ -0,0 +1,17 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
|
||||
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>org.eclipse.cdt</groupId>
|
||||
<artifactId>cdt-parent</artifactId>
|
||||
<version>8.8.0-SNAPSHOT</version>
|
||||
<relativePath>../../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
<artifactId>org.eclipse.cdt.build.core</artifactId>
|
||||
<packaging>eclipse-plugin</packaging>
|
||||
</project>
|
102
build/org.eclipse.cdt.build.core/schema/toolChainProvider.exsd
Normal file
102
build/org.eclipse.cdt.build.core/schema/toolChainProvider.exsd
Normal file
|
@ -0,0 +1,102 @@
|
|||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<!-- Schema file written by PDE -->
|
||||
<schema targetNamespace="org.eclipse.cdt.build.core" xmlns="http://www.w3.org/2001/XMLSchema">
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.schema plugin="org.eclipse.cdt.build.core" id="ToolChainProvider" name="Tool Chain Provider"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
A toolchain provider provides automatically discovered toolchains when requested. Providers have enablement to make sure they aren't called unless there's a good chance they have toolchains to offer.
|
||||
</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>
|
||||
|
||||
</documentation>
|
||||
<appinfo>
|
||||
<meta.attribute kind="java" basedOn=":org.eclipse.cdt.build.core.IToolChainProvider"/>
|
||||
</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>
|
127
build/org.eclipse.cdt.build.core/schema/toolChainType.exsd
Normal file
127
build/org.eclipse.cdt.build.core/schema/toolChainType.exsd
Normal file
|
@ -0,0 +1,127 @@
|
|||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<!-- Schema file written by PDE -->
|
||||
<schema targetNamespace="org.eclipse.cdt.build.core" xmlns="http://www.w3.org/2001/XMLSchema">
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.schema plugin="org.eclipse.cdt.build.core" id="ToolChainType" name="Tool Chain Type"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
Defines toolchain type extensions. Toolchain types provide toolchain objects for a given type of toolchain. They are passed properties that are stored for the toolchain.
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<element name="extension">
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.element />
|
||||
</appinfo>
|
||||
</annotation>
|
||||
<complexType>
|
||||
<sequence minOccurs="1" maxOccurs="unbounded">
|
||||
<element ref="toolChainType"/>
|
||||
</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="toolChainType">
|
||||
<complexType>
|
||||
<sequence minOccurs="0" maxOccurs="unbounded">
|
||||
<element ref="targetType"/>
|
||||
</sequence>
|
||||
<attribute name="id" type="string" use="required">
|
||||
<annotation>
|
||||
<documentation>
|
||||
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
<attribute name="class" type="string" use="required">
|
||||
<annotation>
|
||||
<documentation>
|
||||
|
||||
</documentation>
|
||||
<appinfo>
|
||||
<meta.attribute kind="java" basedOn=":org.eclipse.cdt.build.core.IToolChainType"/>
|
||||
</appinfo>
|
||||
</annotation>
|
||||
</attribute>
|
||||
</complexType>
|
||||
</element>
|
||||
|
||||
<element name="targetType">
|
||||
<complexType>
|
||||
<attribute name="id" type="string" use="required">
|
||||
<annotation>
|
||||
<documentation>
|
||||
|
||||
</documentation>
|
||||
<appinfo>
|
||||
<meta.attribute kind="identifier" basedOn="org.eclipse.launchbar.core.launchTargetTypes/launchTargetType/@id"/>
|
||||
</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>
|
|
@ -0,0 +1,130 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2015 QNX Software Systems and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.build.core;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Collection;
|
||||
|
||||
import org.eclipse.cdt.build.core.internal.Activator;
|
||||
import org.eclipse.cdt.build.core.internal.ScannerInfoData;
|
||||
import org.eclipse.cdt.build.core.internal.ToolChainScannerInfo;
|
||||
import org.eclipse.cdt.core.model.ILanguage;
|
||||
import org.eclipse.cdt.core.parser.IExtendedScannerInfo;
|
||||
import org.eclipse.cdt.core.parser.IScannerInfo;
|
||||
import org.eclipse.core.resources.IBuildConfiguration;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.resources.IProjectDescription;
|
||||
import org.eclipse.core.resources.IResource;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.core.runtime.PlatformObject;
|
||||
import org.eclipse.core.runtime.preferences.InstanceScope;
|
||||
import org.osgi.service.prefs.BackingStoreException;
|
||||
import org.osgi.service.prefs.Preferences;
|
||||
|
||||
/**
|
||||
* Root class for CDT build configurations. Provides access to the build
|
||||
* settings for subclasses.
|
||||
*
|
||||
* @since 5.12
|
||||
*/
|
||||
public abstract class CBuildConfiguration extends PlatformObject {
|
||||
|
||||
private static final String TOOLCHAIN_TYPE = "cdt.toolChain.type"; //$NON-NLS-1$
|
||||
private static final String TOOLCHAIN_NAME = "cdt.toolChain.name"; //$NON-NLS-1$
|
||||
|
||||
private final IBuildConfiguration config;
|
||||
private final IToolChain toolChain;
|
||||
|
||||
private ScannerInfoData scannerInfoData;
|
||||
|
||||
protected CBuildConfiguration(IBuildConfiguration config) {
|
||||
this.config = config;
|
||||
|
||||
// Load toolchain from prefs
|
||||
Preferences settings = getSettings();
|
||||
String typeId = settings.get(TOOLCHAIN_TYPE, ""); //$NON-NLS-1$
|
||||
String id = settings.get(TOOLCHAIN_NAME, ""); //$NON-NLS-1$
|
||||
toolChain = !id.isEmpty() ? Activator.getToolChainManager().getToolChain(typeId, id) : null;
|
||||
}
|
||||
|
||||
protected CBuildConfiguration(IBuildConfiguration config, IToolChain toolChain) {
|
||||
this.config = config;
|
||||
this.toolChain = toolChain;
|
||||
Preferences settings = getSettings();
|
||||
settings.put(TOOLCHAIN_TYPE, toolChain.getType().getId());
|
||||
settings.put(TOOLCHAIN_NAME, toolChain.getName());
|
||||
try {
|
||||
settings.flush();
|
||||
} catch (BackingStoreException e) {
|
||||
Activator.log(e);
|
||||
}
|
||||
}
|
||||
|
||||
public IBuildConfiguration getBuildConfiguration() {
|
||||
return config;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return config.getName();
|
||||
}
|
||||
|
||||
public IProject getProject() {
|
||||
return config.getProject();
|
||||
}
|
||||
|
||||
public void setActive(IProgressMonitor monitor) throws CoreException {
|
||||
IProject project = config.getProject();
|
||||
if (config.equals(project.getActiveBuildConfig())) {
|
||||
// already set
|
||||
return;
|
||||
}
|
||||
|
||||
IProjectDescription projectDesc = project.getDescription();
|
||||
projectDesc.setActiveBuildConfig(config.getName());
|
||||
project.setDescription(projectDesc, monitor);
|
||||
}
|
||||
|
||||
protected Preferences getSettings() {
|
||||
return InstanceScope.INSTANCE.getNode(Activator.getId()).node("config") //$NON-NLS-1$
|
||||
.node(getProject().getName()).node(config.getName());
|
||||
}
|
||||
|
||||
public IToolChain getToolChain() {
|
||||
return toolChain;
|
||||
}
|
||||
|
||||
public IScannerInfo getScannerInfo(IResource resource) throws IOException {
|
||||
return getScannerInfoData().getScannerInfo(resource);
|
||||
}
|
||||
|
||||
public void putScannerInfo(ILanguage language, IExtendedScannerInfo info) {
|
||||
getScannerInfoData().putScannerInfo(language, info);
|
||||
}
|
||||
|
||||
public void putScannerInfo(IResource resource, ToolChainScannerInfo info) {
|
||||
getScannerInfoData().putScannerInfo(resource, info);
|
||||
}
|
||||
|
||||
private ScannerInfoData getScannerInfoData() {
|
||||
if (scannerInfoData == null) {
|
||||
scannerInfoData = ScannerInfoData.load(this);
|
||||
}
|
||||
return scannerInfoData;
|
||||
}
|
||||
|
||||
public void clearScannerInfo() throws CoreException {
|
||||
scannerInfoData = null;
|
||||
}
|
||||
|
||||
public Collection<CConsoleParser> getConsoleParsers() throws CoreException {
|
||||
IToolChain toolChain = getToolChain();
|
||||
return toolChain != null ? toolChain.getConsoleParsers() : null;
|
||||
}
|
||||
|
||||
}
|
|
@ -5,16 +5,17 @@
|
|||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.core.build;
|
||||
package org.eclipse.cdt.build.core;
|
||||
|
||||
import java.nio.file.Path;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.eclipse.cdt.core.CCorePlugin;
|
||||
import org.eclipse.cdt.core.model.ICModelMarker;
|
||||
import org.eclipse.core.resources.IFile;
|
||||
import org.eclipse.core.resources.IFolder;
|
||||
import org.eclipse.core.resources.IMarker;
|
||||
import org.eclipse.core.resources.ResourcesPlugin;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
|
||||
/**
|
||||
|
@ -99,26 +100,31 @@ public abstract class CConsoleParser {
|
|||
|
||||
protected abstract int getLinkLength(Matcher matcher);
|
||||
|
||||
public IMarker generateMarker(IFolder buildDirectory, String text) {
|
||||
public IMarker generateMarker(Path buildDirectory, String text) {
|
||||
Matcher matcher = errorPattern.matcher(text);
|
||||
if (matcher.matches()) {
|
||||
String fileName = getFileName(matcher);
|
||||
|
||||
IFile file = buildDirectory.getFile(fileName);
|
||||
if (file.exists()) {
|
||||
try {
|
||||
IMarker marker = file.createMarker(ICModelMarker.C_MODEL_PROBLEM_MARKER);
|
||||
marker.setAttribute(IMarker.MESSAGE, getMessage(matcher));
|
||||
marker.setAttribute(IMarker.SEVERITY, getSeverity(matcher));
|
||||
marker.setAttribute(IMarker.LINE_NUMBER, getLineNumber(matcher));
|
||||
marker.setAttribute(IMarker.CHAR_START, -1);
|
||||
marker.setAttribute(IMarker.CHAR_END, -1);
|
||||
marker.setAttribute(LINK_OFFSET, getLinkOffset(matcher));
|
||||
marker.setAttribute(LINK_LENGTH, getLinkLength(matcher));
|
||||
return marker;
|
||||
} catch (CoreException e) {
|
||||
CCorePlugin.log(e);
|
||||
return null;
|
||||
Path filePath = buildDirectory.resolve(fileName);
|
||||
|
||||
IFile[] files = ResourcesPlugin.getWorkspace().getRoot().findFilesForLocationURI(filePath.toUri());
|
||||
if (files.length > 0) {
|
||||
IFile file = files[0];
|
||||
if (file.exists()) {
|
||||
try {
|
||||
IMarker marker = file.createMarker(ICModelMarker.C_MODEL_PROBLEM_MARKER);
|
||||
marker.setAttribute(IMarker.MESSAGE, getMessage(matcher));
|
||||
marker.setAttribute(IMarker.SEVERITY, getSeverity(matcher));
|
||||
marker.setAttribute(IMarker.LINE_NUMBER, getLineNumber(matcher));
|
||||
marker.setAttribute(IMarker.CHAR_START, -1);
|
||||
marker.setAttribute(IMarker.CHAR_END, -1);
|
||||
marker.setAttribute(LINK_OFFSET, getLinkOffset(matcher));
|
||||
marker.setAttribute(LINK_LENGTH, getLinkLength(matcher));
|
||||
return marker;
|
||||
} catch (CoreException e) {
|
||||
CCorePlugin.log(e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -5,11 +5,10 @@
|
|||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.core.build;
|
||||
package org.eclipse.cdt.build.core;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.eclipse.core.resources.IFolder;
|
||||
import java.nio.file.Path;
|
||||
|
||||
/**
|
||||
* This may be temporary. It's uses the TextConsole's parsing and hyperlink
|
||||
|
@ -31,7 +30,7 @@ public interface IConsoleService {
|
|||
* @param buildDirectory
|
||||
* @throws IOException
|
||||
*/
|
||||
void monitor(Process process, CConsoleParser[] consoleParsers, IFolder buildDirectory) throws IOException;
|
||||
void monitor(Process process, CConsoleParser[] consoleParsers, Path buildDirectory) throws IOException;
|
||||
|
||||
/**
|
||||
* Write a message on the console stdout.
|
|
@ -0,0 +1,48 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2015 QNX Software Systems and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.build.core;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Path;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.eclipse.cdt.core.parser.IExtendedScannerInfo;
|
||||
import org.eclipse.core.resources.IResource;
|
||||
import org.eclipse.launchbar.core.target.ILaunchTarget;
|
||||
import org.osgi.service.prefs.Preferences;
|
||||
|
||||
/**
|
||||
* Represents a toolchain used to build and deploy systems.
|
||||
*/
|
||||
public interface IToolChain {
|
||||
|
||||
IToolChainType getType();
|
||||
|
||||
String getName();
|
||||
|
||||
boolean supports(ILaunchTarget target);
|
||||
|
||||
IExtendedScannerInfo getScannerInfo(String command, List<String> args, List<String> includePaths,
|
||||
IResource resource, Path buildDirectory) throws IOException;
|
||||
|
||||
Collection<CConsoleParser> getConsoleParsers();
|
||||
|
||||
void setEnvironment(Map<String, String> env);
|
||||
|
||||
/**
|
||||
* Called by the tool chain manager to save settings for this toolchain into
|
||||
* the user's preferences.
|
||||
*
|
||||
* @param properties
|
||||
* settings for the toolchain to be persisted
|
||||
*/
|
||||
void save(Preferences properties);
|
||||
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2015 QNX Software Systems and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.build.core;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import org.eclipse.launchbar.core.target.ILaunchTarget;
|
||||
|
||||
/**
|
||||
* The global toolchain manager. Accessed as an OSGi service.
|
||||
*/
|
||||
public interface IToolChainManager {
|
||||
|
||||
IToolChainType getToolChainType(String id);
|
||||
|
||||
IToolChain getToolChain(String typeId, String name);
|
||||
|
||||
Collection<IToolChain> getToolChainsSupporting(ILaunchTarget target);
|
||||
|
||||
}
|
|
@ -5,18 +5,16 @@
|
|||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.core.build;
|
||||
package org.eclipse.cdt.build.core;
|
||||
|
||||
import org.osgi.service.prefs.Preferences;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* @since 5.12
|
||||
* A provider of toolchains. Registered with the toolChainProvider extension
|
||||
* point.
|
||||
*/
|
||||
public interface IToolChainFactory {
|
||||
public interface IToolChainProvider {
|
||||
|
||||
CToolChain createToolChain(String id, Preferences settings);
|
||||
|
||||
default void discover() {
|
||||
}
|
||||
Collection<IToolChain> getToolChains();
|
||||
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2015 QNX Software Systems and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.build.core;
|
||||
|
||||
import org.osgi.service.prefs.Preferences;
|
||||
|
||||
/**
|
||||
* A type of toolchain.
|
||||
*/
|
||||
public interface IToolChainType {
|
||||
|
||||
String getId();
|
||||
|
||||
/**
|
||||
* Called by the toolchain to inflate the toolchain from the user preference
|
||||
* store.
|
||||
*
|
||||
* @param name
|
||||
* the name of the toolchain
|
||||
* @param properties
|
||||
* the persisted settings for the toolchain
|
||||
* @return the toolchain initialized with the settings.
|
||||
*/
|
||||
IToolChain getToolChain(String name, Preferences properties);
|
||||
|
||||
}
|
|
@ -0,0 +1,79 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2015 QNX Software Systems and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.build.core.internal;
|
||||
|
||||
import org.eclipse.cdt.build.core.IToolChainManager;
|
||||
import org.eclipse.core.resources.ResourcesPlugin;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
import org.eclipse.core.runtime.Plugin;
|
||||
import org.eclipse.core.runtime.Status;
|
||||
import org.osgi.framework.BundleContext;
|
||||
import org.osgi.framework.ServiceReference;
|
||||
|
||||
public class Activator extends Plugin {
|
||||
|
||||
private static Activator plugin;
|
||||
|
||||
private static ToolChainManager toolChainManager;
|
||||
private static CBuildConfigurationCleanup configCleanup;
|
||||
|
||||
public void start(BundleContext context) throws Exception {
|
||||
super.start(context);
|
||||
plugin = this;
|
||||
|
||||
toolChainManager = new ToolChainManager();
|
||||
context.registerService(IToolChainManager.class, toolChainManager, null);
|
||||
|
||||
configCleanup = new CBuildConfigurationCleanup();
|
||||
ResourcesPlugin.getWorkspace().addResourceChangeListener(configCleanup);
|
||||
|
||||
// Save participant for toolchain data
|
||||
ResourcesPlugin.getWorkspace().addSaveParticipant(getId(), new ScannerInfoSaveParticipant());
|
||||
}
|
||||
|
||||
public void stop(BundleContext context) throws Exception {
|
||||
plugin = null;
|
||||
|
||||
ResourcesPlugin.getWorkspace().removeResourceChangeListener(configCleanup);
|
||||
configCleanup = null;
|
||||
|
||||
super.stop(context);
|
||||
}
|
||||
|
||||
public static Activator getDefault() {
|
||||
return plugin;
|
||||
}
|
||||
|
||||
public static String getId() {
|
||||
return plugin.getBundle().getSymbolicName();
|
||||
}
|
||||
|
||||
public static ToolChainManager getToolChainManager() {
|
||||
return toolChainManager;
|
||||
}
|
||||
|
||||
public static void log(IStatus status) {
|
||||
plugin.getLog().log(status);
|
||||
}
|
||||
|
||||
public static void log(Exception e) {
|
||||
if (e instanceof CoreException) {
|
||||
plugin.getLog().log(((CoreException) e).getStatus());
|
||||
} else {
|
||||
plugin.getLog().log(new Status(IStatus.ERROR, getId(), e.getLocalizedMessage(), e));
|
||||
}
|
||||
}
|
||||
|
||||
public static <T> T getService(Class<T> service) {
|
||||
BundleContext context = plugin.getBundle().getBundleContext();
|
||||
ServiceReference<T> ref = context.getServiceReference(service);
|
||||
return ref != null ? context.getService(ref) : null;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,73 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2015 QNX Software Systems and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.build.core.internal;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.file.FileVisitResult;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.SimpleFileVisitor;
|
||||
import java.nio.file.attribute.BasicFileAttributes;
|
||||
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.resources.IResource;
|
||||
import org.eclipse.core.resources.IResourceChangeEvent;
|
||||
import org.eclipse.core.resources.IResourceChangeListener;
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
import org.eclipse.core.runtime.preferences.InstanceScope;
|
||||
import org.osgi.service.prefs.BackingStoreException;
|
||||
import org.osgi.service.prefs.Preferences;
|
||||
|
||||
public class CBuildConfigurationCleanup implements IResourceChangeListener {
|
||||
|
||||
@Override
|
||||
public void resourceChanged(IResourceChangeEvent event) {
|
||||
if (event.getType() == IResourceChangeEvent.PRE_CLOSE || event.getType() == IResourceChangeEvent.PRE_DELETE) {
|
||||
if (event.getResource().getType() == IResource.PROJECT) {
|
||||
IProject project = event.getResource().getProject();
|
||||
|
||||
// Clean up the config settings
|
||||
Preferences parentNode = InstanceScope.INSTANCE.getNode(Activator.getId()).node("config"); //$NON-NLS-1$
|
||||
if (parentNode != null) {
|
||||
Preferences projectNode = parentNode.node(project.getName());
|
||||
if (projectNode != null) {
|
||||
try {
|
||||
projectNode.removeNode();
|
||||
parentNode.flush();
|
||||
} catch (BackingStoreException e) {
|
||||
Activator.log(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Clean up the scanner info data
|
||||
IPath stateLoc = Activator.getDefault().getStateLocation();
|
||||
IPath scannerInfoPath = stateLoc.append(project.getName());
|
||||
Path directory = scannerInfoPath.toFile().toPath();
|
||||
try {
|
||||
Files.walkFileTree(directory, new SimpleFileVisitor<Path>() {
|
||||
@Override
|
||||
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
|
||||
Files.delete(file);
|
||||
return FileVisitResult.CONTINUE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FileVisitResult postVisitDirectory(Path dir, IOException exc) throws IOException {
|
||||
Files.delete(dir);
|
||||
return FileVisitResult.CONTINUE;
|
||||
}
|
||||
});
|
||||
} catch (IOException e) {
|
||||
Activator.log(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -5,7 +5,7 @@
|
|||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.build;
|
||||
package org.eclipse.cdt.build.core.internal;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileReader;
|
||||
|
@ -19,16 +19,15 @@ import java.util.HashSet;
|
|||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.eclipse.cdt.build.core.CBuildConfiguration;
|
||||
import org.eclipse.cdt.core.CCorePlugin;
|
||||
import org.eclipse.cdt.core.build.CBuildConfiguration;
|
||||
import org.eclipse.cdt.core.model.ILanguage;
|
||||
import org.eclipse.cdt.core.model.LanguageManager;
|
||||
import org.eclipse.cdt.core.parser.ExtendedScannerInfo;
|
||||
import org.eclipse.cdt.core.parser.IExtendedScannerInfo;
|
||||
import org.eclipse.cdt.core.parser.IScannerInfo;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.resources.IResource;
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
import org.eclipse.core.runtime.Platform;
|
||||
import org.eclipse.core.runtime.content.IContentType;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
|
@ -121,7 +120,7 @@ public class ScannerInfoData {
|
|||
queueSave();
|
||||
}
|
||||
|
||||
public void putScannerInfo(ILanguage language, ExtendedScannerInfo info) {
|
||||
public void putScannerInfo(ILanguage language, IExtendedScannerInfo info) {
|
||||
if (perLanguageInfo == null) {
|
||||
perLanguageInfo = new HashMap<>();
|
||||
}
|
||||
|
@ -130,9 +129,8 @@ public class ScannerInfoData {
|
|||
}
|
||||
|
||||
public static ScannerInfoData load(CBuildConfiguration config) {
|
||||
IPath stateLoc = Platform.getStateLocation(CCorePlugin.getDefault().getBundle());
|
||||
IPath scannerInfoPath = stateLoc.append(config.getProject().getName())
|
||||
.append(config.getName() + ".scInfo"); //$NON-NLS-1$
|
||||
IPath stateLoc = Activator.getDefault().getStateLocation();
|
||||
IPath scannerInfoPath = stateLoc.append(config.getProject().getName()).append(config.getName() + ".scInfo"); //$NON-NLS-1$
|
||||
File scannerInfoFile = scannerInfoPath.toFile();
|
||||
ScannerInfoData info = null;
|
||||
if (scannerInfoFile.canRead()) {
|
|
@ -5,7 +5,7 @@
|
|||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.build;
|
||||
package org.eclipse.cdt.build.core.internal;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
|
@ -0,0 +1,109 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2015 QNX Software Systems and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.build.core.internal;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.eclipse.cdt.build.core.IToolChain;
|
||||
import org.eclipse.cdt.build.core.IToolChainManager;
|
||||
import org.eclipse.cdt.build.core.IToolChainProvider;
|
||||
import org.eclipse.cdt.build.core.IToolChainType;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IConfigurationElement;
|
||||
import org.eclipse.core.runtime.IExtensionPoint;
|
||||
import org.eclipse.core.runtime.IExtensionRegistry;
|
||||
import org.eclipse.core.runtime.Platform;
|
||||
import org.eclipse.launchbar.core.target.ILaunchTarget;
|
||||
|
||||
public class ToolChainManager implements IToolChainManager {
|
||||
|
||||
private Map<String, IConfigurationElement> typeElements;
|
||||
private Map<String, IToolChainType> types;
|
||||
private Map<String, Map<String, IToolChain>> toolChains;
|
||||
|
||||
private void init() {
|
||||
if (typeElements == null) {
|
||||
typeElements = new HashMap<>();
|
||||
types = new HashMap<>();
|
||||
|
||||
// Load the types
|
||||
IExtensionRegistry registry = Platform.getExtensionRegistry();
|
||||
IExtensionPoint typesPoint = registry.getExtensionPoint(Activator.getId() + ".toolChainType"); //$NON-NLS-1$
|
||||
for (IConfigurationElement element : typesPoint.getConfigurationElements()) {
|
||||
String id = element.getAttribute("id"); //$NON-NLS-1$
|
||||
typeElements.put(id, element);
|
||||
}
|
||||
|
||||
// Load the discovered toolchains
|
||||
toolChains = new HashMap<>();
|
||||
IExtensionPoint providersPoint = registry.getExtensionPoint(Activator.getId() + ".toolChainProvider"); //$NON-NLS-1$
|
||||
for (IConfigurationElement element : providersPoint.getConfigurationElements()) {
|
||||
// TODO check for enablement
|
||||
try {
|
||||
IToolChainProvider provider = (IToolChainProvider) element.createExecutableExtension("class"); //$NON-NLS-1$
|
||||
for (IToolChain toolChain : provider.getToolChains()) {
|
||||
String typeId = toolChain.getType().getId();
|
||||
Map<String, IToolChain> tcs = toolChains.get(typeId);
|
||||
if (tcs == null) {
|
||||
tcs = new HashMap<>();
|
||||
toolChains.put(typeId, tcs);
|
||||
}
|
||||
tcs.put(toolChain.getName(), toolChain);
|
||||
}
|
||||
} catch (CoreException e) {
|
||||
Activator.log(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public IToolChainType getToolChainType(String id) {
|
||||
init();
|
||||
IToolChainType type = types.get(id);
|
||||
if (type == null) {
|
||||
IConfigurationElement element = typeElements.get(id);
|
||||
if (element != null) {
|
||||
try {
|
||||
type = (IToolChainType) element.createExecutableExtension("class"); //$NON-NLS-1$
|
||||
types.put(id, type);
|
||||
} catch (CoreException e) {
|
||||
Activator.log(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
return type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IToolChain getToolChain(String typeId, String name) {
|
||||
init();
|
||||
Map<String, IToolChain> tcs = toolChains.get(typeId);
|
||||
return tcs != null ? tcs.get(name) : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<IToolChain> getToolChainsSupporting(ILaunchTarget target) {
|
||||
init();
|
||||
|
||||
List<IToolChain> supportingtcs = new ArrayList<>();
|
||||
for (Map<String, IToolChain> tcs : toolChains.values()) {
|
||||
for (IToolChain tc : tcs.values()) {
|
||||
if (tc.supports(target)) {
|
||||
supportingtcs.add(tc);
|
||||
}
|
||||
}
|
||||
}
|
||||
return supportingtcs;
|
||||
}
|
||||
|
||||
}
|
|
@ -5,7 +5,7 @@
|
|||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.build;
|
||||
package org.eclipse.cdt.build.core.internal;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
|
@ -14,6 +14,7 @@ import java.util.Map;
|
|||
import java.util.Set;
|
||||
|
||||
import org.eclipse.cdt.core.parser.ExtendedScannerInfo;
|
||||
import org.eclipse.cdt.core.parser.IExtendedScannerInfo;
|
||||
import org.eclipse.cdt.core.parser.IScannerInfo;
|
||||
import org.eclipse.core.resources.IResource;
|
||||
|
||||
|
@ -27,7 +28,7 @@ public class ToolChainScannerInfo {
|
|||
|
||||
private transient IScannerInfo scannerInfo;
|
||||
|
||||
public ToolChainScannerInfo(ExtendedScannerInfo scannerInfo) {
|
||||
public ToolChainScannerInfo(IExtendedScannerInfo scannerInfo) {
|
||||
this.scannerInfo = scannerInfo;
|
||||
this.definedSymbols = scannerInfo.getDefinedSymbols();
|
||||
this.includePaths = scannerInfo.getIncludePaths();
|
7
build/org.eclipse.cdt.build.gcc.core/.classpath
Normal file
7
build/org.eclipse.cdt.build.gcc.core/.classpath
Normal file
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
|
||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
28
build/org.eclipse.cdt.build.gcc.core/.project
Normal file
28
build/org.eclipse.cdt.build.gcc.core/.project
Normal file
|
@ -0,0 +1,28 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>org.eclipse.cdt.build.gcc.core</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.pde.ManifestBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.pde.SchemaBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.pde.PluginNature</nature>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
|
@ -0,0 +1,7 @@
|
|||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
||||
org.eclipse.jdt.core.compiler.compliance=1.8
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.source=1.8
|
15
build/org.eclipse.cdt.build.gcc.core/META-INF/MANIFEST.MF
Normal file
15
build/org.eclipse.cdt.build.gcc.core/META-INF/MANIFEST.MF
Normal file
|
@ -0,0 +1,15 @@
|
|||
Manifest-Version: 1.0
|
||||
Bundle-ManifestVersion: 2
|
||||
Bundle-Name: GCC support for CDT Build Core
|
||||
Bundle-SymbolicName: org.eclipse.cdt.build.gcc.core;singleton:=true
|
||||
Bundle-Version: 1.0.0.qualifier
|
||||
Bundle-Activator: org.eclipse.cdt.build.gcc.core.internal.Activator
|
||||
Bundle-Vendor: Eclipse CDT
|
||||
Require-Bundle: org.eclipse.core.runtime,
|
||||
org.eclipse.core.resources;bundle-version="3.10.0",
|
||||
org.eclipse.launchbar.core;bundle-version="2.0.0",
|
||||
org.eclipse.cdt.build.core;bundle-version="1.0.0",
|
||||
org.eclipse.cdt.core;bundle-version="5.12.0"
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
|
||||
Bundle-ActivationPolicy: lazy
|
||||
Export-Package: org.eclipse.cdt.build.gcc.core
|
24
build/org.eclipse.cdt.build.gcc.core/about.html
Normal file
24
build/org.eclipse.cdt.build.gcc.core/about.html
Normal file
|
@ -0,0 +1,24 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml"><head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>About</title></head>
|
||||
|
||||
<body lang="EN-US">
|
||||
<h2>About This Content</h2>
|
||||
|
||||
<p>June 22, 2007</p>
|
||||
<h3>License</h3>
|
||||
|
||||
<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise
|
||||
indicated below, the Content is provided to you under the terms and conditions of the
|
||||
Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available
|
||||
at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
|
||||
For purposes of the EPL, "Program" will mean the Content.</p>
|
||||
|
||||
<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
|
||||
being redistributed by another party ("Redistributor") and different terms and conditions may
|
||||
apply to your use of any object code in the Content. Check the Redistributor's license that was
|
||||
provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
|
||||
indicated below, the terms and conditions of the EPL still apply to any source code in the Content
|
||||
and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
|
||||
|
||||
</body></html>
|
6
build/org.eclipse.cdt.build.gcc.core/build.properties
Normal file
6
build/org.eclipse.cdt.build.gcc.core/build.properties
Normal file
|
@ -0,0 +1,6 @@
|
|||
source.. = src/
|
||||
output.. = bin/
|
||||
bin.includes = META-INF/,\
|
||||
.,\
|
||||
plugin.xml,\
|
||||
about.html
|
18
build/org.eclipse.cdt.build.gcc.core/plugin.xml
Normal file
18
build/org.eclipse.cdt.build.gcc.core/plugin.xml
Normal file
|
@ -0,0 +1,18 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<?eclipse version="3.4"?>
|
||||
<plugin>
|
||||
<extension
|
||||
point="org.eclipse.cdt.build.core.toolChainType">
|
||||
<toolChainType
|
||||
class="org.eclipse.cdt.build.gcc.core.GCCToolChainType"
|
||||
id="org.eclipse.cdt.build.gcc">
|
||||
</toolChainType>
|
||||
</extension>
|
||||
<extension
|
||||
point="org.eclipse.cdt.build.core.toolChainProvider">
|
||||
<provider
|
||||
class="org.eclipse.cdt.build.gcc.core.GCCPathToolChainProvider">
|
||||
</provider>
|
||||
</extension>
|
||||
|
||||
</plugin>
|
17
build/org.eclipse.cdt.build.gcc.core/pom.xml
Normal file
17
build/org.eclipse.cdt.build.gcc.core/pom.xml
Normal file
|
@ -0,0 +1,17 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
|
||||
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>org.eclipse.cdt</groupId>
|
||||
<artifactId>cdt-parent</artifactId>
|
||||
<version>8.8.0-SNAPSHOT</version>
|
||||
<relativePath>../../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
<artifactId>org.eclipse.cdt.build.gcc.core</artifactId>
|
||||
<packaging>eclipse-plugin</packaging>
|
||||
</project>
|
|
@ -5,13 +5,16 @@
|
|||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.core.build.gcc;
|
||||
package org.eclipse.cdt.build.gcc.core;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
@ -19,22 +22,26 @@ import java.util.Map.Entry;
|
|||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.eclipse.cdt.core.build.CToolChain;
|
||||
import org.eclipse.cdt.core.build.IToolChainFactory;
|
||||
import org.osgi.service.prefs.Preferences;
|
||||
import org.eclipse.cdt.build.core.IToolChain;
|
||||
import org.eclipse.cdt.build.core.IToolChainManager;
|
||||
import org.eclipse.cdt.build.core.IToolChainProvider;
|
||||
import org.eclipse.cdt.build.core.IToolChainType;
|
||||
import org.eclipse.cdt.build.gcc.core.internal.Activator;
|
||||
|
||||
/**
|
||||
* @since 5.12
|
||||
* Finds gcc and clang on the path.
|
||||
*/
|
||||
public class GCCToolChainFactory implements IToolChainFactory {
|
||||
public class GCCPathToolChainProvider implements IToolChainProvider {
|
||||
|
||||
private static Pattern gccPattern = Pattern.compile("(.*-)?(gcc|g\\+\\+|clang|clang\\+\\+)(-[0-9].*)?"); //$NON-NLS-1$
|
||||
|
||||
/**
|
||||
* Discover gcc installs that exist on the path.
|
||||
*/
|
||||
@Override
|
||||
public void discover() {
|
||||
public Collection<IToolChain> getToolChains() {
|
||||
IToolChainManager manager = Activator.getService(IToolChainManager.class);
|
||||
IToolChainType type = null;
|
||||
|
||||
List<IToolChain> toolChains = new ArrayList<>();
|
||||
|
||||
String path = null;
|
||||
for (Entry<String, String> entry : System.getenv().entrySet()) {
|
||||
if (entry.getKey().equalsIgnoreCase("PATH")) { //$NON-NLS-1$
|
||||
|
@ -68,12 +75,29 @@ public class GCCToolChainFactory implements IToolChainFactory {
|
|||
}
|
||||
|
||||
for (Entry<String, List<String>> entry : installs.entrySet()) {
|
||||
System.out.println(entry.getKey());
|
||||
String version = entry.getKey();
|
||||
String searchStr;
|
||||
if (version.contains("LLVM")) {
|
||||
searchStr = "clang++";
|
||||
} else {
|
||||
searchStr = "g++";
|
||||
}
|
||||
|
||||
for (String command : entry.getValue()) {
|
||||
System.out.println("\t" + command);
|
||||
if (command.contains(searchStr)) {
|
||||
if (type == null) {
|
||||
type = manager.getToolChainType(GCCToolChainType.ID);
|
||||
}
|
||||
Path commandPath = Paths.get(command);
|
||||
toolChains.add(
|
||||
new GCCToolChain(type, commandPath.getParent(), commandPath.getFileName().toString()));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return toolChains;
|
||||
}
|
||||
|
||||
private static Pattern versionPattern = Pattern.compile(".*(gcc|LLVM) version .*"); //$NON-NLS-1$
|
||||
|
@ -113,9 +137,4 @@ public class GCCToolChainFactory implements IToolChainFactory {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public CToolChain createToolChain(String id, Preferences settings) {
|
||||
return new GCCToolChain(id, settings);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,260 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2015 QNX Software Systems and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.build.gcc.core;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.nio.file.FileAlreadyExistsException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.eclipse.cdt.build.core.CConsoleParser;
|
||||
import org.eclipse.cdt.build.core.IToolChain;
|
||||
import org.eclipse.cdt.build.core.IToolChainType;
|
||||
import org.eclipse.cdt.build.gcc.core.internal.Activator;
|
||||
import org.eclipse.cdt.core.parser.ExtendedScannerInfo;
|
||||
import org.eclipse.cdt.core.parser.IExtendedScannerInfo;
|
||||
import org.eclipse.core.resources.IFile;
|
||||
import org.eclipse.core.resources.IMarker;
|
||||
import org.eclipse.core.resources.IResource;
|
||||
import org.eclipse.core.resources.ResourcesPlugin;
|
||||
import org.eclipse.core.runtime.Platform;
|
||||
import org.eclipse.launchbar.core.target.ILaunchTarget;
|
||||
import org.eclipse.launchbar.core.target.ILaunchTargetManager;
|
||||
import org.osgi.service.prefs.Preferences;
|
||||
|
||||
/**
|
||||
* The GCC toolchain. Placing it in cdt.core for now.
|
||||
*
|
||||
* TODO move to it's own plug-in.
|
||||
*
|
||||
* @since 5.12
|
||||
*/
|
||||
public class GCCToolChain implements IToolChain {
|
||||
|
||||
private IToolChainType type;
|
||||
private final String name;
|
||||
private String version;
|
||||
private String target;
|
||||
|
||||
public GCCToolChain(IToolChainType type, Path path, String command) {
|
||||
this.type = type;
|
||||
getVersion(path.resolve(command).toString());
|
||||
this.name = command + '-' + version;
|
||||
}
|
||||
|
||||
protected GCCToolChain(IToolChainType type, String name) {
|
||||
this.type = type;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IToolChainType getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
private static Pattern versionPattern = Pattern.compile(".*(gcc|LLVM) version .*"); //$NON-NLS-1$
|
||||
private static Pattern targetPattern = Pattern.compile("Target: (.*)"); //$NON-NLS-1$
|
||||
|
||||
private void getVersion(String command) {
|
||||
try {
|
||||
Process proc = new ProcessBuilder(new String[] { command, "-v" }).redirectErrorStream(true) //$NON-NLS-1$
|
||||
.start();
|
||||
try (BufferedReader reader = new BufferedReader(new InputStreamReader(proc.getInputStream()))) {
|
||||
for (String line = reader.readLine(); line != null; line = reader.readLine()) {
|
||||
Matcher versionMatcher = versionPattern.matcher(line);
|
||||
if (versionMatcher.matches()) {
|
||||
version = line.trim();
|
||||
continue;
|
||||
}
|
||||
Matcher targetMatcher = targetPattern.matcher(line);
|
||||
if (targetMatcher.matches()) {
|
||||
target = targetMatcher.group(1);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
Activator.log(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setEnvironment(Map<String, String> env) {
|
||||
// TODO Auto-generated method stub
|
||||
// The base one could just assume the toolchain is already set up in the
|
||||
// user's env
|
||||
}
|
||||
|
||||
protected void addDiscoveryOptions(List<String> command) {
|
||||
command.add("-E"); //$NON-NLS-1$
|
||||
command.add("-P"); //$NON-NLS-1$
|
||||
command.add("-v"); //$NON-NLS-1$
|
||||
command.add("-dD"); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
@Override
|
||||
public IExtendedScannerInfo getScannerInfo(String command, List<String> args, List<String> includePaths,
|
||||
IResource resource, Path buildDirectory) throws IOException {
|
||||
List<String> commandLine = new ArrayList<>();
|
||||
commandLine.add(command);
|
||||
|
||||
for (String includePath : includePaths) {
|
||||
commandLine.add("-I" + includePath); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
addDiscoveryOptions(commandLine);
|
||||
commandLine.addAll(args);
|
||||
|
||||
// Change output to stdout
|
||||
for (int i = 0; i < commandLine.size() - 1; ++i) {
|
||||
if (commandLine.get(i).equals("-o")) { //$NON-NLS-1$
|
||||
commandLine.set(i + 1, "-"); //$NON-NLS-1$
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Change source file to a tmp file (needs to be empty)
|
||||
Path tmpFile = null;
|
||||
for (int i = 1; i < commandLine.size(); ++i) {
|
||||
if (!commandLine.get(i).startsWith("-")) { //$NON-NLS-1$
|
||||
// TODO optimize by dealing with multi arg options like -o
|
||||
Path filePath = buildDirectory.resolve(commandLine.get(i));
|
||||
IFile[] files = ResourcesPlugin.getWorkspace().getRoot().findFilesForLocationURI(filePath.toUri());
|
||||
if (files.length > 0) {
|
||||
// replace it with a temp file
|
||||
Path parentPath = filePath.getParent();
|
||||
int n = 0;
|
||||
while (true) {
|
||||
// TODO need to know the language
|
||||
tmpFile = parentPath.resolve(".sc" + n + ".cpp"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
commandLine.set(i, tmpFile.toString());
|
||||
try {
|
||||
Files.createFile(tmpFile);
|
||||
break;
|
||||
} catch (FileAlreadyExistsException e) {
|
||||
// try again
|
||||
++n;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Files.createDirectories(buildDirectory);
|
||||
|
||||
// Startup the command
|
||||
ProcessBuilder processBuilder = new ProcessBuilder(commandLine).directory(buildDirectory.toFile())
|
||||
.redirectErrorStream(true);
|
||||
setEnvironment(processBuilder.environment());
|
||||
Process process = processBuilder.start();
|
||||
|
||||
// Scan for the scanner info
|
||||
Map<String, String> symbols = new HashMap<>();
|
||||
List<String> includePath = new ArrayList<>();
|
||||
Pattern definePattern = Pattern.compile("#define (.*)\\s(.*)"); //$NON-NLS-1$
|
||||
boolean inIncludePaths = false;
|
||||
try (BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream()))) {
|
||||
for (String line = reader.readLine(); line != null; line = reader.readLine()) {
|
||||
if (inIncludePaths) {
|
||||
if (line.equals("End of search list.")) { //$NON-NLS-1$
|
||||
inIncludePaths = false;
|
||||
} else {
|
||||
includePath.add(line.trim());
|
||||
}
|
||||
} else if (line.startsWith("#define ")) { //$NON-NLS-1$
|
||||
Matcher matcher = definePattern.matcher(line);
|
||||
if (matcher.matches()) {
|
||||
symbols.put(matcher.group(1), matcher.group(2));
|
||||
}
|
||||
} else if (line.equals("#include <...> search starts here:")) { //$NON-NLS-1$
|
||||
inIncludePaths = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
process.waitFor();
|
||||
} catch (InterruptedException e) {
|
||||
Activator.log(e);
|
||||
}
|
||||
Files.delete(tmpFile);
|
||||
|
||||
return new ExtendedScannerInfo(symbols, includePath.toArray(new String[includePath.size()]));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<CConsoleParser> getConsoleParsers() {
|
||||
// ../src/Test.cpp:4:1: error: 'x' was not declared in this scope
|
||||
return Arrays.asList(new CConsoleParser("(.*?):(\\d+):(\\d+:)? (fatal )?error: (.*)") { //$NON-NLS-1$
|
||||
@Override
|
||||
protected int getSeverity(Matcher matcher) {
|
||||
return IMarker.SEVERITY_ERROR;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getMessage(Matcher matcher) {
|
||||
return matcher.group(5);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getLineNumber(Matcher matcher) {
|
||||
return Integer.parseInt(matcher.group(2));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getFileName(Matcher matcher) {
|
||||
return matcher.group(1);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getLinkOffset(Matcher matcher) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getLinkLength(Matcher matcher) {
|
||||
return matcher.group(1).length() + 1 + matcher.group(2).length() + 1 + matcher.group(3).length();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supports(ILaunchTarget target) {
|
||||
if (target.getTypeId().equals(ILaunchTargetManager.localLaunchTargetTypeId)) {
|
||||
switch (Platform.getOS()) {
|
||||
case Platform.OS_MACOSX:
|
||||
return this.target.contains("apple-darwin"); //$NON-NLS-1$
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save(Preferences properties) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2015 QNX Software Systems and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.build.gcc.core;
|
||||
|
||||
import org.eclipse.cdt.build.core.IToolChain;
|
||||
import org.eclipse.cdt.build.core.IToolChainType;
|
||||
import org.osgi.service.prefs.Preferences;
|
||||
|
||||
public class GCCToolChainType implements IToolChainType {
|
||||
|
||||
public static final String ID = "org.eclipse.cdt.build.gcc"; //$NON-NLS-1$
|
||||
|
||||
@Override
|
||||
public String getId() {
|
||||
return ID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IToolChain getToolChain(String name, Preferences properties) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,51 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2015 QNX Software Systems and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.build.gcc.core.internal;
|
||||
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
import org.eclipse.core.runtime.Plugin;
|
||||
import org.eclipse.core.runtime.Status;
|
||||
import org.osgi.framework.BundleContext;
|
||||
import org.osgi.framework.ServiceReference;
|
||||
|
||||
public class Activator extends Plugin {
|
||||
|
||||
private static Plugin plugin;
|
||||
|
||||
public void start(BundleContext bundleContext) throws Exception {
|
||||
plugin = this;
|
||||
}
|
||||
|
||||
public void stop(BundleContext bundleContext) throws Exception {
|
||||
plugin = null;
|
||||
}
|
||||
|
||||
public static String getId() {
|
||||
return plugin.getBundle().getSymbolicName();
|
||||
}
|
||||
|
||||
public static void log(IStatus status) {
|
||||
plugin.getLog().log(status);
|
||||
}
|
||||
|
||||
public static void log(Exception e) {
|
||||
if (e instanceof CoreException) {
|
||||
plugin.getLog().log(((CoreException) e).getStatus());
|
||||
} else {
|
||||
plugin.getLog().log(new Status(IStatus.ERROR, getId(), e.getLocalizedMessage(), e));
|
||||
}
|
||||
}
|
||||
|
||||
public static <T> T getService(Class<T> service) {
|
||||
BundleContext context = plugin.getBundle().getBundleContext();
|
||||
ServiceReference<T> ref = context.getServiceReference(service);
|
||||
return ref != null ? context.getService(ref) : null;
|
||||
}
|
||||
|
||||
}
|
7
build/org.eclipse.cdt.build.ui/.classpath
Normal file
7
build/org.eclipse.cdt.build.ui/.classpath
Normal file
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
|
||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
28
build/org.eclipse.cdt.build.ui/.project
Normal file
28
build/org.eclipse.cdt.build.ui/.project
Normal file
|
@ -0,0 +1,28 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>org.eclipse.cdt.build.ui</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.pde.ManifestBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.pde.SchemaBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.pde.PluginNature</nature>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
|
@ -0,0 +1,7 @@
|
|||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
||||
org.eclipse.jdt.core.compiler.compliance=1.8
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.source=1.8
|
17
build/org.eclipse.cdt.build.ui/META-INF/MANIFEST.MF
Normal file
17
build/org.eclipse.cdt.build.ui/META-INF/MANIFEST.MF
Normal file
|
@ -0,0 +1,17 @@
|
|||
Manifest-Version: 1.0
|
||||
Bundle-ManifestVersion: 2
|
||||
Bundle-Name: Ui
|
||||
Bundle-SymbolicName: org.eclipse.cdt.build.ui
|
||||
Bundle-Version: 1.0.0.qualifier
|
||||
Bundle-Activator: org.eclipse.cdt.build.ui.internal.Activator
|
||||
Bundle-Vendor: Eclipse CDT
|
||||
Require-Bundle: org.eclipse.cdt.build.core;bundle-version="1.0.0",
|
||||
org.eclipse.jface.text;bundle-version="3.10.0",
|
||||
org.eclipse.ui.console;bundle-version="3.6.0",
|
||||
org.eclipse.ui.ide;bundle-version="3.11.0",
|
||||
org.eclipse.ui,
|
||||
org.eclipse.core.runtime,
|
||||
org.eclipse.core.resources;bundle-version="3.10.0"
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
|
||||
Bundle-ActivationPolicy: lazy
|
||||
Service-Component: OSGI-INF/consoleservice.xml
|
|
@ -0,0 +1,6 @@
|
|||
<component name="NewConsoleService">
|
||||
<implementation class="org.eclipse.cdt.build.ui.internal.CConsoleService"/>
|
||||
<service>
|
||||
<provide interface="org.eclipse.cdt.build.core.IConsoleService"/>
|
||||
</service>
|
||||
</component>
|
24
build/org.eclipse.cdt.build.ui/about.html
Normal file
24
build/org.eclipse.cdt.build.ui/about.html
Normal file
|
@ -0,0 +1,24 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml"><head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>About</title></head>
|
||||
|
||||
<body lang="EN-US">
|
||||
<h2>About This Content</h2>
|
||||
|
||||
<p>June 22, 2007</p>
|
||||
<h3>License</h3>
|
||||
|
||||
<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise
|
||||
indicated below, the Content is provided to you under the terms and conditions of the
|
||||
Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available
|
||||
at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
|
||||
For purposes of the EPL, "Program" will mean the Content.</p>
|
||||
|
||||
<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
|
||||
being redistributed by another party ("Redistributor") and different terms and conditions may
|
||||
apply to your use of any object code in the Content. Check the Redistributor's license that was
|
||||
provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
|
||||
indicated below, the terms and conditions of the EPL still apply to any source code in the Content
|
||||
and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
|
||||
|
||||
</body></html>
|
5
build/org.eclipse.cdt.build.ui/build.properties
Normal file
5
build/org.eclipse.cdt.build.ui/build.properties
Normal file
|
@ -0,0 +1,5 @@
|
|||
source.. = src/
|
||||
output.. = bin/
|
||||
bin.includes = META-INF/,\
|
||||
.,\
|
||||
about.html
|
17
build/org.eclipse.cdt.build.ui/pom.xml
Normal file
17
build/org.eclipse.cdt.build.ui/pom.xml
Normal file
|
@ -0,0 +1,17 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
|
||||
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>org.eclipse.cdt</groupId>
|
||||
<artifactId>cdt-parent</artifactId>
|
||||
<version>8.8.0-SNAPSHOT</version>
|
||||
<relativePath>../../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
<artifactId>org.eclipse.cdt.build.ui</artifactId>
|
||||
<packaging>eclipse-plugin</packaging>
|
||||
</project>
|
|
@ -0,0 +1,53 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2015 QNX Software Systems and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.build.ui.internal;
|
||||
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
import org.eclipse.core.runtime.Status;
|
||||
import org.eclipse.ui.plugin.AbstractUIPlugin;
|
||||
import org.osgi.framework.BundleContext;
|
||||
import org.osgi.framework.ServiceReference;
|
||||
|
||||
public class Activator extends AbstractUIPlugin {
|
||||
|
||||
private static Activator plugin;
|
||||
|
||||
public void start(BundleContext context) throws Exception {
|
||||
super.start(context);
|
||||
plugin = this;
|
||||
}
|
||||
|
||||
public void stop(BundleContext context) throws Exception {
|
||||
plugin = null;
|
||||
super.stop(context);
|
||||
}
|
||||
|
||||
public static Activator getDefault() {
|
||||
return plugin;
|
||||
}
|
||||
|
||||
public static String getId() {
|
||||
return plugin.getBundle().getSymbolicName();
|
||||
}
|
||||
|
||||
public static void log(Exception e) {
|
||||
if (e instanceof CoreException) {
|
||||
plugin.getLog().log(((CoreException) e).getStatus());
|
||||
} else {
|
||||
plugin.getLog().log(new Status(IStatus.ERROR, getId(), e.getLocalizedMessage(), e));
|
||||
}
|
||||
}
|
||||
|
||||
public static <T> T getService(Class<T> service) {
|
||||
BundleContext context = plugin.getBundle().getBundleContext();
|
||||
ServiceReference<T> ref = context.getServiceReference(service);
|
||||
return ref != null ? context.getService(ref) : null;
|
||||
}
|
||||
|
||||
}
|
|
@ -5,16 +5,18 @@
|
|||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.ui.build;
|
||||
package org.eclipse.cdt.build.ui.internal;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.nio.file.Path;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
|
||||
import org.eclipse.core.resources.IFolder;
|
||||
import org.eclipse.cdt.build.core.CConsoleParser;
|
||||
import org.eclipse.cdt.build.core.IConsoleService;
|
||||
import org.eclipse.core.resources.IResourceChangeEvent;
|
||||
import org.eclipse.core.resources.IResourceChangeListener;
|
||||
import org.eclipse.core.resources.IncrementalProjectBuilder;
|
||||
|
@ -26,17 +28,13 @@ import org.eclipse.ui.console.IConsole;
|
|||
import org.eclipse.ui.console.MessageConsole;
|
||||
import org.eclipse.ui.console.MessageConsoleStream;
|
||||
|
||||
import org.eclipse.cdt.core.build.CConsoleParser;
|
||||
import org.eclipse.cdt.core.build.IConsoleService;
|
||||
import org.eclipse.cdt.ui.CUIPlugin;
|
||||
|
||||
public class CConsoleService implements IConsoleService, IResourceChangeListener {
|
||||
|
||||
private MessageConsole console;
|
||||
private MessageConsoleStream out;
|
||||
private MessageConsoleStream err;
|
||||
|
||||
private IFolder buildDirectory;
|
||||
private Path buildDirectory;
|
||||
List<CPatternMatchListener> listeners = new ArrayList<>();
|
||||
|
||||
private void initConsole() {
|
||||
|
@ -72,7 +70,7 @@ public class CConsoleService implements IConsoleService, IResourceChangeListener
|
|||
}
|
||||
|
||||
@Override
|
||||
public void monitor(final Process process, CConsoleParser[] consoleParsers, IFolder buildDirectory)
|
||||
public void monitor(final Process process, CConsoleParser[] consoleParsers, Path buildDirectory)
|
||||
throws IOException {
|
||||
if (console == null) {
|
||||
initConsole();
|
||||
|
@ -103,8 +101,7 @@ public class CConsoleService implements IConsoleService, IResourceChangeListener
|
|||
new Thread("C/C++ Build Console Output") { //$NON-NLS-1$
|
||||
@Override
|
||||
public void run() {
|
||||
try (BufferedReader processOut = new BufferedReader(
|
||||
new InputStreamReader(process.getInputStream()))) {
|
||||
try (BufferedReader processOut = new BufferedReader(new InputStreamReader(process.getInputStream()))) {
|
||||
for (String line = processOut.readLine(); line != null; line = processOut.readLine()) {
|
||||
out.write(line);
|
||||
out.write('\n');
|
||||
|
@ -121,8 +118,7 @@ public class CConsoleService implements IConsoleService, IResourceChangeListener
|
|||
new Thread("C/C++ Build Console Error") { //$NON-NLS-1$
|
||||
@Override
|
||||
public void run() {
|
||||
try (BufferedReader processErr = new BufferedReader(
|
||||
new InputStreamReader(process.getErrorStream()))) {
|
||||
try (BufferedReader processErr = new BufferedReader(new InputStreamReader(process.getErrorStream()))) {
|
||||
for (String line = processErr.readLine(); line != null; line = processErr.readLine()) {
|
||||
err.write(line);
|
||||
out.write('\n');
|
||||
|
@ -139,7 +135,7 @@ public class CConsoleService implements IConsoleService, IResourceChangeListener
|
|||
latch.await();
|
||||
process.waitFor();
|
||||
} catch (InterruptedException e) {
|
||||
CUIPlugin.log(e);
|
||||
Activator.log(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -159,7 +155,7 @@ public class CConsoleService implements IConsoleService, IResourceChangeListener
|
|||
err.write(msg);
|
||||
}
|
||||
|
||||
public IFolder getBuildDirectory() {
|
||||
public Path getBuildDirectory() {
|
||||
return buildDirectory;
|
||||
}
|
||||
|
|
@ -5,7 +5,7 @@
|
|||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.ui.build;
|
||||
package org.eclipse.cdt.build.ui.internal;
|
||||
|
||||
import org.eclipse.core.resources.IMarker;
|
||||
import org.eclipse.ui.IWorkbenchPage;
|
||||
|
@ -14,8 +14,6 @@ import org.eclipse.ui.PlatformUI;
|
|||
import org.eclipse.ui.console.IHyperlink;
|
||||
import org.eclipse.ui.ide.IDE;
|
||||
|
||||
import org.eclipse.cdt.ui.CUIPlugin;
|
||||
|
||||
public class CHyperlink implements IHyperlink {
|
||||
|
||||
private final IMarker marker;
|
||||
|
@ -38,7 +36,7 @@ public class CHyperlink implements IHyperlink {
|
|||
try {
|
||||
IDE.openEditor(page, marker);
|
||||
} catch (PartInitException e) {
|
||||
CUIPlugin.log(e);
|
||||
Activator.log(e);
|
||||
}
|
||||
}
|
||||
|
|
@ -5,17 +5,15 @@
|
|||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.ui.build;
|
||||
package org.eclipse.cdt.build.ui.internal;
|
||||
|
||||
import org.eclipse.cdt.build.core.CConsoleParser;
|
||||
import org.eclipse.core.resources.IMarker;
|
||||
import org.eclipse.jface.text.BadLocationException;
|
||||
import org.eclipse.ui.console.IPatternMatchListener;
|
||||
import org.eclipse.ui.console.PatternMatchEvent;
|
||||
import org.eclipse.ui.console.TextConsole;
|
||||
|
||||
import org.eclipse.cdt.core.build.CConsoleParser;
|
||||
import org.eclipse.cdt.ui.CUIPlugin;
|
||||
|
||||
public class CPatternMatchListener implements IPatternMatchListener {
|
||||
|
||||
protected final CConsoleService console;
|
||||
|
@ -48,7 +46,7 @@ public class CPatternMatchListener implements IPatternMatchListener {
|
|||
marker.getAttribute(CConsoleParser.LINK_LENGTH, event.getLength()));
|
||||
}
|
||||
} catch (BadLocationException e) {
|
||||
CUIPlugin.log(e);
|
||||
Activator.log(e);
|
||||
}
|
||||
}
|
||||
|
|
@ -26,4 +26,11 @@
|
|||
version="0.0.0"
|
||||
unpack="false"/>
|
||||
|
||||
<plugin
|
||||
id="org.eclipse.cdt.build.gcc.core"
|
||||
download-size="0"
|
||||
install-size="0"
|
||||
version="0.0.0"
|
||||
unpack="false"/>
|
||||
|
||||
</feature>
|
||||
|
|
|
@ -26,4 +26,11 @@
|
|||
version="0.0.0"
|
||||
unpack="false"/>
|
||||
|
||||
<plugin
|
||||
id="org.eclipse.cdt.build.gcc.core.source"
|
||||
download-size="0"
|
||||
install-size="0"
|
||||
version="0.0.0"
|
||||
unpack="false"/>
|
||||
|
||||
</feature>
|
||||
|
|
|
@ -1,17 +0,0 @@
|
|||
package org.eclipse.cdt.core.internal.build;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.eclipse.cdt.core.build.gcc.GCCToolChainFactory;
|
||||
import org.junit.Test;
|
||||
|
||||
public class GCCTests {
|
||||
|
||||
@Test
|
||||
public void tryGCCDiscovery() throws IOException {
|
||||
long start = System.currentTimeMillis();
|
||||
new GCCToolChainFactory().discover();
|
||||
System.out.println("Time: " + (System.currentTimeMillis() - start));
|
||||
}
|
||||
|
||||
}
|
|
@ -8,8 +8,6 @@ Bundle-Vendor: %providerName
|
|||
Bundle-Localization: plugin
|
||||
Export-Package: org.eclipse.cdt.core,
|
||||
org.eclipse.cdt.core.browser,
|
||||
org.eclipse.cdt.core.build,
|
||||
org.eclipse.cdt.core.build.gcc,
|
||||
org.eclipse.cdt.core.cdtvariables,
|
||||
org.eclipse.cdt.core.dom,
|
||||
org.eclipse.cdt.core.dom.ast,
|
||||
|
@ -128,7 +126,6 @@ Require-Bundle: org.eclipse.cdt.core.native;bundle-version="[5.7.0,6.0.0)";visib
|
|||
org.eclipse.core.variables;bundle-version="[3.1.100,4.0.0)",
|
||||
org.eclipse.ltk.core.refactoring;bundle-version="3.4.0",
|
||||
org.eclipse.text;bundle-version="[3.2.0,4.0.0)",
|
||||
com.ibm.icu;bundle-version="4.4.2",
|
||||
com.google.gson;bundle-version="2.2.4";resolution:=optional
|
||||
com.ibm.icu;bundle-version="4.4.2"
|
||||
Bundle-ActivationPolicy: lazy
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
* Contributors:
|
||||
* Markus Schorn - initial API and implementation
|
||||
* Sergey Prigogin (Google)
|
||||
*******************************************************************************/
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.parser.scanner;
|
||||
|
||||
import java.io.File;
|
||||
|
@ -17,29 +17,36 @@ import org.eclipse.cdt.utils.PathUtil;
|
|||
import org.eclipse.core.runtime.IPath;
|
||||
import org.eclipse.core.runtime.Path;
|
||||
|
||||
/**
|
||||
/**
|
||||
* Represents an entry of the include search path
|
||||
*/
|
||||
public final class IncludeSearchPathElement {
|
||||
private static final boolean NON_SLASH_SEPARATOR = File.separatorChar != '/';
|
||||
public static final String FRAMEWORK_VAR = "__framework__"; //$NON-NLS-1$
|
||||
public static final String FILE_VAR = "__header__"; //$NON-NLS-1$
|
||||
private static final String FRAMEWORK_HEADERS = ".framework/Headers"; //$NON-NLS-1$
|
||||
|
||||
private final String fPath;
|
||||
private final boolean fForQuoteIncludesOnly;
|
||||
private final boolean fIsFrameworkDirectory;
|
||||
|
||||
private final boolean fIsFrameworkDirectory;
|
||||
private final boolean fIsNewFrameworkDirectory;
|
||||
|
||||
IncludeSearchPathElement(String path, boolean forQuoteIncludesOnly) {
|
||||
fPath= path;
|
||||
fForQuoteIncludesOnly= forQuoteIncludesOnly;
|
||||
|
||||
fPath = path;
|
||||
fForQuoteIncludesOnly = forQuoteIncludesOnly;
|
||||
|
||||
if (path.indexOf('_') != -1 && path.indexOf(FRAMEWORK_VAR) != -1 && path.indexOf(FILE_VAR) != -1) {
|
||||
fIsFrameworkDirectory= true;
|
||||
fIsFrameworkDirectory = true;
|
||||
fIsNewFrameworkDirectory = false;
|
||||
} else if (path.endsWith(FRAMEWORK_HEADERS)) {
|
||||
fIsFrameworkDirectory = false;
|
||||
fIsNewFrameworkDirectory = true;
|
||||
} else {
|
||||
fIsFrameworkDirectory= false;
|
||||
fIsFrameworkDirectory = false;
|
||||
fIsNewFrameworkDirectory = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public boolean isForQuoteIncludesOnly() {
|
||||
return fForQuoteIncludesOnly;
|
||||
}
|
||||
|
@ -51,22 +58,33 @@ public final class IncludeSearchPathElement {
|
|||
return null;
|
||||
}
|
||||
String framework = includeDirective.substring(0, firstSep);
|
||||
String file= includeDirective.substring(firstSep + 1);
|
||||
String file = includeDirective.substring(firstSep + 1);
|
||||
if (file.length() == 0)
|
||||
return null;
|
||||
|
||||
StringBuilder buf= new StringBuilder(fPath);
|
||||
StringBuilder buf = new StringBuilder(fPath);
|
||||
replace(buf, FRAMEWORK_VAR, framework);
|
||||
replace(buf, FILE_VAR, file);
|
||||
return ScannerUtility.reconcilePath(buf.toString());
|
||||
} else if (fIsNewFrameworkDirectory) {
|
||||
int firstSep = firstSeparator(includeDirective);
|
||||
if (firstSep > 0) {
|
||||
String framework = includeDirective.substring(0, firstSep);
|
||||
String file = includeDirective.substring(firstSep + 1);
|
||||
if (file.length() > 0) {
|
||||
if (fPath.endsWith(framework + FRAMEWORK_HEADERS)) { // $NON-NLS-1$
|
||||
return ScannerUtility.createReconciledPath(fPath, file);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return ScannerUtility.createReconciledPath(fPath, includeDirective);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the include directive for the given location satisfying the condition
|
||||
* {@code getLocation(getIncludeDirective(location) == location}. If no such include directive
|
||||
* without ".." exists, returns {@code null}.
|
||||
* Returns the include directive for the given location satisfying the
|
||||
* condition {@code getLocation(getIncludeDirective(location) == location}.
|
||||
* If no such include directive without ".." exists, returns {@code null}.
|
||||
*/
|
||||
public String getIncludeDirective(String location) {
|
||||
IPath dirPath = new Path(fPath);
|
||||
|
@ -95,20 +113,20 @@ public final class IncludeSearchPathElement {
|
|||
}
|
||||
|
||||
if (!PathUtil.isPrefix(dirPath, locationPath))
|
||||
return null;
|
||||
return locationPath.removeFirstSegments(dirPath.segmentCount()).setDevice(null).toPortableString();
|
||||
return null;
|
||||
return locationPath.removeFirstSegments(dirPath.segmentCount()).setDevice(null).toPortableString();
|
||||
}
|
||||
|
||||
private int firstSeparator(String path) {
|
||||
int firstSep= path.indexOf('/');
|
||||
int firstSep = path.indexOf('/');
|
||||
if (NON_SLASH_SEPARATOR) {
|
||||
firstSep= Math.max(firstSep, path.indexOf(File.separatorChar));
|
||||
firstSep = Math.max(firstSep, path.indexOf(File.separatorChar));
|
||||
}
|
||||
return firstSep;
|
||||
}
|
||||
|
||||
private void replace(StringBuilder buf, String find, final String replace) {
|
||||
int idx= buf.indexOf(find);
|
||||
int idx = buf.indexOf(find);
|
||||
if (idx >= 0) {
|
||||
buf.replace(idx, idx + find.length(), replace);
|
||||
}
|
||||
|
|
|
@ -683,7 +683,6 @@
|
|||
<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"/>
|
||||
<extension-point id="ToolChainFactory" name="Tool Chain Factory" schema="schema/ToolChainFactory.exsd"/>
|
||||
|
||||
<extension
|
||||
point="org.eclipse.cdt.core.templateProcessTypes">
|
||||
|
@ -857,12 +856,5 @@
|
|||
ordering="first">
|
||||
</filterMatcher>
|
||||
</extension>
|
||||
<extension
|
||||
point="org.eclipse.cdt.core.ToolChainFactory">
|
||||
<factory
|
||||
class="org.eclipse.cdt.core.build.gcc.GCCToolChainFactory"
|
||||
family="GCC">
|
||||
</factory>
|
||||
</extension>
|
||||
|
||||
</plugin>
|
||||
|
|
|
@ -50,7 +50,6 @@ import org.eclipse.cdt.internal.core.CDTLogWriter;
|
|||
import org.eclipse.cdt.internal.core.CdtVarPathEntryVariableManager;
|
||||
import org.eclipse.cdt.internal.core.ICConsole;
|
||||
import org.eclipse.cdt.internal.core.PositionTrackerManager;
|
||||
import org.eclipse.cdt.internal.core.build.ScannerInfoSaveParticipant;
|
||||
import org.eclipse.cdt.internal.core.cdtvariables.CdtVariableManager;
|
||||
import org.eclipse.cdt.internal.core.cdtvariables.UserVarSupplier;
|
||||
import org.eclipse.cdt.internal.core.dom.ast.tag.TagService;
|
||||
|
@ -391,9 +390,6 @@ public class CCorePlugin extends Plugin {
|
|||
// job.
|
||||
post1.schedule();
|
||||
post2.schedule();
|
||||
|
||||
// Save participant for toolchain data
|
||||
ResourcesPlugin.getWorkspace().addSaveParticipant(PLUGIN_ID, new ScannerInfoSaveParticipant());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,159 +0,0 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2015 QNX Software Systems and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.core.build;
|
||||
|
||||
import org.eclipse.cdt.core.CCorePlugin;
|
||||
import org.eclipse.cdt.core.model.ILanguage;
|
||||
import org.eclipse.cdt.core.parser.ExtendedScannerInfo;
|
||||
import org.eclipse.cdt.core.parser.IScannerInfo;
|
||||
import org.eclipse.cdt.internal.core.build.ScannerInfoData;
|
||||
import org.eclipse.cdt.internal.core.build.ToolChainScannerInfo;
|
||||
import org.eclipse.core.resources.IBuildConfiguration;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.resources.IProjectDescription;
|
||||
import org.eclipse.core.resources.IResource;
|
||||
import org.eclipse.core.resources.ProjectScope;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IConfigurationElement;
|
||||
import org.eclipse.core.runtime.IExtension;
|
||||
import org.eclipse.core.runtime.IExtensionPoint;
|
||||
import org.eclipse.core.runtime.IExtensionRegistry;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
import org.eclipse.core.runtime.Platform;
|
||||
import org.eclipse.core.runtime.PlatformObject;
|
||||
import org.eclipse.core.runtime.Status;
|
||||
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
|
||||
import org.osgi.service.prefs.BackingStoreException;
|
||||
|
||||
/**
|
||||
* Root class for CDT build configurations. Provides access to the build
|
||||
* settings for subclasses.
|
||||
*
|
||||
* @since 5.12
|
||||
*/
|
||||
public abstract class CBuildConfiguration extends PlatformObject {
|
||||
|
||||
private static final String TOOLCHAIN = "cdt.toolChain"; //$NON-NLS-1$
|
||||
|
||||
private final IBuildConfiguration config;
|
||||
private CToolChain toolChain;
|
||||
private ScannerInfoData scannerInfoData;
|
||||
|
||||
protected CBuildConfiguration(IBuildConfiguration config) {
|
||||
this.config = config;
|
||||
}
|
||||
|
||||
public IBuildConfiguration getBuildConfiguration() {
|
||||
return config;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return config.getName();
|
||||
}
|
||||
|
||||
public IProject getProject() {
|
||||
return config.getProject();
|
||||
}
|
||||
|
||||
public void setActive(IProgressMonitor monitor) throws CoreException {
|
||||
IProject project = config.getProject();
|
||||
if (config.equals(project.getActiveBuildConfig())) {
|
||||
// already set
|
||||
return;
|
||||
}
|
||||
|
||||
IProjectDescription projectDesc = project.getDescription();
|
||||
projectDesc.setActiveBuildConfig(config.getName());
|
||||
project.setDescription(projectDesc, monitor);
|
||||
}
|
||||
|
||||
protected IEclipsePreferences getSettings() {
|
||||
return (IEclipsePreferences) new ProjectScope(config.getProject()).getNode("org.eclipse.cdt.core") //$NON-NLS-1$
|
||||
.node("config") //$NON-NLS-1$
|
||||
.node(config.getName());
|
||||
}
|
||||
|
||||
private synchronized CToolChain getToolChain(String id) throws CoreException {
|
||||
IExtensionRegistry registry = Platform.getExtensionRegistry();
|
||||
IExtensionPoint point = registry.getExtensionPoint(CCorePlugin.PLUGIN_ID + ".ToolChain"); //$NON-NLS-1$
|
||||
for (IExtension extension : point.getExtensions()) {
|
||||
for (IConfigurationElement element : extension.getConfigurationElements()) {
|
||||
String eid = element.getAttribute("id"); //$NON-NLS-1$
|
||||
if (id.equals(eid)) {
|
||||
String clsName = element.getAttribute("adaptor"); //$NON-NLS-1$
|
||||
if (clsName != null) {
|
||||
try {
|
||||
Class<?> cls = Class.forName(clsName);
|
||||
return (CToolChain) getAdapter(cls);
|
||||
} catch (ClassNotFoundException e) {
|
||||
throw new CoreException(new Status(IStatus.ERROR, CCorePlugin.PLUGIN_ID,
|
||||
"creating toolchain", e)); //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public synchronized void setToolChain(CToolChain toolChain) throws CoreException {
|
||||
this.toolChain = toolChain;
|
||||
|
||||
IEclipsePreferences settings = getSettings();
|
||||
settings.put(TOOLCHAIN, toolChain.getId());
|
||||
try {
|
||||
settings.flush();
|
||||
} catch (BackingStoreException e) {
|
||||
throw new CoreException(
|
||||
new Status(IStatus.ERROR, CCorePlugin.PLUGIN_ID, "saving toolchain id", e)); //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
|
||||
public CToolChain getToolChain() throws CoreException {
|
||||
if (toolChain == null) {
|
||||
IEclipsePreferences settings = getSettings();
|
||||
String id = settings.get(TOOLCHAIN, ""); //$NON-NLS-1$
|
||||
if (id.isEmpty()) {
|
||||
return null;
|
||||
} else {
|
||||
toolChain = getToolChain(id);
|
||||
}
|
||||
}
|
||||
return toolChain;
|
||||
}
|
||||
|
||||
public IScannerInfo getScannerInfo(IResource resource) throws CoreException {
|
||||
return getScannerInfoData().getScannerInfo(resource);
|
||||
}
|
||||
|
||||
public void putScannerInfo(ILanguage language, ExtendedScannerInfo info) {
|
||||
getScannerInfoData().putScannerInfo(language, info);
|
||||
}
|
||||
|
||||
public void putScannerInfo(IResource resource, ToolChainScannerInfo info) {
|
||||
getScannerInfoData().putScannerInfo(resource, info);
|
||||
}
|
||||
|
||||
private ScannerInfoData getScannerInfoData() {
|
||||
if (scannerInfoData == null) {
|
||||
scannerInfoData = ScannerInfoData.load(this);
|
||||
}
|
||||
return scannerInfoData;
|
||||
}
|
||||
|
||||
public void clearScannerInfo() throws CoreException {
|
||||
scannerInfoData = null;
|
||||
}
|
||||
|
||||
public CConsoleParser[] getConsoleParsers() throws CoreException {
|
||||
CToolChain toolChain = getToolChain();
|
||||
return toolChain != null ? toolChain.getConsoleParsers() : null;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,124 +0,0 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2015 QNX Software Systems and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.core.build;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.eclipse.cdt.core.parser.ExtendedScannerInfo;
|
||||
import org.eclipse.core.resources.IFile;
|
||||
import org.eclipse.core.resources.IFolder;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.PlatformObject;
|
||||
import org.osgi.service.prefs.Preferences;
|
||||
|
||||
/**
|
||||
* Root class for CDT toolchains.
|
||||
*
|
||||
* @since 5.12
|
||||
*/
|
||||
public abstract class CToolChain extends PlatformObject {
|
||||
|
||||
public static final String FAMILY = "family"; //$NON-NLS-1$
|
||||
private static final String NAME = "name"; //$NON-NLS-1$
|
||||
|
||||
private String id;
|
||||
private String name;
|
||||
|
||||
protected CToolChain(String id, Preferences settings) {
|
||||
this.id = id;
|
||||
this.name = settings.get(NAME, "<Unknown>"); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
protected CToolChain(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public abstract String getFamily();
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void save(Preferences settings) {
|
||||
settings.put(FAMILY, getFamily());
|
||||
settings.put(NAME, name);
|
||||
}
|
||||
|
||||
public static String[] splitCommand(String command) {
|
||||
// TODO deal with quotes properly, for now just strip
|
||||
return command.replace("\"", "").split("\\s+"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
}
|
||||
|
||||
public static String[] fixPaths(String[] command) {
|
||||
for (int i = 0; i < command.length; ++i) {
|
||||
if (command[i].indexOf('\\') >= 0) {
|
||||
command[i] = command[i].replace('\\', '/');
|
||||
}
|
||||
}
|
||||
return command;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the given environment to run the toolchain.
|
||||
*
|
||||
* @param env
|
||||
*/
|
||||
public void setEnvironment(Map<String, String> env) {
|
||||
// default, nothing
|
||||
}
|
||||
|
||||
/**
|
||||
* Find the file mentioned in the command line.
|
||||
*
|
||||
* @param buildFolder
|
||||
* @param commandLine
|
||||
* @return the file in the command line or null if can't be found.
|
||||
*/
|
||||
public IFile getResource(IFolder buildFolder, String[] commandLine) {
|
||||
// default, not found
|
||||
return null;
|
||||
}
|
||||
|
||||
public IFile getResource(IFolder buildFolder, String commandLine) {
|
||||
return getResource(buildFolder, splitCommand(commandLine));
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate the scanner info from the given command line
|
||||
*
|
||||
* @param buildFolder
|
||||
* @param commandLine
|
||||
* @return scanner info, or null if can't be calculated
|
||||
* @throws CoreException
|
||||
*/
|
||||
public ExtendedScannerInfo getScannerInfo(IFolder buildFolder, List<String> commandLine)
|
||||
throws CoreException {
|
||||
// default, null
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the console parsers to be used when this toolchain is being used
|
||||
* for a build.
|
||||
*
|
||||
* @return console parsers, or null if there aren't any
|
||||
*/
|
||||
public CConsoleParser[] getConsoleParsers() {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,127 +0,0 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2015 QNX Software Systems and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.core.build;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.eclipse.cdt.core.CCorePlugin;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IConfigurationElement;
|
||||
import org.eclipse.core.runtime.IExtension;
|
||||
import org.eclipse.core.runtime.IExtensionPoint;
|
||||
import org.eclipse.core.runtime.IExtensionRegistry;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
import org.eclipse.core.runtime.Platform;
|
||||
import org.eclipse.core.runtime.Status;
|
||||
import org.eclipse.core.runtime.jobs.Job;
|
||||
import org.eclipse.core.runtime.preferences.ConfigurationScope;
|
||||
import org.osgi.service.prefs.BackingStoreException;
|
||||
import org.osgi.service.prefs.Preferences;
|
||||
|
||||
/**
|
||||
* Manager that manages the list of toolchains available.
|
||||
*
|
||||
* @since 5.12
|
||||
*/
|
||||
public class CToolChainManager {
|
||||
|
||||
private static final String TOOLCHAINS = "toolchains"; //$NON-NLS-1$
|
||||
|
||||
public static final CToolChainManager instance = new CToolChainManager();
|
||||
|
||||
private Map<String, IConfigurationElement> toolChainFamilies = new HashMap<>();
|
||||
private Map<String, CToolChain> toolChains = new HashMap<>();
|
||||
|
||||
private CToolChainManager() {
|
||||
new Job("Load toolchains") {
|
||||
@Override
|
||||
protected IStatus run(IProgressMonitor monitor) {
|
||||
try {
|
||||
// Load up the families
|
||||
IExtensionRegistry registry = Platform.getExtensionRegistry();
|
||||
IExtensionPoint point = registry
|
||||
.getExtensionPoint("org.eclipse.cdt.core.ToolChainFactory"); //$NON-NLS-1$
|
||||
for (IExtension extension : point.getExtensions()) {
|
||||
for (IConfigurationElement element : extension.getConfigurationElements()) {
|
||||
String family = element.getAttribute(CToolChain.FAMILY);
|
||||
if (family != null) {
|
||||
toolChainFamilies.put(family, element);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Load up the toolchains
|
||||
Preferences toolChainsPref = getToolChainSettings();
|
||||
for (String toolChainId : toolChainsPref.childrenNames()) {
|
||||
Preferences toolChainPref = toolChainsPref.node(toolChainId);
|
||||
String family = toolChainPref.get(CToolChain.FAMILY, ""); //$NON-NLS-1$
|
||||
if (!family.isEmpty()) {
|
||||
IConfigurationElement element = toolChainFamilies.get(family);
|
||||
if (element != null) {
|
||||
IToolChainFactory factory = (IToolChainFactory) element
|
||||
.createExecutableExtension("class"); //$NON-NLS-1$
|
||||
CToolChain toolChain = factory.createToolChain(toolChainId, toolChainPref);
|
||||
toolChains.put(toolChain.getName(), toolChain);
|
||||
}
|
||||
}
|
||||
}
|
||||
return Status.OK_STATUS;
|
||||
} catch (BackingStoreException e) {
|
||||
return new Status(IStatus.ERROR, CCorePlugin.PLUGIN_ID, "loading toolchains", e);
|
||||
} catch (CoreException e) {
|
||||
return e.getStatus();
|
||||
}
|
||||
}
|
||||
}.schedule();
|
||||
}
|
||||
|
||||
private Preferences getToolChainSettings() {
|
||||
return ConfigurationScope.INSTANCE.getNode(CCorePlugin.PLUGIN_ID).node(TOOLCHAINS);
|
||||
}
|
||||
|
||||
Preferences getSettings(String id) {
|
||||
return getToolChainSettings().node(id);
|
||||
}
|
||||
|
||||
public Collection<CToolChain> getToolChains() {
|
||||
return toolChains.values();
|
||||
}
|
||||
|
||||
public void addToolChain(CToolChain toolChain) throws CoreException {
|
||||
// First find an open id for the toolchain
|
||||
String id = null;
|
||||
for (int i = 0; i < toolChains.size(); ++i) {
|
||||
String istr = String.valueOf(i);
|
||||
if (toolChains.containsKey(istr)) {
|
||||
id = istr;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (id == null) {
|
||||
id = String.valueOf(toolChains.size());
|
||||
}
|
||||
|
||||
toolChain.setId(id);
|
||||
toolChains.put(id, toolChain);
|
||||
|
||||
// save
|
||||
try {
|
||||
Preferences toolChainsPref = getToolChainSettings();
|
||||
toolChain.save(toolChainsPref.node(id));
|
||||
toolChainsPref.flush();
|
||||
} catch (BackingStoreException e) {
|
||||
throw new CoreException(
|
||||
new Status(IStatus.ERROR, CCorePlugin.PLUGIN_ID, "saving toolchain " + id, e));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -1,201 +0,0 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2015 QNX Software Systems and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.core.build.gcc;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.nio.file.FileAlreadyExistsException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.eclipse.cdt.core.CCorePlugin;
|
||||
import org.eclipse.cdt.core.build.CConsoleParser;
|
||||
import org.eclipse.cdt.core.build.CToolChain;
|
||||
import org.eclipse.cdt.core.model.CoreModel;
|
||||
import org.eclipse.cdt.core.parser.ExtendedScannerInfo;
|
||||
import org.eclipse.core.resources.IFile;
|
||||
import org.eclipse.core.resources.IFolder;
|
||||
import org.eclipse.core.resources.IMarker;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
import org.eclipse.core.runtime.Status;
|
||||
import org.osgi.service.prefs.Preferences;
|
||||
|
||||
/**
|
||||
* The GCC toolchain. Placing it in cdt.core for now.
|
||||
*
|
||||
* TODO move to it's own plug-in.
|
||||
*
|
||||
* @since 5.12
|
||||
*/
|
||||
public class GCCToolChain extends CToolChain {
|
||||
|
||||
public GCCToolChain(String id, Preferences settings) {
|
||||
super(id, settings);
|
||||
}
|
||||
|
||||
public GCCToolChain(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFamily() {
|
||||
return "GCC"; //$NON-NLS-1$
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFile getResource(IFolder buildFolder, String[] commandLine) {
|
||||
for (String arg : commandLine) {
|
||||
if (!arg.startsWith("-")) { //$NON-NLS-1$
|
||||
// TODO optimize by dealing with multi arg options like -o
|
||||
IFile file = buildFolder.getFile(arg);
|
||||
if (file.exists() && CoreModel.isTranslationUnit(file)) {
|
||||
return file;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ExtendedScannerInfo getScannerInfo(IFolder buildFolder, List<String> cmd) throws CoreException {
|
||||
try {
|
||||
String[] commandLine = cmd.toArray(new String[cmd.size()]);
|
||||
|
||||
// Change output to stdout
|
||||
for (int i = 0; i < commandLine.length - 1; ++i) {
|
||||
if (commandLine[i].equals("-o")) { //$NON-NLS-1$
|
||||
commandLine[i + 1] = "-"; //$NON-NLS-1$
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Change source file to a tmp file (needs to be empty)
|
||||
Path tmpFile = null;
|
||||
for (int i = 1; i < commandLine.length; ++i) {
|
||||
if (!commandLine[i].startsWith("-")) { //$NON-NLS-1$
|
||||
// TODO optimize by dealing with multi arg options like -o
|
||||
IFile file = buildFolder.getFile(commandLine[i]);
|
||||
if (file.exists() && CoreModel.isTranslationUnit(file)) {
|
||||
// replace it with a temp file
|
||||
Path parentPath = new File(((IFolder) file.getParent()).getLocationURI()).toPath();
|
||||
int n = 0;
|
||||
while (true) {
|
||||
tmpFile = parentPath.resolve(".sc" + n + "." + file.getFileExtension()); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
commandLine[i] = tmpFile.toString();
|
||||
try {
|
||||
Files.createFile(tmpFile);
|
||||
break;
|
||||
} catch (FileAlreadyExistsException e) {
|
||||
// try again
|
||||
++n;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Add in the magic potion: -E -P -v -dD
|
||||
String[] fullCmd = new String[commandLine.length + 4];
|
||||
fullCmd[0] = commandLine[0];
|
||||
fullCmd[1] = "-E"; //$NON-NLS-1$
|
||||
fullCmd[2] = "-P"; //$NON-NLS-1$
|
||||
fullCmd[3] = "-v"; //$NON-NLS-1$
|
||||
fullCmd[4] = "-dD"; //$NON-NLS-1$
|
||||
System.arraycopy(commandLine, 1, fullCmd, 5, commandLine.length - 1);
|
||||
fixPaths(fullCmd);
|
||||
|
||||
File buildDir = new File(buildFolder.getLocationURI());
|
||||
Files.createDirectories(buildDir.toPath());
|
||||
|
||||
// Startup the command
|
||||
ProcessBuilder processBuilder = new ProcessBuilder(fullCmd).directory(buildDir)
|
||||
.redirectErrorStream(true);
|
||||
setEnvironment(processBuilder.environment());
|
||||
Process process = processBuilder.start();
|
||||
|
||||
// Scan for the scanner info
|
||||
Map<String, String> symbols = new HashMap<>();
|
||||
List<String> includePath = new ArrayList<>();
|
||||
Pattern definePattern = Pattern.compile("#define (.*)\\s(.*)"); //$NON-NLS-1$
|
||||
boolean inIncludePaths = false;
|
||||
try (BufferedReader reader = new BufferedReader(
|
||||
new InputStreamReader(process.getInputStream()))) {
|
||||
for (String line = reader.readLine(); line != null; line = reader.readLine()) {
|
||||
if (inIncludePaths) {
|
||||
if (line.equals("End of search list.")) { //$NON-NLS-1$
|
||||
inIncludePaths = false;
|
||||
} else {
|
||||
includePath.add(line.trim());
|
||||
}
|
||||
} else if (line.startsWith("#define ")) { //$NON-NLS-1$
|
||||
Matcher matcher = definePattern.matcher(line);
|
||||
if (matcher.matches()) {
|
||||
symbols.put(matcher.group(1), matcher.group(2));
|
||||
}
|
||||
} else if (line.equals("#include <...> search starts here:")) { //$NON-NLS-1$
|
||||
inIncludePaths = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return new ExtendedScannerInfo(symbols, includePath.toArray(new String[includePath.size()]));
|
||||
} catch (IOException e) {
|
||||
throw new CoreException(new Status(IStatus.ERROR, CCorePlugin.PLUGIN_ID, "scanner info", e)); //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public CConsoleParser[] getConsoleParsers() {
|
||||
// ../src/Test.cpp:4:1: error: 'x' was not declared in this scope
|
||||
|
||||
return new CConsoleParser[] { new CConsoleParser("(.*?):(\\d+):(\\d+:)? (fatal )?error: (.*)") { //$NON-NLS-1$
|
||||
@Override
|
||||
protected int getSeverity(Matcher matcher) {
|
||||
return IMarker.SEVERITY_ERROR;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getMessage(Matcher matcher) {
|
||||
return matcher.group(5);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getLineNumber(Matcher matcher) {
|
||||
return Integer.parseInt(matcher.group(2));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getFileName(Matcher matcher) {
|
||||
return matcher.group(1);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getLinkOffset(Matcher matcher) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getLinkLength(Matcher matcher) {
|
||||
return matcher.group(1).length() + 1 + matcher.group(2).length() + 1
|
||||
+ matcher.group(3).length();
|
||||
}
|
||||
} };
|
||||
}
|
||||
|
||||
}
|
|
@ -15,7 +15,6 @@ Export-Package: org.eclipse.cdt.internal.corext;x-internal:=true,
|
|||
org.eclipse.cdt.internal.ui;x-friends:="org.eclipse.cdt.debug.edc.tests",
|
||||
org.eclipse.cdt.internal.ui.actions;x-internal:=true,
|
||||
org.eclipse.cdt.internal.ui.browser.opentype;x-internal:=true,
|
||||
org.eclipse.cdt.internal.ui.build;x-internal:=true,
|
||||
org.eclipse.cdt.internal.ui.buildconsole;x-internal:=true,
|
||||
org.eclipse.cdt.internal.ui.callhierarchy;x-internal:=true,
|
||||
org.eclipse.cdt.internal.ui.compare;x-internal:=true,
|
||||
|
@ -126,4 +125,3 @@ Require-Bundle: org.eclipse.cdt.core;bundle-version="[5.2.0,6.0.0)",
|
|||
org.eclipse.e4.ui.css.swt.theme
|
||||
Bundle-ActivationPolicy: lazy
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
|
||||
Service-Component: OSGI-INF/consoleservice.xml
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
<component name="QtConsoleService">
|
||||
<implementation class="org.eclipse.cdt.internal.ui.build.CConsoleService"/>
|
||||
<service>
|
||||
<provide interface="org.eclipse.cdt.core.build.IConsoleService"/>
|
||||
</service>
|
||||
</component>
|
3
pom.xml
3
pom.xml
|
@ -61,6 +61,8 @@
|
|||
|
||||
<module>releng/org.eclipse.cdt</module>
|
||||
<module>core/org.eclipse.cdt.core</module>
|
||||
<module>build/org.eclipse.cdt.build.core</module>
|
||||
<module>build/org.eclipse.cdt.build.ui</module>
|
||||
<module>codan/org.eclipse.cdt.codan.core</module>
|
||||
<module>codan/org.eclipse.cdt.codan.ui</module>
|
||||
<module>codan/org.eclipse.cdt.codan.core.cxx</module>
|
||||
|
@ -80,6 +82,7 @@
|
|||
<module>releng/org.eclipse.cdt.platform-feature</module>
|
||||
<module>releng/org.eclipse.cdt.platform.source-feature</module>
|
||||
|
||||
<module>build/org.eclipse.cdt.build.gcc.core</module>
|
||||
<module>build/org.eclipse.cdt.managedbuilder.gnu.ui</module>
|
||||
<module>build/org.eclipse.cdt.gnu.build-feature</module>
|
||||
<module>build/org.eclipse.cdt.gnu.build.source-feature</module>
|
||||
|
|
|
@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2
|
|||
Bundle-Name: %pluginName
|
||||
Bundle-SymbolicName: org.eclipse.cdt.qt.core;singleton:=true
|
||||
Bundle-Version: 2.0.0.qualifier
|
||||
Bundle-Activator: org.eclipse.cdt.internal.qt.core.QtPlugin
|
||||
Bundle-Activator: org.eclipse.cdt.internal.qt.core.Activator
|
||||
Bundle-Vendor: %providerName
|
||||
Require-Bundle: org.eclipse.core.runtime,
|
||||
org.eclipse.core.resources,
|
||||
|
@ -16,7 +16,9 @@ Require-Bundle: org.eclipse.core.runtime,
|
|||
org.eclipse.remote.core;bundle-version="2.0.0",
|
||||
org.eclipse.debug.core;bundle-version="3.10.0",
|
||||
org.eclipse.cdt.debug.core,
|
||||
org.freemarker;bundle-version="2.3.22"
|
||||
org.freemarker;bundle-version="2.3.22",
|
||||
org.eclipse.cdt.build.core;bundle-version="1.0.0",
|
||||
org.eclipse.cdt.build.gcc.core;bundle-version="1.0.0"
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
|
||||
Bundle-ActivationPolicy: lazy
|
||||
Bundle-Localization: plugin
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<?eclipse version="3.4"?>
|
||||
<plugin>
|
||||
<extension-point id="qmakeEnvProvider" name="%qmakeEnvProvider.name" schema="schema/qmakeEnvProvider.exsd"/>
|
||||
<extension-point id="qtInstallTargetMapper" name="Qt Install Target Mapper" schema="schema/qtInstallTargetMapper.exsd"/>
|
||||
|
||||
<extension
|
||||
point="org.eclipse.cdt.core.templates">
|
||||
|
@ -124,6 +124,7 @@
|
|||
</extension>
|
||||
<extension
|
||||
id="qtBuilder"
|
||||
name="Qt Builder"
|
||||
point="org.eclipse.core.resources.builders">
|
||||
<builder
|
||||
callOnEmptyDelta="true"
|
||||
|
@ -178,10 +179,17 @@
|
|||
point="org.eclipse.core.runtime.adapters">
|
||||
<factory
|
||||
adaptableType="org.eclipse.core.resources.IBuildConfiguration"
|
||||
class="org.eclipse.cdt.internal.qt.core.build.QtBuildConfiguration$Factory">
|
||||
class="org.eclipse.cdt.internal.qt.core.build.QtBuildConfigurationFactory">
|
||||
<adapter
|
||||
type="org.eclipse.cdt.internal.qt.core.build.QtBuildConfiguration">
|
||||
</adapter>
|
||||
</factory>
|
||||
</extension>
|
||||
<extension
|
||||
point="org.eclipse.cdt.qt.core.qtInstallTargetMapper">
|
||||
<mapper
|
||||
class="org.eclipse.cdt.internal.qt.core.LocalQtInstallTargetMapper"
|
||||
targetTypeId="org.eclipse.launchbar.core.launchTargetType.local">
|
||||
</mapper>
|
||||
</extension>
|
||||
</plugin>
|
||||
|
|
|
@ -1,138 +0,0 @@
|
|||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<!-- Schema file written by PDE -->
|
||||
<schema targetNamespace="org.eclipse.cdt.qt.core" xmlns="http://www.w3.org/2001/XMLSchema">
|
||||
|
||||
<include schemaLocation="schema://org.eclipse.core.expressions/schema/expressionLanguage.exsd"/>
|
||||
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.schema plugin="org.eclipse.cdt.qt.core" id="qmakeEnvProvider" name="QMake Environment Provider"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
This extension point allows to provide environment for qmake cmd-line tool execution.
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<element name="extension">
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.element />
|
||||
</appinfo>
|
||||
</annotation>
|
||||
<complexType>
|
||||
<sequence>
|
||||
<element ref="qmakeEnvProvider" minOccurs="1" maxOccurs="unbounded"/>
|
||||
</sequence>
|
||||
<attribute name="point" type="string" use="required">
|
||||
<annotation>
|
||||
<documentation>
|
||||
a fully qualified identifier of the target extension point
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
<attribute name="id" type="string">
|
||||
<annotation>
|
||||
<documentation>
|
||||
an optional identifier of the extension instance
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
<attribute name="name" type="string">
|
||||
<annotation>
|
||||
<documentation>
|
||||
an optional name of the extension instance
|
||||
</documentation>
|
||||
<appinfo>
|
||||
<meta.attribute translatable="true"/>
|
||||
</appinfo>
|
||||
</annotation>
|
||||
</attribute>
|
||||
</complexType>
|
||||
</element>
|
||||
|
||||
<element name="qmakeEnvProvider">
|
||||
<complexType>
|
||||
<sequence>
|
||||
<element ref="enablement" minOccurs="0" maxOccurs="1"/>
|
||||
</sequence>
|
||||
<attribute name="class" type="string" use="required">
|
||||
<annotation>
|
||||
<documentation>
|
||||
Implementation of QMake environment provider which is used to determinate environment for running QMake.
|
||||
</documentation>
|
||||
<appinfo>
|
||||
<meta.attribute kind="java" basedOn=":org.eclipse.cdt.qt.core.index.IQMakeEnvProvider"/>
|
||||
</appinfo>
|
||||
</annotation>
|
||||
</attribute>
|
||||
<attribute name="priority" type="integer">
|
||||
<annotation>
|
||||
<documentation>
|
||||
Priority of QMake environment provider. Less number means higher priority. Default priority is 0.
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
</complexType>
|
||||
</element>
|
||||
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.section type="since"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
8.2
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.section type="examples"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
The following is an example of a qmakeEnvProvider contribution:
|
||||
<p>
|
||||
<pre>
|
||||
<extension
|
||||
point="org.eclipse.cdt.qt.core.qmakeEnvProvider"
|
||||
id="example"
|
||||
name="Example QMake Env Provider Extension">
|
||||
<qmakeEnvProvider
|
||||
class="com.example.internal.ExampleProvider">
|
||||
<enablement>
|
||||
<with variable="projectNatures">
|
||||
<iterate operator="or">
|
||||
<equals value="com.example.my-nature"/>
|
||||
</iterate>
|
||||
</with>
|
||||
</enablement>
|
||||
</qmakeEnvProvider>
|
||||
</extension>
|
||||
</pre>
|
||||
</p>
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.section type="apiinfo"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
The contributed class must implement <code>org.eclipse.cdt.qt.core.index.IQMakeEnvProvider</code>.
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.section type="copyright"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
Copyright (c) 2013 QNX Software Systems and others.
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are made available under the terms of the Eclipse Public License v1.0
|
||||
which accompanies this distribution, and is available at
|
||||
http://www.eclipse.org/legal/epl-v10.html
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
</schema>
|
|
@ -1,10 +1,10 @@
|
|||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<!-- Schema file written by PDE -->
|
||||
<schema targetNamespace="org.eclipse.cdt.core" xmlns="http://www.w3.org/2001/XMLSchema">
|
||||
<schema targetNamespace="org.eclipse.cdt.qt.core" xmlns="http://www.w3.org/2001/XMLSchema">
|
||||
<annotation>
|
||||
<appInfo>
|
||||
<meta.schema plugin="org.eclipse.cdt.core" id="ToolChainFactory" name="Tool Chain Factory"/>
|
||||
</appInfo>
|
||||
<appinfo>
|
||||
<meta.schema plugin="org.eclipse.cdt.qt.core" id="qtInstallTargetMapper" name="Qt Install Target Mapper"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
[Enter description of this extension point.]
|
||||
</documentation>
|
||||
|
@ -12,13 +12,13 @@
|
|||
|
||||
<element name="extension">
|
||||
<annotation>
|
||||
<appInfo>
|
||||
<appinfo>
|
||||
<meta.element />
|
||||
</appInfo>
|
||||
</appinfo>
|
||||
</annotation>
|
||||
<complexType>
|
||||
<sequence minOccurs="1" maxOccurs="unbounded">
|
||||
<element ref="factory"/>
|
||||
<sequence>
|
||||
<element ref="mapper"/>
|
||||
</sequence>
|
||||
<attribute name="point" type="string" use="required">
|
||||
<annotation>
|
||||
|
@ -39,21 +39,24 @@
|
|||
<documentation>
|
||||
|
||||
</documentation>
|
||||
<appInfo>
|
||||
<appinfo>
|
||||
<meta.attribute translatable="true"/>
|
||||
</appInfo>
|
||||
</appinfo>
|
||||
</annotation>
|
||||
</attribute>
|
||||
</complexType>
|
||||
</element>
|
||||
|
||||
<element name="factory">
|
||||
<element name="mapper">
|
||||
<complexType>
|
||||
<attribute name="family" type="string" use="required">
|
||||
<attribute name="targetTypeId" type="string" use="required">
|
||||
<annotation>
|
||||
<documentation>
|
||||
|
||||
</documentation>
|
||||
<appinfo>
|
||||
<meta.attribute kind="identifier" basedOn="org.eclipse.launchbar.core.launchTargetTypes/launchTargetType/@id"/>
|
||||
</appinfo>
|
||||
</annotation>
|
||||
</attribute>
|
||||
<attribute name="class" type="string" use="required">
|
||||
|
@ -61,45 +64,45 @@
|
|||
<documentation>
|
||||
|
||||
</documentation>
|
||||
<appInfo>
|
||||
<meta.attribute kind="java" basedOn=":org.eclipse.cdt.core.build.IToolChainFactory"/>
|
||||
</appInfo>
|
||||
<appinfo>
|
||||
<meta.attribute kind="java" basedOn=":org.eclipse.cdt.qt.core.IQtInstallTargetMapper"/>
|
||||
</appinfo>
|
||||
</annotation>
|
||||
</attribute>
|
||||
</complexType>
|
||||
</element>
|
||||
|
||||
<annotation>
|
||||
<appInfo>
|
||||
<appinfo>
|
||||
<meta.section type="since"/>
|
||||
</appInfo>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
[Enter the first release in which this extension point appears.]
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<annotation>
|
||||
<appInfo>
|
||||
<appinfo>
|
||||
<meta.section type="examples"/>
|
||||
</appInfo>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
[Enter extension point usage example here.]
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<annotation>
|
||||
<appInfo>
|
||||
<appinfo>
|
||||
<meta.section type="apiinfo"/>
|
||||
</appInfo>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
[Enter API information here.]
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<annotation>
|
||||
<appInfo>
|
||||
<appinfo>
|
||||
<meta.section type="implementation"/>
|
||||
</appInfo>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
[Enter information about supplied implementation of this extension point.]
|
||||
</documentation>
|
|
@ -85,7 +85,7 @@ public class ASTUtil {
|
|||
try {
|
||||
return getFullyQualifiedName(((ICPPBinding) binding).getQualifiedName());
|
||||
} catch(DOMException e) {
|
||||
QtPlugin.log(e);
|
||||
Activator.log(e);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -165,7 +165,7 @@ public class ASTUtil {
|
|||
if (scope instanceof ICPPClassScope)
|
||||
return ((ICPPClassScope) scope).getClassType();
|
||||
} catch (DOMException e) {
|
||||
QtPlugin.log(e);
|
||||
Activator.log(e);
|
||||
}
|
||||
|
||||
return null;
|
||||
|
|
|
@ -7,22 +7,19 @@
|
|||
*/
|
||||
package org.eclipse.cdt.internal.qt.core;
|
||||
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
import org.eclipse.cdt.core.model.CModelException;
|
||||
import org.eclipse.cdt.internal.qt.core.index.QMakeProjectInfoManager;
|
||||
import org.eclipse.cdt.internal.qt.core.build.QtBuildConfigurationFactory;
|
||||
import org.eclipse.cdt.qt.core.IQtInstallManager;
|
||||
import org.eclipse.core.resources.ResourcesPlugin;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
import org.eclipse.core.runtime.Plugin;
|
||||
import org.eclipse.core.runtime.QualifiedName;
|
||||
import org.eclipse.core.runtime.Status;
|
||||
import org.osgi.framework.BundleContext;
|
||||
import org.osgi.framework.BundleEvent;
|
||||
import org.osgi.framework.BundleListener;
|
||||
import org.osgi.framework.ServiceReference;
|
||||
|
||||
public class QtPlugin extends Plugin {
|
||||
public class Activator extends Plugin {
|
||||
|
||||
public static final String ID = "org.eclipse.cdt.qt.core"; //$NON-NLS-1$
|
||||
public static final String SIGNAL_SLOT_TAGGER_ID = ID + ".signalslot.tagger"; //$NON-NLS-1$
|
||||
|
@ -42,43 +39,34 @@ public class QtPlugin extends Plugin {
|
|||
*/
|
||||
public static final QualifiedName QTINDEX_PROP_NAME = new QualifiedName(ID, "qtindex"); //$NON-NLS-1$
|
||||
|
||||
private static QtPlugin instance;
|
||||
private static Activator instance;
|
||||
private static QtBuildConfigurationFactory.Cleanup configCleanup;
|
||||
|
||||
public static QtPlugin getDefault() {
|
||||
public static Activator getDefault() {
|
||||
return instance;
|
||||
}
|
||||
|
||||
public QtPlugin() {
|
||||
public Activator() {
|
||||
instance = this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start(BundleContext context) throws Exception {
|
||||
// have to wait for STARTED event because
|
||||
// cannot access CoreModel.getDefault().addCProjectDescriptionListener()
|
||||
// since the CoreModel is not completely initialized at this time
|
||||
BundleListener bundleListener = new BundleListener() {
|
||||
final AtomicBoolean initStarted = new AtomicBoolean(false);
|
||||
|
||||
@Override
|
||||
public void bundleChanged(BundleEvent bundleEvent) {
|
||||
if (bundleEvent.getType() == BundleEvent.STARTED) {
|
||||
if (!initStarted.getAndSet(true)) {
|
||||
QMakeProjectInfoManager.start();
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
context.addBundleListener(bundleListener);
|
||||
super.start(context);
|
||||
|
||||
context.registerService(IQtInstallManager.class, new QtInstallManager(), null);
|
||||
|
||||
super.start(context);
|
||||
configCleanup = new QtBuildConfigurationFactory.Cleanup();
|
||||
ResourcesPlugin.getWorkspace().addResourceChangeListener(configCleanup);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stop(BundleContext context) throws Exception {
|
||||
QMakeProjectInfoManager.stop();
|
||||
// QMakeProjectInfoManager.stop();
|
||||
|
||||
ResourcesPlugin.getWorkspace().removeResourceChangeListener(configCleanup);
|
||||
configCleanup = null;
|
||||
|
||||
super.stop(context);
|
||||
}
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2015 QNX Software Systems and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.qt.core;
|
||||
|
||||
import org.eclipse.cdt.build.core.IToolChain;
|
||||
import org.eclipse.cdt.build.gcc.core.GCCToolChainType;
|
||||
import org.eclipse.cdt.qt.core.IQtInstall;
|
||||
import org.eclipse.cdt.qt.core.IQtInstallTargetMapper;
|
||||
import org.eclipse.core.runtime.Platform;
|
||||
import org.eclipse.launchbar.core.target.ILaunchTarget;
|
||||
|
||||
public class LocalQtInstallTargetMapper implements IQtInstallTargetMapper {
|
||||
|
||||
@Override
|
||||
public boolean supported(IQtInstall qtInstall, ILaunchTarget launchTarget) {
|
||||
String os = Platform.getOS();
|
||||
String arch = Platform.getOSArch();
|
||||
|
||||
switch (qtInstall.getSpec()) {
|
||||
case "macx-clang": //$NON-NLS-1$
|
||||
return Platform.OS_MACOSX.equals(os) && Platform.ARCH_X86_64.equals(arch);
|
||||
case "win32-g++": //$NON-NLS-1$
|
||||
return Platform.OS_WIN32.equals(os);
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supported(IQtInstall qtInstall, IToolChain toolChain) {
|
||||
if (toolChain.getType().equals(GCCToolChainType.ID)) {
|
||||
String spec = qtInstall.getSpec();
|
||||
return spec.endsWith("-clang") || spec.endsWith("-g++"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
|
@ -200,7 +200,7 @@ public class QtIncludePaths extends LanguageSettingsSerializableProvider {
|
|||
try {
|
||||
return Long.parseLong(value);
|
||||
} catch(NumberFormatException e) {
|
||||
QtPlugin.log("attribute name:" + attr + " value:" + value, e);
|
||||
Activator.log("attribute name:" + attr + " value:" + value, e);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
@ -230,7 +230,7 @@ public class QtIncludePaths extends LanguageSettingsSerializableProvider {
|
|||
reader = new BufferedReader(new InputStreamReader(process.getInputStream()));
|
||||
qtInstallHeadersPath = reader.readLine();
|
||||
} catch(IOException e) {
|
||||
QtPlugin.log(e);
|
||||
Activator.log(e);
|
||||
} finally {
|
||||
try {
|
||||
if (reader != null)
|
||||
|
@ -275,7 +275,7 @@ public class QtIncludePaths extends LanguageSettingsSerializableProvider {
|
|||
try {
|
||||
entries.add(new CIncludePathEntry(file.getCanonicalPath(), ICSettingEntry.READONLY | ICSettingEntry.RESOLVED));
|
||||
} catch(IOException e) {
|
||||
QtPlugin.log(e);
|
||||
Activator.log(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,7 +13,6 @@ import java.io.InputStreamReader;
|
|||
import java.nio.file.Path;
|
||||
|
||||
import org.eclipse.cdt.qt.core.IQtInstall;
|
||||
import org.eclipse.core.runtime.Platform;
|
||||
|
||||
public class QtInstall implements IQtInstall {
|
||||
|
||||
|
@ -41,17 +40,6 @@ public class QtInstall implements IQtInstall {
|
|||
return qmakePath.resolve("../lib"); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supports(String os, String arch) {
|
||||
switch (getSpec()) {
|
||||
case "macx-clang": //$NON-NLS-1$
|
||||
return Platform.OS_MACOSX.equals(os) && Platform.ARCH_X86_64.equals(arch);
|
||||
case "win32-g++": //$NON-NLS-1$
|
||||
return Platform.OS_WIN32.equals(os);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static String getSpec(String qmakePath) throws IOException {
|
||||
Process proc = new ProcessBuilder(qmakePath, "-query", "QMAKE_XSPEC").start(); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
try (BufferedReader reader = new BufferedReader(new InputStreamReader(proc.getInputStream()))) {
|
||||
|
@ -69,7 +57,7 @@ public class QtInstall implements IQtInstall {
|
|||
try {
|
||||
spec = getSpec(getQmakePath().toString());
|
||||
} catch (IOException e) {
|
||||
QtPlugin.log(e);
|
||||
Activator.log(e);
|
||||
}
|
||||
}
|
||||
return spec;
|
||||
|
|
|
@ -13,18 +13,28 @@ import java.util.Collections;
|
|||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.eclipse.cdt.build.core.IToolChain;
|
||||
import org.eclipse.cdt.qt.core.IQtInstall;
|
||||
import org.eclipse.cdt.qt.core.IQtInstallManager;
|
||||
import org.eclipse.core.runtime.preferences.InstanceScope;
|
||||
import org.eclipse.cdt.qt.core.IQtInstallTargetMapper;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IConfigurationElement;
|
||||
import org.eclipse.core.runtime.IExtension;
|
||||
import org.eclipse.core.runtime.IExtensionPoint;
|
||||
import org.eclipse.core.runtime.Platform;
|
||||
import org.eclipse.core.runtime.preferences.ConfigurationScope;
|
||||
import org.eclipse.launchbar.core.target.ILaunchTarget;
|
||||
import org.osgi.service.prefs.BackingStoreException;
|
||||
import org.osgi.service.prefs.Preferences;
|
||||
|
||||
public class QtInstallManager implements IQtInstallManager {
|
||||
|
||||
private Map<String, IQtInstall> installs;
|
||||
private Map<String, IConfigurationElement> mapperElements;
|
||||
private Map<String, IQtInstallTargetMapper> mappers;
|
||||
|
||||
private Preferences getPreferences() {
|
||||
return InstanceScope.INSTANCE.getNode(QtPlugin.ID).node("qtInstalls"); //$NON-NLS-1$
|
||||
return ConfigurationScope.INSTANCE.getNode(Activator.ID).node("qtInstalls"); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
private void initInstalls() {
|
||||
|
@ -36,7 +46,7 @@ public class QtInstallManager implements IQtInstallManager {
|
|||
installs.put(key, new QtInstall(key, Paths.get(prefs.get(key, "/")))); //$NON-NLS-1$
|
||||
}
|
||||
} catch (BackingStoreException e) {
|
||||
QtPlugin.log(e);
|
||||
Activator.log(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -58,8 +68,10 @@ public class QtInstallManager implements IQtInstallManager {
|
|||
prefs.put(key, installs.get(key).getQmakePath().toString());
|
||||
}
|
||||
}
|
||||
|
||||
prefs.flush();
|
||||
} catch (BackingStoreException e) {
|
||||
QtPlugin.log(e);
|
||||
Activator.log(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -88,4 +100,48 @@ public class QtInstallManager implements IQtInstallManager {
|
|||
saveInstalls();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supports(IQtInstall install, ILaunchTarget target) {
|
||||
if (mapperElements == null) {
|
||||
// init the extension point
|
||||
mapperElements = new HashMap<>();
|
||||
mappers = new HashMap<>();
|
||||
|
||||
IExtensionPoint point = Platform.getExtensionRegistry()
|
||||
.getExtensionPoint(Activator.ID + ".qtInstallTargetMapper"); //$NON-NLS-1$
|
||||
for (IExtension extension : point.getExtensions()) {
|
||||
for (IConfigurationElement element : extension.getConfigurationElements()) {
|
||||
String targetTypeId = element.getAttribute("targetTypeId"); //$NON-NLS-1$
|
||||
mapperElements.put(targetTypeId, element);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
String targetTypeId = target.getTypeId();
|
||||
IQtInstallTargetMapper mapper = mappers.get(targetTypeId);
|
||||
if (mapper == null) {
|
||||
IConfigurationElement element = mapperElements.get(targetTypeId);
|
||||
if (element != null) {
|
||||
try {
|
||||
mapper = (IQtInstallTargetMapper) element.createExecutableExtension("class"); //$NON-NLS-1$
|
||||
mappers.put(targetTypeId, mapper);
|
||||
} catch (CoreException e) {
|
||||
Activator.log(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (mapper == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return mapper.supported(install, target);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supports(IQtInstall install, IToolChain toolChain) {
|
||||
// TODO need another extension point for this
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -108,7 +108,7 @@ public class QtKeywords {
|
|||
try {
|
||||
return ((ICPPFunction) binding).getQualifiedName();
|
||||
} catch (DOMException e) {
|
||||
QtPlugin.log(e);
|
||||
Activator.log(e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -173,7 +173,7 @@ public class QtMethodReference extends ASTNameReference {
|
|||
try {
|
||||
qualName = cls.getQualifiedName();
|
||||
} catch(DOMException e) {
|
||||
QtPlugin.log(e);
|
||||
Activator.log(e);
|
||||
}
|
||||
|
||||
IProject project = ASTUtil.getProject(delegate);
|
||||
|
|
|
@ -36,7 +36,7 @@ public class QtNature implements IProjectNature {
|
|||
try {
|
||||
return project.hasNature(ID);
|
||||
} catch (CoreException e) {
|
||||
QtPlugin.log(e);
|
||||
Activator.log(e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -57,6 +57,9 @@ public class QtNature implements IProjectNature {
|
|||
|
||||
@Override
|
||||
public void configure() throws CoreException {
|
||||
}
|
||||
|
||||
public void configurex() throws CoreException {
|
||||
ICProject cProject = CCorePlugin.getDefault().getCoreModel().create(project);
|
||||
if (cProject == null)
|
||||
return;
|
||||
|
|
|
@ -26,11 +26,11 @@ public class QtTemplateGenerator {
|
|||
|
||||
public QtTemplateGenerator() throws CoreException {
|
||||
config = new Configuration(Configuration.VERSION_2_3_22);
|
||||
URL templateDirURL = FileLocator.find(QtPlugin.getDefault().getBundle(), new Path("/templates"), null); //$NON-NLS-1$
|
||||
URL templateDirURL = FileLocator.find(Activator.getDefault().getBundle(), new Path("/templates"), null); //$NON-NLS-1$
|
||||
try {
|
||||
config.setDirectoryForTemplateLoading(new File(FileLocator.toFileURL(templateDirURL).toURI()));
|
||||
} catch (IOException | URISyntaxException e) {
|
||||
throw new CoreException(new Status(IStatus.ERROR, QtPlugin.ID, "Template configuration", e));
|
||||
throw new CoreException(new Status(IStatus.ERROR, Activator.ID, "Template configuration", e));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -50,7 +50,7 @@ public class QtTemplateGenerator {
|
|||
}
|
||||
}
|
||||
} catch (IOException | TemplateException e) {
|
||||
throw new CoreException(new Status(IStatus.ERROR, QtPlugin.ID, "Processing template " + templateFile, e));
|
||||
throw new CoreException(new Status(IStatus.ERROR, Activator.ID, "Processing template " + templateFile, e));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -12,124 +12,79 @@ import java.io.File;
|
|||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.eclipse.cdt.build.core.CBuildConfiguration;
|
||||
import org.eclipse.cdt.build.core.IToolChain;
|
||||
import org.eclipse.cdt.core.CCorePlugin;
|
||||
import org.eclipse.cdt.core.build.CBuildConfiguration;
|
||||
import org.eclipse.cdt.core.model.ILanguage;
|
||||
import org.eclipse.cdt.core.model.LanguageManager;
|
||||
import org.eclipse.cdt.core.parser.IExtendedScannerInfo;
|
||||
import org.eclipse.cdt.core.parser.IScannerInfo;
|
||||
import org.eclipse.cdt.internal.qt.core.QtPlugin;
|
||||
import org.eclipse.cdt.internal.qt.core.Activator;
|
||||
import org.eclipse.cdt.qt.core.IQtInstall;
|
||||
import org.eclipse.cdt.qt.core.IQtInstallManager;
|
||||
import org.eclipse.core.resources.IBuildConfiguration;
|
||||
import org.eclipse.core.resources.IFolder;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.resources.IProjectDescription;
|
||||
import org.eclipse.core.resources.IResource;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IAdapterFactory;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||
import org.osgi.service.prefs.BackingStoreException;
|
||||
import org.osgi.service.prefs.Preferences;
|
||||
|
||||
public class QtBuildConfiguration extends CBuildConfiguration {
|
||||
|
||||
private IQtInstall qtInstall;
|
||||
private String launchMode;
|
||||
private static final String QTINSTALL_NAME = "cdt.qt.install.name"; //$NON-NLS-1$
|
||||
private static final String LAUNCH_MODE = "cdt.qt.launchMode"; //$NON-NLS-1$
|
||||
|
||||
private final IQtInstall qtInstall;
|
||||
private final String launchMode;
|
||||
private Map<String, String> properties;
|
||||
|
||||
public QtBuildConfiguration(IBuildConfiguration config) {
|
||||
super(config);
|
||||
|
||||
Preferences settings = getSettings();
|
||||
String installName = settings.get(QTINSTALL_NAME, ""); //$NON-NLS-1$
|
||||
if (!installName.isEmpty()) {
|
||||
IQtInstallManager manager = Activator.getService(IQtInstallManager.class);
|
||||
qtInstall = manager.getInstall(installName);
|
||||
} else {
|
||||
qtInstall = null;
|
||||
}
|
||||
|
||||
launchMode = settings.get(LAUNCH_MODE, ""); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
private static Map<IBuildConfiguration, QtBuildConfiguration> cache = new HashMap<>();
|
||||
public QtBuildConfiguration(IBuildConfiguration config, IToolChain toolChain, IQtInstall qtInstall,
|
||||
String launchMode) {
|
||||
super(config, toolChain);
|
||||
this.qtInstall = qtInstall;
|
||||
this.launchMode = launchMode;
|
||||
|
||||
public static class Factory implements IAdapterFactory {
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public <T> T getAdapter(Object adaptableObject, Class<T> adapterType) {
|
||||
if (adapterType.equals(QtBuildConfiguration.class) && adaptableObject instanceof IBuildConfiguration) {
|
||||
synchronized (cache) {
|
||||
IBuildConfiguration config = (IBuildConfiguration) adaptableObject;
|
||||
QtBuildConfiguration qtConfig = cache.get(config);
|
||||
if (qtConfig == null) {
|
||||
qtConfig = new QtBuildConfiguration(config);
|
||||
cache.put(config, qtConfig);
|
||||
}
|
||||
return (T) qtConfig;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
Preferences settings = getSettings();
|
||||
settings.put(QTINSTALL_NAME, qtInstall.getName());
|
||||
settings.put(LAUNCH_MODE, launchMode);
|
||||
try {
|
||||
settings.flush();
|
||||
} catch (BackingStoreException e) {
|
||||
Activator.log(e);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<?>[] getAdapterList() {
|
||||
return new Class<?>[] { QtBuildConfiguration.class };
|
||||
}
|
||||
}
|
||||
|
||||
public static QtBuildConfiguration getConfig(IProject project, String os, String arch, String launchMode,
|
||||
IProgressMonitor monitor) throws CoreException {
|
||||
// return it if it exists already
|
||||
for (IBuildConfiguration config : project.getBuildConfigs()) {
|
||||
QtBuildConfiguration qtConfig = config.getAdapter(QtBuildConfiguration.class);
|
||||
IQtInstall qtInstall = qtConfig.getQtInstall();
|
||||
if (qtInstall != null && qtInstall.supports(os, arch) && launchMode.equals(qtConfig.getLaunchMode())) {
|
||||
return qtConfig;
|
||||
}
|
||||
}
|
||||
|
||||
// Nope, create it
|
||||
for (IQtInstall qtInstall : QtPlugin.getService(IQtInstallManager.class).getInstalls()) {
|
||||
if (qtInstall.supports(os, arch)) {
|
||||
Set<String> configNames = new HashSet<>();
|
||||
for (IBuildConfiguration config : project.getBuildConfigs()) {
|
||||
configNames.add(config.getName());
|
||||
}
|
||||
String baseName = qtInstall.getSpec() + ":" + launchMode; //$NON-NLS-1$
|
||||
String newName = baseName;
|
||||
int n = 0;
|
||||
while (configNames.contains(newName)) {
|
||||
newName = baseName + (++n);
|
||||
}
|
||||
configNames.add(newName);
|
||||
IProjectDescription projectDesc = project.getDescription();
|
||||
projectDesc.setBuildConfigs(configNames.toArray(new String[configNames.size()]));
|
||||
project.setDescription(projectDesc, monitor);
|
||||
|
||||
QtBuildConfiguration qtConfig = project.getBuildConfig(newName).getAdapter(QtBuildConfiguration.class);
|
||||
qtConfig.setup(qtInstall, launchMode);
|
||||
return qtConfig;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public IQtInstall getQtInstall() {
|
||||
if (qtInstall == null) {
|
||||
// TODO set based on settings
|
||||
}
|
||||
return qtInstall;
|
||||
}
|
||||
|
||||
private String getLaunchMode() {
|
||||
if (launchMode != null) {
|
||||
// TODO set based on settings
|
||||
}
|
||||
public String getLaunchMode() {
|
||||
return launchMode;
|
||||
}
|
||||
|
||||
private void setup(IQtInstall qtInstall, String launchMode) {
|
||||
this.qtInstall = qtInstall;
|
||||
this.launchMode = launchMode;
|
||||
// TODO save settings
|
||||
}
|
||||
|
||||
public String getQmakeCommand() {
|
||||
return qtInstall.getQmakePath().toString();
|
||||
}
|
||||
|
@ -157,8 +112,28 @@ public class QtBuildConfiguration extends CBuildConfiguration {
|
|||
}
|
||||
}
|
||||
|
||||
public IFolder getBuildFolder() {
|
||||
return getProject().getFolder("build").getFolder(getBuildConfiguration().getName()); //$NON-NLS-1$
|
||||
private IFolder getBuildFolder() {
|
||||
String configName = getBuildConfiguration().getName();
|
||||
if (configName.isEmpty()) {
|
||||
configName = "default"; //$NON-NLS-1$
|
||||
}
|
||||
|
||||
try {
|
||||
// TODO should really be passing a monitor in here or create this in
|
||||
// a better spot. should also throw the core exception
|
||||
IFolder buildRootFolder = getProject().getFolder("build"); //$NON-NLS-1$
|
||||
if (!buildRootFolder.exists()) {
|
||||
buildRootFolder.create(IResource.FORCE | IResource.DERIVED, true, new NullProgressMonitor());
|
||||
}
|
||||
IFolder buildFolder = buildRootFolder.getFolder(configName);
|
||||
if (!buildFolder.exists()) {
|
||||
buildFolder.create(true, true, new NullProgressMonitor());
|
||||
}
|
||||
return buildFolder;
|
||||
} catch (CoreException e) {
|
||||
Activator.log(e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public Path getBuildDirectory() {
|
||||
|
@ -183,16 +158,16 @@ public class QtBuildConfiguration extends CBuildConfiguration {
|
|||
try (BufferedReader reader = new BufferedReader(new InputStreamReader(proc.getInputStream()))) {
|
||||
properties = new HashMap<>();
|
||||
for (String line = reader.readLine(); line != null; line = reader.readLine()) {
|
||||
if (line.contains("=")) { //$NON-NLS-1$
|
||||
String[] parts = line.split("="); //$NON-NLS-1$
|
||||
if (parts.length == 2) {
|
||||
properties.put(parts[0].trim(), parts[1].trim());
|
||||
}
|
||||
int i = line.indexOf('=');
|
||||
if (i >= 0) {
|
||||
String k = line.substring(0, i);
|
||||
String v = line.substring(i + 1);
|
||||
properties.put(k.trim(), v.trim());
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
QtPlugin.log(e);
|
||||
Activator.log(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -200,28 +175,31 @@ public class QtBuildConfiguration extends CBuildConfiguration {
|
|||
}
|
||||
|
||||
@Override
|
||||
public IScannerInfo getScannerInfo(IResource resource) throws CoreException {
|
||||
public IScannerInfo getScannerInfo(IResource resource) throws IOException {
|
||||
IScannerInfo info = super.getScannerInfo(resource);
|
||||
if (info == null) {
|
||||
List<String> cmd = new ArrayList<>();
|
||||
cmd.add(getProperty("QMAKE_CXX")); //$NON-NLS-1$
|
||||
cmd.addAll(Arrays.asList(getProperty("QMAKE_CXXFLAGS").split(" "))); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
String cxx = getProperty("QMAKE_CXX"); //$NON-NLS-1$
|
||||
String[] cxxSplit = cxx.split(" "); //$NON-NLS-1$
|
||||
String command = cxxSplit[0];
|
||||
|
||||
for (String include : getProperty("INCLUDEPATH").split(" ")) { //$NON-NLS-1$ //$NON-NLS-2$
|
||||
cmd.add("-I"); //$NON-NLS-1$
|
||||
cmd.add(include);
|
||||
List<String> args = new ArrayList<>();
|
||||
for (int i = 1; i < cxxSplit.length; ++i) {
|
||||
args.add(cxxSplit[i]);
|
||||
}
|
||||
args.addAll(Arrays.asList(getProperty("QMAKE_CXXFLAGS").split(" "))); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
args.add("-o"); //$NON-NLS-1$
|
||||
args.add("-"); //$NON-NLS-1$
|
||||
args.add(resource.getLocation().toString());
|
||||
|
||||
cmd.add("-o"); //$NON-NLS-1$
|
||||
cmd.add("-"); //$NON-NLS-1$
|
||||
|
||||
// TODO need to make sure this path is valid
|
||||
// The gcc toolchain uses IFile to make sure it exists
|
||||
cmd.add(resource.getFullPath().toPortableString());
|
||||
String[] includePaths = getProperty("INCLUDEPATH").split(" "); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
|
||||
ILanguage language = LanguageManager.getInstance()
|
||||
.getLanguage(CCorePlugin.getContentType(getProject(), resource.getName()), getProject()); // $NON-NLS-1$
|
||||
putScannerInfo(language, getToolChain().getScannerInfo(getBuildFolder(), cmd));
|
||||
Path dir = Paths.get(getProject().getLocationURI());
|
||||
IExtendedScannerInfo extendedInfo = getToolChain().getScannerInfo(command, args,
|
||||
Arrays.asList(includePaths), resource, dir);
|
||||
putScannerInfo(language, extendedInfo);
|
||||
info = extendedInfo;
|
||||
}
|
||||
return info;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,171 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2015 QNX Software Systems and others. All rights reserved. This
|
||||
* program and the accompanying materials are made available under the terms of
|
||||
* the Eclipse Public License v1.0 which accompanies this distribution, and is
|
||||
* available at http://www.eclipse.org/legal/epl-v10.html
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.qt.core.build;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.eclipse.cdt.build.core.IToolChain;
|
||||
import org.eclipse.cdt.build.core.IToolChainManager;
|
||||
import org.eclipse.cdt.internal.qt.core.Activator;
|
||||
import org.eclipse.cdt.internal.qt.core.QtNature;
|
||||
import org.eclipse.cdt.qt.core.IQtInstall;
|
||||
import org.eclipse.cdt.qt.core.IQtInstallManager;
|
||||
import org.eclipse.core.resources.IBuildConfiguration;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.resources.IProjectDescription;
|
||||
import org.eclipse.core.resources.IResource;
|
||||
import org.eclipse.core.resources.IResourceChangeEvent;
|
||||
import org.eclipse.core.resources.IResourceChangeListener;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IAdapterFactory;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.launchbar.core.target.ILaunchTarget;
|
||||
import org.eclipse.launchbar.core.target.ILaunchTargetManager;
|
||||
|
||||
public class QtBuildConfigurationFactory implements IAdapterFactory {
|
||||
|
||||
private static IQtInstallManager qtInstallManager = Activator.getService(IQtInstallManager.class);
|
||||
private static IToolChainManager toolChainManager = Activator.getService(IToolChainManager.class);
|
||||
|
||||
private static Map<IBuildConfiguration, QtBuildConfiguration> cache = new HashMap<>();
|
||||
|
||||
@Override
|
||||
public Class<?>[] getAdapterList() {
|
||||
return new Class<?>[] { QtBuildConfiguration.class };
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public <T> T getAdapter(Object adaptableObject, Class<T> adapterType) {
|
||||
if (adapterType.equals(QtBuildConfiguration.class) && adaptableObject instanceof IBuildConfiguration) {
|
||||
IBuildConfiguration config = (IBuildConfiguration) adaptableObject;
|
||||
synchronized (cache) {
|
||||
QtBuildConfiguration qtConfig = cache.get(config);
|
||||
if (qtConfig == null) {
|
||||
if (!config.getName().equals(IBuildConfiguration.DEFAULT_CONFIG_NAME)) {
|
||||
qtConfig = new QtBuildConfiguration(config);
|
||||
cache.put(config, qtConfig);
|
||||
return (T) qtConfig;
|
||||
} else {
|
||||
// Default to local
|
||||
ILaunchTargetManager targetManager = Activator.getService(ILaunchTargetManager.class);
|
||||
ILaunchTarget localTarget = targetManager
|
||||
.getLaunchTargetsOfType(ILaunchTargetManager.localLaunchTargetTypeId)[0];
|
||||
qtConfig = createDefaultConfig(config, localTarget);
|
||||
if (qtConfig != null) {
|
||||
cache.put(config, qtConfig);
|
||||
return (T) qtConfig;
|
||||
}
|
||||
|
||||
// Just find a combination that works
|
||||
for (ILaunchTarget target : targetManager.getLaunchTargets()) {
|
||||
if (!target.equals(localTarget)) {
|
||||
qtConfig = createDefaultConfig(config, localTarget);
|
||||
if (qtConfig != null) {
|
||||
cache.put(config, qtConfig);
|
||||
return (T) qtConfig;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// TODO if we don't have a target, need another way to
|
||||
// match whatever qtInstalls we have with matching
|
||||
// toolchains
|
||||
}
|
||||
}
|
||||
return (T) qtConfig;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private static QtBuildConfiguration createDefaultConfig(IBuildConfiguration config, ILaunchTarget target) {
|
||||
for (IQtInstall qtInstall : qtInstallManager.getInstalls()) {
|
||||
if (qtInstallManager.supports(qtInstall, target)) {
|
||||
// Find the toolchain
|
||||
for (IToolChain toolChain : toolChainManager.getToolChainsSupporting(target)) {
|
||||
if (qtInstallManager.supports(qtInstall, toolChain)) {
|
||||
return new QtBuildConfiguration(config, toolChain, qtInstall, "run"); //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static QtBuildConfiguration getConfig(IProject project, String launchMode, ILaunchTarget target,
|
||||
IProgressMonitor monitor) throws CoreException {
|
||||
// return it if it exists already
|
||||
for (IBuildConfiguration config : project.getBuildConfigs()) {
|
||||
QtBuildConfiguration qtConfig = config.getAdapter(QtBuildConfiguration.class);
|
||||
IQtInstall qtInstall = qtConfig.getQtInstall();
|
||||
if (qtInstall != null && qtInstallManager.supports(qtInstall, target)
|
||||
&& launchMode.equals(qtConfig.getLaunchMode())) {
|
||||
return qtConfig;
|
||||
}
|
||||
}
|
||||
|
||||
// Nope, create it
|
||||
for (IQtInstall qtInstall : qtInstallManager.getInstalls()) {
|
||||
if (qtInstallManager.supports(qtInstall, target)) {
|
||||
// Create the build config
|
||||
Set<String> configNames = new HashSet<>();
|
||||
for (IBuildConfiguration config : project.getBuildConfigs()) {
|
||||
configNames.add(config.getName());
|
||||
}
|
||||
String baseName = qtInstall.getSpec() + ":" + launchMode; //$NON-NLS-1$
|
||||
String newName = baseName;
|
||||
int n = 0;
|
||||
while (configNames.contains(newName)) {
|
||||
newName = baseName + (++n);
|
||||
}
|
||||
configNames.add(newName);
|
||||
IProjectDescription projectDesc = project.getDescription();
|
||||
projectDesc.setBuildConfigs(configNames.toArray(new String[configNames.size()]));
|
||||
project.setDescription(projectDesc, monitor);
|
||||
|
||||
// Find the toolchain
|
||||
IToolChainManager toolChainManager = Activator.getService(IToolChainManager.class);
|
||||
for (IToolChain toolChain : toolChainManager.getToolChainsSupporting(target)) {
|
||||
if (qtInstallManager.supports(qtInstall, toolChain)) {
|
||||
QtBuildConfiguration qtConfig = new QtBuildConfiguration(project.getBuildConfig(newName),
|
||||
toolChain, qtInstall, launchMode);
|
||||
return qtConfig;
|
||||
// TODO what if there's more than toolChain supported?
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static class Cleanup implements IResourceChangeListener {
|
||||
@Override
|
||||
public void resourceChanged(IResourceChangeEvent event) {
|
||||
if (event.getType() == IResourceChangeEvent.PRE_CLOSE
|
||||
|| event.getType() == IResourceChangeEvent.PRE_DELETE) {
|
||||
if (event.getResource().getType() == IResource.PROJECT) {
|
||||
IProject project = event.getResource().getProject();
|
||||
if (QtNature.hasNature(project)) {
|
||||
try {
|
||||
for (IBuildConfiguration config : project.getBuildConfigs()) {
|
||||
cache.remove(config);
|
||||
}
|
||||
} catch (CoreException e) {
|
||||
Activator.log(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -7,17 +7,15 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.qt.core.build;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Path;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.eclipse.cdt.core.build.IConsoleService;
|
||||
import org.eclipse.cdt.internal.qt.core.QtPlugin;
|
||||
import org.eclipse.core.resources.IContainer;
|
||||
import org.eclipse.cdt.build.core.IConsoleService;
|
||||
import org.eclipse.cdt.internal.qt.core.Activator;
|
||||
import org.eclipse.core.resources.IFile;
|
||||
import org.eclipse.core.resources.IFolder;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.resources.IResource;
|
||||
import org.eclipse.core.resources.IncrementalProjectBuilder;
|
||||
|
@ -29,20 +27,17 @@ import org.eclipse.core.runtime.Status;
|
|||
|
||||
public class QtBuilder extends IncrementalProjectBuilder {
|
||||
|
||||
public static final String ID = QtPlugin.ID + ".qtBuilder"; //$NON-NLS-1$
|
||||
public static final String ID = Activator.ID + ".qtBuilder"; //$NON-NLS-1$
|
||||
|
||||
@Override
|
||||
protected IProject[] build(int kind, Map<String, String> args, IProgressMonitor monitor) throws CoreException {
|
||||
IProject project = getProject();
|
||||
try {
|
||||
IConsoleService console = QtPlugin.getService(IConsoleService.class);
|
||||
IConsoleService console = Activator.getService(IConsoleService.class);
|
||||
QtBuildConfiguration qtConfig = getBuildConfig().getAdapter(QtBuildConfiguration.class);
|
||||
|
||||
IFolder buildFolder = qtConfig.getBuildFolder();
|
||||
createFolder(buildFolder, monitor);
|
||||
|
||||
IFile makeFile = buildFolder.getFile("Makefile"); //$NON-NLS-1$
|
||||
if (!makeFile.exists()) {
|
||||
Path buildDir = qtConfig.getBuildDirectory();
|
||||
if (!buildDir.resolve("Makefile").toFile().exists()) { //$NON-NLS-1$
|
||||
// Need to run qmake
|
||||
List<String> command = new ArrayList<>();
|
||||
command.add(qtConfig.getQmakeCommand());
|
||||
|
@ -55,21 +50,21 @@ public class QtBuilder extends IncrementalProjectBuilder {
|
|||
IFile projectFile = qtConfig.getProject().getFile("main.pro");
|
||||
command.add(projectFile.getLocation().toOSString());
|
||||
|
||||
Process process = new ProcessBuilder(command).directory(new File(buildFolder.getLocationURI())).start();
|
||||
Process process = new ProcessBuilder(command).directory(buildDir.toFile()).start();
|
||||
StringBuffer msg = new StringBuffer();
|
||||
for (String arg : command) {
|
||||
msg.append(arg).append(' ');
|
||||
}
|
||||
msg.append('\n');
|
||||
console.writeOutput(msg.toString());
|
||||
console.monitor(process, null, buildFolder);
|
||||
console.monitor(process, null, buildDir);
|
||||
}
|
||||
|
||||
// run make
|
||||
// TODO obviously hardcoding here
|
||||
boolean isWin = Platform.getOS().equals(Platform.OS_WIN32);
|
||||
String make = isWin ? "C:/Qt/Tools/mingw492_32/bin/mingw32-make" : "make";
|
||||
ProcessBuilder procBuilder = new ProcessBuilder(make).directory(new File(buildFolder.getLocationURI())); //$NON-NLS-1$
|
||||
ProcessBuilder procBuilder = new ProcessBuilder(make).directory(buildDir.toFile());
|
||||
if (isWin) {
|
||||
// Need to put the toolchain into env
|
||||
Map<String, String> env = procBuilder.environment();
|
||||
|
@ -79,22 +74,13 @@ public class QtBuilder extends IncrementalProjectBuilder {
|
|||
}
|
||||
Process process = procBuilder.start();
|
||||
console.writeOutput("make\n"); //$NON-NLS-1$
|
||||
console.monitor(process, null, buildFolder);
|
||||
console.monitor(process, null, buildDir);
|
||||
|
||||
buildFolder.refreshLocal(IResource.DEPTH_INFINITE, monitor);
|
||||
project.refreshLocal(IResource.DEPTH_INFINITE, monitor);
|
||||
return new IProject[] { project };
|
||||
} catch (IOException e) {
|
||||
throw new CoreException(new Status(IStatus.ERROR, QtPlugin.ID, "Building " + project.getName(), e));
|
||||
throw new CoreException(new Status(IStatus.ERROR, Activator.ID, "Building " + project.getName(), e));
|
||||
}
|
||||
}
|
||||
|
||||
private void createFolder(IFolder folder, IProgressMonitor monitor) throws CoreException {
|
||||
IContainer parent = folder.getParent();
|
||||
if (!parent.exists()) {
|
||||
createFolder((IFolder) parent, monitor);
|
||||
}
|
||||
if (!folder.exists()) {
|
||||
folder.create(IResource.FORCE | IResource.DERIVED, true, monitor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,10 +7,12 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.qt.core.build;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.eclipse.cdt.core.parser.IScannerInfo;
|
||||
import org.eclipse.cdt.core.parser.IScannerInfoChangeListener;
|
||||
import org.eclipse.cdt.core.parser.IScannerInfoProvider;
|
||||
import org.eclipse.cdt.internal.qt.core.QtPlugin;
|
||||
import org.eclipse.cdt.internal.qt.core.Activator;
|
||||
import org.eclipse.core.resources.IBuildConfiguration;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.resources.IResource;
|
||||
|
@ -24,11 +26,13 @@ public class QtScannerInfoProvider implements IScannerInfoProvider {
|
|||
IProject project = resource.getProject();
|
||||
IBuildConfiguration config = project.getActiveBuildConfig();
|
||||
QtBuildConfiguration qtConfig = config.getAdapter(QtBuildConfiguration.class);
|
||||
return qtConfig.getScannerInfo(resource);
|
||||
} catch (CoreException e) {
|
||||
QtPlugin.log(e);
|
||||
return null;
|
||||
if (qtConfig != null) {
|
||||
return qtConfig.getScannerInfo(resource);
|
||||
}
|
||||
} catch (CoreException | IOException e) {
|
||||
Activator.log(e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -22,7 +22,7 @@ import org.eclipse.cdt.internal.qt.core.ASTUtil;
|
|||
import org.eclipse.cdt.internal.qt.core.QtFunctionCall;
|
||||
import org.eclipse.cdt.internal.qt.core.QtMethodReference;
|
||||
import org.eclipse.cdt.internal.qt.core.QtNature;
|
||||
import org.eclipse.cdt.internal.qt.core.QtPlugin;
|
||||
import org.eclipse.cdt.internal.qt.core.Activator;
|
||||
import org.eclipse.cdt.internal.qt.core.index.IQMethod;
|
||||
import org.eclipse.core.resources.IResource;
|
||||
import org.eclipse.core.runtime.OperationCanceledException;
|
||||
|
@ -94,9 +94,9 @@ public class QtSyntaxChecker extends AbstractIndexAstChecker implements IChecker
|
|||
|
||||
private void report(IASTNode node, String message, Object... args) {
|
||||
if (args.length <= 0)
|
||||
reportProblem(QtPlugin.QT_SYNTAX_ERR_ID, node, message);
|
||||
reportProblem(Activator.QT_SYNTAX_ERR_ID, node, message);
|
||||
else
|
||||
reportProblem(QtPlugin.QT_SYNTAX_ERR_ID, node, NLS.bind(message, args));
|
||||
reportProblem(Activator.QT_SYNTAX_ERR_ID, node, NLS.bind(message, args));
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
package org.eclipse.cdt.internal.qt.core.index;
|
||||
|
||||
import org.eclipse.cdt.core.index.IIndex;
|
||||
import org.eclipse.cdt.internal.qt.core.QtPlugin;
|
||||
import org.eclipse.cdt.internal.qt.core.Activator;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
|
||||
/**
|
||||
|
@ -52,7 +52,7 @@ public class CDTIndex {
|
|||
try {
|
||||
return accessor.access(index);
|
||||
} catch(CoreException e) {
|
||||
QtPlugin.log( e );
|
||||
Activator.log( e );
|
||||
} finally {
|
||||
index.releaseReadLock();
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ import java.util.Arrays;
|
|||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
||||
import org.eclipse.cdt.internal.qt.core.QtPlugin;
|
||||
import org.eclipse.cdt.internal.qt.core.Activator;
|
||||
import org.eclipse.cdt.internal.qt.core.index.IQMakeEnvProvider.IController;
|
||||
import org.eclipse.core.expressions.EvaluationContext;
|
||||
import org.eclipse.core.expressions.EvaluationResult;
|
||||
|
@ -49,7 +49,7 @@ public final class QMakeEnvProviderDescriptor implements Comparable<QMakeEnvProv
|
|||
try {
|
||||
prio = Integer.parseInt(priorityString);
|
||||
} catch (NumberFormatException e) {
|
||||
QtPlugin.log("Invalid priority value of " + id, e); //$NON-NLS-1$
|
||||
Activator.log("Invalid priority value of " + id, e); //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
this.priority = prio;
|
||||
|
@ -66,11 +66,11 @@ public final class QMakeEnvProviderDescriptor implements Comparable<QMakeEnvProv
|
|||
ExpressionConverter parser = ExpressionConverter.getDefault();
|
||||
expr = parser.perform(children[0]);
|
||||
} catch (CoreException e) {
|
||||
QtPlugin.log("Error in enablement expression of " + id, e); //$NON-NLS-1$
|
||||
Activator.log("Error in enablement expression of " + id, e); //$NON-NLS-1$
|
||||
}
|
||||
break;
|
||||
default:
|
||||
QtPlugin.log("Too many enablement expressions for " + id); //$NON-NLS-1$
|
||||
Activator.log("Too many enablement expressions for " + id); //$NON-NLS-1$
|
||||
evaluation.set(Boolean.FALSE);
|
||||
break;
|
||||
}
|
||||
|
@ -99,7 +99,7 @@ public final class QMakeEnvProviderDescriptor implements Comparable<QMakeEnvProv
|
|||
try {
|
||||
provider = (IQMakeEnvProvider) element.createExecutableExtension(ATTR_CLASS);
|
||||
} catch (CoreException e) {
|
||||
QtPlugin.log("Error in class attribute of " + id, e); //$NON-NLS-1$
|
||||
Activator.log("Error in class attribute of " + id, e); //$NON-NLS-1$
|
||||
return null;
|
||||
}
|
||||
return provider.createEnv(controller);
|
||||
|
@ -127,7 +127,7 @@ public final class QMakeEnvProviderDescriptor implements Comparable<QMakeEnvProv
|
|||
}
|
||||
return enablementExpression.evaluate(evalContext) == EvaluationResult.TRUE;
|
||||
} catch (CoreException e) {
|
||||
QtPlugin.log("Error while evaluating enablement expression for " + id, e); //$NON-NLS-1$
|
||||
Activator.log("Error while evaluating enablement expression for " + id, e); //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
evaluation.set(Boolean.FALSE);
|
||||
|
|
|
@ -14,7 +14,7 @@ import java.util.List;
|
|||
import org.eclipse.cdt.core.CCorePlugin;
|
||||
import org.eclipse.cdt.core.envvar.IEnvironmentVariable;
|
||||
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
||||
import org.eclipse.cdt.internal.qt.core.QtPlugin;
|
||||
import org.eclipse.cdt.internal.qt.core.Activator;
|
||||
import org.eclipse.core.resources.IFile;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.runtime.IConfigurationElement;
|
||||
|
@ -45,7 +45,7 @@ public final class QMakeEnvProviderManager {
|
|||
private static List<QMakeEnvProviderDescriptor> loadDescriptors() {
|
||||
List<QMakeEnvProviderDescriptor> descriptors = new ArrayList<QMakeEnvProviderDescriptor>();
|
||||
IConfigurationElement[] elements = Platform.getExtensionRegistry()
|
||||
.getConfigurationElementsFor(QtPlugin.ID, QtPlugin.QMAKE_ENV_PROVIDER_EXT_POINT_NAME);
|
||||
.getConfigurationElementsFor(Activator.ID, Activator.QMAKE_ENV_PROVIDER_EXT_POINT_NAME);
|
||||
for (IConfigurationElement element : elements) {
|
||||
descriptors.add(new QMakeEnvProviderDescriptor(element));
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.eclipse.cdt.internal.qt.core.QtPlugin;
|
||||
import org.eclipse.cdt.internal.qt.core.Activator;
|
||||
import org.eclipse.cdt.utils.spawner.ProcessFactory;
|
||||
|
||||
/**
|
||||
|
@ -176,7 +176,7 @@ public final class QMakeInfo implements IQMakeInfo {
|
|||
*/
|
||||
private static Map<String, String> exec(Pattern regex, String[] extraEnv, String...command) {
|
||||
if (command.length < 1 || ! new File(command[0]).exists()) {
|
||||
QtPlugin.log("qmake: cannot run command: " + (command.length > 0 ? command[0] : ""));
|
||||
Activator.log("qmake: cannot run command: " + (command.length > 0 ? command[0] : ""));
|
||||
return null;
|
||||
}
|
||||
BufferedReader reader = null;
|
||||
|
@ -190,7 +190,7 @@ public final class QMakeInfo implements IQMakeInfo {
|
|||
reader = new BufferedReader(new InputStreamReader(process.getInputStream()));
|
||||
return QMakeParser.parse(regex, reader);
|
||||
} catch(IOException e) {
|
||||
QtPlugin.log(e);
|
||||
Activator.log(e);
|
||||
return null;
|
||||
} finally {
|
||||
if (reader != null)
|
||||
|
|
|
@ -17,7 +17,7 @@ import java.util.Map;
|
|||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.eclipse.cdt.internal.qt.core.QtPlugin;
|
||||
import org.eclipse.cdt.internal.qt.core.Activator;
|
||||
|
||||
/**
|
||||
* Provides a parser for QMake output.
|
||||
|
@ -54,13 +54,13 @@ public final class QMakeParser {
|
|||
while((line = reader.readLine()) != null) {
|
||||
Matcher m = regex.matcher(line);
|
||||
if (!m.matches() || m.groupCount() != 2) {
|
||||
QtPlugin.log("qmake: cannot decode query line '" + line + '\'');
|
||||
Activator.log("qmake: cannot decode query line '" + line + '\'');
|
||||
} else {
|
||||
String key = m.group(1);
|
||||
String value = m.group(2);
|
||||
String oldValue = result.put(key, value);
|
||||
if (oldValue != null)
|
||||
QtPlugin.log("qmake: duplicate keys in query info '" + line + "' was '" + oldValue + '\'');
|
||||
Activator.log("qmake: duplicate keys in query info '" + line + "' was '" + oldValue + '\'');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ package org.eclipse.cdt.internal.qt.core.index;
|
|||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.eclipse.cdt.internal.qt.core.QtPlugin;
|
||||
import org.eclipse.cdt.internal.qt.core.Activator;
|
||||
|
||||
/**
|
||||
* A container class to interpret and store value of the the qmake version.
|
||||
|
@ -36,7 +36,7 @@ public final class QMakeVersion implements IQtVersion {
|
|||
int minor = Integer.parseInt(m.group(2));
|
||||
return new QMakeVersion(major, minor);
|
||||
} catch(NumberFormatException e) {
|
||||
QtPlugin.log(e);
|
||||
Activator.log(e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ import org.eclipse.cdt.core.index.IIndexMacro;
|
|||
import org.eclipse.cdt.core.index.IndexFilter;
|
||||
import org.eclipse.cdt.core.model.CoreModel;
|
||||
import org.eclipse.cdt.core.model.ICProject;
|
||||
import org.eclipse.cdt.internal.qt.core.QtPlugin;
|
||||
import org.eclipse.cdt.internal.qt.core.Activator;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
|
||||
|
@ -29,13 +29,13 @@ public class QtFactory {
|
|||
public static QtIndex create(IProject project) {
|
||||
CDTIndex cdtIndex = getCDTIndex(project);
|
||||
if (cdtIndex == null) {
|
||||
QtPlugin.log("could not get CDT index from project " + project.getName());
|
||||
Activator.log("could not get CDT index from project " + project.getName());
|
||||
return null;
|
||||
}
|
||||
|
||||
QtVersion qtVersion = cdtIndex.get(QtVersionAccessor);
|
||||
if (qtVersion == null) {
|
||||
QtPlugin.log("could not find Qt version in CDT index from project " + project.getName());
|
||||
Activator.log("could not find Qt version in CDT index from project " + project.getName());
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -58,7 +58,7 @@ public class QtFactory {
|
|||
try {
|
||||
index = CCorePlugin.getIndexManager().getIndex(cProject);
|
||||
} catch( CoreException e ) {
|
||||
QtPlugin.log(e);
|
||||
Activator.log(e);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -88,7 +88,7 @@ public class QtFactory {
|
|||
int patch = Integer.parseInt(m.group(3), 16);
|
||||
return new QtVersion(major, minor, patch);
|
||||
} catch(NumberFormatException e) {
|
||||
QtPlugin.log(e);
|
||||
Activator.log(e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ package org.eclipse.cdt.internal.qt.core.index;
|
|||
|
||||
import java.util.Collection;
|
||||
|
||||
import org.eclipse.cdt.internal.qt.core.QtPlugin;
|
||||
import org.eclipse.cdt.internal.qt.core.Activator;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
|
||||
|
@ -37,11 +37,11 @@ public abstract class QtIndex {
|
|||
return null;
|
||||
|
||||
try {
|
||||
Object index = project.getSessionProperty(QtPlugin.QTINDEX_PROP_NAME);
|
||||
Object index = project.getSessionProperty(Activator.QTINDEX_PROP_NAME);
|
||||
if (index instanceof QtIndex)
|
||||
return (QtIndex)index;
|
||||
} catch(CoreException e) {
|
||||
QtPlugin.log(e);
|
||||
Activator.log(e);
|
||||
}
|
||||
|
||||
// create and store a new instance when needed
|
||||
|
@ -50,9 +50,9 @@ public abstract class QtIndex {
|
|||
return null;
|
||||
|
||||
try {
|
||||
project.setSessionProperty(QtPlugin.QTINDEX_PROP_NAME, index);
|
||||
project.setSessionProperty(Activator.QTINDEX_PROP_NAME, index);
|
||||
} catch( CoreException e ) {
|
||||
QtPlugin.log(e);
|
||||
Activator.log(e);
|
||||
}
|
||||
|
||||
return index;
|
||||
|
|
|
@ -12,10 +12,9 @@ import java.io.IOException;
|
|||
import java.nio.file.Path;
|
||||
import java.util.Map;
|
||||
|
||||
import org.eclipse.cdt.internal.qt.core.QtPlugin;
|
||||
import org.eclipse.cdt.internal.qt.core.Activator;
|
||||
import org.eclipse.cdt.internal.qt.core.build.QtBuildConfiguration;
|
||||
import org.eclipse.core.resources.IFile;
|
||||
import org.eclipse.core.resources.IFolder;
|
||||
import org.eclipse.cdt.internal.qt.core.build.QtBuildConfigurationFactory;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.resources.IProjectDescription;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
|
@ -27,11 +26,21 @@ import org.eclipse.core.runtime.jobs.Job;
|
|||
import org.eclipse.debug.core.DebugPlugin;
|
||||
import org.eclipse.debug.core.ILaunch;
|
||||
import org.eclipse.debug.core.ILaunchConfiguration;
|
||||
import org.eclipse.debug.core.model.LaunchConfigurationDelegate;
|
||||
import org.eclipse.launchbar.core.target.ILaunchTarget;
|
||||
import org.eclipse.launchbar.core.target.launch.ITargetedLaunch;
|
||||
import org.eclipse.launchbar.core.target.launch.LaunchConfigurationTargetedDelegate;
|
||||
import org.eclipse.launchbar.core.target.launch.TargetedLaunch;
|
||||
|
||||
public class QtLocalRunLaunchConfigDelegate extends LaunchConfigurationDelegate {
|
||||
public class QtLocalRunLaunchConfigDelegate extends LaunchConfigurationTargetedDelegate {
|
||||
|
||||
public static final String TYPE_ID = QtPlugin.ID + ".launchConfigurationType"; //$NON-NLS-1$
|
||||
public static final String TYPE_ID = Activator.ID + ".launchConfigurationType"; //$NON-NLS-1$
|
||||
|
||||
@Override
|
||||
public ITargetedLaunch getLaunch(ILaunchConfiguration configuration, String mode, ILaunchTarget target)
|
||||
throws CoreException {
|
||||
// TODO sourcelocator?
|
||||
return new TargetedLaunch(configuration, mode, target, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void launch(ILaunchConfiguration configuration, String mode, ILaunch launch, IProgressMonitor monitor)
|
||||
|
@ -40,29 +49,32 @@ public class QtLocalRunLaunchConfigDelegate extends LaunchConfigurationDelegate
|
|||
@Override
|
||||
protected IStatus run(IProgressMonitor monitor) {
|
||||
try {
|
||||
QtBuildConfiguration qtBuildConfig = getQtBuildConfiguration(configuration, mode, monitor);
|
||||
ILaunchTarget target = ((ITargetedLaunch) launch).getLaunchTarget();
|
||||
QtBuildConfiguration qtBuildConfig = getQtBuildConfiguration(configuration, mode, target, monitor);
|
||||
|
||||
// get the executable
|
||||
IFolder buildFolder = qtBuildConfig.getBuildFolder();
|
||||
IFile exeFile;
|
||||
Path buildFolder = qtBuildConfig.getBuildDirectory();
|
||||
Path exeFile;
|
||||
switch (Platform.getOS()) {
|
||||
case Platform.OS_MACOSX:
|
||||
// TODO this is mac local specific and really should be in the config
|
||||
// TODO also need to pull the app name out of the pro file name
|
||||
IFolder appFolder = buildFolder.getFolder("main.app");
|
||||
IFolder contentsFolder = appFolder.getFolder("Contents");
|
||||
IFolder macosFolder = contentsFolder.getFolder("MacOS");
|
||||
exeFile = macosFolder.getFile("main");
|
||||
// TODO this is mac local specific and really should be
|
||||
// in the config
|
||||
// TODO also need to pull the app name out of the pro
|
||||
// file name
|
||||
Path appFolder = buildFolder.resolve("main.app");
|
||||
Path contentsFolder = appFolder.resolve("Contents");
|
||||
Path macosFolder = contentsFolder.resolve("MacOS");
|
||||
exeFile = macosFolder.resolve("main");
|
||||
break;
|
||||
case Platform.OS_WIN32:
|
||||
IFolder releaseFolder = buildFolder.getFolder("release");
|
||||
exeFile = releaseFolder.getFile("main.exe");
|
||||
Path releaseFolder = buildFolder.resolve("release");
|
||||
exeFile = releaseFolder.resolve("main.exe");
|
||||
break;
|
||||
default:
|
||||
return new Status(IStatus.ERROR, QtPlugin.ID, "platform not supported: " + Platform.getOS());
|
||||
return new Status(IStatus.ERROR, Activator.ID, "platform not supported: " + Platform.getOS());
|
||||
}
|
||||
|
||||
ProcessBuilder builder = new ProcessBuilder(exeFile.getLocation().toFile().getAbsolutePath())
|
||||
ProcessBuilder builder = new ProcessBuilder(exeFile.toString())
|
||||
.directory(qtBuildConfig.getProject().getLocation().toFile());
|
||||
|
||||
// need to add the Qt libraries to the env
|
||||
|
@ -90,7 +102,7 @@ public class QtLocalRunLaunchConfigDelegate extends LaunchConfigurationDelegate
|
|||
Process process = builder.start();
|
||||
DebugPlugin.newProcess(launch, process, "main");
|
||||
} catch (IOException e) {
|
||||
return new Status(IStatus.ERROR, QtPlugin.ID, "running", e);
|
||||
return new Status(IStatus.ERROR, Activator.ID, "running", e);
|
||||
} catch (CoreException e) {
|
||||
return e.getStatus();
|
||||
}
|
||||
|
@ -100,9 +112,9 @@ public class QtLocalRunLaunchConfigDelegate extends LaunchConfigurationDelegate
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean buildForLaunch(ILaunchConfiguration configuration, String mode, IProgressMonitor monitor)
|
||||
throws CoreException {
|
||||
QtBuildConfiguration qtBuildConfig = getQtBuildConfiguration(configuration, mode, monitor);
|
||||
public boolean buildForLaunch(ILaunchConfiguration configuration, String mode, ILaunchTarget target,
|
||||
IProgressMonitor monitor) throws CoreException {
|
||||
QtBuildConfiguration qtBuildConfig = getQtBuildConfiguration(configuration, mode, target, monitor);
|
||||
|
||||
// Set it as active
|
||||
IProject project = qtBuildConfig.getProject();
|
||||
|
@ -111,7 +123,7 @@ public class QtLocalRunLaunchConfigDelegate extends LaunchConfigurationDelegate
|
|||
project.setDescription(desc, monitor);
|
||||
|
||||
// And build
|
||||
return super.buildForLaunch(configuration, mode, monitor);
|
||||
return superBuildForLaunch(configuration, mode, monitor);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -123,12 +135,10 @@ public class QtLocalRunLaunchConfigDelegate extends LaunchConfigurationDelegate
|
|||
}
|
||||
|
||||
private QtBuildConfiguration getQtBuildConfiguration(ILaunchConfiguration configuration, String mode,
|
||||
IProgressMonitor monitor) throws CoreException {
|
||||
ILaunchTarget target, IProgressMonitor monitor) throws CoreException {
|
||||
// Find the Qt build config
|
||||
IProject project = configuration.getMappedResources()[0].getProject();
|
||||
String os = Platform.getOS();
|
||||
String arch = Platform.getOSArch();
|
||||
return QtBuildConfiguration.getConfig(project, os, arch, mode, monitor);
|
||||
return QtBuildConfigurationFactory.getConfig(project, mode, target, monitor);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ import org.eclipse.cdt.internal.core.pdom.dom.IPDOMBinding;
|
|||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMBinding;
|
||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMLinkage;
|
||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMNode;
|
||||
import org.eclipse.cdt.internal.qt.core.QtPlugin;
|
||||
import org.eclipse.cdt.internal.qt.core.Activator;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
|
||||
/**
|
||||
|
@ -106,7 +106,7 @@ public abstract class AbstractQtPDOMClass extends QtPDOMBinding {
|
|||
try {
|
||||
children.accept(collector);
|
||||
} catch(CoreException e) {
|
||||
QtPlugin.log(e);
|
||||
Activator.log(e);
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ package org.eclipse.cdt.internal.qt.core.pdom;
|
|||
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
||||
import org.eclipse.cdt.internal.core.pdom.dom.IPDOMLinkageFactory;
|
||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMLinkage;
|
||||
import org.eclipse.cdt.internal.qt.core.QtPlugin;
|
||||
import org.eclipse.cdt.internal.qt.core.Activator;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
|
||||
@SuppressWarnings("restriction")
|
||||
|
@ -21,7 +21,7 @@ public class PDOMQtLinkageFactory implements IPDOMLinkageFactory {
|
|||
try {
|
||||
return new QtPDOMLinkage(pdom, record);
|
||||
} catch(CoreException e) {
|
||||
QtPlugin.log(e);
|
||||
Activator.log(e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ import org.eclipse.cdt.internal.core.pdom.dom.PDOMLinkage;
|
|||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMName;
|
||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMNode;
|
||||
import org.eclipse.cdt.internal.core.pdom.dom.cpp.PDOMCPPGlobalScope;
|
||||
import org.eclipse.cdt.internal.qt.core.QtPlugin;
|
||||
import org.eclipse.cdt.internal.qt.core.Activator;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
|
||||
@SuppressWarnings("restriction")
|
||||
|
@ -279,21 +279,21 @@ public class QtPDOMLinkage extends PDOMLinkage {
|
|||
|
||||
@Override
|
||||
public PDOMBinding addTypeBinding(IBinding binding) throws CoreException {
|
||||
throw new CoreException(QtPlugin.error("Qt Linkage does not manage types")); //$NON-NLS-1$
|
||||
throw new CoreException(Activator.error("Qt Linkage does not manage types")); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
@Override
|
||||
public IType unmarshalType(ITypeMarshalBuffer buffer) throws CoreException {
|
||||
throw new CoreException(QtPlugin.error("Qt Linkage does not marshal types")); //$NON-NLS-1$
|
||||
throw new CoreException(Activator.error("Qt Linkage does not marshal types")); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBinding unmarshalBinding(ITypeMarshalBuffer buffer) throws CoreException {
|
||||
throw new CoreException(QtPlugin.error("Qt Linkage does not marshal bindings")); //$NON-NLS-1$
|
||||
throw new CoreException(Activator.error("Qt Linkage does not marshal bindings")); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
@Override
|
||||
public ISerializableEvaluation unmarshalEvaluation(ITypeMarshalBuffer typeMarshalBuffer) throws CoreException {
|
||||
throw new CoreException(QtPlugin.error("Qt Linkage does not marshal evaluations")); //$NON-NLS-1$
|
||||
throw new CoreException(Activator.error("Qt Linkage does not marshal evaluations")); //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue