cmParseJacocoCoverage.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. /*============================================================================
  2. CMake - Cross Platform Makefile Generator
  3. Copyright 2000-2009 Kitware, Inc.
  4. Distributed under the OSI-approved BSD License (the "License");
  5. see accompanying file Copyright.txt for details.
  6. This software is distributed WITHOUT ANY WARRANTY; without even the
  7. implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  8. See the License for more information.
  9. ============================================================================*/
  10. #ifndef cmParseJacocoCoverage_h
  11. #define cmParseJacocoCoverage_h
  12. #include <cmConfigure.h> // IWYU pragma: keep
  13. #include <map>
  14. #include <string>
  15. #include <vector>
  16. class cmCTest;
  17. class cmCTestCoverageHandlerContainer;
  18. /** \class cmParseJacocoCoverage
  19. * \brief Parse JaCoCO coverage information
  20. *
  21. * This class is used to parse coverage information for
  22. * java using the JaCoCo tool:
  23. *
  24. * http://www.eclemma.org/jacoco/trunk/index.html
  25. */
  26. class cmParseJacocoCoverage
  27. {
  28. public:
  29. cmParseJacocoCoverage(cmCTestCoverageHandlerContainer& cont, cmCTest* ctest);
  30. bool LoadCoverageData(std::vector<std::string> const& files);
  31. std::string PackageName;
  32. std::string FileName;
  33. std::string ModuleName;
  34. std::string CurFileName;
  35. private:
  36. // implement virtual from parent
  37. // remove files with no coverage
  38. void RemoveUnCoveredFiles();
  39. // Read a single mcov file
  40. bool ReadJacocoXML(const char* f);
  41. // split a string based on ,
  42. bool SplitString(std::vector<std::string>& args, std::string const& line);
  43. bool FindJavaFile(std::string const& routine, std::string& filepath);
  44. void InitializeJavaFile(std::string& file);
  45. bool LoadSource(std::string d);
  46. class XMLParser;
  47. std::map<std::string, std::string> RoutineToDirectory;
  48. cmCTestCoverageHandlerContainer& Coverage;
  49. cmCTest* CTest;
  50. };
  51. #endif