Android M was definitely one of the highlights of Google I/O 2015, just like Android Lollipop was a year earlier. Although the new version isn’t nearly as big an update as Android 5.0 was, it still has quite a few interesting features to boast, like the new permission engine, for example. Users definitely have a lot to look forward to, but it is the developers who must act quick to adapt to the changes and make use of them as best they can.
Consequently, owning a current Nexus device is definitely invaluable to a lot of projects, as it allows for code to be tested as early as possible. Android M AOSP builds have been made available for most of Google's devices, but, rather surprisingly, Sony has also stepped up and enabled developers to test Android M on some Xperia gear, part of the Open Device program.
To achieve this, the Japanese giant has put out the necessary binaries to compile a working ROM for quite a few of its handsets and tablets, as well as a comprehensive guide through the process. However, there is an important note to be made. When Sony says it's for development purposes, it definitely means it. Not only do you have to compile your own ROM, but it still has a lot of missing parts, most notably the camera and modem, which are not implemented yet.
This makes the end product all but pointless for everyday use and thus it's indeed meant for testing and debugging only. However, it is also worth mentioning that such source code releases have usually lead to some quick work from the modding community, so it wouldn't really surprise us if crude, working ROMs start popping up for various Sony devices soon. But we digress. If you are interested in building your own working copy of Android M, the list of currently supported models includes:
Xperia™ Z3, Xperia™ Z3 Compact, Xperia™ Z3 Tablet Compact, Xperia™ Z2, Xperia™ Z2 Tablet, Xperia™ Z1, Xperia™ Z1 Compact, Xperia™ Z Ultra, Xperia™ E3, Xperia™ M2, Xperia™ T2 Ultra, and Xperia™ T3
The tools, binaries and guide are all available at the source link. Have fun!