mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-22 06:02:11 +02:00
Add Makefile Projects to collection of core build project types.
Reuses the old makeNature. Reuses the StandardBuildConfiguration. Generates a pretty simple project for now. Also handles the case where you don't want to generate anything, just create an empty or on an existing source tree. Change-Id: I2f3cddc85d55792a2c537e37d4bc236a3073d930
This commit is contained in:
parent
2bc9836f68
commit
4ce1f1ca16
22 changed files with 675 additions and 357 deletions
|
@ -288,11 +288,11 @@ public class GCCToolChain extends PlatformObject implements IToolChain {
|
||||||
// Change source file to a tmp file (needs to be empty)
|
// Change source file to a tmp file (needs to be empty)
|
||||||
Path tmpFile = null;
|
Path tmpFile = null;
|
||||||
for (int i = 1; i < commandLine.size(); ++i) {
|
for (int i = 1; i < commandLine.size(); ++i) {
|
||||||
if (!commandLine.get(i).startsWith("-")) { //$NON-NLS-1$
|
String arg = commandLine.get(i);
|
||||||
// TODO optimize by dealing with multi arg options like -o
|
if (!arg.startsWith("-")) { //$NON-NLS-1$
|
||||||
Path filePath;
|
Path filePath;
|
||||||
try {
|
try {
|
||||||
filePath = buildDirectory.resolve(commandLine.get(i));
|
filePath = buildDirectory.resolve(commandLine.get(i)).normalize();
|
||||||
} catch (InvalidPathException e) {
|
} catch (InvalidPathException e) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -312,6 +312,10 @@ public class GCCToolChain extends PlatformObject implements IToolChain {
|
||||||
tmpFile = Files.createTempFile(parentPath, ".sc", extension); //$NON-NLS-1$
|
tmpFile = Files.createTempFile(parentPath, ".sc", extension); //$NON-NLS-1$
|
||||||
commandLine.set(i, tmpFile.toString());
|
commandLine.set(i, tmpFile.toString());
|
||||||
}
|
}
|
||||||
|
} else if (arg.equals("-o")) { //$NON-NLS-1$
|
||||||
|
// skip over the next arg
|
||||||
|
// TODO handle other args like this
|
||||||
|
i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (tmpFile == null) {
|
if (tmpFile == null) {
|
||||||
|
@ -486,7 +490,7 @@ public class GCCToolChain extends PlatformObject implements IToolChain {
|
||||||
if (cCommand.contains("gcc")) { //$NON-NLS-1$
|
if (cCommand.contains("gcc")) { //$NON-NLS-1$
|
||||||
cppCommand = cCommand.replace("gcc", "g++"); //$NON-NLS-1$ //$NON-NLS-2$
|
cppCommand = cCommand.replace("gcc", "g++"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
// Also recognize c++ as an alias for g++
|
// Also recognize c++ as an alias for g++
|
||||||
commands = new String[] { cCommand, cppCommand, cCommand.replace("gcc", "c++") }; //$NON-NLS-1$ //$NON-NLS-2$
|
commands = new String[] { cCommand, cppCommand, cCommand.replace("gcc", "c++"), "cc", "c++" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
|
||||||
} else if (cCommand.contains("clang")) { //$NON-NLS-1$
|
} else if (cCommand.contains("clang")) { //$NON-NLS-1$
|
||||||
cppCommand = cCommand.replace("clang", "clang++"); //$NON-NLS-1$ //$NON-NLS-2$
|
cppCommand = cCommand.replace("clang", "clang++"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
commands = new String[] { cCommand, cppCommand };
|
commands = new String[] { cCommand, cppCommand };
|
||||||
|
@ -529,22 +533,22 @@ public class GCCToolChain extends PlatformObject implements IToolChain {
|
||||||
// ran into an option, we're done.
|
// ran into an option, we're done.
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
try {
|
||||||
Path srcPath = Paths.get(arg);
|
Path srcPath = Paths.get(arg);
|
||||||
URI uri;
|
URI uri;
|
||||||
if (srcPath.isAbsolute()) {
|
if (srcPath.isAbsolute()) {
|
||||||
uri = srcPath.toUri();
|
uri = srcPath.toUri();
|
||||||
} else {
|
} else {
|
||||||
try {
|
uri = Paths.get(buildDirectoryURI).resolve(srcPath).toUri().normalize();
|
||||||
uri = buildDirectoryURI.resolve(arg);
|
|
||||||
} catch (IllegalArgumentException e) {
|
|
||||||
// Bad URI
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (IFile resource : root.findFilesForLocationURI(uri)) {
|
for (IFile resource : root.findFilesForLocationURI(uri)) {
|
||||||
resources.add(resource);
|
resources.add(resource);
|
||||||
}
|
}
|
||||||
|
} catch (IllegalArgumentException e) {
|
||||||
|
// Bad URI
|
||||||
|
continue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return resources.toArray(new IResource[resources.size()]);
|
return resources.toArray(new IResource[resources.size()]);
|
||||||
|
|
|
@ -58,7 +58,9 @@ public class CMakeProjectGenerator extends FMProjectGenerator {
|
||||||
List<IPathEntry> entries = new ArrayList<>();
|
List<IPathEntry> entries = new ArrayList<>();
|
||||||
IProject project = getProject();
|
IProject project = getProject();
|
||||||
|
|
||||||
// Create the source folders
|
// Create the source and output folders
|
||||||
|
IFolder buildFolder = getProject().getFolder("build"); //$NON-NLS-1$
|
||||||
|
|
||||||
TemplateManifest manifest = getManifest();
|
TemplateManifest manifest = getManifest();
|
||||||
if (manifest != null) {
|
if (manifest != null) {
|
||||||
List<SourceRoot> srcRoots = getManifest().getSrcRoots();
|
List<SourceRoot> srcRoots = getManifest().getSrcRoots();
|
||||||
|
@ -69,14 +71,15 @@ public class CMakeProjectGenerator extends FMProjectGenerator {
|
||||||
sourceFolder.create(true, true, monitor);
|
sourceFolder.create(true, true, monitor);
|
||||||
}
|
}
|
||||||
|
|
||||||
entries.add(CoreModel.newSourceEntry(sourceFolder.getFullPath()));
|
entries.add(CoreModel.newSourceEntry(sourceFolder.getFullPath(),
|
||||||
|
new IPath[] { buildFolder.getFullPath() }));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
entries.add(CoreModel.newSourceEntry(getProject().getFullPath()));
|
entries.add(CoreModel.newSourceEntry(getProject().getFullPath()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
entries.add(CoreModel.newOutputEntry(getProject().getFolder("build").getFullPath(), //$NON-NLS-1$
|
entries.add(CoreModel.newOutputEntry(buildFolder.getFullPath(), // $NON-NLS-1$
|
||||||
new IPath[] { new Path("**/CMakeFiles/**") })); //$NON-NLS-1$
|
new IPath[] { new Path("**/CMakeFiles/**") })); //$NON-NLS-1$
|
||||||
CoreModel.getDefault().create(project).setRawPathEntries(entries.toArray(new IPathEntry[entries.size()]),
|
CoreModel.getDefault().create(project).setRawPathEntries(entries.toArray(new IPathEntry[entries.size()]),
|
||||||
monitor);
|
monitor);
|
||||||
|
|
BIN
build/org.eclipse.cdt.core.autotools.ui/icons/cdt_logo_48.png
Normal file
BIN
build/org.eclipse.cdt.core.autotools.ui/icons/cdt_logo_48.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.6 KiB |
|
@ -4,6 +4,7 @@
|
||||||
<extension
|
<extension
|
||||||
point="org.eclipse.tools.templates.ui.templates">
|
point="org.eclipse.tools.templates.ui.templates">
|
||||||
<template
|
<template
|
||||||
|
icon="icons/cdt_logo_48.png"
|
||||||
id="org.eclipse.cdt.core.autotools.ui.template1"
|
id="org.eclipse.cdt.core.autotools.ui.template1"
|
||||||
label="%autotoolsTemplate.label"
|
label="%autotoolsTemplate.label"
|
||||||
wizard="org.eclipse.cdt.core.autotools.ui.internal.NewAutotoolsProjectWizard">
|
wizard="org.eclipse.cdt.core.autotools.ui.internal.NewAutotoolsProjectWizard">
|
||||||
|
|
|
@ -2,7 +2,7 @@ Manifest-Version: 1.0
|
||||||
Bundle-ManifestVersion: 2
|
Bundle-ManifestVersion: 2
|
||||||
Bundle-Name: %pluginName
|
Bundle-Name: %pluginName
|
||||||
Bundle-SymbolicName: org.eclipse.cdt.make.core; singleton:=true
|
Bundle-SymbolicName: org.eclipse.cdt.make.core; singleton:=true
|
||||||
Bundle-Version: 7.3.0.qualifier
|
Bundle-Version: 7.4.0.qualifier
|
||||||
Bundle-Activator: org.eclipse.cdt.make.core.MakeCorePlugin
|
Bundle-Activator: org.eclipse.cdt.make.core.MakeCorePlugin
|
||||||
Bundle-Vendor: %providerName
|
Bundle-Vendor: %providerName
|
||||||
Bundle-Localization: plugin
|
Bundle-Localization: plugin
|
||||||
|
@ -23,7 +23,9 @@ Require-Bundle: org.eclipse.cdt.core;bundle-version="[5.0.0,7.0.0)",
|
||||||
org.eclipse.core.resources;bundle-version="[3.2.0,4.0.0)",
|
org.eclipse.core.resources;bundle-version="[3.2.0,4.0.0)",
|
||||||
org.eclipse.core.variables;bundle-version="[3.1.100,4.0.0)",
|
org.eclipse.core.variables;bundle-version="[3.1.100,4.0.0)",
|
||||||
org.eclipse.core.runtime;bundle-version="[3.2.0,4.0.0)",
|
org.eclipse.core.runtime;bundle-version="[3.2.0,4.0.0)",
|
||||||
org.eclipse.core.filesystem;bundle-version="1.2.0"
|
org.eclipse.core.filesystem;bundle-version="1.2.0",
|
||||||
|
org.eclipse.tools.templates.core;bundle-version="1.1.0",
|
||||||
|
org.eclipse.tools.templates.freemarker;bundle-version="1.0.0"
|
||||||
Bundle-ActivationPolicy: lazy
|
Bundle-ActivationPolicy: lazy
|
||||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
|
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
|
||||||
Import-Package: com.ibm.icu.text
|
Import-Package: com.ibm.icu.text
|
||||||
|
|
|
@ -194,5 +194,13 @@
|
||||||
<simple name="buildArguments" external="true" nullable="true"/>
|
<simple name="buildArguments" external="true" nullable="true"/>
|
||||||
</processType>
|
</processType>
|
||||||
</extension>
|
</extension>
|
||||||
|
<extension
|
||||||
|
point="org.eclipse.cdt.core.buildConfigProvider">
|
||||||
|
<provider
|
||||||
|
class="org.eclipse.cdt.make.internal.core.MakefileBuildConfigurationProvider"
|
||||||
|
id="org.eclipse.cdt.make.core.provider"
|
||||||
|
natureId="org.eclipse.cdt.make.core.makeNature">
|
||||||
|
</provider>
|
||||||
|
</extension>
|
||||||
|
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
|
@ -57,6 +57,7 @@ import org.eclipse.core.runtime.Plugin;
|
||||||
import org.eclipse.core.runtime.Preferences;
|
import org.eclipse.core.runtime.Preferences;
|
||||||
import org.eclipse.core.runtime.Status;
|
import org.eclipse.core.runtime.Status;
|
||||||
import org.osgi.framework.BundleContext;
|
import org.osgi.framework.BundleContext;
|
||||||
|
import org.osgi.framework.ServiceReference;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The main plugin class to be used in the desktop.
|
* The main plugin class to be used in the desktop.
|
||||||
|
@ -427,4 +428,14 @@ public class MakeCorePlugin extends Plugin {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @since 7.4
|
||||||
|
*/
|
||||||
|
public static <T> T getService(Class<T> service) {
|
||||||
|
BundleContext context = plugin.getBundle().getBundleContext();
|
||||||
|
ServiceReference<T> ref = context.getServiceReference(service);
|
||||||
|
return ref != null ? context.getService(ref) : null;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,89 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2017 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.make.core;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.CCProjectNature;
|
||||||
|
import org.eclipse.cdt.core.CProjectNature;
|
||||||
|
import org.eclipse.cdt.core.build.CBuilder;
|
||||||
|
import org.eclipse.cdt.core.model.CoreModel;
|
||||||
|
import org.eclipse.cdt.core.model.IPathEntry;
|
||||||
|
import org.eclipse.core.resources.ICommand;
|
||||||
|
import org.eclipse.core.resources.IFolder;
|
||||||
|
import org.eclipse.core.resources.IProject;
|
||||||
|
import org.eclipse.core.resources.IProjectDescription;
|
||||||
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
import org.eclipse.core.runtime.IPath;
|
||||||
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
|
import org.eclipse.tools.templates.freemarker.FMProjectGenerator;
|
||||||
|
import org.eclipse.tools.templates.freemarker.SourceRoot;
|
||||||
|
import org.eclipse.tools.templates.freemarker.TemplateManifest;
|
||||||
|
import org.osgi.framework.Bundle;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generator for Makefile projects.
|
||||||
|
*
|
||||||
|
* @since 7.4
|
||||||
|
*/
|
||||||
|
public class MakefileProjectGenerator extends FMProjectGenerator {
|
||||||
|
|
||||||
|
public MakefileProjectGenerator(String manifestPath) {
|
||||||
|
super(manifestPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Bundle getSourceBundle() {
|
||||||
|
return MakeCorePlugin.getDefault().getBundle();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void initProjectDescription(IProjectDescription description) throws CoreException {
|
||||||
|
description.setNatureIds(new String[] { CProjectNature.C_NATURE_ID, CCProjectNature.CC_NATURE_ID,
|
||||||
|
MakeProjectNature.NATURE_ID });
|
||||||
|
ICommand command = description.newCommand();
|
||||||
|
CBuilder.setupBuilder(command);
|
||||||
|
description.setBuildSpec(new ICommand[] { command });
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void generate(Map<String, Object> model, IProgressMonitor monitor) throws CoreException {
|
||||||
|
super.generate(model, monitor);
|
||||||
|
|
||||||
|
List<IPathEntry> entries = new ArrayList<>();
|
||||||
|
IProject project = getProject();
|
||||||
|
|
||||||
|
// Create the source and output folders
|
||||||
|
IFolder buildFolder = getProject().getFolder("build"); //$NON-NLS-1$
|
||||||
|
|
||||||
|
TemplateManifest manifest = getManifest();
|
||||||
|
if (manifest != null) {
|
||||||
|
List<SourceRoot> srcRoots = getManifest().getSrcRoots();
|
||||||
|
if (srcRoots != null && !srcRoots.isEmpty()) {
|
||||||
|
for (SourceRoot srcRoot : srcRoots) {
|
||||||
|
IFolder sourceFolder = project.getFolder(srcRoot.getDir());
|
||||||
|
if (!sourceFolder.exists()) {
|
||||||
|
sourceFolder.create(true, true, monitor);
|
||||||
|
}
|
||||||
|
|
||||||
|
entries.add(CoreModel.newSourceEntry(sourceFolder.getFullPath(),
|
||||||
|
new IPath[] { buildFolder.getFullPath() }));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
entries.add(CoreModel.newSourceEntry(getProject().getFullPath()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
entries.add(CoreModel.newOutputEntry(buildFolder.getFullPath()));
|
||||||
|
CoreModel.getDefault().create(project)
|
||||||
|
.setRawPathEntries(entries.toArray(new IPathEntry[entries.size()]), monitor);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,66 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2017 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.make.internal.core;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.build.ICBuildConfiguration;
|
||||||
|
import org.eclipse.cdt.core.build.ICBuildConfigurationManager;
|
||||||
|
import org.eclipse.cdt.core.build.ICBuildConfigurationProvider;
|
||||||
|
import org.eclipse.cdt.core.build.IToolChain;
|
||||||
|
import org.eclipse.cdt.core.build.StandardBuildConfiguration;
|
||||||
|
import org.eclipse.cdt.make.core.MakeCorePlugin;
|
||||||
|
import org.eclipse.core.resources.IBuildConfiguration;
|
||||||
|
import org.eclipse.core.resources.IProject;
|
||||||
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
|
|
||||||
|
public class MakefileBuildConfigurationProvider implements ICBuildConfigurationProvider {
|
||||||
|
|
||||||
|
public static final String ID = "org.eclipse.cdt.make.core.provider"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getId() {
|
||||||
|
return ID;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ICBuildConfiguration getCBuildConfiguration(IBuildConfiguration config, String name)
|
||||||
|
throws CoreException {
|
||||||
|
return new StandardBuildConfiguration(config, name);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ICBuildConfiguration createBuildConfiguration(IProject project, IToolChain toolChain,
|
||||||
|
String launchMode, IProgressMonitor monitor) throws CoreException {
|
||||||
|
ICBuildConfigurationManager configManager = MakeCorePlugin.getService(ICBuildConfigurationManager.class);
|
||||||
|
|
||||||
|
StringBuilder configName = new StringBuilder("make."); //$NON-NLS-1$
|
||||||
|
configName.append(launchMode);
|
||||||
|
String os = toolChain.getProperty(IToolChain.ATTR_OS);
|
||||||
|
if (os != null) {
|
||||||
|
configName.append('.');
|
||||||
|
configName.append(os);
|
||||||
|
}
|
||||||
|
String arch = toolChain.getProperty(IToolChain.ATTR_ARCH);
|
||||||
|
if (arch != null && !arch.isEmpty()) {
|
||||||
|
configName.append('.');
|
||||||
|
configName.append(arch);
|
||||||
|
}
|
||||||
|
String name = configName.toString();
|
||||||
|
int i = 0;
|
||||||
|
while (configManager.hasConfiguration(this, project, name)) {
|
||||||
|
name = configName.toString() + '.' + (++i);
|
||||||
|
}
|
||||||
|
|
||||||
|
IBuildConfiguration config = configManager.createBuildConfiguration(this, project, name, monitor);
|
||||||
|
StandardBuildConfiguration makeConfig = new StandardBuildConfiguration(config, name, toolChain,
|
||||||
|
launchMode);
|
||||||
|
configManager.addBuildConfiguration(config, makeConfig);
|
||||||
|
return makeConfig;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
12
build/org.eclipse.cdt.make.core/templates/simple/Makefile
Normal file
12
build/org.eclipse.cdt.make.core/templates/simple/Makefile
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
OBJS = ${projectName}.o
|
||||||
|
|
||||||
|
all: ${projectName}
|
||||||
|
|
||||||
|
${projectName}: $(OBJS)
|
||||||
|
$(CC) -o $@ $^
|
||||||
|
|
||||||
|
%.o: ../../%.cpp
|
||||||
|
$(CC) -c $(CFLAGS) $(CPPFLAGS) -o $@ $<
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -fr ${projectName} $(OBJS)
|
|
@ -0,0 +1,4 @@
|
||||||
|
|
||||||
|
int main(int argc, char **argv) {
|
||||||
|
return 0;
|
||||||
|
}
|
|
@ -0,0 +1,7 @@
|
||||||
|
<templateManifest>
|
||||||
|
<file src="/templates/simple/Makefile"
|
||||||
|
dest="/${projectName}/Makefile"/>
|
||||||
|
<file src="/templates/simple/main.cpp"
|
||||||
|
dest="/${projectName}/${projectName}.cpp"
|
||||||
|
open="true"/>
|
||||||
|
</templateManifest>
|
|
@ -35,7 +35,9 @@ Require-Bundle: org.eclipse.ui.ide;bundle-version="[3.2.0,4.0.0)",
|
||||||
org.eclipse.debug.ui;bundle-version="[3.2.0,4.0.0)",
|
org.eclipse.debug.ui;bundle-version="[3.2.0,4.0.0)",
|
||||||
org.eclipse.ui.navigator;bundle-version="[3.2.0,4.0.0)";resolution:=optional,
|
org.eclipse.ui.navigator;bundle-version="[3.2.0,4.0.0)";resolution:=optional,
|
||||||
org.eclipse.compare;bundle-version="[3.3.0,4.0.0)",
|
org.eclipse.compare;bundle-version="[3.3.0,4.0.0)",
|
||||||
org.eclipse.core.filesystem;bundle-version="1.2.0"
|
org.eclipse.core.filesystem;bundle-version="1.2.0",
|
||||||
|
org.eclipse.tools.templates.ui;bundle-version="1.1.1",
|
||||||
|
org.eclipse.tools.templates.freemarker;bundle-version="1.0.0"
|
||||||
Bundle-ActivationPolicy: lazy
|
Bundle-ActivationPolicy: lazy
|
||||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
|
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
|
||||||
Import-Package: com.ibm.icu.text
|
Import-Package: com.ibm.icu.text
|
||||||
|
|
BIN
build/org.eclipse.cdt.make.ui/icons/cdt_logo_48.png
Normal file
BIN
build/org.eclipse.cdt.make.ui/icons/cdt_logo_48.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.6 KiB |
|
@ -629,4 +629,26 @@
|
||||||
</includes>
|
</includes>
|
||||||
</viewerActionBinding>
|
</viewerActionBinding>
|
||||||
</extension>
|
</extension>
|
||||||
|
<extension
|
||||||
|
point="org.eclipse.tools.templates.ui.templates">
|
||||||
|
<template
|
||||||
|
icon="icons/cdt_logo_48.png"
|
||||||
|
id="org.eclipse.cdt.make.ui.template"
|
||||||
|
label="Makefile Project"
|
||||||
|
wizard="org.eclipse.cdt.make.internal.ui.wizards.NewMakefileProjectWizard">
|
||||||
|
<description>
|
||||||
|
Create a new project that builds with the 'make' build tool.
|
||||||
|
</description>
|
||||||
|
<tagReference
|
||||||
|
id="org.eclipse.cdt.ui.cdtTag">
|
||||||
|
</tagReference>
|
||||||
|
<tagReference
|
||||||
|
id="org.eclipse.cdt.make.ui.tag">
|
||||||
|
</tagReference>
|
||||||
|
</template>
|
||||||
|
<tag
|
||||||
|
id="org.eclipse.cdt.make.ui.tag"
|
||||||
|
label="Make">
|
||||||
|
</tag>
|
||||||
|
</extension>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
|
@ -0,0 +1,78 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2017 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.make.internal.ui.wizards;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.make.core.MakefileProjectGenerator;
|
||||||
|
import org.eclipse.jface.dialogs.Dialog;
|
||||||
|
import org.eclipse.jface.wizard.IWizardContainer;
|
||||||
|
import org.eclipse.swt.SWT;
|
||||||
|
import org.eclipse.swt.events.SelectionAdapter;
|
||||||
|
import org.eclipse.swt.events.SelectionEvent;
|
||||||
|
import org.eclipse.swt.layout.GridData;
|
||||||
|
import org.eclipse.swt.layout.GridLayout;
|
||||||
|
import org.eclipse.swt.widgets.Button;
|
||||||
|
import org.eclipse.swt.widgets.Composite;
|
||||||
|
import org.eclipse.tools.templates.core.IGenerator;
|
||||||
|
import org.eclipse.tools.templates.ui.TemplateWizard;
|
||||||
|
import org.eclipse.ui.dialogs.WizardNewProjectCreationPage;
|
||||||
|
|
||||||
|
public class NewMakefileProjectWizard extends TemplateWizard {
|
||||||
|
|
||||||
|
private WizardNewProjectCreationPage mainPage;
|
||||||
|
private boolean generateSource = true;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setContainer(IWizardContainer wizardContainer) {
|
||||||
|
super.setContainer(wizardContainer);
|
||||||
|
setWindowTitle("New Makefile Project");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addPages() {
|
||||||
|
mainPage = new WizardNewProjectCreationPage("basicNewProjectPage") { //$NON-NLS-1$
|
||||||
|
@Override
|
||||||
|
public void createControl(Composite parent) {
|
||||||
|
super.createControl(parent);
|
||||||
|
Composite comp = (Composite) getControl();
|
||||||
|
createWorkingSetGroup(comp, getSelection(),
|
||||||
|
new String[] { "org.eclipse.ui.resourceWorkingSetPage" }); //$NON-NLS-1$
|
||||||
|
|
||||||
|
Composite buttonComp = new Composite(comp, SWT.NONE);
|
||||||
|
buttonComp.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
|
||||||
|
buttonComp.setLayout(new GridLayout());
|
||||||
|
|
||||||
|
Button genSourceButton = new Button(buttonComp, SWT.CHECK);
|
||||||
|
genSourceButton.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
|
||||||
|
genSourceButton.setText("Generate Source and Makefile");
|
||||||
|
genSourceButton.setSelection(generateSource);
|
||||||
|
genSourceButton.addSelectionListener(new SelectionAdapter() {
|
||||||
|
@Override
|
||||||
|
public void widgetSelected(SelectionEvent e) {
|
||||||
|
generateSource = genSourceButton.getSelection();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Dialog.applyDialogFont(getControl());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
mainPage.setTitle("New Makefile Project");
|
||||||
|
mainPage.setDescription("Specify properties of new Makefile project.");
|
||||||
|
this.addPage(mainPage);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected IGenerator getGenerator() {
|
||||||
|
String manifest = generateSource ? "templates/simple/manifest.xml" : null; //$NON-NLS-1$
|
||||||
|
MakefileProjectGenerator generator = new MakefileProjectGenerator(manifest);
|
||||||
|
generator.setProjectName(mainPage.getProjectName());
|
||||||
|
if (!mainPage.useDefaults()) {
|
||||||
|
generator.setLocationURI(mainPage.getLocationURI());
|
||||||
|
}
|
||||||
|
return generator;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -19,6 +19,7 @@ import java.io.PrintStream;
|
||||||
import java.lang.reflect.Type;
|
import java.lang.reflect.Type;
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
|
import java.nio.file.InvalidPathException;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -413,6 +414,7 @@ public abstract class CBuildConfiguration extends PlatformObject
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Path findCommand(String command) {
|
protected Path findCommand(String command) {
|
||||||
|
try {
|
||||||
Path cmdPath = Paths.get(command);
|
Path cmdPath = Paths.get(command);
|
||||||
if (cmdPath.isAbsolute()) {
|
if (cmdPath.isAbsolute()) {
|
||||||
return cmdPath;
|
return cmdPath;
|
||||||
|
@ -443,6 +445,9 @@ public abstract class CBuildConfiguration extends PlatformObject
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} catch (InvalidPathException e) {
|
||||||
|
// ignore
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -699,6 +704,7 @@ public abstract class CBuildConfiguration extends PlatformObject
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Path commandPath = findCommand(command.get(0));
|
Path commandPath = findCommand(command.get(0));
|
||||||
|
if (commandPath != null) {
|
||||||
command.set(0, commandPath.toString());
|
command.set(0, commandPath.toString());
|
||||||
IExtendedScannerInfo info = getToolChain().getScannerInfo(getBuildConfiguration(),
|
IExtendedScannerInfo info = getToolChain().getScannerInfo(getBuildConfiguration(),
|
||||||
command, null, resource, getBuildDirectoryURI());
|
command, null, resource, getBuildDirectoryURI());
|
||||||
|
@ -706,6 +712,7 @@ public abstract class CBuildConfiguration extends PlatformObject
|
||||||
infoChanged = true;
|
infoChanged = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -35,7 +35,7 @@ import org.eclipse.core.runtime.Status;
|
||||||
*/
|
*/
|
||||||
public class StandardBuildConfiguration extends CBuildConfiguration {
|
public class StandardBuildConfiguration extends CBuildConfiguration {
|
||||||
|
|
||||||
private String[] buildCommand = { "make", "all" }; //$NON-NLS-1$ //$NON-NLS-2$
|
private String[] buildCommand = { "make", "-j", "-f", "../../Makefile", "all" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
|
||||||
private String[] cleanCommand = { "make", "clean" }; //$NON-NLS-1$ //$NON-NLS-2$
|
private String[] cleanCommand = { "make", "clean" }; //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
private IContainer buildContainer;
|
private IContainer buildContainer;
|
||||||
|
|
||||||
|
@ -62,9 +62,7 @@ public class StandardBuildConfiguration extends CBuildConfiguration {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IContainer getBuildContainer() throws CoreException {
|
public IContainer getBuildContainer() throws CoreException {
|
||||||
// If a container isn't set, assume build bits can go anywhere in the
|
return buildContainer != null ? buildContainer : super.getBuildContainer();
|
||||||
// project
|
|
||||||
return buildContainer != null ? buildContainer : getProject();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -100,6 +98,8 @@ public class StandardBuildConfiguration extends CBuildConfiguration {
|
||||||
|
|
||||||
project.refreshLocal(IResource.DEPTH_INFINITE, monitor);
|
project.refreshLocal(IResource.DEPTH_INFINITE, monitor);
|
||||||
|
|
||||||
|
outStream.write(String.format(Messages.StandardBuildConfiguration_1, buildDir.toString()));
|
||||||
|
|
||||||
return new IProject[] { project };
|
return new IProject[] { project };
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new CoreException(
|
throw new CoreException(
|
||||||
|
|
|
@ -17,6 +17,7 @@ public class Messages extends NLS {
|
||||||
public static String CBuilder_NotConfiguredCorrectly;
|
public static String CBuilder_NotConfiguredCorrectly;
|
||||||
public static String CBuilder_NotConfiguredCorrectly2;
|
public static String CBuilder_NotConfiguredCorrectly2;
|
||||||
public static String StandardBuildConfiguration_0;
|
public static String StandardBuildConfiguration_0;
|
||||||
|
public static String StandardBuildConfiguration_1;
|
||||||
static {
|
static {
|
||||||
// initialize resource bundle
|
// initialize resource bundle
|
||||||
NLS.initializeMessages(BUNDLE_NAME, Messages.class);
|
NLS.initializeMessages(BUNDLE_NAME, Messages.class);
|
||||||
|
|
|
@ -186,8 +186,7 @@ public class ToolChainManager implements IToolChainManager {
|
||||||
public Collection<IToolChain> getToolChainsMatching(Map<String, String> properties) {
|
public Collection<IToolChain> getToolChainsMatching(Map<String, String> properties) {
|
||||||
init();
|
init();
|
||||||
List<IToolChain> tcs = new ArrayList<>();
|
List<IToolChain> tcs = new ArrayList<>();
|
||||||
for (Map<String, IToolChain> type : toolChains.values()) {
|
for (IToolChain toolChain : orderedToolChains) {
|
||||||
for (IToolChain toolChain : type.values()) {
|
|
||||||
boolean matches = true;
|
boolean matches = true;
|
||||||
for (Map.Entry<String, String> property : properties.entrySet()) {
|
for (Map.Entry<String, String> property : properties.entrySet()) {
|
||||||
String tcProperty = toolChain.getProperty(property.getKey());
|
String tcProperty = toolChain.getProperty(property.getKey());
|
||||||
|
@ -202,7 +201,6 @@ public class ToolChainManager implements IToolChainManager {
|
||||||
tcs.add(toolChain);
|
tcs.add(toolChain);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return tcs;
|
return tcs;
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,4 +10,5 @@ CBuilder_ExceptionWhileBuilding2=Exception while building
|
||||||
CBuilder_NotConfiguredCorrectly=Build not configured correctly\n
|
CBuilder_NotConfiguredCorrectly=Build not configured correctly\n
|
||||||
CBuilder_NotConfiguredCorrectly2=Build not configured correctly\n
|
CBuilder_NotConfiguredCorrectly2=Build not configured correctly\n
|
||||||
StandardBuildConfiguration_0=Building in: %s\n
|
StandardBuildConfiguration_0=Building in: %s\n
|
||||||
|
StandardBuildConfiguration_1=Build complete: %s\n
|
||||||
CBuildConfiguration_ToolchainMissing=Toolchain is missing for build configuration
|
CBuildConfiguration_ToolchainMissing=Toolchain is missing for build configuration
|
||||||
|
|
|
@ -359,6 +359,7 @@ Java and all Java-based trademarks are trademarks of Oracle Corporation in the U
|
||||||
<plugin id="org.eclipse.text"/>
|
<plugin id="org.eclipse.text"/>
|
||||||
<plugin id="org.eclipse.tm.terminal.control"/>
|
<plugin id="org.eclipse.tm.terminal.control"/>
|
||||||
<plugin id="org.eclipse.tools.templates.core"/>
|
<plugin id="org.eclipse.tools.templates.core"/>
|
||||||
|
<plugin id="org.eclipse.tools.templates.freemarker"/>
|
||||||
<plugin id="org.eclipse.tools.templates.ui"/>
|
<plugin id="org.eclipse.tools.templates.ui"/>
|
||||||
<plugin id="org.eclipse.ui"/>
|
<plugin id="org.eclipse.ui"/>
|
||||||
<plugin id="org.eclipse.ui.cocoa" fragment="true"/>
|
<plugin id="org.eclipse.ui.cocoa" fragment="true"/>
|
||||||
|
@ -376,6 +377,7 @@ Java and all Java-based trademarks are trademarks of Oracle Corporation in the U
|
||||||
<plugin id="org.eclipse.ui.workbench"/>
|
<plugin id="org.eclipse.ui.workbench"/>
|
||||||
<plugin id="org.eclipse.ui.workbench.texteditor"/>
|
<plugin id="org.eclipse.ui.workbench.texteditor"/>
|
||||||
<plugin id="org.eclipse.update.configurator"/>
|
<plugin id="org.eclipse.update.configurator"/>
|
||||||
|
<plugin id="org.freemarker"/>
|
||||||
<plugin id="org.sat4j.core"/>
|
<plugin id="org.sat4j.core"/>
|
||||||
<plugin id="org.sat4j.pb"/>
|
<plugin id="org.sat4j.pb"/>
|
||||||
<plugin id="org.tukaani.xz"/>
|
<plugin id="org.tukaani.xz"/>
|
||||||
|
|
Loading…
Add table
Reference in a new issue