Skip to main content
summaryrefslogtreecommitdiffstats
path: root/build
diff options
context:
space:
mode:
authorDoug Schaefer2015-11-24 14:56:37 -0500
committerDoug Schaefer2015-11-24 22:11:33 -0500
commite3496e12466391b28cb2c1202bd68c0b23a00318 (patch)
treef2c17c34c0d5b6789db1cd8eb4edab4673f1fe54 /build
parentef76cdac14d5f37c3fe3adde5dd3c04d31668857 (diff)
downloadorg.eclipse.cdt-e3496e12466391b28cb2c1202bd68c0b23a00318.tar.gz
org.eclipse.cdt-e3496e12466391b28cb2c1202bd68c0b23a00318.tar.xz
org.eclipse.cdt-e3496e12466391b28cb2c1202bd68c0b23a00318.zip
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
Diffstat (limited to 'build')
-rw-r--r--build/org.eclipse.cdt.build.core.tests/.classpath7
-rw-r--r--build/org.eclipse.cdt.build.core.tests/.project28
-rw-r--r--build/org.eclipse.cdt.build.core.tests/.settings/org.eclipse.jdt.core.prefs7
-rw-r--r--build/org.eclipse.cdt.build.core.tests/META-INF/MANIFEST.MF12
-rw-r--r--build/org.eclipse.cdt.build.core.tests/build.properties4
-rw-r--r--build/org.eclipse.cdt.build.core.tests/pom.xml39
-rw-r--r--build/org.eclipse.cdt.build.core.tests/src/org/eclipse/cdt/build/core/tests/Activator.java29
-rw-r--r--build/org.eclipse.cdt.build.core.tests/src/org/eclipse/cdt/build/core/tests/GCCTests.java22
-rw-r--r--build/org.eclipse.cdt.build.core/.classpath7
-rw-r--r--build/org.eclipse.cdt.build.core/.project28
-rw-r--r--build/org.eclipse.cdt.build.core/.settings/org.eclipse.jdt.core.prefs7
-rw-r--r--build/org.eclipse.cdt.build.core/META-INF/MANIFEST.MF15
-rw-r--r--build/org.eclipse.cdt.build.core/about.html24
-rw-r--r--build/org.eclipse.cdt.build.core/build.properties7
-rw-r--r--build/org.eclipse.cdt.build.core/plugin.xml6
-rw-r--r--build/org.eclipse.cdt.build.core/pom.xml17
-rw-r--r--build/org.eclipse.cdt.build.core/schema/toolChainProvider.exsd102
-rw-r--r--build/org.eclipse.cdt.build.core/schema/toolChainType.exsd127
-rw-r--r--build/org.eclipse.cdt.build.core/src/org/eclipse/cdt/build/core/CBuildConfiguration.java130
-rw-r--r--build/org.eclipse.cdt.build.core/src/org/eclipse/cdt/build/core/CConsoleParser.java134
-rw-r--r--build/org.eclipse.cdt.build.core/src/org/eclipse/cdt/build/core/IConsoleService.java51
-rw-r--r--build/org.eclipse.cdt.build.core/src/org/eclipse/cdt/build/core/IToolChain.java48
-rw-r--r--build/org.eclipse.cdt.build.core/src/org/eclipse/cdt/build/core/IToolChainManager.java25
-rw-r--r--build/org.eclipse.cdt.build.core/src/org/eclipse/cdt/build/core/IToolChainProvider.java20
-rw-r--r--build/org.eclipse.cdt.build.core/src/org/eclipse/cdt/build/core/IToolChainType.java31
-rw-r--r--build/org.eclipse.cdt.build.core/src/org/eclipse/cdt/build/core/internal/Activator.java79
-rw-r--r--build/org.eclipse.cdt.build.core/src/org/eclipse/cdt/build/core/internal/CBuildConfigurationCleanup.java73
-rw-r--r--build/org.eclipse.cdt.build.core/src/org/eclipse/cdt/build/core/internal/ScannerInfoData.java174
-rw-r--r--build/org.eclipse.cdt.build.core/src/org/eclipse/cdt/build/core/internal/ScannerInfoSaveParticipant.java57
-rw-r--r--build/org.eclipse.cdt.build.core/src/org/eclipse/cdt/build/core/internal/ToolChainManager.java109
-rw-r--r--build/org.eclipse.cdt.build.core/src/org/eclipse/cdt/build/core/internal/ToolChainScannerInfo.java59
-rw-r--r--build/org.eclipse.cdt.build.gcc.core/.classpath7
-rw-r--r--build/org.eclipse.cdt.build.gcc.core/.project28
-rw-r--r--build/org.eclipse.cdt.build.gcc.core/.settings/org.eclipse.jdt.core.prefs7
-rw-r--r--build/org.eclipse.cdt.build.gcc.core/META-INF/MANIFEST.MF15
-rw-r--r--build/org.eclipse.cdt.build.gcc.core/about.html24
-rw-r--r--build/org.eclipse.cdt.build.gcc.core/build.properties6
-rw-r--r--build/org.eclipse.cdt.build.gcc.core/plugin.xml18
-rw-r--r--build/org.eclipse.cdt.build.gcc.core/pom.xml17
-rw-r--r--build/org.eclipse.cdt.build.gcc.core/src/org/eclipse/cdt/build/gcc/core/GCCPathToolChainProvider.java140
-rw-r--r--build/org.eclipse.cdt.build.gcc.core/src/org/eclipse/cdt/build/gcc/core/GCCToolChain.java260
-rw-r--r--build/org.eclipse.cdt.build.gcc.core/src/org/eclipse/cdt/build/gcc/core/GCCToolChainType.java29
-rw-r--r--build/org.eclipse.cdt.build.gcc.core/src/org/eclipse/cdt/build/gcc/core/internal/Activator.java51
-rw-r--r--build/org.eclipse.cdt.build.ui/.classpath7
-rw-r--r--build/org.eclipse.cdt.build.ui/.project28
-rw-r--r--build/org.eclipse.cdt.build.ui/.settings/org.eclipse.jdt.core.prefs7
-rw-r--r--build/org.eclipse.cdt.build.ui/META-INF/MANIFEST.MF17
-rw-r--r--build/org.eclipse.cdt.build.ui/OSGI-INF/consoleservice.xml6
-rw-r--r--build/org.eclipse.cdt.build.ui/about.html24
-rw-r--r--build/org.eclipse.cdt.build.ui/build.properties5
-rw-r--r--build/org.eclipse.cdt.build.ui/pom.xml17
-rw-r--r--build/org.eclipse.cdt.build.ui/src/org/eclipse/cdt/build/ui/internal/Activator.java53
-rw-r--r--build/org.eclipse.cdt.build.ui/src/org/eclipse/cdt/build/ui/internal/CConsoleService.java162
-rw-r--r--build/org.eclipse.cdt.build.ui/src/org/eclipse/cdt/build/ui/internal/CHyperlink.java43
-rw-r--r--build/org.eclipse.cdt.build.ui/src/org/eclipse/cdt/build/ui/internal/CPatternMatchListener.java68
-rw-r--r--build/org.eclipse.cdt.gnu.build-feature/feature.xml7
-rw-r--r--build/org.eclipse.cdt.gnu.build.source-feature/feature.xml7
57 files changed, 2531 insertions, 0 deletions
diff --git a/build/org.eclipse.cdt.build.core.tests/.classpath b/build/org.eclipse.cdt.build.core.tests/.classpath
new file mode 100644
index 0000000000..eca7bdba8f
--- /dev/null
+++ b/build/org.eclipse.cdt.build.core.tests/.classpath
@@ -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>
diff --git a/build/org.eclipse.cdt.build.core.tests/.project b/build/org.eclipse.cdt.build.core.tests/.project
new file mode 100644
index 0000000000..2a695fe18a
--- /dev/null
+++ b/build/org.eclipse.cdt.build.core.tests/.project
@@ -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>
diff --git a/build/org.eclipse.cdt.build.core.tests/.settings/org.eclipse.jdt.core.prefs b/build/org.eclipse.cdt.build.core.tests/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000000..0c68a61dca
--- /dev/null
+++ b/build/org.eclipse.cdt.build.core.tests/.settings/org.eclipse.jdt.core.prefs
@@ -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
diff --git a/build/org.eclipse.cdt.build.core.tests/META-INF/MANIFEST.MF b/build/org.eclipse.cdt.build.core.tests/META-INF/MANIFEST.MF
new file mode 100644
index 0000000000..7017a86387
--- /dev/null
+++ b/build/org.eclipse.cdt.build.core.tests/META-INF/MANIFEST.MF
@@ -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
diff --git a/build/org.eclipse.cdt.build.core.tests/build.properties b/build/org.eclipse.cdt.build.core.tests/build.properties
new file mode 100644
index 0000000000..34d2e4d2da
--- /dev/null
+++ b/build/org.eclipse.cdt.build.core.tests/build.properties
@@ -0,0 +1,4 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .
diff --git a/build/org.eclipse.cdt.build.core.tests/pom.xml b/build/org.eclipse.cdt.build.core.tests/pom.xml
new file mode 100644
index 0000000000..67dc3a9c38
--- /dev/null
+++ b/build/org.eclipse.cdt.build.core.tests/pom.xml
@@ -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>
diff --git a/build/org.eclipse.cdt.build.core.tests/src/org/eclipse/cdt/build/core/tests/Activator.java b/build/org.eclipse.cdt.build.core.tests/src/org/eclipse/cdt/build/core/tests/Activator.java
new file mode 100644
index 0000000000..95e3736544
--- /dev/null
+++ b/build/org.eclipse.cdt.build.core.tests/src/org/eclipse/cdt/build/core/tests/Activator.java
@@ -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;
+ }
+
+}
diff --git a/build/org.eclipse.cdt.build.core.tests/src/org/eclipse/cdt/build/core/tests/GCCTests.java b/build/org.eclipse.cdt.build.core.tests/src/org/eclipse/cdt/build/core/tests/GCCTests.java
new file mode 100644
index 0000000000..e6be8a33fc
--- /dev/null
+++ b/build/org.eclipse.cdt.build.core.tests/src/org/eclipse/cdt/build/core/tests/GCCTests.java
@@ -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));
+ }
+
+}
diff --git a/build/org.eclipse.cdt.build.core/.classpath b/build/org.eclipse.cdt.build.core/.classpath
new file mode 100644
index 0000000000..eca7bdba8f
--- /dev/null
+++ b/build/org.eclipse.cdt.build.core/.classpath
@@ -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>
diff --git a/build/org.eclipse.cdt.build.core/.project b/build/org.eclipse.cdt.build.core/.project
new file mode 100644
index 0000000000..0abc37f7a9
--- /dev/null
+++ b/build/org.eclipse.cdt.build.core/.project
@@ -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>
diff --git a/build/org.eclipse.cdt.build.core/.settings/org.eclipse.jdt.core.prefs b/build/org.eclipse.cdt.build.core/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000000..0c68a61dca
--- /dev/null
+++ b/build/org.eclipse.cdt.build.core/.settings/org.eclipse.jdt.core.prefs
@@ -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
diff --git a/build/org.eclipse.cdt.build.core/META-INF/MANIFEST.MF b/build/org.eclipse.cdt.build.core/META-INF/MANIFEST.MF
new file mode 100644
index 0000000000..0d6b5d9318
--- /dev/null
+++ b/build/org.eclipse.cdt.build.core/META-INF/MANIFEST.MF
@@ -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
diff --git a/build/org.eclipse.cdt.build.core/about.html b/build/org.eclipse.cdt.build.core/about.html
new file mode 100644
index 0000000000..d7c511887d
--- /dev/null
+++ b/build/org.eclipse.cdt.build.core/about.html
@@ -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> \ No newline at end of file
diff --git a/build/org.eclipse.cdt.build.core/build.properties b/build/org.eclipse.cdt.build.core/build.properties
new file mode 100644
index 0000000000..e34cf11140
--- /dev/null
+++ b/build/org.eclipse.cdt.build.core/build.properties
@@ -0,0 +1,7 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml,\
+ about.html,\
+ schema/
diff --git a/build/org.eclipse.cdt.build.core/plugin.xml b/build/org.eclipse.cdt.build.core/plugin.xml
new file mode 100644
index 0000000000..12407c4f92
--- /dev/null
+++ b/build/org.eclipse.cdt.build.core/plugin.xml
@@ -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>
diff --git a/build/org.eclipse.cdt.build.core/pom.xml b/build/org.eclipse.cdt.build.core/pom.xml
new file mode 100644
index 0000000000..2986e2ee86
--- /dev/null
+++ b/build/org.eclipse.cdt.build.core/pom.xml
@@ -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> \ No newline at end of file
diff --git a/build/org.eclipse.cdt.build.core/schema/toolChainProvider.exsd b/build/org.eclipse.cdt.build.core/schema/toolChainProvider.exsd
new file mode 100644
index 0000000000..1c376e3d54
--- /dev/null
+++ b/build/org.eclipse.cdt.build.core/schema/toolChainProvider.exsd
@@ -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&apos;t called unless there&apos;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>
diff --git a/build/org.eclipse.cdt.build.core/schema/toolChainType.exsd b/build/org.eclipse.cdt.build.core/schema/toolChainType.exsd
new file mode 100644
index 0000000000..4bd0c4bd10
--- /dev/null
+++ b/build/org.eclipse.cdt.build.core/schema/toolChainType.exsd
@@ -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>
diff --git a/build/org.eclipse.cdt.build.core/src/org/eclipse/cdt/build/core/CBuildConfiguration.java b/build/org.eclipse.cdt.build.core/src/org/eclipse/cdt/build/core/CBuildConfiguration.java
new file mode 100644
index 0000000000..e7f2f7a829
--- /dev/null
+++ b/build/org.eclipse.cdt.build.core/src/org/eclipse/cdt/build/core/CBuildConfiguration.java
@@ -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;
+ }
+
+}
diff --git a/build/org.eclipse.cdt.build.core/src/org/eclipse/cdt/build/core/CConsoleParser.java b/build/org.eclipse.cdt.build.core/src/org/eclipse/cdt/build/core/CConsoleParser.java
new file mode 100644
index 0000000000..b0fa53302d
--- /dev/null
+++ b/build/org.eclipse.cdt.build.core/src/org/eclipse/cdt/build/core/CConsoleParser.java
@@ -0,0 +1,134 @@
+/*******************************************************************************
+ * 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.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.IMarker;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+
+/**
+ * This could be temporary. Provides a core parser for the TextConsole's
+ * IPatternMatchListener.
+ *
+ * TODO that framework doesn't work well for builds that need to use different
+ * parsers at different times. Should consider taking that architecture and
+ * making it work well for our needs.
+ *
+ * @since 5.12
+ */
+public abstract class CConsoleParser {
+
+ private final String pattern;
+ private final int flags;
+ private final String lineQualifier;
+
+ private final Pattern errorPattern;
+
+ public static final String LINK_OFFSET = "cdt.link.offset"; //$NON-NLS-1$
+ public static final String LINK_LENGTH = "cdt.link.length"; //$NON-NLS-1$
+
+ protected CConsoleParser(String pattern, int flags, String lineQualifier) {
+ this.pattern = pattern;
+ this.flags = flags;
+ this.lineQualifier = lineQualifier;
+ this.errorPattern = Pattern.compile(pattern);
+ }
+
+ protected CConsoleParser(String pattern) {
+ this(pattern, 0, null);
+ }
+
+ /**
+ * Returns the pattern to be used for matching. The pattern is a string
+ * representing a regular expression.
+ *
+ * @return the regular expression to be used for matching
+ */
+ public String getPattern() {
+ return pattern;
+ }
+
+ /**
+ * Returns the flags to use when compiling this pattern match listener's
+ * regular expression, as defined by by
+ * <code>Pattern.compile(String regex, int flags)</code>
+ *
+ * @return the flags to use when compiling this pattern match listener's
+ * regular expression
+ * @see java.util.regex.Pattern#compile(java.lang.String, int)
+ */
+ public int getCompilerFlags() {
+ return flags;
+ }
+
+ /**
+ * Returns a simple regular expression used to identify lines that may match
+ * this pattern matcher's complete pattern, or <code>null</code>. Use of
+ * this attribute can improve performance by disqualifying lines from the
+ * search. When a line is found containing a match for this expression, the
+ * line is searched from the beginning for this pattern matcher's complete
+ * pattern. Lines not containing this pattern are discarded.
+ *
+ * @return a simple regular expression used to identify lines that may match
+ * this pattern matcher's complete pattern, or <code>null</code>
+ */
+ public String getLineQualifier() {
+ return lineQualifier;
+ }
+
+ protected abstract String getFileName(Matcher matcher);
+
+ protected abstract int getLineNumber(Matcher matcher);
+
+ protected abstract String getMessage(Matcher matcher);
+
+ protected abstract int getSeverity(Matcher matcher);
+
+ protected abstract int getLinkOffset(Matcher matcher);
+
+ protected abstract int getLinkLength(Matcher matcher);
+
+ public IMarker generateMarker(Path buildDirectory, String text) {
+ Matcher matcher = errorPattern.matcher(text);
+ if (matcher.matches()) {
+ String fileName = getFileName(matcher);
+
+ 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;
+ }
+ }
+ }
+ }
+ return null;
+ }
+
+}
diff --git a/build/org.eclipse.cdt.build.core/src/org/eclipse/cdt/build/core/IConsoleService.java b/build/org.eclipse.cdt.build.core/src/org/eclipse/cdt/build/core/IConsoleService.java
new file mode 100644
index 0000000000..e9811bdeed
--- /dev/null
+++ b/build/org.eclipse.cdt.build.core/src/org/eclipse/cdt/build/core/IConsoleService.java
@@ -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.core;
+
+import java.io.IOException;
+import java.nio.file.Path;
+
+/**
+ * This may be temporary. It's uses the TextConsole's parsing and hyperlink
+ * framework to parse build output for errors.
+ *
+ * TODO Should we replace all CDT build consoles with this.
+ *
+ * @since 5.12
+ */
+public interface IConsoleService {
+
+ /**
+ * Display the stdout and stderr of the process in the console. Use the
+ * console parsers to parse that output to mark errors and warnings and
+ * such. The build directory helps to find resources for markers.
+ *
+ * @param process
+ * @param consoleParsers
+ * @param buildDirectory
+ * @throws IOException
+ */
+ void monitor(Process process, CConsoleParser[] consoleParsers, Path buildDirectory) throws IOException;
+
+ /**
+ * Write a message on the console stdout.
+ *
+ * @param msg
+ * @throws IOException
+ */
+ void writeOutput(String msg) throws IOException;
+
+ /**
+ * Write a message on the console stderr.
+ *
+ * @param msg
+ * @throws IOException
+ */
+ void writeError(String msg) throws IOException;
+
+}
diff --git a/build/org.eclipse.cdt.build.core/src/org/eclipse/cdt/build/core/IToolChain.java b/build/org.eclipse.cdt.build.core/src/org/eclipse/cdt/build/core/IToolChain.java
new file mode 100644
index 0000000000..fbf0a4ac8e
--- /dev/null
+++ b/build/org.eclipse.cdt.build.core/src/org/eclipse/cdt/build/core/IToolChain.java
@@ -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);
+
+}
diff --git a/build/org.eclipse.cdt.build.core/src/org/eclipse/cdt/build/core/IToolChainManager.java b/build/org.eclipse.cdt.build.core/src/org/eclipse/cdt/build/core/IToolChainManager.java
new file mode 100644
index 0000000000..0b6ca2c75d
--- /dev/null
+++ b/build/org.eclipse.cdt.build.core/src/org/eclipse/cdt/build/core/IToolChainManager.java
@@ -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);
+
+}
diff --git a/build/org.eclipse.cdt.build.core/src/org/eclipse/cdt/build/core/IToolChainProvider.java b/build/org.eclipse.cdt.build.core/src/org/eclipse/cdt/build/core/IToolChainProvider.java
new file mode 100644
index 0000000000..dec4679055
--- /dev/null
+++ b/build/org.eclipse.cdt.build.core/src/org/eclipse/cdt/build/core/IToolChainProvider.java
@@ -0,0 +1,20 @@
+/*******************************************************************************
+ * 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;
+
+/**
+ * A provider of toolchains. Registered with the toolChainProvider extension
+ * point.
+ */
+public interface IToolChainProvider {
+
+ Collection<IToolChain> getToolChains();
+
+}
diff --git a/build/org.eclipse.cdt.build.core/src/org/eclipse/cdt/build/core/IToolChainType.java b/build/org.eclipse.cdt.build.core/src/org/eclipse/cdt/build/core/IToolChainType.java
new file mode 100644
index 0000000000..aae69d2037
--- /dev/null
+++ b/build/org.eclipse.cdt.build.core/src/org/eclipse/cdt/build/core/IToolChainType.java
@@ -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);
+
+}
diff --git a/build/org.eclipse.cdt.build.core/src/org/eclipse/cdt/build/core/internal/Activator.java b/build/org.eclipse.cdt.build.core/src/org/eclipse/cdt/build/core/internal/Activator.java
new file mode 100644
index 0000000000..d8625d3a09
--- /dev/null
+++ b/build/org.eclipse.cdt.build.core/src/org/eclipse/cdt/build/core/internal/Activator.java
@@ -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;
+ }
+
+}
diff --git a/build/org.eclipse.cdt.build.core/src/org/eclipse/cdt/build/core/internal/CBuildConfigurationCleanup.java b/build/org.eclipse.cdt.build.core/src/org/eclipse/cdt/build/core/internal/CBuildConfigurationCleanup.java
new file mode 100644
index 0000000000..bd4cd7ae14
--- /dev/null
+++ b/build/org.eclipse.cdt.build.core/src/org/eclipse/cdt/build/core/internal/CBuildConfigurationCleanup.java
@@ -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);
+ }
+ }
+ }
+ }
+
+}
diff --git a/build/org.eclipse.cdt.build.core/src/org/eclipse/cdt/build/core/internal/ScannerInfoData.java b/build/org.eclipse.cdt.build.core/src/org/eclipse/cdt/build/core/internal/ScannerInfoData.java
new file mode 100644
index 0000000000..a1599081ea
--- /dev/null
+++ b/build/org.eclipse.cdt.build.core/src/org/eclipse/cdt/build/core/internal/ScannerInfoData.java
@@ -0,0 +1,174 @@
+/*******************************************************************************
+ * 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.File;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.Reader;
+import java.nio.charset.StandardCharsets;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.util.HashMap;
+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.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.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.content.IContentType;
+
+import com.google.gson.Gson;
+
+/**
+ * Class representing scanner info data for a project as stored in the metadata
+ * area.
+ */
+public class ScannerInfoData {
+
+ private Set<ToolChainScannerInfo> perResourceInfo;
+ private Map<String, ToolChainScannerInfo> perLanguageInfo;
+
+ private transient Path savePath;
+ private transient Map<ToolChainScannerInfo, ToolChainScannerInfo> infoCache;
+ private transient Map<String, ToolChainScannerInfo> resourceCache;
+
+ public void createCache() {
+ infoCache = new HashMap<>();
+ resourceCache = new HashMap<>();
+ if (perResourceInfo != null) {
+ for (ToolChainScannerInfo info : perResourceInfo) {
+ infoCache.put(info, info);
+ for (String path : info.getResourcePaths()) {
+ resourceCache.put(path, info);
+ }
+ }
+ }
+ }
+
+ private boolean perResource() {
+ return perResourceInfo != null && !perResourceInfo.isEmpty();
+ }
+
+ private boolean perLanguage() {
+ return perLanguageInfo != null && !perLanguageInfo.isEmpty();
+ }
+
+ public IScannerInfo getScannerInfo(IResource resource) {
+ if (perResource()) {
+ ToolChainScannerInfo info = resourceCache.get(resource.getFullPath().toString());
+ if (info != null) {
+ return info.getScannerInfo();
+ }
+ }
+
+ // Else try language
+ if (perLanguage()) {
+ IProject project = resource.getProject();
+ IContentType contentType = CCorePlugin.getContentType(project, resource.getName());
+ if (contentType != null) {
+ ILanguage language = LanguageManager.getInstance().getLanguage(contentType, project);
+ ToolChainScannerInfo info = perLanguageInfo.get(language.getId());
+ if (info != null) {
+ return info.getScannerInfo();
+ }
+ }
+ }
+
+ return null;
+ }
+
+ public IScannerInfo getScannerInfo(ILanguage language) {
+ if (perLanguage()) {
+ ToolChainScannerInfo info = perLanguageInfo.get(language.getId());
+ if (info != null) {
+ return info.getScannerInfo();
+ }
+ }
+ return null;
+ }
+
+ public void putScannerInfo(IResource resource, ToolChainScannerInfo info) {
+ if (perResourceInfo == null) {
+ perResourceInfo = new HashSet<>();
+ infoCache = new HashMap<>();
+ infoCache.put(info, info);
+ } else {
+ ToolChainScannerInfo existing = infoCache.get(info);
+ if (existing != null) {
+ info = existing;
+ } else {
+ perResourceInfo.add(info);
+ infoCache.put(info, info);
+ }
+ }
+
+ info.addResource(resource);
+ resourceCache.put(resource.getFullPath().toString(), info);
+ queueSave();
+ }
+
+ public void putScannerInfo(ILanguage language, IExtendedScannerInfo info) {
+ if (perLanguageInfo == null) {
+ perLanguageInfo = new HashMap<>();
+ }
+ perLanguageInfo.put(language.getId(), new ToolChainScannerInfo(info));
+ queueSave();
+ }
+
+ public static ScannerInfoData load(CBuildConfiguration config) {
+ 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()) {
+ try (Reader reader = new FileReader(scannerInfoFile)) {
+ info = new Gson().fromJson(reader, ScannerInfoData.class);
+ } catch (Exception e) {
+ CCorePlugin.log(e);
+ }
+ }
+
+ if (info == null) {
+ info = new ScannerInfoData();
+ }
+
+ info.savePath = scannerInfoFile.toPath();
+ info.createCache();
+ return info;
+ }
+
+ public void save() {
+ try {
+ String json = new Gson().toJson(this);
+ Files.createDirectories(savePath.getParent());
+ Files.write(savePath, json.getBytes(StandardCharsets.UTF_8));
+ } catch (IOException e) {
+ CCorePlugin.log(e);
+ }
+ }
+
+ public void queueSave() {
+ ScannerInfoSaveParticipant.getInstance().save(this);
+ }
+
+ public void clear() {
+ perLanguageInfo = null;
+ perResourceInfo = null;
+ createCache();
+ queueSave();
+ }
+
+}
diff --git a/build/org.eclipse.cdt.build.core/src/org/eclipse/cdt/build/core/internal/ScannerInfoSaveParticipant.java b/build/org.eclipse.cdt.build.core/src/org/eclipse/cdt/build/core/internal/ScannerInfoSaveParticipant.java
new file mode 100644
index 0000000000..ed6e41ecb3
--- /dev/null
+++ b/build/org.eclipse.cdt.build.core/src/org/eclipse/cdt/build/core/internal/ScannerInfoSaveParticipant.java
@@ -0,0 +1,57 @@
+/*******************************************************************************
+ * 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.HashSet;
+import java.util.Set;
+
+import org.eclipse.core.resources.ISaveContext;
+import org.eclipse.core.resources.ISaveParticipant;
+import org.eclipse.core.runtime.CoreException;
+
+public class ScannerInfoSaveParticipant implements ISaveParticipant {
+
+ private static ScannerInfoSaveParticipant instance;
+ private Set<ScannerInfoData> toBeSaved = new HashSet<>();
+
+ public ScannerInfoSaveParticipant() {
+ assert instance == null;
+ instance = this;
+ }
+
+ public static ScannerInfoSaveParticipant getInstance() {
+ return instance;
+ }
+
+ public void save(ScannerInfoData info) {
+ toBeSaved.add(info);
+ }
+
+ @Override
+ public void doneSaving(ISaveContext context) {
+ }
+
+ @Override
+ public void prepareToSave(ISaveContext context) throws CoreException {
+ }
+
+ @Override
+ public void rollback(ISaveContext context) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void saving(ISaveContext context) throws CoreException {
+ for (ScannerInfoData info : toBeSaved) {
+ info.save();
+ }
+ toBeSaved.clear();
+ }
+
+}
diff --git a/build/org.eclipse.cdt.build.core/src/org/eclipse/cdt/build/core/internal/ToolChainManager.java b/build/org.eclipse.cdt.build.core/src/org/eclipse/cdt/build/core/internal/ToolChainManager.java
new file mode 100644
index 0000000000..31f97c7985
--- /dev/null
+++ b/build/org.eclipse.cdt.build.core/src/org/eclipse/cdt/build/core/internal/ToolChainManager.java
@@ -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;
+ }
+
+}
diff --git a/build/org.eclipse.cdt.build.core/src/org/eclipse/cdt/build/core/internal/ToolChainScannerInfo.java b/build/org.eclipse.cdt.build.core/src/org/eclipse/cdt/build/core/internal/ToolChainScannerInfo.java
new file mode 100644
index 0000000000..1547c00c25
--- /dev/null
+++ b/build/org.eclipse.cdt.build.core/src/org/eclipse/cdt/build/core/internal/ToolChainScannerInfo.java
@@ -0,0 +1,59 @@
+/*******************************************************************************
+ * 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.Collection;
+import java.util.Collections;
+import java.util.HashSet;
+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;
+
+public class ToolChainScannerInfo {
+ private Map<String, String> definedSymbols;
+ private String[] includePaths;
+ private String[] macroFiles;
+ private String[] includeFiles;
+ private String[] localIncludePath;
+ private Set<String> resourcePaths;
+
+ private transient IScannerInfo scannerInfo;
+
+ public ToolChainScannerInfo(IExtendedScannerInfo scannerInfo) {
+ this.scannerInfo = scannerInfo;
+ this.definedSymbols = scannerInfo.getDefinedSymbols();
+ this.includePaths = scannerInfo.getIncludePaths();
+ this.macroFiles = scannerInfo.getMacroFiles();
+ this.includeFiles = scannerInfo.getIncludeFiles();
+ this.localIncludePath = scannerInfo.getLocalIncludePath();
+ }
+
+ public IScannerInfo getScannerInfo() {
+ if (scannerInfo == null) {
+ scannerInfo = new ExtendedScannerInfo(definedSymbols, includePaths, macroFiles, includeFiles,
+ localIncludePath);
+ }
+ return scannerInfo;
+ }
+
+ public Collection<String> getResourcePaths() {
+ return resourcePaths != null ? resourcePaths : Collections.<String> emptySet();
+ }
+
+ public void addResource(IResource resource) {
+ if (resourcePaths == null) {
+ resourcePaths = new HashSet<>();
+ }
+ resourcePaths.add(resource.getFullPath().toString());
+ }
+
+}
diff --git a/build/org.eclipse.cdt.build.gcc.core/.classpath b/build/org.eclipse.cdt.build.gcc.core/.classpath
new file mode 100644
index 0000000000..eca7bdba8f
--- /dev/null
+++ b/build/org.eclipse.cdt.build.gcc.core/.classpath
@@ -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>
diff --git a/build/org.eclipse.cdt.build.gcc.core/.project b/build/org.eclipse.cdt.build.gcc.core/.project
new file mode 100644
index 0000000000..46346d9b6c
--- /dev/null
+++ b/build/org.eclipse.cdt.build.gcc.core/.project
@@ -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>
diff --git a/build/org.eclipse.cdt.build.gcc.core/.settings/org.eclipse.jdt.core.prefs b/build/org.eclipse.cdt.build.gcc.core/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000000..0c68a61dca
--- /dev/null
+++ b/build/org.eclipse.cdt.build.gcc.core/.settings/org.eclipse.jdt.core.prefs
@@ -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
diff --git a/build/org.eclipse.cdt.build.gcc.core/META-INF/MANIFEST.MF b/build/org.eclipse.cdt.build.gcc.core/META-INF/MANIFEST.MF
new file mode 100644
index 0000000000..8d49393217
--- /dev/null
+++ b/build/org.eclipse.cdt.build.gcc.core/META-INF/MANIFEST.MF
@@ -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
diff --git a/build/org.eclipse.cdt.build.gcc.core/about.html b/build/org.eclipse.cdt.build.gcc.core/about.html
new file mode 100644
index 0000000000..d7c511887d
--- /dev/null
+++ b/build/org.eclipse.cdt.build.gcc.core/about.html
@@ -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> \ No newline at end of file
diff --git a/build/org.eclipse.cdt.build.gcc.core/build.properties b/build/org.eclipse.cdt.build.gcc.core/build.properties
new file mode 100644
index 0000000000..786b1df936
--- /dev/null
+++ b/build/org.eclipse.cdt.build.gcc.core/build.properties
@@ -0,0 +1,6 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml,\
+ about.html
diff --git a/build/org.eclipse.cdt.build.gcc.core/plugin.xml b/build/org.eclipse.cdt.build.gcc.core/plugin.xml
new file mode 100644
index 0000000000..7b98756e95
--- /dev/null
+++ b/build/org.eclipse.cdt.build.gcc.core/plugin.xml
@@ -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>
diff --git a/build/org.eclipse.cdt.build.gcc.core/pom.xml b/build/org.eclipse.cdt.build.gcc.core/pom.xml
new file mode 100644
index 0000000000..ab26166ebc
--- /dev/null
+++ b/build/org.eclipse.cdt.build.gcc.core/pom.xml
@@ -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> \ No newline at end of file
diff --git a/build/org.eclipse.cdt.build.gcc.core/src/org/eclipse/cdt/build/gcc/core/GCCPathToolChainProvider.java b/build/org.eclipse.cdt.build.gcc.core/src/org/eclipse/cdt/build/gcc/core/GCCPathToolChainProvider.java
new file mode 100644
index 0000000000..1e8ba8622f
--- /dev/null
+++ b/build/org.eclipse.cdt.build.gcc.core/src/org/eclipse/cdt/build/gcc/core/GCCPathToolChainProvider.java
@@ -0,0 +1,140 @@
+/*******************************************************************************
+ * 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.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;
+import java.util.Map.Entry;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+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;
+
+/**
+ * Finds gcc and clang on the path.
+ */
+public class GCCPathToolChainProvider implements IToolChainProvider {
+
+ private static Pattern gccPattern = Pattern.compile("(.*-)?(gcc|g\\+\\+|clang|clang\\+\\+)(-[0-9].*)?"); //$NON-NLS-1$
+
+ @Override
+ 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$
+ path = entry.getValue();
+ break;
+ }
+ }
+
+ if (path != null) {
+ Map<String, List<String>> installs = new HashMap<>();
+
+ for (String dirStr : path.split(File.pathSeparator)) {
+ File dir = new File(dirStr);
+ for (String file : dir.list()) {
+ Matcher matcher = gccPattern.matcher(file);
+ if (matcher.matches()) {
+ String prefix = matcher.group(1);
+ String suffix = matcher.group(3);
+ String command = dirStr + File.separatorChar + file;
+ String version = getVersion(command);
+ if (version != null) {
+ List<String> commands = installs.get(version);
+ if (commands == null) {
+ commands = new ArrayList<>();
+ installs.put(version, commands);
+ }
+ commands.add(command);
+ }
+ }
+ }
+ }
+
+ for (Entry<String, List<String>> entry : installs.entrySet()) {
+ String version = entry.getKey();
+ String searchStr;
+ if (version.contains("LLVM")) {
+ searchStr = "clang++";
+ } else {
+ searchStr = "g++";
+ }
+
+ for (String command : entry.getValue()) {
+ 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$
+ private static Pattern targetPattern = Pattern.compile("Target: (.*)"); //$NON-NLS-1$
+
+ private String getVersion(String command) {
+ try {
+ Process proc = new ProcessBuilder(new String[] { command, "-v" }).redirectErrorStream(true) //$NON-NLS-1$
+ .start();
+ String version = null;
+ String target = null;
+ 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;
+ }
+ }
+ }
+ if (version != null) {
+ if (target != null) {
+ return version + " " + target; // $NON-NLS-1$
+ } else {
+ return version;
+ }
+ } else {
+ return null;
+ }
+ } catch (IOException e) {
+ return null;
+ }
+ }
+
+}
diff --git a/build/org.eclipse.cdt.build.gcc.core/src/org/eclipse/cdt/build/gcc/core/GCCToolChain.java b/build/org.eclipse.cdt.build.gcc.core/src/org/eclipse/cdt/build/gcc/core/GCCToolChain.java
new file mode 100644
index 0000000000..8af950559f
--- /dev/null
+++ b/build/org.eclipse.cdt.build.gcc.core/src/org/eclipse/cdt/build/gcc/core/GCCToolChain.java
@@ -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
+
+ }
+
+}
diff --git a/build/org.eclipse.cdt.build.gcc.core/src/org/eclipse/cdt/build/gcc/core/GCCToolChainType.java b/build/org.eclipse.cdt.build.gcc.core/src/org/eclipse/cdt/build/gcc/core/GCCToolChainType.java
new file mode 100644
index 0000000000..f9298f4443
--- /dev/null
+++ b/build/org.eclipse.cdt.build.gcc.core/src/org/eclipse/cdt/build/gcc/core/GCCToolChainType.java
@@ -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;
+ }
+
+}
diff --git a/build/org.eclipse.cdt.build.gcc.core/src/org/eclipse/cdt/build/gcc/core/internal/Activator.java b/build/org.eclipse.cdt.build.gcc.core/src/org/eclipse/cdt/build/gcc/core/internal/Activator.java
new file mode 100644
index 0000000000..c9f26e7d2d
--- /dev/null
+++ b/build/org.eclipse.cdt.build.gcc.core/src/org/eclipse/cdt/build/gcc/core/internal/Activator.java
@@ -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;
+ }
+
+}
diff --git a/build/org.eclipse.cdt.build.ui/.classpath b/build/org.eclipse.cdt.build.ui/.classpath
new file mode 100644
index 0000000000..eca7bdba8f
--- /dev/null
+++ b/build/org.eclipse.cdt.build.ui/.classpath
@@ -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>
diff --git a/build/org.eclipse.cdt.build.ui/.project b/build/org.eclipse.cdt.build.ui/.project
new file mode 100644
index 0000000000..08ffdebc5c
--- /dev/null
+++ b/build/org.eclipse.cdt.build.ui/.project
@@ -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>
diff --git a/build/org.eclipse.cdt.build.ui/.settings/org.eclipse.jdt.core.prefs b/build/org.eclipse.cdt.build.ui/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000000..0c68a61dca
--- /dev/null
+++ b/build/org.eclipse.cdt.build.ui/.settings/org.eclipse.jdt.core.prefs
@@ -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
diff --git a/build/org.eclipse.cdt.build.ui/META-INF/MANIFEST.MF b/build/org.eclipse.cdt.build.ui/META-INF/MANIFEST.MF
new file mode 100644
index 0000000000..e64bcb322c
--- /dev/null
+++ b/build/org.eclipse.cdt.build.ui/META-INF/MANIFEST.MF
@@ -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
diff --git a/build/org.eclipse.cdt.build.ui/OSGI-INF/consoleservice.xml b/build/org.eclipse.cdt.build.ui/OSGI-INF/consoleservice.xml
new file mode 100644
index 0000000000..f1990da3d9
--- /dev/null
+++ b/build/org.eclipse.cdt.build.ui/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>
diff --git a/build/org.eclipse.cdt.build.ui/about.html b/build/org.eclipse.cdt.build.ui/about.html
new file mode 100644
index 0000000000..d7c511887d
--- /dev/null
+++ b/build/org.eclipse.cdt.build.ui/about.html
@@ -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> \ No newline at end of file
diff --git a/build/org.eclipse.cdt.build.ui/build.properties b/build/org.eclipse.cdt.build.ui/build.properties
new file mode 100644
index 0000000000..17daa5b49c
--- /dev/null
+++ b/build/org.eclipse.cdt.build.ui/build.properties
@@ -0,0 +1,5 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ about.html
diff --git a/build/org.eclipse.cdt.build.ui/pom.xml b/build/org.eclipse.cdt.build.ui/pom.xml
new file mode 100644
index 0000000000..2e2d7b43d5
--- /dev/null
+++ b/build/org.eclipse.cdt.build.ui/pom.xml
@@ -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> \ No newline at end of file
diff --git a/build/org.eclipse.cdt.build.ui/src/org/eclipse/cdt/build/ui/internal/Activator.java b/build/org.eclipse.cdt.build.ui/src/org/eclipse/cdt/build/ui/internal/Activator.java
new file mode 100644
index 0000000000..2d00aaabe8
--- /dev/null
+++ b/build/org.eclipse.cdt.build.ui/src/org/eclipse/cdt/build/ui/internal/Activator.java
@@ -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;
+ }
+
+}
diff --git a/build/org.eclipse.cdt.build.ui/src/org/eclipse/cdt/build/ui/internal/CConsoleService.java b/build/org.eclipse.cdt.build.ui/src/org/eclipse/cdt/build/ui/internal/CConsoleService.java
new file mode 100644
index 0000000000..3dbf85157b
--- /dev/null
+++ b/build/org.eclipse.cdt.build.ui/src/org/eclipse/cdt/build/ui/internal/CConsoleService.java
@@ -0,0 +1,162 @@
+/*******************************************************************************
+ * 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 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.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;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.console.ConsolePlugin;
+import org.eclipse.ui.console.IConsole;
+import org.eclipse.ui.console.MessageConsole;
+import org.eclipse.ui.console.MessageConsoleStream;
+
+public class CConsoleService implements IConsoleService, IResourceChangeListener {
+
+ private MessageConsole console;
+ private MessageConsoleStream out;
+ private MessageConsoleStream err;
+
+ private Path buildDirectory;
+ List<CPatternMatchListener> listeners = new ArrayList<>();
+
+ private void initConsole() {
+ console = new MessageConsole("C/C++", null);
+ ConsolePlugin.getDefault().getConsoleManager().addConsoles(new IConsole[] { console });
+ out = console.newMessageStream();
+ err = console.newMessageStream();
+
+ // set the colors
+ final Display display = Display.getDefault();
+ display.syncExec(new Runnable() {
+ @Override
+ public void run() {
+ // TODO use preferences so user can change the colors
+ out.setColor(display.getSystemColor(SWT.COLOR_BLACK));
+ err.setColor(display.getSystemColor(SWT.COLOR_RED));
+ }
+ });
+ ResourcesPlugin.getWorkspace().addResourceChangeListener(this, IResourceChangeEvent.PRE_BUILD);
+ }
+
+ @Override
+ public void resourceChanged(IResourceChangeEvent event) {
+ switch (event.getType()) {
+ case IResourceChangeEvent.PRE_BUILD:
+ if (event.getBuildKind() != IncrementalProjectBuilder.AUTO_BUILD) {
+ // TODO this really should be done from the core and only when
+ // our projects are being built
+ console.clearConsole();
+ }
+ break;
+ }
+ }
+
+ @Override
+ public void monitor(final Process process, CConsoleParser[] consoleParsers, Path buildDirectory)
+ throws IOException {
+ if (console == null) {
+ initConsole();
+ }
+
+ this.buildDirectory = buildDirectory;
+
+ // Clear the old listeners
+ for (CPatternMatchListener listener : listeners) {
+ console.removePatternMatchListener(listener);
+ }
+ listeners.clear();
+
+ // Add in the new ones if any
+ if (consoleParsers != null) {
+ for (CConsoleParser parser : consoleParsers) {
+ CPatternMatchListener listener = new CPatternMatchListener(this, parser);
+ listeners.add(listener);
+ console.addPatternMatchListener(listener);
+ }
+ }
+
+ console.activate();
+
+ final CountDownLatch latch = new CountDownLatch(2);
+
+ // Output stream reader
+ new Thread("C/C++ Build Console Output") { //$NON-NLS-1$
+ @Override
+ public void run() {
+ 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');
+ }
+ } catch (IOException e) {
+ e.printStackTrace();
+ } finally {
+ latch.countDown();
+ }
+ }
+ }.start();
+
+ // Error stream reader
+ new Thread("C/C++ Build Console Error") { //$NON-NLS-1$
+ @Override
+ public void run() {
+ 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');
+ }
+ } catch (IOException e) {
+ e.printStackTrace();
+ } finally {
+ latch.countDown();
+ }
+ }
+ }.start();
+
+ try {
+ latch.await();
+ process.waitFor();
+ } catch (InterruptedException e) {
+ Activator.log(e);
+ }
+ }
+
+ @Override
+ public void writeOutput(String msg) throws IOException {
+ if (out == null) {
+ initConsole();
+ }
+ out.write(msg);
+ }
+
+ @Override
+ public void writeError(String msg) throws IOException {
+ if (err == null) {
+ initConsole();
+ }
+ err.write(msg);
+ }
+
+ public Path getBuildDirectory() {
+ return buildDirectory;
+ }
+
+}
diff --git a/build/org.eclipse.cdt.build.ui/src/org/eclipse/cdt/build/ui/internal/CHyperlink.java b/build/org.eclipse.cdt.build.ui/src/org/eclipse/cdt/build/ui/internal/CHyperlink.java
new file mode 100644
index 0000000000..2d3c571644
--- /dev/null
+++ b/build/org.eclipse.cdt.build.ui/src/org/eclipse/cdt/build/ui/internal/CHyperlink.java
@@ -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.build.ui.internal;
+
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.console.IHyperlink;
+import org.eclipse.ui.ide.IDE;
+
+public class CHyperlink implements IHyperlink {
+
+ private final IMarker marker;
+
+ public CHyperlink(IMarker marker) {
+ this.marker = marker;
+ }
+
+ @Override
+ public void linkEntered() {
+ }
+
+ @Override
+ public void linkExited() {
+ }
+
+ @Override
+ public void linkActivated() {
+ IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
+ try {
+ IDE.openEditor(page, marker);
+ } catch (PartInitException e) {
+ Activator.log(e);
+ }
+ }
+
+}
diff --git a/build/org.eclipse.cdt.build.ui/src/org/eclipse/cdt/build/ui/internal/CPatternMatchListener.java b/build/org.eclipse.cdt.build.ui/src/org/eclipse/cdt/build/ui/internal/CPatternMatchListener.java
new file mode 100644
index 0000000000..d27471236a
--- /dev/null
+++ b/build/org.eclipse.cdt.build.ui/src/org/eclipse/cdt/build/ui/internal/CPatternMatchListener.java
@@ -0,0 +1,68 @@
+/*******************************************************************************
+ * 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.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;
+
+public class CPatternMatchListener implements IPatternMatchListener {
+
+ protected final CConsoleService console;
+ protected final CConsoleParser parser;
+
+ protected TextConsole textConsole;
+
+ public CPatternMatchListener(CConsoleService console, CConsoleParser parser) {
+ this.console = console;
+ this.parser = parser;
+ }
+
+ @Override
+ public void connect(TextConsole console) {
+ this.textConsole = console;
+ }
+
+ @Override
+ public void disconnect() {
+ }
+
+ @Override
+ public void matchFound(PatternMatchEvent event) {
+ try {
+ String text = textConsole.getDocument().get(event.getOffset(), event.getLength());
+ IMarker marker = parser.generateMarker(console.getBuildDirectory(), text);
+ if (marker != null) {
+ textConsole.addHyperlink(new CHyperlink(marker),
+ event.getOffset() + marker.getAttribute(CConsoleParser.LINK_OFFSET, 0),
+ marker.getAttribute(CConsoleParser.LINK_LENGTH, event.getLength()));
+ }
+ } catch (BadLocationException e) {
+ Activator.log(e);
+ }
+ }
+
+ @Override
+ public String getPattern() {
+ return parser.getPattern();
+ }
+
+ @Override
+ public int getCompilerFlags() {
+ return parser.getCompilerFlags();
+ }
+
+ @Override
+ public String getLineQualifier() {
+ return parser.getLineQualifier();
+ }
+
+}
diff --git a/build/org.eclipse.cdt.gnu.build-feature/feature.xml b/build/org.eclipse.cdt.gnu.build-feature/feature.xml
index 9f31162265..9ed97d90b6 100644
--- a/build/org.eclipse.cdt.gnu.build-feature/feature.xml
+++ b/build/org.eclipse.cdt.gnu.build-feature/feature.xml
@@ -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>
diff --git a/build/org.eclipse.cdt.gnu.build.source-feature/feature.xml b/build/org.eclipse.cdt.gnu.build.source-feature/feature.xml
index 957b40433f..07076e3b60 100644
--- a/build/org.eclipse.cdt.gnu.build.source-feature/feature.xml
+++ b/build/org.eclipse.cdt.gnu.build.source-feature/feature.xml
@@ -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>

Back to the top