blob: 8bfc753afbc139c0e3d46c7533b3bc0425824c1c [file] [log] [blame]
Mads Ager418d1ca2017-05-22 09:35:49 +02001#! /bin/bash
2# Copyright (c) 2016, the R8 project authors. Please see the AUTHORS file
3# for details. All rights reserved. Use of this source code is governed by a
4# BSD-style license that can be found in the LICENSE file.
5
6# This script will update the host art VM in tools/linux/art
7
8# Before running this script make sure that you have a full android build
9# and that the host Art version required is build in ~/android/master:
10#
11# m -j24
12# m -j24 build-art
13#
14# Maybe also run the Art host tests:
15#
16# m -j24 test-art-host
17
18set -e
19
20ANDROID_CHECKOUT=~/android/master
21ANDROID_PRODUCT=angler
22ART_DIR=art
23DEST_ROOT=tools/linux
24
25function usage {
26 echo "Usage: $(basename $0)"
27 echo " [--android-checkout <android repo root>]"
28 echo " [--art-dir <destination directory>]"
29 echo " [--android-product <product name>]"
30 echo " [--destination-dir <destination directory>]"
31 echo ""
32 echo " --android-checkout specifies the Android repo root"
33 echo " Defaults to: $ANDROID_CHECKOUT"
34 echo ""
35 echo " --art-dir specifies the directory name inside the root destination"
36 echo " directory for the art bundle"
37 echo " Defaults to: $ART_DIR"
38 echo ""
39 echo " --android-product specifies the Android product for the framework to include"
40 echo " Defaults to: $ANDROID_PRODUCT"
41 echo ""
42 echo " --destination-dir specifies the root destination directory for the art bundle"
43 echo " Defaults to: $DEST_ROOT"
44 echo ""
45 echo "Update the master version of art from ~/android/master:"
46 echo " "
47 echo " $(basename $0)"
48 echo " "
49 echo "Update a specific version of art:"
50 echo " "
51 echo " $(basename $0) --android-checkout ~/android/5.1.1_r19 --art-dir 5.1.1"
52 echo " "
53 echo "Test the Art bundle in a temporary directory:"
54 echo " "
55 echo " $(basename $0) --android-checkout ~/android/5.1.1_r19 --art-dir art-5.1.1 --android-product mako --destination-dir /tmp/art"
56 echo " "
57 exit 1
58}
59
60# Process options.
61while [ $# -gt 0 ]; do
62 case $1 in
63 --android-checkout)
64 ANDROID_CHECKOUT="$2"
65 shift 2
66 ;;
67 --art-dir)
68 ART_DIR="$2"
69 shift 2
70 ;;
71 --android-product)
72 ANDROID_PRODUCT="$2"
73 shift 2
74 ;;
75 --destination-dir)
76 DEST_ROOT="$2"
77 shift 2
78 ;;
79 --help|-h|-H|-\?)
80 usage
81 ;;
82 *)
83 echo "Unkonwn option $1"
84 echo ""
85 usage
86 ;;
87 esac
88done
89
90ANDROID_HOST_BUILD=$ANDROID_CHECKOUT/out/host/linux-x86
91ANDROID_TARGET_BUILD=$ANDROID_CHECKOUT/out/target
92DEST=$DEST_ROOT/$ART_DIR
93
94# Clean out the previous version of Art
95rm -rf $DEST
96
97# Required binaries and scripts.
98mkdir -p $DEST/bin
99if [ -f $ANDROID_HOST_BUILD/bin/art ]; then
100 cp $ANDROID_HOST_BUILD/bin/art $DEST/bin
101else
102 cp $ANDROID_CHECKOUT/art/tools/art $DEST/bin
103fi
104
105cp $ANDROID_HOST_BUILD/bin/dalvikvm64 $DEST/bin
106cp $ANDROID_HOST_BUILD/bin/dalvikvm32 $DEST/bin
107# Copy the dalvikvm link creating a regular file instead, as download_from_google_stroage.py does
108# not allow tar files with symbolic links (depending on Android/Art version dalvikvm links to
109# dalvikvm32 or dalvikvm64).
110cp $ANDROID_HOST_BUILD/bin/dalvikvm $DEST/bin
111cp $ANDROID_HOST_BUILD/bin/dex2oat $DEST/bin
112cp $ANDROID_HOST_BUILD/bin/patchoat $DEST/bin
113
114# Required framework files.
115mkdir -p $DEST/framework
116cp -R $ANDROID_HOST_BUILD/framework/* $DEST/framework
117
118# Required library files.
119mkdir -p $DEST/lib64
120cp -r $ANDROID_HOST_BUILD/lib64/* $DEST/lib64
121mkdir -p $DEST/lib
122cp -r $ANDROID_HOST_BUILD/lib/* $DEST/lib
123
124# Image files required for dex2oat of actual android apps. We need an actual android product
125# image containing framework classes to verify the code against.
126mkdir -p $DEST/product/$ANDROID_PRODUCT/system/framework
127cp -r $ANDROID_TARGET_BUILD/product/$ANDROID_PRODUCT/system/framework/* $DEST/product/$ANDROID_PRODUCT/system/framework
128
129# Required auxillary files.
130mkdir -p $DEST/usr/icu
131cp -r $ANDROID_HOST_BUILD/usr/icu/* $DEST/usr/icu
132
133# Allow failure for strip commands below.
134set +e
135
136strip $DEST/bin/* 2> /dev/null
137strip $DEST/lib/*
138strip $DEST/lib64/*
139strip $DEST/framework/x86/* 2> /dev/null
140strip $DEST/framework/x86_64/* 2> /dev/null
141
142echo "Now run"
143echo "(cd $DEST_ROOT; upload_to_google_storage.py -a --bucket r8-deps $ART_DIR)"