Eclipse CDT项目模板

时间:2019-01-17 16:17:34

标签: eclipse templates eclipse-cdt

我做了一个使用Eclipse Kepler可以正常使用的Eclipse插件:

Require-Bundle: org.eclipse.cdt.managedbuilder.core;bundle-version="8. 0.2"
,org.eclipse.core.runtime;bundle-version="3.7.0"
,org.eclipse.cdt.managedbuilder.ui;bundle-version="8.0.2"
,org.eclipse.core.resources;bundle-version="3.7.101"
,org.eclipse.cdt;bundle-version="8.0.2"
,org.eclipse.cdt.core;bundle-version="5.3.2"

其目的是创建一个定制工具链来编译ARM C文件。 有了这个工具链,我有了一个模板,可以复制源文件来创建一个简单的ARM项目。

现在,我需要使用最新版本的Eclipse(至少需要Oxygen)。 CDT似乎可以读取我的模板,因为打开新项目向导时可以看到其标签。 但是当我创建项目时,模板永远不会执行。

这是我的plugin.xml:

<?xml version="1.0" encoding="UTF-8"?>
<!-- ?eclipse version="3.4"? -->
<plugin>   
    <extension point="org.eclipse.cdt.managedbuilder.core.buildDefinitions">
        <projectType
           buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe"
           id="com.company.product.buildDefinitions.projectType"
           isAbstract="false"
           name="product Project"
           projectEnvironmentSupplier="com.company.product.build.ExampleEnvironmentVariableSupplier">
        <configuration
              id="productManagedBuilder.configuration"
              name="BUILD">
           <toolChain
                 id="com.company.product.buildDefinitions.toolChain"
                 isAbstract="false"
                 name="product Toolchain"
                 targetTool="com.company.product.buildDefinitions.createflash">
              <builder
                    buildRunner="com.company.product.build.ExampleBuildRunner"
                    id="productManagedBuilder.builder"
                    isAbstract="false"
                    isVariableCaseSensitive="false"
                    name="product Builder"
                    superClass="org.eclipse.cdt.build.core.internal.builder"
                     >
                     <!-- attribut qui marche pour le builder en paralelle :
                     parallelBuildOn="true"
                    parallelizationNumber="4"-->
              </builder>
              <tool
                    command="gcc"
                    commandLinePattern="${TOOLCHAIN_BIN_PATH}/${TOOLCHAIN_PREFIX}${COMMAND} ${FLAGS} ${OUTPUT_FLAG} ${OUTPUT_PREFIX}${OUTPUT} ${INPUTS}"
                    id="com.company.product.buildDefinitions.compiler"
                    isAbstract="false"
                    name="Compiler"
                    natureFilter="both"
                    outputFlag="-o">
                 <optionCategory
                       id="com.company.product.compiler.optionCategory"
                       name="Option">
                 </optionCategory>
                 <option
                       category="com.company.product.compiler.optionCategory"
                       defaultValue="-c -g -Wall -fno-common -O2 -mcpu=cortex-m3 -mthumb -mthumb-interwork"
                       id="com.company.product.compiler.option.other.otherflags"
                       name="Other flags"
                       valueType="string">
                 </option>
                 <option
                       browseType="directory"
                       category="com.company.product.compiler.optionCategory"
                       command="-I"
                       id="com.company.product.compiler.option.include.paths"
                       name="Include paths (-I)"
                       valueType="includePath">
                    <listOptionValue
                          builtIn="false"
                          value="../">
                    </listOptionValue>
                 </option>
                 <inputType
                       dependencyCalculator="org.eclipse.cdt.managedbuilder.makegen.gnu.DefaultGCCDependencyCalculator"
                       dependencyContentType="org.eclipse.cdt.core.cHeader"
                       dependencyExtensions="h"
                       id="com.company.product.buildDefinitions.compiler.inputType"
                       sourceContentType=" org.eclipse.cdt.core.cSource"
                       sources="c">
                 </inputType>
                 <outputType
                       buildVariable="OBJS"
                       id="com.company.product.buildDefinitions.compiler.outputType"
                       outputs="o">
                 </outputType>
                 <envVarBuildPath
                       pathType="buildpathInclude"
                       variableList="INCLUDE_PATH">
                 </envVarBuildPath>
              </tool>
              <tool
                    command="gcc"
                    commandLinePattern="${TOOLCHAIN_BIN_PATH}/${TOOLCHAIN_PREFIX}${COMMAND} ${FLAGS} ${OUTPUT_FLAG} ${OUTPUT_PREFIX}${OUTPUT} ${INPUTS}"
                    id="com.company.product.buildDefinitions.linker"
                    isAbstract="false"
                    name="Linker"
                    natureFilter="cnature"
                    outputFlag="-o">
                 <optionCategory
                       id="com.company.product.linker.optionCategory"
                       name="Option">
                 </optionCategory>
                 <option
                       category="com.company.product.linker.optionCategory"
                       defaultValue="-Wall -nostartfiles -mcpu=cortex-m3 -mthumb -mthumb-interwork -T../Example.ld"
                       id="com.company.product.buildDefinitions.linker.otherflags"
                       name="Other flags"
                       valueType="string">
                 </option>
                 <option
                       browseType="none"
                       category="com.company.product.linker.optionCategory"
                       command="-l"
                       id="com.company.product.buildDefinitions.linker.libs"
                       name="Libraries (-l)"
                       valueType="libs">
                 </option>
                 <option
                       browseType="directory"
                       category="com.company.product.linker.optionCategory"
                       command="-L"
                       id="com.company.product.buildDefinitions.linker.paths"
                       name="Library search path (-L)"
                       valueType="libPaths">
                 </option>
                 <inputType
                       buildVariable="OBJS"
                       id="com.company.product.buildDefinitions.linker.inputType"
                       multipleOfType="true"
                       sourceContentType="org.eclipse.cdt.managedbuilder.core.compiledObjectFile"
                       sources="o">
                 </inputType>
                 <outputType
                       buildVariable="ELF"
                       id="com.company.product.buildDefinitions.linker.outputType"
                       outputNames="${BuildArtifactFileBaseName}.elf"
                       outputs="elf">
                 </outputType>
              </tool>
              <tool
                    command="objcopy"
                    commandLinePattern="${TOOLCHAIN_BIN_PATH}/${TOOLCHAIN_PREFIX}${COMMAND} ${BuildArtifactFileBaseName}.elf -O binary ${BuildArtifactFileBaseName}.bin "
                    id="com.company.product.buildDefinitions.createflash"
                    isAbstract="false"
                    name="Flash binary builder (bin)">
                 <inputType
                       buildVariable="ELF"
                       id="com.company.product.buildDefinitions.createflash.inputType"
                       sources="elf">
                 </inputType>
              </tool>
           </toolChain>
        </configuration>
        </projectType>
    </extension>

     <extension
           point="org.eclipse.cdt.core.templateProcessTypes">
        <processType
              name="CopyFolders"
              processRunner="com.company.product.build.CopyFolders">
           <simple
                 name="projectName">
           </simple>
        <simple
              name="folder">
        </simple>
        </processType>
     </extension>

     <extension
           point="org.eclipse.cdt.core.templates">
        <template
              id="com.company.product.build.CopyFolders"
              location="templates/ExampleBase/template.xml"
              projectType="com.company.product.buildDefinitions.projectType">
        </template>
     </extension>

     <extension
           point="org.eclipse.cdt.core.templateAssociations">
        <template
              id="com.company.product.build.CopyFolders">
           <toolChain
                 id="com.company.product.buildDefinitions.toolChain">
           </toolChain>
        </template>
     </extension>

</plugin>

看来我的扩展点org.eclipse.cdt.core.templates具有属性projectType =“ com.company.product.buildDefinitions.projectType”与我的扩展点org.eclipse.cdt.managedbuilder.core不兼容。创建项目时,buildDefinitions标记为具有属性id =“ com.company.product.buildDefinitions.projectType”的projectType。

在阅读了有关模板的最新文档并阅读了cdt.autotools / cdt.build.crossgcc源代码后,我尝试了很多事情,但是没有任何效果。

这是CDT的错误吗,我缺少什么吗?

感谢您的帮助。

0 个答案:

没有答案