Use travis tasks
diff --git a/.travis.yml b/.travis.yml
index d7febdd..24d56a3 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,5 +1,17 @@
 language: dart
-dart: dev
-script: ./tool/travis.sh
-dist: trusty
 sudo: false
+dart:
+  - dev
+  - stable
+dart_task:
+  - test
+  - dartfmt
+  - dartanalyzer: --fatal-warnings .
+
+# Only building master means that we don't run two builds for each pull request.
+branches:
+  only: [master]
+
+cache:
+  directories:
+    - $HOME/.pub-cache
diff --git a/tool/travis.sh b/tool/travis.sh
deleted file mode 100755
index 6d8cfe3..0000000
--- a/tool/travis.sh
+++ /dev/null
@@ -1,17 +0,0 @@
-#!/bin/bash
-
-# Copyright (c) 2015, the Dart project authors.  Please see the AUTHORS file
-# for details. All rights reserved. Use of this source code is governed by a
-# BSD-style license that can be found in the LICENSE file.
-
-# Fast fail the script on failures.		
-set -e
-
-# Verify that the libraries are error free.
-dartanalyzer --fatal-warnings \
-  lib/packages.dart \
-  test/all.dart
-
-# Run the tests.
-dart test/all.dart
-