Skip to content

Commit

Permalink
Blog post for Bazel 2.1 (#216)
Browse files Browse the repository at this point in the history
Co-authored-by: Jin <jin@users.noreply.github.com>
  • Loading branch information
laurentlb and jin authored Feb 7, 2020
1 parent 4e8dfba commit 8cc2bfb
Showing 1 changed file with 87 additions and 0 deletions.
87 changes: 87 additions & 0 deletions _posts/2020-02-06-bazel-2.1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
---
layout: posts
title: "Bazel 2.1"
authors:
- laurentlb
---

[Bazel 2.1](https://github.com/bazelbuild/bazel/releases/tag/2.1.0) has just been released.

Bazel 2.1 is intended to be backward-compatible with Bazel 2.0. However it contains a single incompatible change that was deemed a bug fix and thus eligible for inclusion. We haven’t found any code broken by this change, but [please report](https://github.com/bazelbuild/bazel/issues/new) if it causes any burden to you.


## Incompatible change

* The following attributes of `CcToolchainProvider`, which formerly were
accessible both as fields `x.f` and as methods `x.f()`, are now only fields:
`ld_executable`, `objcopy_executable`, `compiler_executable`,
`preprocessor_executable`, `nm_executable`, `objdump_executable`,
`ar_executable`, `strip_executable`.

## Starlark

* `x.f()` is now equivalent to `y=x.f; y()`. That is, `x.f` should return the
same attribute value regardless of whether it is accessed as a field or
called like a method. Any arguments to the call are evaluated after the
`x.f` operation.
* Keyword-only arguments are now allowed:
```python
def foo(a, *, k): pass
def foo(a, *b, k): pass
foo(5, k = 6) # k can be specified only by keyword
```
* A new boolean field
[`ctx.target_platform_has_constraint`](https://docs.bazel.build/versions/master/skylark/lib/ctx.html#target_platform_has_constraint)
is added to allow rules to check the target platform's constraints.


## bazelignore



* Similar to the
[.bazelignore](https://docs.bazel.build/versions/master/guide.html#.bazelignore)
in the main repository, a .bazelignore file in external repository now
causes the specified directories to be ignored by Bazel. Bazel doesn't try to
identify any packages under the directories, but the files can still be
referenced in other BUILD files.
* `.bazelignore` files now support line comments, e.g. `# this is a comment`.


## Android



* Experimental support for d8 merger is now available for use using
`--define=android_dexmerger_tool=d8_dexmerger`.
* `RoleManager#addRoleHolderAsUser` now supports desugaring.


## Other changes



* Total critical path runtime will not be longer than total execution runtime.
* A new
[`BuildEventProtocol`](https://docs.bazel.build/versions/master/build-event-protocol.html)
message is added for listing the convenience symlinks that get created in
the workspace (such as `bazel-out`). Enable it with the
`--experimental_convenience_symlinks_bep_event` flag.
* `cquery 'somepath(...)'` returns more reliable results when the dependency has a
different configuration than the parent. To get a result for
`somepath(//foo, //bar)` when `//bar` isn't in the top-level configuration,
run your query with `--universe_scope=//foo`. See [cquery
docs](https://docs.bazel.build/versions/2.1.0/cquery.html) for details.


## Community updates

* P.J. McNerney wrote a new book:
[Beginning Bazel: Building and Testing for Java, Go, and More](https://www.amazon.com/Beginning-Bazel-Building-Testing-Java/dp/1484251938).
* Oreilly published a report: [Getting Started with Bazel](https://get.oreilly.com/ind_getting-started-with-bazel.html) by Benjamin Muschko.
* `rules_nodejs` made its [first stable release](https://github.com/bazelbuild/rules_nodejs/releases/tag/1.0.0).
* Judah Jacobson published [hrepl](https://github.com/google/hrepl), a tool that lets you interactively develop Haskell code. It uses Bazel to compile your code's dependencies, and then loads your modules into an interpreter.
* The [Bazel Community Experts](https://bazel.build/experts.html) page has been updated.
* BazelCon 2019: The [video recordings](https://blog.bazel.build/2020/01/21/bazelcon-videos.html) have been posted. VMWare open-source team shared their [First-Timer Perspective on BazelCon](https://blogs.vmware.com/opensource/2020/01/16/bazelcon-2019/), and [Wix wrote a blog post](https://www.wix.engineering/post/bazelcon-2019-lessons-learned-from-migrating-our-build-system-to-bazel) about it. thundergolfer shared [some personal notes](https://www.reddit.com/r/bazel/comments/esqtnd/bazelcon_2019_notes_on_presentations/) about BazelCon talks.

This release contains contributions from many people at Google, as well as Adam Liddell, Alessandro Patti, Andreas Herrmann, Bor Kae Hwang, Brian Silverman, Emran BatmanGhelich, George Gensure, Jeff Palm, Jonathan Beverly, Mark Nevill, Patrick Niklaus, Peter, Ryan Beasley, Shin Yamamoto, and Yen-Chi Chen.

0 comments on commit 8cc2bfb

Please sign in to comment.