Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

misc(build): include locale files in devtools roll #9639

Merged
merged 4 commits into from
Sep 5, 2019
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 19 additions & 8 deletions lighthouse-core/scripts/roll-to-devtools.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
# yarn devtools node_modules/temp-devtoolsfrontend/front_end/

chromium_dir="$HOME/chromium/src"
check="\033[96m ✓\033[39m"

if [[ -n "$1" ]]; then
frontend_dir="$1"
Expand All @@ -29,26 +30,36 @@ if [[ ! -d "$frontend_dir" || ! -a "$frontend_dir/Runtime.js" ]]; then
echo " $frontend_dir"
exit 1
else
echo -e "\033[96m ✓\033[39m Chromium folder in place."
echo -e "$check Chromium folder in place."
fi

report_dir="lighthouse-core/report/html"
fe_lh_dir="$frontend_dir/audits/lighthouse"

lh_bg_js="dist/lighthouse-dt-bundle.js"
lh_worker_dir="$frontend_dir/audits_worker/lighthouse"
fe_worker_dir="$frontend_dir/audits_worker/lighthouse"

# copy lighthouse-dt-bundle (potentially stale)
cp -pPR "$lh_bg_js" "$lh_worker_dir/lighthouse-dt-bundle.js"
echo -e "\033[96m ✓\033[39m (Potentially stale) lighthouse-dt-bundle copied."
cp -pPR "$lh_bg_js" "$fe_worker_dir/lighthouse-dt-bundle.js"
echo -e "$check (Potentially stale) lighthouse-dt-bundle copied."

# copy report generator + cached resources into $fe_lh_dir
# use dir/* format to copy over all files in dt-report-resources directly to $fe_lh_dir
# use dir/* format to copy over all files in dt-report-resources directly to $fe_lh_dir
# dir/ format behavior changes based on if their exists a folder named dir, which can get weird
cp -r dist/dt-report-resources/* $fe_lh_dir
cp -r dist/dt-report-resources/* "$fe_lh_dir"
echo -e "$check Report resources copied."

# copy locale JSON files (but not the .ctc.json ones)
lh_locales_dir="lighthouse-core/lib/i18n/locales"
fe_locales_dir="$frontend_dir/audits_worker/lighthouse/locales"

find $lh_locales_dir -name '*.json' ! -name '*.ctc.json' -exec cp {} "$fe_locales_dir" \;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fine as long as the folder is guaranteed to exist. might suggest a quick mkdir -p $fe_locales_dir to be explicit.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good call, especially while it's not landed.

echo -e "$check Locale JSON files copied."

# update expected version string in tests
VERSION=$(node -e "console.log(require('./package.json').version)")
sed -i '' -e "s/Version:.*/Version: $VERSION/g" "$tests_dir"/*-expected.txt
echo -e "$check Updated Version string in tests."

echo "Done. To rebase the test expectations, run: yarn --cwd ~/chromium/src/third_party/blink/renderer/devtools test 'http/tests/devtools/audits/*.js' --reset-results"
echo ""
echo "Done. To rebase the test expectations, run: "
echo " yarn --cwd ~/chromium/src/third_party/blink/renderer/devtools test 'http/tests/devtools/audits/*.js' --reset-results"