0

I have an embedded C project comprised of dozens of source module and headers, in a directory hierarchy. The project is defined for a few targets (managed using build configurations) and many of the modules are included in the build for only a subset of configurations.

The project is a makefile project, built from command line, and I am using the Eclipse IDE mostly for its static code analysis capabilities. For example, when searching for a definition of an object, it knows what header file to open, based on the inclusion of that module in the build configuration.

In the past I used the Export/Import feature to bulk-edit the include paths and macro definitions for the various configurations.

But I am looking for a way to do that for module inclusion/exclusion. If I right-click on a directory in the code tree, I see the Exclude from build... menu entry, that opens a dialog with the list of configurations, where I can conveniently select in which configs to exclude that directory.

But, this dialog is missing from the context menu of a specific module. Thus, I need to open the Properties dialog and scroll through all configs exclude the from the required ones one-by-one.

Is there a dialog similar to the directory one for a single module?

Is there a way to export these settings (other than include paths and macros) to an XML file for easy editing? Where does Eclipse save this information?

I am using ARM's DS-5 Eclipse platform version Mars.2 (4.5.2)

ysap
  • 7,723
  • 7
  • 59
  • 122

1 Answers1

1

I see Exclude from build... in the Resource Configurations submenu for both directories and individual files.

As for where Eclipse stores this information: in the .cproject file, in entries that look something like this:

<cproject ...>
  <storageModule ...>
    <cconfiguration ...>
      ...
      <storageModule ...>
        <configuration ...>
          ...
          <sourceEntries>
            <entry excluding="<path-to-excluded-resource>" ...>
            ...
          </sourceEntries> 
          ...
HighCommander4
  • 50,428
  • 24
  • 122
  • 194
  • Thanks! Reading your answer I checked again. It appears that Eclipse is distinguishing the source module from the header files! In the source module there is indeed this submenu item. However for header files it is missing. I can understand the rationale behind this, however, when you open the Properties menu of the header, then this option is actually available... – ysap Nov 01 '19 at 16:41
  • So I took some time to explore the `.cproject` file using an XML tree viewer and directly parsing the text. It took some experimentation to find the places where the files and directories are listed, b/c it seems like the XML tree is not being maintained (as in garbage collection) when this is required. That is, files that are added to the project and to the exclusion list of a specific configuration, are not being removed from the list once they are renamed or deleted. So the list of exclusions grow longer than necessary, containing obsolete information. – ysap Nov 02 '19 at 21:54
  • [...cont] I could not find a menu entry for compacting/maintaining the `.cproject` file. Not even closing the project and/or exiting Eclipse. – ysap Nov 02 '19 at 21:54