toolchains.rst 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. .. _build_toolchains:
  2. ===========================
  3. Creating Toolchain Archives
  4. ===========================
  5. There are various scripts in the repository for producing archives
  6. of the build tools (e.g. compilers and linkers) required to build.
  7. Clang
  8. =====
  9. See the ``build/build-clang`` directory. Read ``build/build-clang/README``
  10. for more.
  11. Windows
  12. =======
  13. The ``build/windows_toolchain.py`` script is used to build and manage
  14. Windows toolchain archives containing Visual Studio executables, SDKs,
  15. etc.
  16. The way Firefox build automation works is an archive containing the
  17. toolchain is produced and uploaded to an internal Mozilla server. The
  18. build automation will download, verify, and extract this archive before
  19. building. The archive is self-contained so machines don't need to install
  20. Visual Studio, SDKs, or various other dependencies. Unfortunately,
  21. Microsoft's terms don't allow Mozilla to distribute this archive
  22. publicly. However, the same tool can be used to create your own copy.
  23. Configuring Your System
  24. -----------------------
  25. It is **highly** recommended to perform this process on a fresh installation
  26. of Windows 7 or 10 (such as in a VM). Installing all updates through
  27. Windows Update is not only acceptable - it is encouraged. Although it
  28. shouldn't matter.
  29. Next, install Visual Studio 2015 Community. The download link can be
  30. found at https://www.visualstudio.com/en-us/products/visual-studio-community-vs.aspx.
  31. Be sure to follow these install instructions:
  32. 1. Choose a ``Custom`` installation and click ``Next``
  33. 2. Select ``Programming Languages`` -> ``Visual C++`` (make sure all sub items are
  34. selected)
  35. 3. Under ``Windows and Web Development`` uncheck everything except
  36. ``Universal Windows App Development Tools`` and the items under it
  37. (should be ``Tools (1.3.1)...`` and the ``Windows 10 SDK``).
  38. Once Visual Studio 2015 Community has been installed, from a checkout
  39. of mozilla-central, run something like the following to produce a ZIP
  40. archive::
  41. $ ./mach python build/windows_toolchain.py create-zip vs2015u3
  42. The produced archive will be the argument to ``create-zip`` + ``.zip``.
  43. Firefox for Android with Gradle
  44. ===============================
  45. To build Firefox for Android with Gradle in automation, archives
  46. containing both the Gradle executable and a Maven repository
  47. comprising the exact build dependencies are produced and uploaded to
  48. an internal Mozilla server. The build automation will download,
  49. verify, and extract these archive before building. These archives
  50. provide a self-contained Gradle and Maven repository so that machines
  51. don't need to fetch additional Maven dependencies at build time.
  52. (Gradle and the downloaded Maven dependencies can be both
  53. redistributed publicly.)
  54. Archiving the Gradle executable is straight-forward, but archiving a
  55. local Maven repository is not. Therefore a special Task Cluster
  56. Docker image and job exist for producing the required archives. The
  57. Docker image definition is rooted in
  58. ``taskcluster/docker/android-gradle-build``. The Task Cluster job
  59. definition is in
  60. ``testing/taskcluster/tasks/builds/android_api_15_gradle_dependencies.yml``.
  61. The job runs in a container based on the custom Docker image and
  62. spawns a Sonatype Nexus proxying Maven repository process in the
  63. background. The job builds Firefox for Android using Gradle and the
  64. in-tree Gradle configuration rooted at ``build.gradle``. The spawned
  65. proxying Maven repository downloads external dependencies and collects
  66. them. After the Gradle build completes, the job archives the Gradle
  67. version used to build, and the downloaded Maven repository, and
  68. exposes them as Task Cluster artifacts.
  69. Here is `an example try job fetching these dependencies
  70. <https://treeherder.mozilla.org/#/jobs?repo=try&revision=75bc98935147&selectedJob=17793653>`_.
  71. The resulting task produced a `Gradle archive
  72. <https://queue.taskcluster.net/v1/task/CeYMgAP3Q-KF8h37nMhJjg/runs/0/artifacts/public%2Fbuild%2Fgradle.tar.xz>`_
  73. and a `Maven repository archive
  74. <https://queue.taskcluster.net/v1/task/CeYMgAP3Q-KF8h37nMhJjg/runs/0/artifacts/public%2Fbuild%2Fjcentral.tar.xz>`_.
  75. These archives were then uploaded (manually) to Mozilla automation
  76. using tooltool for consumption in Gradle builds.
  77. To update the version of Gradle in the archive produced, update
  78. ``gradle/wrapper/gradle-wrapper.properties``. Be sure to also update
  79. the SHA256 checksum to prevent poisoning the build machines!
  80. To update the versions of Gradle dependencies used, update
  81. ``dependencies`` sections in the in-tree Gradle configuration rooted
  82. at ``build.gradle``. Once you are confident your changes build
  83. locally, push a fresh try build with an invocation like::
  84. $ hg push-to-try -m "try: -b o -p android-api-15-gradle-dependencies"
  85. Then `upload your archives to tooltool
  86. <https://wiki.mozilla.org/ReleaseEngineering/Applications/Tooltool#How_To_Upload_To_Tooltool>`_,
  87. update the in-tree manifests in
  88. ``mobile/android/config/tooltool-manifests``, and push a fresh try
  89. build.