Skip to content

Commit

Permalink
misc: yarn open-devtools (#11445)
Browse files Browse the repository at this point in the history
  • Loading branch information
connorjclark authored Sep 21, 2020
1 parent 0200358 commit 6062f8b
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 0 deletions.
46 changes: 46 additions & 0 deletions lighthouse-core/scripts/open-devtools.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#!/usr/bin/env bash

set -euo pipefail

##
# @license Copyright 2020 The Lighthouse Authors. All Rights Reserved.
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
##

SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
LH_ROOT="$SCRIPT_DIR/../.."
TEST_DIR="$LH_ROOT/.tmp/chromium-web-tests"
DEFAULT_DEVTOOLS_PATH="$TEST_DIR/devtools/devtools-frontend"
DEVTOOLS_PATH=${DEVTOOLS_PATH:-"$DEFAULT_DEVTOOLS_PATH"}

if [[ -z $CHROME_PATH ]]; then
echo 'Must set $CHROME_PATH'
exit 1
fi

echo "CHROME_PATH: $CHROME_PATH"
echo "DEVTOOLS_PATH: $DEVTOOLS_PATH"

if [ ! -d $DEVTOOLS_PATH ]; then
echo "No devtools found at $DEVTOOLS_PATH. Have you run 'yarn test-devtools' yet?"
exit 1
fi

if ! which gn ; then
# If the contributor doesn't have a separate depot tools in their path, use the tmp copy.
DEPOT_TOOLS_PATH="$TEST_DIR/depot-tools"
BLINK_TOOLS_PATH="$TEST_DIR/blink_tools"
export PATH=$DEPOT_TOOLS_PATH:$PATH
# Add typ to python path. The regular method assumes there is a Chromium checkout.
export PYTHONPATH="${PYTHONPATH:-}:$BLINK_TOOLS_PATH/latest/third_party/typ"
fi

yarn build-devtools
yarn devtools "$DEVTOOLS_PATH"

cd "$DEVTOOLS_PATH"
gn gen out/Default
gclient sync
autoninja -C out/Default
"$CHROME_PATH" --custom-devtools-frontend=file://$DEVTOOLS_PATH/out/Default/resources/inspector
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
"update:sample-json": "yarn i18n:collect-strings && node ./lighthouse-cli -A=./lighthouse-core/test/results/artifacts --config-path=./lighthouse-core/test/results/sample-config.js --output=json --output-path=./lighthouse-core/test/results/sample_v2.json && node lighthouse-core/scripts/cleanup-LHR-for-diff.js ./lighthouse-core/test/results/sample_v2.json --only-remove-timing",
"update:test-devtools": "bash lighthouse-core/test/chromium-web-tests/test-locally.sh --reset-results",
"test-devtools": "bash lighthouse-core/test/chromium-web-tests/test-locally.sh",
"open-devtools": "bash lighthouse-core/scripts/open-devtools.sh",
"diff:sample-json": "yarn i18n:checks && bash lighthouse-core/scripts/assert-golden-lhr-unchanged.sh",
"computeBenchmarkIndex": "./lighthouse-core/scripts/benchmark.js",
"minify-latest-run": "./lighthouse-core/scripts/lantern/minify-trace.js ./latest-run/defaultPass.trace.json ./latest-run/defaultPass.trace.min.json && ./lighthouse-core/scripts/lantern/minify-devtoolslog.js ./latest-run/defaultPass.devtoolslog.json ./latest-run/defaultPass.devtoolslog.min.json",
Expand Down

0 comments on commit 6062f8b

Please sign in to comment.