Ignore:
Timestamp:
Nov 27, 2011, 4:36:15 PM (13 years ago)
Author:
rybkin
Message:

See C.L. 465

File:
1 edited

Legend:

Unmodified
Added
Removed
  • CMT/HEAD/source/cmt_deps_builder.cxx

    r427 r588  
    1111#include "cmt_symbol.h"
    1212#include "cmt_log.h"
     13#include "cmt_error.h"
    1314
    1415//
     
    9293        {
    9394          cmt_string stamp_file;
     95          log << "|header_file_action> header " << header_file_path << " against stamp " << stamp_file << log_endl;
    9496          if (header_filters[i].use_stamp (header_file_path, stamp_file))
    9597            {
     
    113115///////////////////////////////////////////////////////////////////////////////////////////////////////
    114116  cmt_string text;
    115   text.read (header_file_path);
     117  if (!text.read (header_file_path))
     118    {
     119      CmtError::set (CmtError::file_access_error, header_file_path);
     120      return;
     121    }
    116122  char* ptr = &text[0];
    117123  cmt_string new_dir;
     
    725731    {
    726732      cmt_string text;
    727       text.read (full_name);
     733      if (!text.read (full_name))
     734        {
     735          CmtError::set (CmtError::file_access_error, full_name);
     736          return -2;
     737        }
    728738      char* ptr = &text[0];
    729739      cmt_string new_dir;
     
    746756    {
    747757      log << "CMT> build_deps3" << log_endl;
     758      CmtError::set (CmtError::path_not_found, name);
    748759    }
    749760  return path_index;
     
    811822
    812823//--------------------------------------------------------------------------
     824DepsBuilder::DepsBuilder ()
     825{ }
     826
     827//--------------------------------------------------------------------------
     828DepsBuilder::~DepsBuilder ()
     829{
     830  clear ();
     831}
     832
     833//--------------------------------------------------------------------------
    813834void DepsBuilder::clear ()
    814835{
     
    820841    }
    821842  m_header_filters.clear ();
     843  m_deps.clear ();
     844  m_all_deps.clear ();
    822845}
    823846
     
    829852      return;
    830853    }
     854
     855  cmt_string p = path;
    831856  if (path[path.size () - 1] == CmtSystem::file_separator ())
    832857    {
    833       cmt_string p = path;
    834       p.erase (path.size () - 1);
    835       m_include_paths.push_back (p);
    836     }
    837   else
    838     {
    839       m_include_paths.push_back (path);
    840     }
    841 
     858      p = path.substr(0, path.size () - 1);
     859    }
     860  for (int k = m_include_paths.size () - 1; k >= 0; k--)
     861    if (m_include_paths[k] == p)
     862      {
     863        return;
     864      }
     865 
     866  m_include_paths.push_back (p);
    842867  m_substitutions.push_back (substitution);
    843868}
     
    919944
    920945//--------------------------------------------------------------------------
    921 CmtSystem::cmt_string_vector& DepsBuilder::run (const cmt_string& file_name)
     946CmtSystem::cmt_string_vector& DepsBuilder::run (const cmt_string& file_name,
     947                                                const cmt_string& constituent_name)
    922948{
    923949  Log;
    924950
    925951  log << "Starting deps builder on " << file_name << log_endl;
     952  CmtMessage::info ("calculating dependencies for " + file_name);
    926953
    927954  m_deps.clear ();
     
    9741001      // missing)
    9751002      //
    976       preprocessor += " ";
    9771003      macro = Symbol::find ("includes");
    978       preprocessor += macro->resolve_macro_value ();
     1004      if (0 != macro)
     1005        {
     1006          preprocessor += " ";
     1007          preprocessor += macro->resolve_macro_value ();
     1008        }
     1009      macro = Symbol::find ("app_" + constituent_name + "_cppflags");
     1010      if (0 != macro)
     1011        {
     1012          preprocessor += " ";
     1013          preprocessor += macro->resolve_macro_value ();
     1014        }
     1015      macro = Symbol::find ("lib_" + constituent_name + "_cppflags");
     1016      if (0 != macro)
     1017        {
     1018          preprocessor += " ";
     1019          preprocessor += macro->resolve_macro_value ();
     1020        }
     1021     
    9791022      preprocessor += " ";
    9801023      preprocessor += file_name;
     
    9821025      cmt_string output;
    9831026     
    984       CmtSystem::execute (preprocessor, output);
     1027      int status = CmtSystem::execute (preprocessor, output);
     1028      if (0 != status)
     1029        {
     1030          CmtError::set (CmtError::execution_failed, preprocessor, status);
     1031          return m_deps;
     1032        }
    9851033
    9861034      //
     
    10411089
    10421090//--------------------------------------------------------------------------
    1043 void DepsBuilder::add_header_filter (const Use* use, const cmt_regexp* filter, const cmt_string& stamp)
     1091void DepsBuilder::add_header_filter (const Use* use, cmt_regexp* filter, const cmt_string& stamp)
    10441092{
    10451093  add_header_filter (HeaderFilter (use, filter, stamp));
Note: See TracChangeset for help on using the changeset viewer.