Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDoug Schaefer2016-09-12 01:30:25 +0000
committerDoug Schaefer2016-09-12 15:14:17 +0000
commitb26917be9068d14b7fa5d5c6b2fdcc1228a0e445 (patch)
tree362c69a1a312cff5d4e8221cf45fc541fd2faed9 /build/org.eclipse.cdt.cmake.core
parenta6062a2b985ae2856d0ee5c8d79220c8be8b02ea (diff)
downloadorg.eclipse.cdt-b26917be9068d14b7fa5d5c6b2fdcc1228a0e445.tar.gz
org.eclipse.cdt-b26917be9068d14b7fa5d5c6b2fdcc1228a0e445.tar.xz
org.eclipse.cdt-b26917be9068d14b7fa5d5c6b2fdcc1228a0e445.zip
Introduce Core Build launches and Launch Bar integration.
Unify launching for projects that use the new Core Build system. Starts with CMake projects. We'll do Qt projects next. Change-Id: I14af8e99decd54cc6548095b3ad3e054c550aea2
Diffstat (limited to 'build/org.eclipse.cdt.cmake.core')
-rw-r--r--build/org.eclipse.cdt.cmake.core/META-INF/MANIFEST.MF5
-rw-r--r--build/org.eclipse.cdt.cmake.core/plugin.xml33
-rw-r--r--build/org.eclipse.cdt.cmake.core/pom.xml2
-rw-r--r--build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/CMakeBuildConfiguration.java5
-rw-r--r--build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/CMakeLaunchConfigurationDelegate.java86
-rw-r--r--build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/CMakeLaunchConfigurationProvider.java111
-rw-r--r--build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/CMakeLaunchDescriptor.java49
-rw-r--r--build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/CMakeLaunchDescriptorType.java39
8 files changed, 5 insertions, 325 deletions
diff --git a/build/org.eclipse.cdt.cmake.core/META-INF/MANIFEST.MF b/build/org.eclipse.cdt.cmake.core/META-INF/MANIFEST.MF
index 2cf8671247f..76fde2680d3 100644
--- a/build/org.eclipse.cdt.cmake.core/META-INF/MANIFEST.MF
+++ b/build/org.eclipse.cdt.cmake.core/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: CDT CMake Core
Bundle-SymbolicName: org.eclipse.cdt.cmake.core;singleton:=true
-Bundle-Version: 1.0.0.qualifier
+Bundle-Version: 1.1.0.qualifier
Bundle-Activator: org.eclipse.cdt.cmake.core.internal.Activator
Bundle-Vendor: Eclipse CDT
Require-Bundle: org.eclipse.core.runtime,
@@ -14,4 +14,5 @@ Require-Bundle: org.eclipse.core.runtime,
com.google.gson
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-ActivationPolicy: lazy
-Export-Package: org.eclipse.cdt.cmake.core
+Export-Package: org.eclipse.cdt.cmake.core,
+ org.eclipse.cdt.cmake.core.internal;x-friends:="org.eclipse.cdt.cmake.ui"
diff --git a/build/org.eclipse.cdt.cmake.core/plugin.xml b/build/org.eclipse.cdt.cmake.core/plugin.xml
index 2673e5b6d95..b907d39959a 100644
--- a/build/org.eclipse.cdt.cmake.core/plugin.xml
+++ b/build/org.eclipse.cdt.cmake.core/plugin.xml
@@ -12,39 +12,6 @@
</runtime>
</extension>
<extension
- point="org.eclipse.launchbar.core.launchBarContributions">
- <descriptorType
- class="org.eclipse.cdt.cmake.core.internal.CMakeLaunchDescriptorType"
- id="org.eclipse.cdt.cmake.core.descriptorType"
- priority="10">
- <enablement>
- <instanceof
- value="org.eclipse.core.resources.IProject">
- </instanceof>
- <test
- forcePluginActivation="true"
- property="org.eclipse.core.resources.projectNature"
- value="org.eclipse.cdt.cmake.core.cmakeNature">
- </test>
- </enablement>
- </descriptorType>
- <configProvider
- class="org.eclipse.cdt.cmake.core.internal.CMakeLaunchConfigurationProvider"
- descriptorType="org.eclipse.cdt.cmake.core.descriptorType"
- priority="10">
- </configProvider>
- </extension>
- <extension
- point="org.eclipse.debug.core.launchConfigurationTypes">
- <launchConfigurationType
- delegate="org.eclipse.cdt.cmake.core.internal.CMakeLaunchConfigurationDelegate"
- id="org.eclipse.cdt.cmake.core.launchConfigurationType"
- modes="run"
- name="CMake Application"
- public="true">
- </launchConfigurationType>
- </extension>
- <extension
point="org.eclipse.cdt.core.buildConfigProvider">
<provider
class="org.eclipse.cdt.cmake.core.internal.CMakeBuildConfigurationProvider"
diff --git a/build/org.eclipse.cdt.cmake.core/pom.xml b/build/org.eclipse.cdt.cmake.core/pom.xml
index 90611596e23..4e9235ecd12 100644
--- a/build/org.eclipse.cdt.cmake.core/pom.xml
+++ b/build/org.eclipse.cdt.cmake.core/pom.xml
@@ -11,7 +11,7 @@
<relativePath>../../pom.xml</relativePath>
</parent>
- <version>1.0.0-SNAPSHOT</version>
+ <version>1.1.0-SNAPSHOT</version>
<artifactId>org.eclipse.cdt.cmake.core</artifactId>
<packaging>eclipse-plugin</packaging>
</project> \ No newline at end of file
diff --git a/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/CMakeBuildConfiguration.java b/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/CMakeBuildConfiguration.java
index 9db982f7ce4..1b684999dad 100644
--- a/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/CMakeBuildConfiguration.java
+++ b/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/CMakeBuildConfiguration.java
@@ -28,13 +28,10 @@ import org.eclipse.cdt.core.build.IToolChain;
import org.eclipse.cdt.core.model.ICModelMarker;
import org.eclipse.cdt.core.resources.IConsole;
import org.eclipse.core.resources.IBuildConfiguration;
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Platform;
import org.osgi.service.prefs.BackingStoreException;
import org.osgi.service.prefs.Preferences;
@@ -50,11 +47,11 @@ public class CMakeBuildConfiguration extends CBuildConfiguration {
public CMakeBuildConfiguration(IBuildConfiguration config, String name) throws CoreException {
super(config, name);
+ ICMakeToolChainManager manager = Activator.getService(ICMakeToolChainManager.class);
Preferences settings = getSettings();
String pathStr = settings.get(TOOLCHAIN_FILE, ""); //$NON-NLS-1$
if (!pathStr.isEmpty()) {
Path path = Paths.get(pathStr);
- ICMakeToolChainManager manager = Activator.getService(ICMakeToolChainManager.class);
toolChainFile = manager.getToolChainFile(path);
}
}
diff --git a/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/CMakeLaunchConfigurationDelegate.java b/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/CMakeLaunchConfigurationDelegate.java
deleted file mode 100644
index a2a5435d23f..00000000000
--- a/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/CMakeLaunchConfigurationDelegate.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2015 QNX Software Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *******************************************************************************/
-package org.eclipse.cdt.cmake.core.internal;
-
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.cdt.core.build.ICBuildConfiguration;
-import org.eclipse.cdt.core.build.ICBuildConfigurationManager;
-import org.eclipse.cdt.core.build.IToolChain;
-import org.eclipse.cdt.core.build.IToolChainManager;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IProjectDescription;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.debug.core.ILaunch;
-import org.eclipse.debug.core.ILaunchConfiguration;
-import org.eclipse.debug.core.model.ILaunchConfigurationDelegate;
-import org.eclipse.launchbar.core.target.ILaunchTarget;
-import org.eclipse.launchbar.core.target.launch.LaunchConfigurationTargetedDelegate;
-
-public class CMakeLaunchConfigurationDelegate extends LaunchConfigurationTargetedDelegate
- implements ILaunchConfigurationDelegate {
-
- public static final String TYPE_ID = "org.eclipse.cdt.cmake.core.launchConfigurationType"; //$NON-NLS-1$
-
- private ICBuildConfigurationManager configManager = Activator.getService(ICBuildConfigurationManager.class);
- private IToolChainManager tcManager = Activator.getService(IToolChainManager.class);
-
- private IProject getProject(ILaunchConfiguration configuration) throws CoreException {
- return configuration.getMappedResources()[0].getProject();
- }
-
- @Override
- public boolean buildForLaunch(ILaunchConfiguration configuration, String mode, ILaunchTarget target,
- IProgressMonitor monitor) throws CoreException {
- // Set active build config based on toolchain for target
- Map<String, String> properties = new HashMap<>();
- String os = target.getAttribute(ILaunchTarget.ATTR_OS, ""); //$NON-NLS-1$
- if (!os.isEmpty()) {
- properties.put(IToolChain.ATTR_OS, os);
- }
- String arch = target.getAttribute(ILaunchTarget.ATTR_ARCH, ""); //$NON-NLS-1$
- if (!arch.isEmpty()) {
- properties.put(IToolChain.ATTR_ARCH, arch);
- }
- Collection<IToolChain> tcs = tcManager.getToolChainsMatching(properties);
- if (!tcs.isEmpty()) {
- IToolChain toolChain = tcs.iterator().next();
-
- IProject project = getProject(configuration);
- ICBuildConfiguration config = configManager.getBuildConfiguration(project, toolChain, "run", monitor); //$NON-NLS-1$
-
- if (config != null) {
- IProjectDescription desc = project.getDescription();
- desc.setActiveBuildConfig(config.getBuildConfiguration().getName());
- project.setDescription(desc, monitor);
- }
- }
-
- // proceed with the build
- return superBuildForLaunch(configuration, mode, monitor);
- }
-
- @Override
- public void launch(ILaunchConfiguration configuration, String mode, ILaunch launch, IProgressMonitor monitor)
- throws CoreException {
- // TODO need to find the binary and launch it.
- // Though, more likely, need to have launch configs per binary.
- }
-
- @Override
- protected IProject[] getBuildOrder(ILaunchConfiguration configuration, String mode) throws CoreException {
- // 1. Extract project from configuration
- // TODO dependencies too.
- IProject project = getProject(configuration);
- return new IProject[] { project };
- }
-
-}
diff --git a/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/CMakeLaunchConfigurationProvider.java b/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/CMakeLaunchConfigurationProvider.java
deleted file mode 100644
index adf1bb8d358..00000000000
--- a/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/CMakeLaunchConfigurationProvider.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2015 QNX Software Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *******************************************************************************/
-package org.eclipse.cdt.cmake.core.internal;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Map.Entry;
-
-import org.eclipse.cdt.cmake.core.ICMakeToolChainManager;
-import org.eclipse.cdt.core.build.IToolChain;
-import org.eclipse.cdt.core.build.IToolChainManager;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.debug.core.DebugPlugin;
-import org.eclipse.debug.core.ILaunchConfiguration;
-import org.eclipse.debug.core.ILaunchConfigurationType;
-import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
-import org.eclipse.launchbar.core.AbstractLaunchConfigProvider;
-import org.eclipse.launchbar.core.ILaunchDescriptor;
-import org.eclipse.launchbar.core.target.ILaunchTarget;
-import org.eclipse.launchbar.core.target.ILaunchTargetManager;
-
-public class CMakeLaunchConfigurationProvider extends AbstractLaunchConfigProvider {
-
- private Map<IProject, ILaunchConfiguration> configs = new HashMap<>();
-
- @Override
- public boolean supports(ILaunchDescriptor descriptor, ILaunchTarget target) throws CoreException {
- return ILaunchTargetManager.localLaunchTargetTypeId.equals(target.getTypeId());
- }
-
- @Override
- public ILaunchConfigurationType getLaunchConfigurationType(ILaunchDescriptor descriptor, ILaunchTarget target)
- throws CoreException {
- return DebugPlugin.getDefault().getLaunchManager()
- .getLaunchConfigurationType(CMakeLaunchConfigurationDelegate.TYPE_ID);
- }
-
- @Override
- public ILaunchConfiguration getLaunchConfiguration(ILaunchDescriptor descriptor, ILaunchTarget target)
- throws CoreException {
- ILaunchConfiguration config = null;
- IProject project = descriptor.getAdapter(IProject.class);
- if (project != null) {
- config = configs.get(project);
- if (config == null) {
- config = createLaunchConfiguration(descriptor, target);
- // launch config added will get called below to add it to the
- // configs map
- }
- }
- return config;
- }
-
- @Override
- protected void populateLaunchConfiguration(ILaunchDescriptor descriptor, ILaunchTarget target,
- ILaunchConfigurationWorkingCopy workingCopy) throws CoreException {
- super.populateLaunchConfiguration(descriptor, target, workingCopy);
-
- // Set the project and the connection
- CMakeLaunchDescriptor qtDesc = (CMakeLaunchDescriptor) descriptor;
- workingCopy.setMappedResources(new IResource[] { qtDesc.getProject() });
- }
-
- @Override
- public boolean launchConfigurationAdded(ILaunchConfiguration configuration) throws CoreException {
- if (ownsLaunchConfiguration(configuration)) {
- IProject project = configuration.getMappedResources()[0].getProject();
- configs.put(project, configuration);
- return true;
- }
- return false;
- }
-
- @Override
- public boolean launchConfigurationRemoved(ILaunchConfiguration configuration) throws CoreException {
- for (Entry<IProject, ILaunchConfiguration> entry : configs.entrySet()) {
- if (configuration.equals(entry.getValue())) {
- configs.remove(entry.getKey());
- return true;
- }
- }
- return false;
- }
-
- @Override
- public boolean launchConfigurationChanged(ILaunchConfiguration configuration) throws CoreException {
- // TODO not sure I care
- return false;
- }
-
- @Override
- public void launchDescriptorRemoved(ILaunchDescriptor descriptor) throws CoreException {
- IProject project = descriptor.getAdapter(IProject.class);
- if (project != null) {
- configs.remove(project);
- }
- }
-
- @Override
- public void launchTargetRemoved(ILaunchTarget target) throws CoreException {
- // nothing to do since the Local connection can't be removed
- }
-
-}
diff --git a/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/CMakeLaunchDescriptor.java b/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/CMakeLaunchDescriptor.java
deleted file mode 100644
index cd1cff81eee..00000000000
--- a/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/CMakeLaunchDescriptor.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2015 QNX Software Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *******************************************************************************/
-package org.eclipse.cdt.cmake.core.internal;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.PlatformObject;
-import org.eclipse.launchbar.core.ILaunchDescriptor;
-import org.eclipse.launchbar.core.ILaunchDescriptorType;
-
-public class CMakeLaunchDescriptor extends PlatformObject implements ILaunchDescriptor {
-
- private final CMakeLaunchDescriptorType type;
- private final IProject project;
-
- public CMakeLaunchDescriptor(CMakeLaunchDescriptorType type, IProject project) {
- this.type = type;
- this.project = project;
- }
-
- @Override
- public String getName() {
- return project.getName();
- }
-
- @Override
- public ILaunchDescriptorType getType() {
- return type;
- }
-
- public IProject getProject() {
- return project;
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public <T> T getAdapter(Class<T> adapter) {
- if (adapter.equals(IProject.class)) {
- return (T) project;
- } else {
- return super.getAdapter(adapter);
- }
- }
-
-}
diff --git a/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/CMakeLaunchDescriptorType.java b/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/CMakeLaunchDescriptorType.java
deleted file mode 100644
index 944084338af..00000000000
--- a/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/CMakeLaunchDescriptorType.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2015 QNX Software Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *******************************************************************************/
-package org.eclipse.cdt.cmake.core.internal;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.cdt.cmake.core.CMakeNature;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.launchbar.core.ILaunchDescriptor;
-import org.eclipse.launchbar.core.ILaunchDescriptorType;
-
-public class CMakeLaunchDescriptorType implements ILaunchDescriptorType {
-
- private Map<IProject, CMakeLaunchDescriptor> descriptors = new HashMap<>();
-
- @Override
- public ILaunchDescriptor getDescriptor(Object launchObject) throws CoreException {
- if (launchObject instanceof IProject) {
- IProject project = (IProject) launchObject;
- if (project.hasNature(CMakeNature.ID)) {
- CMakeLaunchDescriptor desc = descriptors.get(project);
- if (desc == null) {
- desc = new CMakeLaunchDescriptor(this, project);
- descriptors.put(project, desc);
- }
- return desc;
- }
- }
- return null;
- }
-
-}

Back to the top