3 # Copyright 2015 The Chromium Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file.
7 CHROME_APP_DIR
="$(cd "$
(dirname "${BASH_SOURCE[0]}")" && pwd)"
8 MEMORY_INSPECTOR_DIR
="$(cd "${CHROME_APP_DIR}/..
" && pwd)"
9 TEMPLATE_DIR
="${CHROME_APP_DIR}/template"
11 OUT_DIR
="${1:-${CHROME_APP_DIR}/out}"
12 APP_FOLDER_NAME
="memory_inspector_app"
13 APP_DIR
="${OUT_DIR}/${APP_FOLDER_NAME}"
14 SANDBOX_DIR
="${APP_DIR}/sandbox"
15 ZIP_FILE
="${APP_DIR}.zip"
17 # NaCl Python prebuilts URL.
18 NACL_PREBUILTS_BASE_URL
="https://gsdview.appspot.com/naclports/builds/pepper_40/trunk-154-geacd680/publish/python/pnacl"
20 # Memory Inspector prebuilts bucket and destination folder.
21 MEMORY_INSPECTOR_PREBUILTS_BUCKET
="chromium-telemetry"
22 MEMORY_INSPECTOR_PREBUILTS_DIR
="${MEMORY_INSPECTOR_DIR}/prebuilts"
24 # Memory Inspector dependencies and destination folder in the sandbox
26 MEMORY_INSPECTOR_DEPS
=( \
27 "memory_inspector/" "classification_rules/" "prebuilts/" "start_web_ui")
28 MEMORY_INSPECTOR_DEPS_FOLDER
="memory_inspector"
31 # Delete existing app folder and zip file.
35 # Create a new app folder.
38 # Link all files from the template/ folder.
39 ln -s -t "${APP_DIR}" "${TEMPLATE_DIR}"/*
41 # Download NaCl Python prebuilt files.
42 wget
"${NACL_PREBUILTS_BASE_URL}/naclprocess.js" -P "${APP_DIR}" --no-verbose
43 wget
"${NACL_PREBUILTS_BASE_URL}/python.nmf" -P "${SANDBOX_DIR}" --no-verbose
44 wget
"${NACL_PREBUILTS_BASE_URL}/python.pexe" -P "${SANDBOX_DIR}" --no-verbose
45 wget
"${NACL_PREBUILTS_BASE_URL}/pydata_pnacl.tar" -P "${SANDBOX_DIR}" \
48 # Download Memory Inspector prebuilt files.
49 download_from_google_storage
--directory "${MEMORY_INSPECTOR_PREBUILTS_DIR}" \
50 --bucket "${MEMORY_INSPECTOR_PREBUILTS_BUCKET}" --no_auth
52 # Add Memory Inspector dependencies to pydata_pnacl.tar.
53 tmp_dir
="$(mktemp -d)"
56 ln -s "${MEMORY_INSPECTOR_DIR}" "${MEMORY_INSPECTOR_DEPS_FOLDER}"
57 for dependency
in "${MEMORY_INSPECTOR_DEPS[@]}"; do
58 tar --owner="memory-inspector:1002" --group="memory-inspector:1002" \
59 --append --dereference --file "${SANDBOX_DIR}/pydata_pnacl.tar" \
60 "${MEMORY_INSPECTOR_DEPS_FOLDER}/${dependency}"
64 echo "Chrome app directory: ${APP_DIR}"
69 zip "${ZIP_FILE}" "${APP_FOLDER_NAME}" -r -q
71 echo "Chrome app zip file: ${ZIP_FILE}"