download-firefox-artifact 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. #!/usr/bin/env bash -x
  2. # Forked from https://github.com/devtools-html/debugger.html/blob/master/bin/download-firefox-artifact
  3. #
  4. # This looks for a mozilla-central artifact build as a sibling of the
  5. # activity-stream tree. If it's not there, it creates it. If it is there, it
  6. # updates it.
  7. # If AS_GIT_BIN_REPO (the git repo from which prepare-mochitests-dev and
  8. # friends will be executed) isn't set in the environment, just use the repo
  9. # we're running from.
  10. if [ -z ${AS_GIT_BIN_REPO+x} ]; then
  11. ROOT=`dirname $0`
  12. AS_GIT_BIN_REPO="../../../../activity-stream"
  13. else
  14. ROOT=${AS_GIT_BIN_REPO}/bin
  15. fi
  16. # Compute the mozilla-central path based on whether AS_PINE_TEST_DIR is set
  17. # (i.e. whether this script has been called from test-merges.js)
  18. if [ -z ${AS_PINE_TEST_DIR+x} ]; then
  19. FIREFOX_PATH="$ROOT/../../mozilla-central"
  20. else
  21. FIREFOX_PATH=${AS_PINE_TEST_DIR}/mozilla-central
  22. fi
  23. # check that mercurial is installed
  24. if [ -z "`command -v hg`" ]; then
  25. echo >&2 "mercurial is required for mochitests, use 'brew install mercurial' on MacOS";
  26. exit 1;
  27. fi
  28. if [ -d "$FIREFOX_PATH" ]; then
  29. # convert path to absolute path
  30. FIREFOX_PATH=$(cd "$FIREFOX_PATH"; pwd)
  31. # If we already have Firefox locally, just update it
  32. cd "$FIREFOX_PATH";
  33. if [ -n "`hg status`" ]; then
  34. read -p "There are local changes to Firefox which will be overwritten. Are you sure? [Y/n] " -r
  35. if [[ $REPLY == "n" ]]; then
  36. exit 0;
  37. fi
  38. hg revert -a
  39. fi
  40. hg pull
  41. hg update -C
  42. else
  43. echo "Downloading Firefox source code, requires about 10-30min depending on connection"
  44. hg clone https://hg.mozilla.org/mozilla-central/ "$FIREFOX_PATH"
  45. # if somebody cancels (ctrl-c) out of the long download don't continue
  46. exit_code=$?
  47. if [ $exit_code -ne 0 ]; then
  48. exit $exit_code
  49. fi
  50. cd "$FIREFOX_PATH"
  51. # Make an artifact build so it builds much faster
  52. echo "
  53. ac_add_options --enable-artifact-builds
  54. mk_add_options AUTOCLOBBER=1
  55. mk_add_options MOZ_OBJDIR=./objdir-frontend
  56. " > .mozconfig
  57. fi