protected function collectFiles(ComponentCollection $component_collection) {
    $file_info = array();

    // Components which provide a file should have registered themselves as
    // children of the root component.
    $file_components = $component_collection->getContainmentTreeChildren($component_collection->getRootComponent());
    foreach ($file_components as $id => $child_component) {
      // Don't get files for existing components.
      // TODO! This is quick and dirty! It's a lot more complicated than this,
      // for instance with components that affect other files.
      // Currently the only component that will set this is Info, to make
      // adding code to existing modules look like it works!
      if ($child_component->exists) {
        continue;
      }

      $file_info_item = $child_component->getFileInfo();
      if (is_array($file_info_item)) {
        // Prepend the component_base_path to the path.
        if (!empty($child_component->component_data['component_base_path'])) {
          if (empty($file_info_item['path'])) {
            $file_info_item['path'] = $child_component->component_data['component_base_path'];
          }
          else {
            $file_info_item['path'] = $child_component->component_data['component_base_path']
              . '/'
              . $file_info_item['path'];
          }
        }

        // Add the source component ID.
        $file_info_item['source_component_id'] = $id;

        $file_info[$id] = $file_info_item;
      }
    }

    return $file_info;
  }