1#!/bin/sh
2
3# Don't do anything for Debug builds, so the Inspector is easier to debug.
4if [[ ${CONFIGURATION:=Debug} == "Debug" ]]; then
5    exit
6fi
7
8# Combine all script resources in the inspector.html file.
9"$SRCROOT/../inspector/combine-javascript-resources.pl" --input-html "${SRCROOT}/../inspector/front-end/inspector.html" --generated-scripts-dir ${BUILT_PRODUCTS_DIR}/DerivedSources/WebCore --output-dir "${DERIVED_FILE_DIR}/WebCore" --output-script-name inspector.js
10
11# Inline script imports in ScriptFormatterWorker.js file.
12"$SRCROOT/../inspector/inline-javascript-imports.py" "${SRCROOT}/../inspector/front-end/ScriptFormatterWorker.js" "${SRCROOT}/../inspector/front-end" "${DERIVED_FILE_DIR}/WebCore/scriptFormatterWorker.js"
13
14if [ -d "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/inspector" ]; then
15    # Remove any JavaScript files, since they will be replaced with the combined files.
16    cd "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/inspector"
17    rm *.js
18
19    # Copy the modified HTML file and the combined scripts.
20    cp "${DERIVED_FILE_DIR}/WebCore/inspector.html" inspector.html
21    cp "${DERIVED_FILE_DIR}/WebCore/inspector.js" inspector.js
22    cp "${DERIVED_FILE_DIR}/WebCore/scriptFormatterWorker.js" scriptFormatterWorker.js
23fi
24