PageRenderTime 3349ms CodeModel.GetById 30ms RepoModel.GetById 1ms app.codeStats 0ms

/blog/golang-and-the-next-gen-build-tools/index.html

https://github.com/abijr/abijr.github.com
HTML | 287 lines | 159 code | 128 blank | 0 comment | 0 complexity | 75b50a0d1bb3a17322b2b1d6e597198e MD5 | raw file
  1. <!DOCTYPE html>
  2. <html lang="en-US">
  3. <head>
  4. <meta charset="utf-8">
  5. <meta http-equiv="X-UA-Compatible" content="chrome=1">
  6. <meta name="HandheldFriendly" content="True">
  7. <meta name="MobileOptimized" content="320">
  8. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  9. <meta name="referrer" content="no-referrer">
  10. <meta name="description" content="Don&#39;t panic">
  11. <meta property="og:title" content="Golang and the Next-Gen Build Tools" />
  12. <meta property="og:description" content="The three general build systems from the big players. Bazel by Google, Pants by Twitter and Buck by Facebook, all attempt to allay the problems plaguing build system since time immemorial. They are all based on the internal build system from Google, Blaze, and as such, they are almost identical in features. They improve on the correctness, speed and modularity of the builds with features such as sandboxed builds, caching of targets, and namespacing of build modules." />
  13. <meta property="og:type" content="article" />
  14. <meta property="og:url" content="http://abijr.com/blog/golang-and-the-next-gen-build-tools/" />
  15. <meta property="article:published_time" content="2017-04-30T21:19:59-05:00"/>
  16. <meta property="article:modified_time" content="2017-04-30T21:19:59-05:00"/>
  17. <title>
  18. Golang and the Next-Gen Build Tools
  19. </title>
  20. <link rel="canonical" href="http://abijr.com/blog/golang-and-the-next-gen-build-tools/">
  21. <link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.8.0/styles/default.min.css">
  22. <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Open+Sans:400,700|Ubuntu+Mono:400,400i,700,700i|Raleway:500">
  23. <link rel="stylesheet" href="http://abijr.com/css/reset.css?t=2017-05-01%2016%3a53%3a11.400218341%20-0500%20CDT">
  24. <link rel="stylesheet" href="http://abijr.com/css/pygments.css?t=2017-05-01%2016%3a53%3a11.400218341%20-0500%20CDT">
  25. <link rel="stylesheet" href="http://abijr.com/css/main.css?t=2017-05-01%2016%3a53%3a11.400218341%20-0500%20CDT">
  26. <link rel="shortcut icon"
  27. href="http://abijr.com/img/favicon.ico"
  28. >
  29. </head>
  30. <body lang="en">
  31. <section class="header">
  32. <div class="container">
  33. <div class="content">
  34. <a href="http://abijr.com/"><img class="avatar" src="http://abijr.com/img/avatar.png" srcset="http://abijr.com/img/avatar.png 1x"></a>
  35. <a href="http://abijr.com/"><div class="name">Abimael Martínez</div></a>
  36. <nav>
  37. <ul>
  38. <li class="nav-blog"><a href="http://abijr.com/blog/"><span>Blog</span></a></li>
  39. <li class="nav-about"><a href="http://abijr.com/about/"><span>About</span></a></li>
  40. <li class="nav-code"><a href="http://abijr.com/code/"><span>Code</span></a></li>
  41. </ul>
  42. </nav>
  43. </div>
  44. </div>
  45. </section>
  46. <section class="icons">
  47. <div class="container">
  48. <div class="content">
  49. <a href="//github.com/abijr" target="_blank" rel="noopener"><img class="icon" src="http://abijr.com/img/github.svg" alt="github" /></a>
  50. <a href="//linkedin.com/in/abimael" target="_blank" rel="noopener"><img class="icon" src="http://abijr.com/img/linkedin.svg" alt="linkedin" /></a>
  51. <a href="mailto:abijr.mtz@gmail.com"><img class="icon" src="http://abijr.com/img/email.svg" alt="email" /></a>
  52. <a href="http://abijr.com/index.xml"><img class="icon" src="http://abijr.com/img/rss.svg" alt="rss" /></a>
  53. </div>
  54. </div>
  55. </section>
  56. <section class="main post non-narrow zero-top-spacing">
  57. <div class="container">
  58. <div class="content">
  59. <div class="front-matter">
  60. <div class="title-container">
  61. <div class="page-heading">
  62. Golang and the Next-Gen Build Tools
  63. </div>
  64. <div class="initials"><a href="http://abijr.com/"></a></div>
  65. </div>
  66. <div class="meta">
  67. <div class="date" title='Sun Apr 30 2017 21:19:59 CDT'>Apr 30, 2017</div>
  68. <div class="reading-time"><div class="middot"></div>4 minutes read</div>
  69. </div>
  70. </div>
  71. <div class="markdown">
  72. <p>The three general build systems from the big players. Bazel by Google, Pants by Twitter and Buck by Facebook, all attempt to allay the problems plaguing build system since time immemorial. They are all based on the internal build system from Google, Blaze, and as such, they are almost identical in features. They improve on the correctness, speed and modularity of the builds with features such as sandboxed builds, caching of targets, and namespacing of build modules. </p>
  73. <p>They enforce the correctness of the task definitions and its dependencies, and thereby allow the optimization of incremental builds by caching intermediate results. They have client-server implementations to allow significant speedup of build operations. They are extensible and configurable. </p>
  74. <p>So, how do they compare? Which one is best? Well, for starters, heres a table of features:</p>
  75. <table>
  76. <thead>
  77. <tr>
  78. <th>Build Tool</th>
  79. <th>Ease of Installation</th>
  80. <th>Windows Support</th>
  81. <th>Go Support</th>
  82. <th>Other</th>
  83. </tr>
  84. </thead>
  85. <tbody>
  86. <tr>
  87. <td>Bazel</td>
  88. <td>Single script installer</td>
  89. <td>Beta</td>
  90. <td><ul style="list-style:none;padding-left:0"><li>Beta:</li><li>- Rudimentary dependency management<li>- Bootstraps <code>go</code> tool</li><li>- Cgo</li></ul></td>
  91. <td><ul style="padding-left:1rem"><li>iOS, Android</li><li>C++, Java, Python</li><li>Rust</li><li>Javascript using Closure (3rd party support for NodeJS)</li><li>Docker</li></td>
  92. </tr>
  93. <tr>
  94. <td>Pants</td>
  95. <td>Check-in-able runner script</td>
  96. <td>Nope</td>
  97. <td><ul style="list-style:none;padding-left:0"><li>Good:</li><li>- Good-ish dependency management</li><li>- go-fmt (beta)</li><li>- Bootstraps <code>go</code> tool</li></ul></td>
  98. <td><ul style="padding-left:1rem"><li>iOS, Android</li><li>C++, Java, Python</li><li>Javascript through NodeJS</li><li>Rust</li></ul></td>
  99. </tr>
  100. <tr>
  101. <td>Buck</td>
  102. <td><ul style="list-style:none;padding-left:0"><li>Mac</li><li>- Brew tap</li><li>Linux/Windows</li><li>- Build from source</li></ul></td>
  103. <td>Yes</td>
  104. <td><ul style="list-style:none;padding-left:0"><li>Basic:</li><li>- No bootstrapping of <code>go</code> binary.</li><li>- No dependency management.</li></ul></td>
  105. <td><ul style="padding-left:1rem"><li>iOS, Android</li><li>C++, Java, Python</li><li>Haskell</li><li>Rust</li></ul></td>
  106. </tr>
  107. </tbody>
  108. </table>
  109. <p>Pants is the first of the three to be released as open source, and it shows, it is the one with the shiniest features. It has good dependency management, integration with the tools you&rsquo;re probably using now and it is easy to setup whether it is on your workstation or remote build machines.</p>
  110. <p>Next up is Bazel. It feels like an industrial grade tool, with a nice web page, lots of stars on its github page and Windows support. But it is still lagging in features compared to pants. The lack of good dependency management means you will be writing dependency files by hand. No support for coverage means you&rsquo;ll have to run scripts on the side. The goals of the Bazel project are more geared towards big companies and not for small projects (which is to be expected of Google). Depending on what language your project is mainly written (say Python<sup class="footnote-ref" id="fnref:1"><a rel="footnote" href="#fn:1">1</a></sup>) Bazel might not be ready for prime time, unless you&rsquo;re already vendoring (copying) 3rd party code into your repository or if you&rsquo;re willing to make the (non-trivial) change.</p>
  111. <p>As for Buck, well, it is a tool more geared towards front-end and mobile development. And it looks like a really good tool if you work on that segment. But you&rsquo;ll need to build it yourself if you want to use it on Linux, and that&rsquo;s a show stopper for me (at least give me bootsrap script!). Really nice output and good support for Windows might make this your first choice. Do note that Buck is the youngest of the tools, perhaps it will take over the build system world?</p>
  112. <h2 id="summary">Summary</h2>
  113. <p>If limiting our scope to projects using Go, Pants takes the cake. It&rsquo;s <a href="https://pantsbuild.github.io/go_readme.html">documentation</a> for Go is top notch, and it walks you through the whole process. They&rsquo;re pretty responsive on their <a href="https://groups.google.com/forum/#!forum/pants-devel">community</a> channels, specially on <a href="https://pantsslack.herokuapp.com/">slack</a>. Trying up and coming features is as simple as changing the Pants version in the <code>pants.ini</code> file. And if you extend your considerations to other languages, you&rsquo;d be more than satisfied with Python+Pip+PEX support, NodeJS+NPM, along with the usual C++ and Java.</p>
  114. <p>Perhaps the best build tool will not remain the same one. Let&rsquo;s hope that the open source model shared by the tools will enhance their improvement through the competition and sharing of features. But, whether it is Pants, Buck or Bazel, these Next-Gen build tools feel like the future even if you&rsquo;re not following the monorepo structure in your organization. I keep wondering where the hype behind the next-gen build tools is, I would consider starting to use these tools, if only for the speedups in builds<sup class="footnote-ref" id="fnref:2"><a rel="footnote" href="#fn:2">2</a></sup>. Now, if you add build correctness and code organization improvements to the mix&hellip;</p>
  115. <p>What do you think?</p>
  116. <div class="footnotes">
  117. <hr />
  118. <ol>
  119. <li id="fn:1"><a href="http://tanin.nanakorn.com/blogs/371">Bazel vs. Pants for a Python project</a>
  120. <a class="footnote-return" href="#fnref:1"><sup>[return]</sup></a></li>
  121. <li id="fn:2"><a href="http://zserge.com/blog/buck-build-system.html">Buck - life is too short to spend a minute for each build</a>
  122. <a class="footnote-return" href="#fnref:2"><sup>[return]</sup></a></li>
  123. </ol>
  124. </div>
  125. <br>
  126. <p><a href="http://abijr.com/blog/">Back to posts</a></p>
  127. </div>
  128. <br>
  129. <div class="disqus">
  130. <div id="disqus_thread"></div>
  131. <script type="text/javascript">
  132. var disqus_shortname = 'abijr';
  133. var disqus_identifier = 'http:\/\/abijr.com\/blog\/golang-and-the-next-gen-build-tools\/';
  134. var disqus_title = 'Golang and the Next-Gen Build Tools';
  135. var disqus_url = 'http:\/\/abijr.com\/blog\/golang-and-the-next-gen-build-tools\/';
  136. (function() {
  137. var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
  138. dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
  139. (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
  140. })();
  141. </script>
  142. <noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
  143. <a href="http://disqus.com" class="dsq-brlink">comments powered by <span class="logo-disqus">Disqus</span></a>
  144. </div>
  145. </div>
  146. </div>
  147. </section>
  148. <script>
  149. window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)};ga.l=+new Date;
  150. ga('create', 'UA-98404805-1', 'auto');
  151. ga('send', 'pageview');
  152. </script>
  153. <script async src='//www.google-analytics.com/analytics.js'></script>
  154. <script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.8.0/highlight.min.js"></script>
  155. <script type="text/javascript">
  156. hljs.initHighlightingOnLoad();
  157. </script>
  158. </body>
  159. </html>