incremental_parsing.txt 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. Incremental Parsing
  2. --------------------
  3. Incremental parsing is a feature where Raptor can avoid reparsing bld.infs,
  4. mmps etc (generally known as metadata files) when it determines that they
  5. have not changed. This means that the makefiles that were generated in a
  6. previous build may be reused.
  7. The primary benefit of this feature is to reduce the test-build-run cycle
  8. in situations where the same build is being repeated many times without
  9. changes to metadata files, e.g. repeatedly changing a C++ source file and
  10. recompiling the project.
  11. Example:
  12. sbs -b bld.inf --ip=on
  13. Old makefiles are only reused if they were aimed at building exactly the
  14. same components, for exactly the same platforms and in the same environment.
  15. The incremental parsing feature is currently sensitive to the PATH variable
  16. only but it may be desirable to reparse metadata in other situations also.
  17. At the moment, the decision to re-parse is "all-or-nothing" - i.e. a change to any
  18. single bld.inf or mmp or any of their dependencies will result in a complete
  19. re-parse of all of them. A more fine-grained approach may become possible in future.
  20. This feature is new and somewhat experimental - if you suspect that something
  21. should have been rebuilt but hasn't while you are using the feature then
  22. simply remove the option from your invocation of sbs and rebuild.
  23. Are Two Builds the Same?
  24. ------------------------
  25. The judgement about whether a set of makefiles can be reused is made on two criteria:
  26. 1) The environment: currently only the "EPOCROOT" and "PATH"
  27. environment variables are compared between two builds - if these differ
  28. then the builds are not equivalent. This attempts to ensure that
  29. two builds are building against the same SDK with the same tools but
  30. since not all tools have to be on the path there is room for some
  31. degree of error e.g. if you upgraded tools or the SDK itself between
  32. two builds.
  33. 2) The commandline: if the commandline for two builds is different then
  34. the makefiles are considered different. This *very* conservative but
  35. that seems right with a build system. There are 3 exceptions.
  36. i) The "--ip=on" command itself is not considered to count as a
  37. difference
  38. ii) The "clean" target is ignored. This means that building code and
  39. then cleaning it should not require the regeneration of makefiles.
  40. iii) The -f (logfilename) option and its argument are ignored.
  41. e.g. the makefiles generated for:
  42. sbs -b bld.inf -c armv5
  43. ...will be reused if this command follows:
  44. sbs -b bld.inf --ip=on -c armv5 clean
  45. Build Records
  46. --------------
  47. A new file is created in every build with the name #MAKEFILE#.buildrecord.
  48. This file records of the names of the makefiles involved in a build and
  49. the corresponding commandline that was given to raptor when it created
  50. them.
  51. Raptor uses these records to determine if the current build can reuse
  52. existing makefiles. If the current build attempt's commandline and
  53. "environment" match those of an existing record then the makefiles
  54. referenced by the record can be reused.
  55. Build record files are written in JSON format.
  56. Performance and Timing Data from Build Records
  57. -----------------------------------------------
  58. The Build Record (as of 2.17.4) also records the start time, end time and
  59. running time of the build in the JSON "timing" element. The start and end
  60. times are decimal fractions of "seconds" from Python's time.time() method
  61. and the run time (end-start) is similarly a decimal fraction in seconds.
  62. This provides an easy way to collect performance data over a number of builds
  63. - particularly from users who have been experiencing problems with slow builds
  64. Example Demonstrating incremental Parsing Use Cases
  65. ----------------------------------------------------
  66. Step 1)
  67. With a clean epocroot the user types:
  68. sbs -b bld.inf --ip=on
  69. What happens: bld.infs and mmps are parsed, makefiles are generated, the
  70. source code is built
  71. Step 2)
  72. Next the user changes a source file and issues the same build
  73. instruction:
  74. sbs -b bld.inf --ip=on
  75. What happens: bld.infs and mmps are NOT parsed, step 1 makefiles are reused,
  76. the changed source code is rebuilt.
  77. Step 3)
  78. The user adds a new mmp into their bld.inf file and issues the same build
  79. command:
  80. What happens: bld.infs and mmps are parsed, new makefiles are created,
  81. the new code is built.
  82. Step 4)
  83. The user decides to build only for arm.v5.urel.rcvt4_0
  84. sbs -b bld.inf --ip=on -c arm.v5.urel.rvct4_0
  85. What happens: bld.infs and mmps are parsed because the configuration has
  86. changed even if arm.v5.urel.rvct4_0 is only a subset of the former builds,
  87. new makefiles are created, nothing is built since no code changed.