CONTRIBUTING.adoc 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. // Copyright 2019-2020 Rene Rivera
  2. // Copyright 2003, 2006 Vladimir Prus
  3. // Distributed under the Boost Software License, Version 1.0.
  4. // (See accompanying file LICENSE.txt or https://www.bfgroup.xyz/b2/LICENSE.txt)
  5. = B2 contributor guidelines
  6. B2 is an open-source project. This means that we welcome and appreciate
  7. all contributions -- be it ideas, bug reports, or patches. This document
  8. contains guidelines which helps to assure that development goes on smoothly, and
  9. changes are made quickly.
  10. The guidelines are not mandatory, and you can decide for yourself which one to
  11. follow. But note, the 10 mins that you spare writing a comment, for example,
  12. might lead to significantly longer delay for everyone.
  13. == Additional resources include
  14. === The issue tracker
  15. https://github.com/bfgroup/b2/issues
  16. === Discussion forums
  17. https://github.com/bfgroup/b2/discussions
  18. == BUGS and PATCHES
  19. Both bugs and patches can be submitted to the GitHub tracker.
  20. When reporting a bug, please try to provide the following information:
  21. * What you did.
  22. * A minimal reproducible test case is very much appreciated.
  23. * Shell script with some annotations is much better than verbose
  24. description of the problem.
  25. * A regression test is the best (see test/test_system.html).
  26. * What you got.
  27. * What you expected.
  28. * What version of B2 did you use. If possible, please try to test with the
  29. main branch state.
  30. When submitting a patch, please:
  31. * Make a single patch for a single logical change
  32. * Follow the policies and coding conventions below
  33. * Send patches as pull requests to the main branch
  34. * Provide a good PR message together with the patch
  35. The purpose of message serves to communicate what was changed, and *why*.
  36. Without a good message, you might spend a lot of time later, wondering where
  37. a strange piece of code came from and why it was necessary.
  38. The good message mentions each changed file and each rule/method, saying
  39. what happened to it, and why. Consider, the following log message
  40. ----
  41. Better direct request handling.
  42. * new/build-request.jam
  43. (directly-requested-properties-adjuster): Redo.
  44. * new/targets.jam
  45. (main-target.generate-really): Adjust properties here.
  46. * new/virtual-target.jam
  47. (register-actual-name): New rule.
  48. (virtual-target.actualize-no-scanner): Call the above, to detected bugs,
  49. where two virtual target correspond to one Jam target name.
  50. ----
  51. The messages for the last two files are good. They tell what was changed.
  52. The change to the first file is clearly under-commented.
  53. It's okay to use terse messages for uninteresting changes, like ones induced
  54. by interface changes elsewhere.
  55. == POLICIES
  56. === Testing
  57. All serious changes must be tested. New rules must be tested by the module where
  58. they are declared. The test system (link:test/test_system.html[test/test_system.html])
  59. should be used to verify user-observable behavior.
  60. === Documentation
  61. It turns out that it's hard to have too much comments, but it's easy to have too
  62. little. Please prepend each rule with a comment saying what the rule does and
  63. what arguments mean. Stop for a minute and consider if the comment makes sense
  64. for anybody else, and completely describes what the rules does. Generic phrases
  65. like "adjusts properties" are really not enough.
  66. When applicable, make changes to the user documentation as well.
  67. == CODING CONVENTIONS
  68. 1. All names of rules and variables are lowercase with "-" to separate
  69. words.
  70. +
  71. ----
  72. rule call-me-ishmael ( ) ...
  73. ----
  74. 2. Names with dots in them are "intended globals". Ordinary globals use a
  75. dot prefix:
  76. +
  77. ----
  78. .foobar
  79. $(.foobar)
  80. ----
  81. 3. Pseudofunctions or associations are <parameter>.<property>:
  82. +
  83. ----
  84. $(argument).name = hello ;
  85. $($(argument).name)
  86. ----
  87. 4. Class attribute names are prefixed with "self.":
  88. +
  89. ----
  90. self.x
  91. $(self.x)
  92. ----
  93. 5. Builtin rules are called via their ALL_UPPERCASE_NAMES:
  94. +
  95. ----
  96. DEPENDS $(target) : $(sources) ;
  97. ----
  98. 6. Opening and closing braces go on separate lines:
  99. +
  100. ----
  101. if $(a)
  102. {
  103. #
  104. }
  105. else
  106. {
  107. #
  108. }
  109. ----
  110. == ENGINE
  111. Developing in the `b2` engine, the C++ part, requires two steps to be
  112. effective: building the "stable" engine, and developing the
  113. "in-progress" engine.
  114. What is the "stable" engine is up to you. It only refers to a build of the
  115. engine you know is at a good working state. When you are at a point the
  116. source is stable you can run `bootstrap.sh/bat` from the root. That will
  117. create the `b2` executable at the root. You can then use this version to run
  118. regular B2 builds as needed both within the B2 tree and in other projects.
  119. The "in-progress" engine is whatever build you happen to be testing at the
  120. moment. There are two ways to build this be engine. You can either
  121. (a) run `b2 b2` at the root, or (b) run `build.sh/bat` in `src/engine`.
  122. Using (a) will place, by default, a fully debuggable `b2` in the `.build`
  123. directories. You can run that one from a debugger with full symbols and
  124. stepping features. This should be the first choice in developing in the
  125. engine.
  126. After using (a) to implement functionality you can use (b) to fully test
  127. that functionality. The engine built from (b) is fully optimized and
  128. is the one used, by default, by the test system when running in the `test`
  129. directory. Before submitting patches it's required to build this way and
  130. run the tests in at least one toolset version (but preferably at least two).