diff --git a/build/org.eclipse.cdt.core.autotools-feature/.project b/build/org.eclipse.cdt.core.autotools-feature/.project new file mode 100644 index 00000000000..4fd0d45d8b6 --- /dev/null +++ b/build/org.eclipse.cdt.core.autotools-feature/.project @@ -0,0 +1,17 @@ + + + org.eclipse.cdt.core.autotools-feature + + + + + + org.eclipse.pde.FeatureBuilder + + + + + + org.eclipse.pde.FeatureNature + + diff --git a/build/org.eclipse.cdt.core.autotools-feature/build.properties b/build/org.eclipse.cdt.core.autotools-feature/build.properties new file mode 100644 index 00000000000..b3a611b5c93 --- /dev/null +++ b/build/org.eclipse.cdt.core.autotools-feature/build.properties @@ -0,0 +1,2 @@ +bin.includes = feature.xml,\ + feature.properties diff --git a/build/org.eclipse.cdt.core.autotools-feature/feature.properties b/build/org.eclipse.cdt.core.autotools-feature/feature.properties new file mode 100644 index 00000000000..8fb34ecf756 --- /dev/null +++ b/build/org.eclipse.cdt.core.autotools-feature/feature.properties @@ -0,0 +1,17 @@ +############################################################################### +# Copyright (c) 2017 Intel Corporation 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 +############################################################################### + +featureName=C/C++ Autotools Build Support - Experimental +providerName=Eclipse CDT +description=Support for projects built using Autotools +copyright=\ +Copyright (c) 2017 Intel Corporation and others.\n\ +All rights reserved. This program and the accompanying materials\n\ +are made available under the terms of the Eclipse Public License v1.0\n\ +which accompanies this distribution, and is available at\n\ +http://www.eclipse.org/legal/epl-v10.html diff --git a/build/org.eclipse.cdt.core.autotools-feature/feature.xml b/build/org.eclipse.cdt.core.autotools-feature/feature.xml new file mode 100644 index 00000000000..f438b4da3e6 --- /dev/null +++ b/build/org.eclipse.cdt.core.autotools-feature/feature.xml @@ -0,0 +1,36 @@ + + + + + %description + + + + %copyright + + + + %license + + + + + + + diff --git a/build/org.eclipse.cdt.core.autotools.core/.classpath b/build/org.eclipse.cdt.core.autotools.core/.classpath new file mode 100644 index 00000000000..eca7bdba8f0 --- /dev/null +++ b/build/org.eclipse.cdt.core.autotools.core/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/build/org.eclipse.cdt.core.autotools.core/.project b/build/org.eclipse.cdt.core.autotools.core/.project new file mode 100644 index 00000000000..5d2806ec0ed --- /dev/null +++ b/build/org.eclipse.cdt.core.autotools.core/.project @@ -0,0 +1,28 @@ + + + org.eclipse.cdt.core.autotools.core + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/build/org.eclipse.cdt.core.autotools.core/.settings/org.eclipse.jdt.core.prefs b/build/org.eclipse.cdt.core.autotools.core/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 00000000000..0c68a61dca8 --- /dev/null +++ b/build/org.eclipse.cdt.core.autotools.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.core.autotools.core/META-INF/MANIFEST.MF b/build/org.eclipse.cdt.core.autotools.core/META-INF/MANIFEST.MF new file mode 100644 index 00000000000..1b020242bd3 --- /dev/null +++ b/build/org.eclipse.cdt.core.autotools.core/META-INF/MANIFEST.MF @@ -0,0 +1,15 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: %pluginName +Bundle-SymbolicName: org.eclipse.cdt.core.autotools.core;singleton:=true +Bundle-Version: 1.0.0.qualifier +Bundle-Activator: org.eclipse.cdt.core.autotools.core.internal.Activator +Require-Bundle: org.eclipse.core.runtime, + org.eclipse.tools.templates.freemarker;bundle-version="1.0.0", + org.eclipse.cdt.core;bundle-version="6.3.1", + org.eclipse.core.resources;bundle-version="3.12.0" +Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-ActivationPolicy: lazy +Bundle-Vendor: %providerName +Export-Package: org.eclipse.cdt.core.autotools.core +Bundle-Localization: plugin diff --git a/build/org.eclipse.cdt.core.autotools.core/about.html b/build/org.eclipse.cdt.core.autotools.core/about.html new file mode 100644 index 00000000000..d7c511887d6 --- /dev/null +++ b/build/org.eclipse.cdt.core.autotools.core/about.html @@ -0,0 +1,24 @@ + + +About + + +

About This Content

+ +

June 22, 2007

+

License

+ +

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 http://www.eclipse.org/legal/epl-v10.html. +For purposes of the EPL, "Program" will mean the Content.

+ +

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 http://www.eclipse.org.

+ + \ No newline at end of file diff --git a/build/org.eclipse.cdt.core.autotools.core/build.properties b/build/org.eclipse.cdt.core.autotools.core/build.properties new file mode 100644 index 00000000000..ed3fde1c6e7 --- /dev/null +++ b/build/org.eclipse.cdt.core.autotools.core/build.properties @@ -0,0 +1,8 @@ +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + .,\ + plugin.xml,\ + about.html,\ + templates/,\ + plugin.properties diff --git a/build/org.eclipse.cdt.core.autotools.core/plugin.properties b/build/org.eclipse.cdt.core.autotools.core/plugin.properties new file mode 100644 index 00000000000..a5769a5e852 --- /dev/null +++ b/build/org.eclipse.cdt.core.autotools.core/plugin.properties @@ -0,0 +1,10 @@ +############################################################################### +# Copyright (c) 2017 Intel Corporation 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 +############################################################################### + +pluginName=CDT Autotools Core +providerName=Eclipse CDT diff --git a/build/org.eclipse.cdt.core.autotools.core/plugin.xml b/build/org.eclipse.cdt.core.autotools.core/plugin.xml new file mode 100644 index 00000000000..58bd75b72d0 --- /dev/null +++ b/build/org.eclipse.cdt.core.autotools.core/plugin.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + diff --git a/build/org.eclipse.cdt.core.autotools.core/src/org/eclipse/cdt/core/autotools/core/AutotoolsBuildConfiguration.java b/build/org.eclipse.cdt.core.autotools.core/src/org/eclipse/cdt/core/autotools/core/AutotoolsBuildConfiguration.java new file mode 100644 index 00000000000..0668baf6a23 --- /dev/null +++ b/build/org.eclipse.cdt.core.autotools.core/src/org/eclipse/cdt/core/autotools/core/AutotoolsBuildConfiguration.java @@ -0,0 +1,78 @@ +/******************************************************************************* + * Copyright (c) 2017 Intel Corporation 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 + * + * Contributors: + * Intel Corporation - initial API and implementation + *******************************************************************************/ + +package org.eclipse.cdt.core.autotools.core; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +import org.eclipse.cdt.core.IConsoleParser; +import org.eclipse.cdt.core.build.CBuildConfiguration; +import org.eclipse.cdt.core.build.IToolChain; +import org.eclipse.cdt.core.resources.IConsole; +import org.eclipse.cdt.core.autotools.core.internal.Activator; +import org.eclipse.core.resources.IBuildConfiguration; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.IProgressMonitor; + +public class AutotoolsBuildConfiguration extends CBuildConfiguration { + + public static final String AUTOTOOLS_GENERATOR = "autotools.generator"; //$NON-NLS-1$ + public static final String AUTOTOOLS_ARGUMENTS = "autotools.arguments"; //$NON-NLS-1$ + public static final String BUILD_COMMAND = "autotools.command.build"; //$NON-NLS-1$ + public static final String CLEAN_COMMAND = "autotools.command.clean"; //$NON-NLS-1$ + + public AutotoolsBuildConfiguration(IBuildConfiguration config, String name) throws CoreException { + super(config, name); + } + + public AutotoolsBuildConfiguration(IBuildConfiguration config, String name, IToolChain toolChain) { + super(config, name, toolChain, "run"); // TODO: why "run" + } + + @Override + public IProject[] build(int kind, Map args, IConsole console, IProgressMonitor monitor) + throws CoreException { + + IProject project = getProject(); + + execute(Arrays.asList(new String[] { "autoreconf", "--install" }), project.getLocation(), console, monitor); + execute(Arrays.asList(new String[] { "./configure" }), project.getLocation(), console, monitor); + execute(Arrays.asList(new String[] { "make" }), project.getLocation(), console, monitor); + + return new IProject[] { project }; + } + + @Override + public void clean(IConsole console, IProgressMonitor monitor) throws CoreException { + execute(Arrays.asList(new String[] { "make", "clean" }), getProject().getLocation(), console, monitor); + } + + protected void execute(List command, IPath dir, IConsole console, IProgressMonitor monitor) throws CoreException { + + ProcessBuilder builder = new ProcessBuilder(command).directory(dir.toFile()); + + try { + Process process = builder.start(); + watchProcess(process, new IConsoleParser[0], console); + } catch (IOException e) { + throw new CoreException(Activator.errorStatus("Error executing: " + String.join(" ", command), e)); + } + + getProject().refreshLocal(IResource.DEPTH_INFINITE, monitor); + } + +} diff --git a/build/org.eclipse.cdt.core.autotools.core/src/org/eclipse/cdt/core/autotools/core/AutotoolsBuildConfigurationProvider.java b/build/org.eclipse.cdt.core.autotools.core/src/org/eclipse/cdt/core/autotools/core/AutotoolsBuildConfigurationProvider.java new file mode 100644 index 00000000000..bc9db7cb5ed --- /dev/null +++ b/build/org.eclipse.cdt.core.autotools.core/src/org/eclipse/cdt/core/autotools/core/AutotoolsBuildConfigurationProvider.java @@ -0,0 +1,104 @@ +/******************************************************************************* + * Copyright (c) 2017 Intel Corporation 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 + * + * Contributors: + * Intel Corporation - initial API and implementation + *******************************************************************************/ + +package org.eclipse.cdt.core.autotools.core; + +import java.util.HashMap; +import java.util.Map; + +import org.eclipse.cdt.core.build.CBuildConfiguration; +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.IToolChainManager; +import org.eclipse.cdt.core.autotools.core.internal.Activator; +import org.eclipse.core.resources.IBuildConfiguration; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.Platform; + +public class AutotoolsBuildConfigurationProvider implements ICBuildConfigurationProvider { + + public static final String ID = Activator.PLUGIN_ID + ".provider"; //$NON-NLS-1$ + + private ICBuildConfigurationManager configManager = Activator.getService(ICBuildConfigurationManager.class); + + @Override + public String getId() { + return ID; + } + + @Override + public ICBuildConfiguration getCBuildConfiguration(IBuildConfiguration config, String name) throws CoreException { + IToolChain toolChain = null; + + // try the toolchain for the local target + Map properties = new HashMap<>(); + properties.put(IToolChain.ATTR_OS, Platform.getOS()); + properties.put(IToolChain.ATTR_ARCH, Platform.getOSArch()); + IToolChainManager toolChainManager = Activator.getService(IToolChainManager.class); + for (IToolChain tc : toolChainManager.getToolChainsMatching(properties)) { + toolChain = tc; + break; + } + + // local didn't work, try and find one that does + if (toolChain == null) { + for (IToolChain tc : toolChainManager.getToolChainsMatching(new HashMap<>())) { + toolChain = tc; + break; + } + } + + if (toolChain != null) { + return new AutotoolsBuildConfiguration(config, name, toolChain); + } else { + return null; + } + } + + @Override + public ICBuildConfiguration createBuildConfiguration(IProject project, IToolChain toolChain, String launchMode, + IProgressMonitor monitor) throws CoreException { + // See if there is one already + for (IBuildConfiguration config : project.getBuildConfigs()) { + ICBuildConfiguration cconfig = config.getAdapter(ICBuildConfiguration.class); + if (cconfig != null) { + CBuildConfiguration cmakeConfig = cconfig.getAdapter(AutotoolsBuildConfiguration.class); + if (cmakeConfig != null && cmakeConfig.getToolChain().equals(toolChain) + && launchMode.equals(cmakeConfig.getLaunchMode())) { + return cconfig; + } + } + } + + // get matching toolchain file if any + Map properties = new HashMap<>(); + String os = toolChain.getProperty(IToolChain.ATTR_OS); + if (os != null && !os.isEmpty()) { + properties.put(IToolChain.ATTR_OS, os); + } + String arch = toolChain.getProperty(IToolChain.ATTR_ARCH); + if (!arch.isEmpty()) { + properties.put(IToolChain.ATTR_ARCH, arch); + } + + // create config + String configName = "autotools." + launchMode + '.' + toolChain.getId(); //$NON-NLS-1$ + IBuildConfiguration config = configManager.createBuildConfiguration(this, project, configName, monitor); + CBuildConfiguration autotoolsConfig = new AutotoolsBuildConfiguration(config, configName); + configManager.addBuildConfiguration(config, autotoolsConfig); + return autotoolsConfig; + } + +} diff --git a/build/org.eclipse.cdt.core.autotools.core/src/org/eclipse/cdt/core/autotools/core/AutotoolsNature.java b/build/org.eclipse.cdt.core.autotools.core/src/org/eclipse/cdt/core/autotools/core/AutotoolsNature.java new file mode 100644 index 00000000000..af4bb2e994c --- /dev/null +++ b/build/org.eclipse.cdt.core.autotools.core/src/org/eclipse/cdt/core/autotools/core/AutotoolsNature.java @@ -0,0 +1,56 @@ +/******************************************************************************* + * Copyright (c) 2017 Intel Corporation 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 + * + * Contributors: + * Intel Corporation - initial API and implementation + *******************************************************************************/ + +package org.eclipse.cdt.core.autotools.core; + +import org.eclipse.cdt.core.build.CBuilder; +import org.eclipse.cdt.core.autotools.core.internal.Activator; +import org.eclipse.core.resources.ICommand; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IProjectDescription; +import org.eclipse.core.resources.IProjectNature; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.NullProgressMonitor; + +public class AutotoolsNature implements IProjectNature { + + public static final String ID = Activator.PLUGIN_ID + ".autotoolsNature"; //$NON-NLS-1$ + + private IProject project; + + public static void setupBuilder(IProjectDescription projDesc) throws CoreException { + ICommand command = projDesc.newCommand(); + CBuilder.setupBuilder(command); + projDesc.setBuildSpec(new ICommand[] { command }); + } + + @Override + public void configure() throws CoreException { + IProjectDescription projDesc = project.getDescription(); + setupBuilder(projDesc); + project.setDescription(projDesc, new NullProgressMonitor()); + } + + @Override + public void deconfigure() throws CoreException { + } + + @Override + public IProject getProject() { + return project; + } + + @Override + public void setProject(IProject project) { + this.project = project; + } + +} diff --git a/build/org.eclipse.cdt.core.autotools.core/src/org/eclipse/cdt/core/autotools/core/AutotoolsProjectGenerator.java b/build/org.eclipse.cdt.core.autotools.core/src/org/eclipse/cdt/core/autotools/core/AutotoolsProjectGenerator.java new file mode 100644 index 00000000000..e93def6b22e --- /dev/null +++ b/build/org.eclipse.cdt.core.autotools.core/src/org/eclipse/cdt/core/autotools/core/AutotoolsProjectGenerator.java @@ -0,0 +1,88 @@ +/******************************************************************************* + * Copyright (c) 2017 Intel Corporation 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 + * + * Contributors: + * Intel Corporation - initial API and implementation + *******************************************************************************/ + +package org.eclipse.cdt.core.autotools.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.cdt.core.autotools.core.internal.Activator; +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.IProgressMonitor; +import org.eclipse.tools.templates.core.IGenerator; +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; + +public class AutotoolsProjectGenerator extends FMProjectGenerator implements IGenerator { + + public AutotoolsProjectGenerator(String manifestFile) { + super(manifestFile); + } + + @Override + protected void initProjectDescription(IProjectDescription description) { + description + .setNatureIds( + new String[] { CProjectNature.C_NATURE_ID, CCProjectNature.CC_NATURE_ID, AutotoolsNature.ID }); + ICommand command = description.newCommand(); + CBuilder.setupBuilder(command); + description.setBuildSpec(new ICommand[] { command }); + } + + @Override + public Bundle getSourceBundle() { + return Activator.getContext().getBundle(); + } + + @Override + public void generate(Map model, IProgressMonitor monitor) throws CoreException { + super.generate(model, monitor); + + List entries = new ArrayList<>(); + IProject project = getProject(); + + // Create the source folders + TemplateManifest manifest = getManifest(); + if (manifest != null) { + List 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())); + } + } else { + entries.add(CoreModel.newSourceEntry(getProject().getFullPath())); + } + } + + entries.add(CoreModel.newOutputEntry(getProject().getFullPath())); //$NON-NLS-1$ + CoreModel.getDefault().create(project).setRawPathEntries(entries.toArray(new IPathEntry[entries.size()]), + monitor); + + } + +} diff --git a/build/org.eclipse.cdt.core.autotools.core/src/org/eclipse/cdt/core/autotools/core/internal/Activator.java b/build/org.eclipse.cdt.core.autotools.core/src/org/eclipse/cdt/core/autotools/core/internal/Activator.java new file mode 100644 index 00000000000..771a7e70a4d --- /dev/null +++ b/build/org.eclipse.cdt.core.autotools.core/src/org/eclipse/cdt/core/autotools/core/internal/Activator.java @@ -0,0 +1,55 @@ +/******************************************************************************* + * Copyright (c) 2017 Intel Corporation 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 + * + * Contributors: + * Intel Corporation - initial API and implementation + *******************************************************************************/ + +package org.eclipse.cdt.core.autotools.core.internal; + +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; +import org.osgi.framework.BundleActivator; +import org.osgi.framework.BundleContext; +import org.osgi.framework.ServiceReference; + +public class Activator implements BundleActivator { + + // The plug-in ID + public static final String PLUGIN_ID = "org.eclipse.cdt.core.autotools.core"; //$NON-NLS-1$ + + private static BundleContext context; + + public static BundleContext getContext() { + return context; + } + + /* + * (non-Javadoc) + * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext) + */ + public void start(BundleContext bundleContext) throws Exception { + Activator.context = bundleContext; + } + + /* + * (non-Javadoc) + * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext) + */ + public void stop(BundleContext bundleContext) throws Exception { + Activator.context = null; + } + + public static IStatus errorStatus(String message, Throwable cause) { + return new Status(IStatus.ERROR, PLUGIN_ID, message, cause); + } + + public static T getService(Class service) { + ServiceReference ref = context.getServiceReference(service); + return ref != null ? context.getService(ref) : null; + } +} diff --git a/build/org.eclipse.cdt.core.autotools.core/templates/autotools/Makefile.am b/build/org.eclipse.cdt.core.autotools.core/templates/autotools/Makefile.am new file mode 100644 index 00000000000..38bdf12e4f4 --- /dev/null +++ b/build/org.eclipse.cdt.core.autotools.core/templates/autotools/Makefile.am @@ -0,0 +1,2 @@ +SUBDIRS = src +dist_doc_DATA = README diff --git a/build/org.eclipse.cdt.core.autotools.core/templates/autotools/README b/build/org.eclipse.cdt.core.autotools.core/templates/autotools/README new file mode 100644 index 00000000000..7a16c0b0d4a --- /dev/null +++ b/build/org.eclipse.cdt.core.autotools.core/templates/autotools/README @@ -0,0 +1 @@ +Autotools project README file \ No newline at end of file diff --git a/build/org.eclipse.cdt.core.autotools.core/templates/autotools/configure.ac b/build/org.eclipse.cdt.core.autotools.core/templates/autotools/configure.ac new file mode 100644 index 00000000000..be8adeb1258 --- /dev/null +++ b/build/org.eclipse.cdt.core.autotools.core/templates/autotools/configure.ac @@ -0,0 +1,8 @@ +AC_INIT([main)], [1.0]) +AM_INIT_AUTOMAKE([-Wall -Werror foreign]) +AC_PROG_CC +AC_CONFIG_FILES([ + Makefile + src/Makefile +]) +AC_OUTPUT \ No newline at end of file diff --git a/build/org.eclipse.cdt.core.autotools.core/templates/autotools/manifest.xml b/build/org.eclipse.cdt.core.autotools.core/templates/autotools/manifest.xml new file mode 100644 index 00000000000..113682f6474 --- /dev/null +++ b/build/org.eclipse.cdt.core.autotools.core/templates/autotools/manifest.xml @@ -0,0 +1,13 @@ + + + + + + + \ No newline at end of file diff --git a/build/org.eclipse.cdt.core.autotools.core/templates/autotools/src/Makefile.am b/build/org.eclipse.cdt.core.autotools.core/templates/autotools/src/Makefile.am new file mode 100644 index 00000000000..0552a007944 --- /dev/null +++ b/build/org.eclipse.cdt.core.autotools.core/templates/autotools/src/Makefile.am @@ -0,0 +1,2 @@ +bin_PROGRAMS = hello +hello_SOURCES = main.c diff --git a/build/org.eclipse.cdt.core.autotools.core/templates/autotools/src/main.c b/build/org.eclipse.cdt.core.autotools.core/templates/autotools/src/main.c new file mode 100644 index 00000000000..0fd0c2065b2 --- /dev/null +++ b/build/org.eclipse.cdt.core.autotools.core/templates/autotools/src/main.c @@ -0,0 +1,8 @@ +#include + +int main(void) { + + printf("Hello from autotools!\n"); + return 0; + +} \ No newline at end of file diff --git a/build/org.eclipse.cdt.core.autotools.ui/.classpath b/build/org.eclipse.cdt.core.autotools.ui/.classpath new file mode 100644 index 00000000000..eca7bdba8f0 --- /dev/null +++ b/build/org.eclipse.cdt.core.autotools.ui/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/build/org.eclipse.cdt.core.autotools.ui/.project b/build/org.eclipse.cdt.core.autotools.ui/.project new file mode 100644 index 00000000000..8522cebb305 --- /dev/null +++ b/build/org.eclipse.cdt.core.autotools.ui/.project @@ -0,0 +1,28 @@ + + + org.eclipse.cdt.core.autotools.ui + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/build/org.eclipse.cdt.core.autotools.ui/.settings/org.eclipse.jdt.core.prefs b/build/org.eclipse.cdt.core.autotools.ui/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 00000000000..0c68a61dca8 --- /dev/null +++ b/build/org.eclipse.cdt.core.autotools.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.core.autotools.ui/META-INF/MANIFEST.MF b/build/org.eclipse.cdt.core.autotools.ui/META-INF/MANIFEST.MF new file mode 100644 index 00000000000..2f3498c3f52 --- /dev/null +++ b/build/org.eclipse.cdt.core.autotools.ui/META-INF/MANIFEST.MF @@ -0,0 +1,16 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: %pluginName +Bundle-SymbolicName: org.eclipse.cdt.core.autotools.ui;singleton:=true +Bundle-Version: 1.0.0.qualifier +Bundle-Activator: org.eclipse.cdt.core.autotools.ui.internal.Activator +Bundle-Vendor: %providerName +Require-Bundle: org.eclipse.ui, + org.eclipse.core.runtime, + org.eclipse.tools.templates.ui;bundle-version="1.1.1", + org.eclipse.ui.ide;bundle-version="3.13.0", + org.eclipse.cdt.core.autotools.core;bundle-version="1.0.0", + org.eclipse.tools.templates.freemarker;bundle-version="1.0.0" +Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-ActivationPolicy: lazy +Bundle-Localization: plugin diff --git a/build/org.eclipse.cdt.core.autotools.ui/about.html b/build/org.eclipse.cdt.core.autotools.ui/about.html new file mode 100644 index 00000000000..d7c511887d6 --- /dev/null +++ b/build/org.eclipse.cdt.core.autotools.ui/about.html @@ -0,0 +1,24 @@ + + +About + + +

About This Content

+ +

June 22, 2007

+

License

+ +

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 http://www.eclipse.org/legal/epl-v10.html. +For purposes of the EPL, "Program" will mean the Content.

+ +

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 http://www.eclipse.org.

+ + \ No newline at end of file diff --git a/build/org.eclipse.cdt.core.autotools.ui/build.properties b/build/org.eclipse.cdt.core.autotools.ui/build.properties new file mode 100644 index 00000000000..e398e4efb7b --- /dev/null +++ b/build/org.eclipse.cdt.core.autotools.ui/build.properties @@ -0,0 +1,7 @@ +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + .,\ + plugin.xml,\ + about.html,\ + plugin.properties diff --git a/build/org.eclipse.cdt.core.autotools.ui/plugin.properties b/build/org.eclipse.cdt.core.autotools.ui/plugin.properties new file mode 100644 index 00000000000..b17c46c6a19 --- /dev/null +++ b/build/org.eclipse.cdt.core.autotools.ui/plugin.properties @@ -0,0 +1,12 @@ +############################################################################### +# Copyright (c) 2017 Intel Corporation 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 +############################################################################### + +pluginName=CDT Autotools UI +providerName=Eclipse CDT +autotoolsTemplate.label=Autotools Project +autotoolsTemplate.description=An Autotools project with a Hello World executable build using the CDT's core build system. Can be built using toolchain containers. diff --git a/build/org.eclipse.cdt.core.autotools.ui/plugin.xml b/build/org.eclipse.cdt.core.autotools.ui/plugin.xml new file mode 100644 index 00000000000..e4abf4678a7 --- /dev/null +++ b/build/org.eclipse.cdt.core.autotools.ui/plugin.xml @@ -0,0 +1,19 @@ + + + + + + + + diff --git a/build/org.eclipse.cdt.core.autotools.ui/src/org/eclipse/cdt/core/autotools/ui/internal/Activator.java b/build/org.eclipse.cdt.core.autotools.ui/src/org/eclipse/cdt/core/autotools/ui/internal/Activator.java new file mode 100644 index 00000000000..5109d0c6a10 --- /dev/null +++ b/build/org.eclipse.cdt.core.autotools.ui/src/org/eclipse/cdt/core/autotools/ui/internal/Activator.java @@ -0,0 +1,61 @@ +/******************************************************************************* + * Copyright (c) 2017 Intel Corporation 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 + * + * Contributors: + * Intel Corporation - initial API and implementation + *******************************************************************************/ + +package org.eclipse.cdt.core.autotools.ui.internal; + +import org.eclipse.ui.plugin.AbstractUIPlugin; +import org.osgi.framework.BundleContext; + +/** + * The activator class controls the plug-in life cycle + */ +public class Activator extends AbstractUIPlugin { + + // The plug-in ID + public static final String PLUGIN_ID = "org.eclipse.cdt.core.autotools.ui"; //$NON-NLS-1$ + + // The shared instance + private static Activator plugin; + + /** + * The constructor + */ + public Activator() { + } + + /* + * (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) + */ + public void start(BundleContext context) throws Exception { + super.start(context); + plugin = this; + } + + /* + * (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) + */ + public void stop(BundleContext context) throws Exception { + plugin = null; + super.stop(context); + } + + /** + * Returns the shared instance + * + * @return the shared instance + */ + public static Activator getDefault() { + return plugin; + } + +} diff --git a/build/org.eclipse.cdt.core.autotools.ui/src/org/eclipse/cdt/core/autotools/ui/internal/Messages.java b/build/org.eclipse.cdt.core.autotools.ui/src/org/eclipse/cdt/core/autotools/ui/internal/Messages.java new file mode 100644 index 00000000000..e24b2335db1 --- /dev/null +++ b/build/org.eclipse.cdt.core.autotools.ui/src/org/eclipse/cdt/core/autotools/ui/internal/Messages.java @@ -0,0 +1,27 @@ +/******************************************************************************* + * Copyright (c) 2017 Intel Corporation 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 + * + * Contributors: + * Intel Corporation - initial API and implementation + *******************************************************************************/ + +package org.eclipse.cdt.core.autotools.ui.internal; + +import org.eclipse.osgi.util.NLS; + +public class Messages extends NLS { + private static final String BUNDLE_NAME = "org.eclipse.cdt.core.autotools.ui.internal.messages"; //$NON-NLS-1$ + public static String NewAutotoolsProjectWizard_Description; + public static String NewAutotoolsProjectWizard_Title; + static { + // initialize resource bundle + NLS.initializeMessages(BUNDLE_NAME, Messages.class); + } + + private Messages() { + } +} diff --git a/build/org.eclipse.cdt.core.autotools.ui/src/org/eclipse/cdt/core/autotools/ui/internal/NewAutotoolsProjectWizard.java b/build/org.eclipse.cdt.core.autotools.ui/src/org/eclipse/cdt/core/autotools/ui/internal/NewAutotoolsProjectWizard.java new file mode 100644 index 00000000000..1d492ce88f7 --- /dev/null +++ b/build/org.eclipse.cdt.core.autotools.ui/src/org/eclipse/cdt/core/autotools/ui/internal/NewAutotoolsProjectWizard.java @@ -0,0 +1,51 @@ +/******************************************************************************* + * Copyright (c) 2017 Intel Corporation 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 + * + * Contributors: + * Intel Corporation - initial API and implementation + *******************************************************************************/ + +package org.eclipse.cdt.core.autotools.ui.internal; + +import org.eclipse.cdt.core.autotools.core.AutotoolsProjectGenerator; +import org.eclipse.jface.dialogs.Dialog; +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 NewAutotoolsProjectWizard extends TemplateWizard { + + private WizardNewProjectCreationPage mainPage; + + @Override + public void addPages() { + mainPage = new WizardNewProjectCreationPage("basicNewProjectPage") { //$NON-NLS-1$ + @Override + public void createControl(Composite parent) { + super.createControl(parent); + createWorkingSetGroup((Composite) getControl(), getSelection(), + new String[] { "org.eclipse.ui.resourceWorkingSetPage" }); //$NON-NLS-1$ + Dialog.applyDialogFont(getControl()); + } + }; + mainPage.setTitle(Messages.NewAutotoolsProjectWizard_Title); + mainPage.setDescription(Messages.NewAutotoolsProjectWizard_Description); + this.addPage(mainPage); + } + + @Override + protected IGenerator getGenerator() { + AutotoolsProjectGenerator generator = new AutotoolsProjectGenerator("templates/autotools/manifest.xml"); //$NON-NLS-1$ + generator.setProjectName(mainPage.getProjectName()); + if (!mainPage.useDefaults()) { + generator.setLocationURI(mainPage.getLocationURI()); + } + return generator; + } + +} diff --git a/build/org.eclipse.cdt.core.autotools.ui/src/org/eclipse/cdt/core/autotools/ui/internal/messages.properties b/build/org.eclipse.cdt.core.autotools.ui/src/org/eclipse/cdt/core/autotools/ui/internal/messages.properties new file mode 100644 index 00000000000..e24e11786f3 --- /dev/null +++ b/build/org.eclipse.cdt.core.autotools.ui/src/org/eclipse/cdt/core/autotools/ui/internal/messages.properties @@ -0,0 +1,9 @@ +############################################################################### +# Copyright (c) 2017 Intel Corporation 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 +############################################################################### +NewAutotoolsProjectWizard_Description=Specify properties of new Autotools project. +NewAutotoolsProjectWizard_Title=New Autotools Project diff --git a/pom.xml b/pom.xml index ea165cfefa2..cd749583356 100644 --- a/pom.xml +++ b/pom.xml @@ -73,6 +73,10 @@ build/org.eclipse.cdt.cmake.ui build/org.eclipse.cdt.cmake-feature + build/org.eclipse.cdt.core.autotools.core + build/org.eclipse.cdt.core.autotools.ui + build/org.eclipse.cdt.core.autotools-feature + codan/org.eclipse.cdt.codan.core codan/org.eclipse.cdt.codan.ui codan/org.eclipse.cdt.codan.core.cxx diff --git a/releng/org.eclipse.cdt.repo/category.xml b/releng/org.eclipse.cdt.repo/category.xml index 819d4c4a363..b0ab41b917f 100644 --- a/releng/org.eclipse.cdt.repo/category.xml +++ b/releng/org.eclipse.cdt.repo/category.xml @@ -149,6 +149,12 @@ + + + + + +