Bug 1232707 - Build changes to support Loop imported as an add-on. r=mikedeboer,r=glandium
authorMark Banner <standard8@mozilla.com>
Thu, 14 Jan 2016 17:53:32 +0000
changeset 315113 adbce5cdc59284f846ef6efd3f0ecd773fbe94e7
parent 315112 2c23bb770b54555a7320dd87cec45dfc7eaafa31
child 315114 55af065de40efae8994228830bbb8daeabf595b5
push id5703
push userraliiev@mozilla.com
push dateMon, 07 Mar 2016 14:18:41 +0000
treeherdermozilla-beta@31e373ad5b5f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmikedeboer, glandium
bugs1232707
milestone46.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1232707 - Build changes to support Loop imported as an add-on. r=mikedeboer,r=glandium
.eslintignore
browser/extensions/loop/README.txt
browser/extensions/loop/build-jsx
browser/extensions/loop/manifest.ini
browser/extensions/loop/moz.build
browser/extensions/loop/run-all-loop-tests.sh
testing/profiles/prefs_general.js
--- a/.eslintignore
+++ b/.eslintignore
@@ -1,16 +1,15 @@
 # Always ignore node_modules.
 **/node_modules/**/*.*
 
 # Exclude expected objdirs.
 obj*/**
 
 # Temporarily ignore HTML files that still need to be fixed.
-browser/extensions/loop/**/*.html
 devtools/**/*.html
 
 # We ignore all these directories by default, until we get them enabled.
 # If you are enabling a directory, please add directory specific exclusions
 # below.
 accessible/**
 addon-sdk/**
 build/**
@@ -84,50 +83,18 @@ browser/components/tabview/**
 browser/components/translation/**
 browser/components/uitour/**
 browser/extensions/pdfjs/**
 browser/extensions/pocket/content/panels/js/vendor/**
 browser/extensions/shumway/**
 browser/fuel/**
 browser/locales/**
 
-# Loop specific exclusions
-
-# This file currently uses a non-standard (and not on a standards track)
-# if statement within catch.
-browser/extensions/loop/content/modules/MozLoopWorker.js
-# This file currently uses es7 features eslint issue:
-# https://github.com/eslint/espree/issues/125
-browser/extensions/loop/content/modules/MozLoopAPI.jsm
-# Need to fix the configuration for this.
-browser/extensions/loop/bootstrap.js
-# Need to drop the preprocessing (bug 1212428)
-browser/extensions/loop/content/preferences/prefs.js
-# Libs we don't need to check
-browser/extensions/loop/content/panels/vendor
-browser/extensions/loop/content/shared/vendor
-browser/extensions/loop/standalone/content/vendor
-# Libs we don't need to check
-browser/extensions/loop/test/shared/vendor
-# Coverage files
-browser/extensions/loop/test/coverage
-# These are generated react files that we don't need to check
-browser/extensions/loop/content/panels/js/conversation.js
-browser/extensions/loop/content/panels/js/conversationViews.js
-browser/extensions/loop/content/panels/js/panel.js
-browser/extensions/loop/content/panels/js/roomViews.js
-browser/extensions/loop/content/panels/js/feedbackViews.js
-browser/extensions/loop/content/shared/js/textChatView.js
-browser/extensions/loop/content/shared/js/linkifiedTextView.js
-browser/extensions/loop/content/shared/js/views.js
-browser/extensions/loop/standalone/content/js/standaloneRoomViews.js
-browser/extensions/loop/standalone/content/js/webapp.js
-browser/extensions/loop/ui/ui-showcase.js
-# Don't need to check the built tree
-browser/extensions/loop/standalone/dist
+# Ignore all of loop since it is imported from github and checked at source.
+browser/extensions/loop/**
 
 # devtools/ exclusions
 # Ignore d3
 devtools/client/shared/d3.js
 devtools/client/webaudioeditor/lib/dagre-d3.js
 
 # Ignore codemirror
 devtools/client/sourceeditor/codemirror/*.js
--- a/browser/extensions/loop/README.txt
+++ b/browser/extensions/loop/README.txt
@@ -1,103 +1,3 @@
-This is the directory for the Loop desktop implementation and the standalone
-client.
-
-The desktop implementation is the UX built into Firefox, activated by the Loop
-button on the toolbar. The standalone client is the link-clicker UX for any
-modern browser that supports WebRTC.
-
-The standalone client is a set of web pages intended to be hosted on a
-standalone server referenced by the loop-server.
-
-The standalone client exists in standalone/ but shares items
-(from content/shared/) with the desktop implementation. See the README.md
-file in the standalone/ directory for how to run the server locally.
-
-Working with React JSX files
-============================
-
-Our views use [React](http://facebook.github.io/react/) written in JSX files
-and transpiled to JS before we commit. You need to install the JSX compiler
-using npm in order to compile the .jsx files into regular .js ones:
-
-    npm install -g react-tools@0.12.2
-
-Once installed, run build-jsx with the --watch option from
-browser/extensions/loop, eg.:
-
-    cd browser/extensions/loop
-    ./build-jsx --watch
-
-build-jsx can also be do a one-time compile pass instead of watching if
-the --watch argument is omitted.  Be sure to commit any transpiled files
-at the same time as changes to their sources.
-
-
-Hacking
-=======
-Please be sure to execute
-
-  browser/extensions/loop/run-all-loop-tests.sh
-
-from the top level before requesting review on a patch.
-
-Linting
-=======
-run-all-loop-tests.sh will take care of this for you automatically, after
-you've installed the dependencies by typing:
-
-  ( cd standalone ; make install )
-
-If you install eslint and the react plugin globally:
+This is the loop project output, https://github.com/mozilla/loop
 
-  npm install -g eslint
-  npm install -g eslint-plugin-react
-
-You can also run it by hand in the browser/extensions/loop directory:
-
-  eslint --ext .js --ext .jsx --ext .jsm .
-
-Test coverage
-=============
-Initial setup
-  cd test
-  npm install
-
-To run
-  npm run build-coverage
-
-It will create a `coverage` folder under test/
-
-Front-End Unit Tests
-====================
-The unit tests for Loop reside in three directories:
-
-- test/desktop-local
-- test/shared
-- test/standalone
-
-You can run these as part of the run-all-loop-tests.sh command above, or you can run these individually in Firefox. To run them individually, start the standalone client (see standalone/README.md) and load:
-
-  http://localhost:3000/test/
-
-
-Functional Tests
-================
-These are currently a work in progress, but it's already possible to run a test
-if you have a [loop-server](https://github.com/mozilla-services/loop-server)
-install that is properly configured.  From the top-level gecko directory,
-execute:
-
-  export LOOP_SERVER=/Users/larry/src/loop-server
-  ./mach marionette-test browser/extensions/loop/test/functional/manifest.ini
-
-Once the automation is complete, we'll include this in run-all-loop-tests.sh
-as well.
-
-
-UI-Showcase
-===========
-This is a tool giving the layouts for all the frontend views of Loop, allowing debugging and testing of css layouts and local component behavior.
-
-To access it, start the standalone client (see standalone/README.md) and load:
-
-  http://localhost:3000/ui/
+Current extension version is: 0.1
deleted file mode 100755
--- a/browser/extensions/loop/build-jsx
+++ /dev/null
@@ -1,173 +0,0 @@
-#! /usr/bin/env python
-
-import os
-import sys
-import re
-from distutils import spawn
-import subprocess
-from threading import Thread
-import argparse
-
-
-def find_react_version(lib_dir):
-    "Finds the React library version number currently used."
-    for filename in os.listdir(lib_dir):
-        match = re.match(r"react-(.*)-prod\.js", filename)
-        if (match and match.group(1)):
-            return match.group(1)
-    print 'Unable to find the current react version used in content.'
-    print 'Please checked the %s directory.' % lib_dir
-    exit(1)
-
-
-def append_arguments(array1, array2):
-    "Appends array2 onto the end of array1"
-    result = array1[:]
-    result.extend(array2)
-    return result
-
-
-def check_jsx(jsx_path):
-    "Checks to see if jsx is installed or not"
-    if jsx_path is None:
-        print 'You do not have the react-tools installed'
-        print 'Please do $ npm install -g react-tools and make sure it is available in PATH'
-        exit(1)
-
-
-def find_react_command():
-    "Searches for a jsx location and forms a runnable command"
-    if sys.platform != 'win32':
-        jsx_path = spawn.find_executable('jsx')
-        check_jsx(jsx_path)
-        return [jsx_path]
-
-    # Else windows.
-    def find_excutable_no_extension(fileName):
-        """
-            spawn.find_executable assumes a '.exe' extension on windows
-            something which jsx doesn't have...
-        """
-        paths = os.environ['PATH'].split(os.pathsep)
-        for path in paths:
-            file = os.path.join(path, fileName)
-            if os.path.isfile(file):
-                return path
-        return None
-
-    # jsx isn't a true windows executable, so the standard spawn
-    # processes get upset. Hence, we have to use node to run the
-    # jsx file direct.
-    node = spawn.find_executable('node')
-    if node is None:
-        print 'You do not have node installed, or it is not in your PATH'
-        exit(1)
-
-    # We need the jsx path to make node happy
-    jsx_path = find_excutable_no_extension('jsx')
-    check_jsx(jsx_path)
-
-    # This is what node really wants to run.
-    jsx_path = os.path.join(jsx_path,
-                            "node_modules", "react-tools", "bin", "jsx")
-
-    return [node, jsx_path]
-
-
-SHARED_LIBS_DIR=os.path.join(os.path.dirname(__file__), "content", "shared", "vendor")
-REACT_VERSION=find_react_version(SHARED_LIBS_DIR)
-
-src_files = []  # files to be compiled
-
-run_command = find_react_command()
-
-if sys.platform == 'win32':
-    print 'Please ensure you are running react-tools version %s' % REACT_VERSION
-    print 'You may be already, but we are not currently able to detect it'
-else:
-    p = subprocess.Popen(append_arguments(run_command, ['-V']),
-                         stdout=subprocess.PIPE,
-                         stderr=subprocess.STDOUT)
-    for line in iter(p.stdout.readline, b''):
-        info = line.rstrip()
-
-    if not info == REACT_VERSION:
-        print 'You have the wrong version of react-tools installed'
-        print 'Please use version %s' % REACT_VERSION
-        exit(1)
-
-# parse the CLI arguments
-description = 'Loop build tool for JSX files. ' + \
-              'Will scan entire loop directory and compile them in place. ' + \
-              'Must be executed from browser/extensions/loop directory.'
-
-parser = argparse.ArgumentParser(description=description)
-parser.add_argument('--watch', '-w', action='store_true', help='continuous' +
-                    'build based on file changes (optional)')
-args = parser.parse_args()
-
-# loop through all tuples and get unique dirs only
-unique_jsx_dirs = []
-
-# find all .jsx files
-for dirname, dirnames, filenames in os.walk('.'):
-    for filename in filenames:
-        if '.jsx' == os.path.splitext(filename)[1]:  # (root, ext)
-            src_files.append(filename)
-            if dirname not in unique_jsx_dirs:
-                unique_jsx_dirs.append(dirname)
-
-
-def jsx_run_watcher(path):
-    # keep --target=es3 for now, as at least our UnsupportedBrowserView wants
-    # to be able to render on IE8
-    subprocess.call(append_arguments(run_command, ['--target=es3', '-w', '-x',
-                                                   'jsx', path, path]))
-
-
-def start_jsx_watcher_threads(dirs):
-    """
-        starts a thread with a jsx watch process
-        for every dir in the dirs argument
-    """
-    threads = []
-    for udir in dirs:
-        t = Thread(target=jsx_run_watcher, args=(udir,))
-        threads.append(t)
-        t.start()
-
-    for t in threads:
-        t.join()
-
-
-def check_file_packaging(srcs):
-    """
-        get all lines from jar.mn file
-        check against the files we are going to compile.
-        Note that this only looks at filenames, and will miss
-        the one of two identically named files.
-    """
-    # get all lines from jar.mn
-    packaged_files = [line.strip() for line in open('./jar.mn')]
-
-    # loop through our compiled files and compare against jar.mn
-    # XXX fix to use paths so that identically named files don't get overlooked
-    # and update the docstring for this function
-    missing_jar_files = []  # initially empty
-    for src_file in srcs:
-        transpiled_file = os.path.splitext(src_file)[0] + ".js"  # (root, ext)
-        if not any(transpiled_file in x for x in packaged_files):
-            missing_jar_files.append(transpiled_file)
-
-    # output a message to the user
-    if len(missing_jar_files):
-        for f in missing_jar_files:
-            print f + ' not in jar.mn file'
-
-check_file_packaging(src_files)
-
-if args.watch:
-    start_jsx_watcher_threads(unique_jsx_dirs)
-else:
-    for d in unique_jsx_dirs:
-        out = subprocess.call(append_arguments(run_command, ['-x', 'jsx', d, d]))
--- a/browser/extensions/loop/manifest.ini
+++ b/browser/extensions/loop/manifest.ini
@@ -12,13 +12,11 @@
 ; This might get messy if we start having pre-processed files, but for now it
 ; seems to work.
 
 [DEFAULT]
 b2g = false
 browser = true
 qemu = false
 
-[test/shared/test_shared_all.py]
+[chrome/content/shared/test/test_shared_all.py]
 skip-if = os == "win" # Bug 1149955
-[test/desktop-local/test_desktop_all.py]
-[test/standalone/test_standalone_all.py]
-[test/ui-showcase/test_ui-showcase.py]
+[chrome/content/panels/test/test_desktop_all.py]
--- a/browser/extensions/loop/moz.build
+++ b/browser/extensions/loop/moz.build
@@ -9,16 +9,16 @@ FINAL_TARGET_FILES.features['loop@mozill
 ]
 
 FINAL_TARGET_PP_FILES.features['loop@mozilla.org'] += [
   'install.rdf.in'
 ]
 
 JAR_MANIFESTS += ['jar.mn']
 
-XPCSHELL_TESTS_MANIFESTS += ['test/xpcshell/xpcshell.ini']
+XPCSHELL_TESTS_MANIFESTS += ['chrome/test/xpcshell/xpcshell.ini']
 
 BROWSER_CHROME_MANIFESTS += [
-    'test/mochitest/browser.ini',
+    'chrome/test/mochitest/browser.ini',
 ]
 
 with Files('**'):
     BUG_COMPONENT = ('Loop', 'Client')
--- a/browser/extensions/loop/run-all-loop-tests.sh
+++ b/browser/extensions/loop/run-all-loop-tests.sh
@@ -8,47 +8,28 @@ if [ "$1" == "--help" ]; then
 fi
 
 # Causes script to abort immediately if error code is not checked.
 set -e
 
 # Main tests
 
 LOOPDIR=browser/extensions/loop
-ESLINT=standalone/node_modules/.bin/eslint
-if [ -x "${LOOPDIR}/${ESLINT}" ]; then
-  echo 'running eslint; see http://eslint.org/docs/rules/ for error info'
-  (./${LOOPDIR}/${ESLINT} --ext .js --ext .jsm --ext .jsx ${LOOPDIR})
-  if [ $? != 0 ]; then
-    exit 1;
-  fi
-  echo 'eslint run finished.'
-fi
-
-# Build tests coverage.
-MISSINGDEPSMSG="\nMake sure all dependencies are up to date by running
-'npm install' inside the 'browser/extensions/loop/test/' directory.\n"
-(
-cd ${LOOPDIR}/test
-if ! npm run-script build-coverage ; then
-  echo $MISSINGDEPSMSG && exit 1
-fi
-)
 
 ./mach xpcshell-test ${LOOPDIR}/
 ./mach marionette-test ${LOOPDIR}/manifest.ini
 
 # The browser_parsable_css.js can fail if we add some css that isn't parsable.
 #
 # The check to make sure that the media devices can be used in Loop without
 # prompting is in browser_devices_get_user_media_about_urls.js. It's possible
 # to mess this up with CSP handling, and probably other changes, too.
 
 TESTS="
-  ${LOOPDIR}/test/mochitest
+  ${LOOPDIR}/chrome/test/mochitest
   browser/components/uitour/test/browser_UITour_loop.js
   browser/base/content/test/general/browser_devices_get_user_media_about_urls.js
   browser/base/content/test/general/browser_parsable_css.js
 "
 
 # Due to bug 1209463, we need to split these up and run them individually to
 # ensure we stop and report that there's an error.
 for test in $TESTS
--- a/testing/profiles/prefs_general.js
+++ b/testing/profiles/prefs_general.js
@@ -279,17 +279,17 @@ user_pref("dom.apps.customization.enable
 // Don't fetch or send directory tiles data from real servers
 user_pref("browser.newtabpage.directory.source", 'data:application/json,{"testing":1}');
 user_pref("browser.newtabpage.directory.ping", "");
 
 // Enable Loop
 user_pref("loop.debug.loglevel", "All");
 user_pref("loop.enabled", true);
 user_pref("loop.throttled", false);
-user_pref("loop.server", "http://%(server)s/browser/browser/extensions/loop/test/mochitest/loop_fxa.sjs?");
+user_pref("loop.server", "http://%(server)s/browser/browser/extensions/loop/chrome/test/mochitest/loop_fxa.sjs?");
 user_pref("loop.CSP","default-src 'self' about: file: chrome: data: wss://* http://* https://*");
 
 // Ensure UITour won't hit the network
 user_pref("browser.uitour.pinnedTabUrl", "http://%(server)s/uitour-dummy/pinnedTab");
 user_pref("browser.uitour.url", "http://%(server)s/uitour-dummy/tour");
 
 // Tell the search service we are running in the US.  This also has the desired
 // side-effect of preventing our geoip lookup.