Bug 1207653 - Build simulator from mulet. r=garndt,jryans

This commit is contained in:
Alexandre Poirot 2015-09-29 03:02:48 -07:00
parent 6fb31ae078
commit 84b6f50aed
5 changed files with 184 additions and 0 deletions

View File

@ -1,3 +1,7 @@
user_pref("devtools.debugger.prompt-connection", false);
user_pref("devtools.debugger.forbid-certified-apps", false);
user_pref("devtools.apps.forbidden-permissions", "");
// Required for Mulet in order to run the debugger server from the command line
user_pref("devtools.debugger.remote-enabled", true);
user_pref("devtools.chrome.enabled", true);

View File

@ -0,0 +1,113 @@
#!/bin/bash
usage() {
echo "Usage: $0 GECKO_DIR GAIA_DIR MULET_TARBALL_URL"
}
if [ "$#" -ne 3 ]; then
usage
exit
fi
if [ -z $1 ] || [ ! -d $1 ]; then
usage
echo "First argument should be path to a gecko checkout"
exit
fi
GECKO_DIR=$1
if [ -z $2 ] || [ ! -d $2 ]; then
usage
echo "Second argument should be path to a gaia checkout"
exit
fi
GAIA_DIR=$2
url_re='^(http|https|ftp)://.*tar.bz2'
if [ -z $3 ] || ! [[ $3 =~ $url_re ]] ; then
usage
echo "Third argument should be URL to mulet tarball"
exit
fi
BUILD_URL=$3
set -ex
WORKDIR=simulator
SIM_DIR=$GECKO_DIR/b2g/simulator
if [[ $BUILD_URL =~ 'linux-x86_64' ]] ; then
PLATFORM=linux64
elif [[ $BUILD_URL =~ 'linux' ]] ; then
PLATFORM=linux
elif [[ $BUILD_URL =~ 'win32' ]] ; then
PLATFORM=win32
elif [[ $BUILD_URL =~ 'mac64' ]] ; then
PLATFORM=mac64
fi
if [ -z $PLATFORM ]; then
echo "Unable to compute platform out of mulet URL: $BUILD_URL"
exit
fi
echo "PLATFORM: $PLATFORM"
VERSION=$(sed -nE "s/MOZ_B2G_VERSION=([0-9]+\.[0-9]+).*prerelease/\1/p" $GECKO_DIR/b2g/confvars.sh)
re='^[0-9]\.[0-9]$'
if ! [[ $VERSION =~ $re ]] ; then
echo "Invalid b2g version: $VERSION"
exit
fi
echo "B2G VERSION: $VERSION"
mkdir -p $WORKDIR
if [ ! -f mulet.tar.bz2 ]; then
wget -O mulet.tar.bz2 $BUILD_URL
fi
(cd $WORKDIR/ && tar jxvf ../mulet.tar.bz2)
# Not sure it is still useful with mulet...
# remove useless stuff we don't want to ship in simulators
rm -rf $WORKDIR/firefox/gaia $WORKDIR/firefox/B2G.app/Contents/MacOS/gaia $WORKDIR/firefox/B2G.app/Contents/Resources/gaia
# Build a gaia profile specific to the simulator in order to:
# - disable the FTU
# - set custom prefs to enable devtools debugger server
# - set custom settings to disable lockscreen and screen timeout
# - only ship production apps
NOFTU=1 GAIA_APP_TARGET=production SETTINGS_PATH=$SIM_DIR/custom-settings.json make -j1 -C $GAIA_DIR profile
mv $GAIA_DIR/profile $WORKDIR/
cat $SIM_DIR/custom-prefs.js >> $WORKDIR/profile/user.js
APP_BUILDID=$(sed -n "s/BuildID=\([0-9]\{8\}\)/\1/p" $WORKDIR/firefox/application.ini)
echo "BUILDID $APP_BUILDID -- VERSION $VERSION"
XPI_NAME=fxos-simulator-$VERSION.$APP_BUILDID-$PLATFORM.xpi
ADDON_ID=fxos_$(echo $VERSION | sed "s/\./_/")_simulator@mozilla.org
ADDON_VERSION=$VERSION.$APP_BUILDID
ADDON_NAME="Firefox OS $VERSION Simulator"
ADDON_DESCRIPTION="a Firefox OS $VERSION Simulator"
echo "ADDON_ID: $ADDON_ID"
echo "ADDON_VERSION: $ADDON_VERSION"
FTP_ROOT_PATH=/pub/mozilla.org/labs/fxos-simulator
UPDATE_PATH=$VERSION/$PLATFORM
UPDATE_LINK=https://ftp.mozilla.org$FTP_ROOT_PATH/$UPDATE_PATH/$XPI_NAME
UPDATE_URL=https://ftp.mozilla.org$FTP_ROOT_PATH/$UPDATE_PATH/update.rdf
# Replace all template string in install.rdf
sed -e "s/@ADDON_VERSION@/$ADDON_VERSION/" \
-e "s/@ADDON_ID@/$ADDON_ID/" \
-e "s#@ADDON_UPDATE_URL@#$UPDATE_URL#" \
-e "s/@ADDON_NAME@/$ADDON_NAME/" \
-e "s/@ADDON_DESCRIPTION@/$ADDON_DESCRIPTION/" \
$SIM_DIR/install.rdf.in > $WORKDIR/install.rdf
# copy all useful addon file
cp $SIM_DIR/icon.png $WORKDIR/
cp $SIM_DIR/icon64.png $WORKDIR/
mkdir -p artifacts
(cd $WORKDIR && zip -r - .) > artifacts/$XPI_NAME

View File

@ -1,5 +1,9 @@
#! /bin/bash -e
# Ensure all the scripts in this dir are on the path....
DIRNAME=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
PATH=$DIRNAME:$PATH
gecko_dir=$1
target=$2

View File

@ -9,6 +9,7 @@ $inherits:
flags:
post-build:
- upload-symbols
- simulator
builds:
linux64_gecko:
@ -226,6 +227,10 @@ post-build:
- tasks/builds/dbg_linux64.yml
- tasks/builds/android_api_11.yml
task: tasks/post-builds/upload_symbols.yml
simulator:
allowed_build_tasks:
- tasks/builds/mulet_linux.yml
task: tasks/post-builds/mulet_simulator.yml
tests:
cppunit:

View File

@ -0,0 +1,58 @@
# This tasks takes a mulet build, pull gaia and craft a xpi file for FxOS simulator addon
---
taskId: {{taskId}}
task:
created: '{{now}}'
deadline: '{{#from_now}}24 hours{{/from_now}}'
metadata:
source: https://hg.mozilla.org/mozilla-central/file/tip/b2g/simulator
owner: apoirot@mozilla.com
name: '[TC] FxOS Simulator'
description: 'Firefox OS Simulator addon'
tags:
createdForUser: {{owner}}
workerType: b2gbuild
provisionerId: aws-provisioner-v1
schedulerId: task-graph-scheduler
scopes:
- 'docker-worker:cache:tc-vcs'
- 'docker-worker:image:{{#docker_image}}builder{{/docker_image}}'
- 'queue:define-task:aws-provisioner-v1/build-c4-2xlarge'
- 'queue:create-task:aws-provisioner-v1/build-c4-2xlarge'
payload:
image: '{{#docker_image}}builder{{/docker_image}}'
maxRunTime: 600
command:
- /bin/bash
- -exc
- >
tc-vcs checkout ./gecko {{base_repository}} {{head_repository}} {{head_rev}} {{head_ref}} &&
./gecko/testing/taskcluster/scripts/builder/pull-gaia.sh ./gecko ./gaia &&
./gecko/testing/taskcluster/scripts/builder/build-simulator.sh ./gecko ./gaia {{build_url}}
artifacts:
'public/build':
type: directory
path: '/home/worker/artifacts/'
expires: '{{#from_now}}1 year{{/from_now}}'
env:
GECKO_BASE_REPOSITORY: '{{base_repository}}'
GECKO_HEAD_REPOSITORY: '{{head_repository}}'
GECKO_HEAD_REV: '{{head_rev}}'
GECKO_HEAD_REF: '{{head_ref}}'
extra:
treeherderEnv:
- production
- staging
treeherder:
groupSymbol: tc-Sim
groupName: Simulator build
symbol: 'S'