[Webkit-unassigned] [Bug 192612] HTTPS Upgrade: Scripts / preprocessing necessary to create new database in future
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Thu Dec 13 10:14:22 PST 2018
https://bugs.webkit.org/show_bug.cgi?id=192612
--- Comment #6 from Andy Estes <aestes at apple.com> ---
(In reply to Vivek Seth from comment #4)
> Comment on attachment 357101 [details]
> Patch
>
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=357101&action=review
>
> This is the script:
I'd recommend moving the script into its own file in Source/WebKit/Scripts/. Scripts in Xcode project files are hard to deal with, as you can probably see (but thank you for providing it in a comment).
>
> ```
> # This script requires that HTTPSUpgradeList.txt has the following format:
> # 1. It must be a plain text file with domains delimited by new lines
> ("\n").
> # 2. The file must not contain duplicate domains.
> # 3. All domains must be lowercase.
> # 4. All domains must be IDNA encoded.
>
> set -e
>
> # Do not create database if feature flag is disabled.
> if [[ -z "${ENABLE_HTTPS_UPGRADE}" ]]; then
> exit 0
> fi
>
> WK_ADDITIONS_PATH="usr/local/include/WebKitAdditions"
>
> INPUT_FILE_PATH="${BUILT_PRODUCTS_DIR}/${WK_ADDITIONS_PATH}/HTTPSUpgradeList.
> txt"
This won't work for Production builds. In that configuration, HTTPSUpgradeList.txt will be in $SDKROOT but not $BUILT_PRODUCTS_DIR.
Usually what we do is search for files first in $BUILT_PRODUCTS_DIR/usr/local/include/WebKitAdditions and then in $SDKROOT/usr/local/include/WebKitAdditions. It's easy to do this in makefiles using vpath (see below regarding makefiles).
> OUTPUT_FILE_PATH="${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/
> HTTPSUpgradeList.db"
$BUILT_PRODUCTS_DIR/DerivedSources/WebKit2/ is the usual place WebKit puts generated files.
>
> # Only create database for macOS and iOS.
> if [[ "${WK_PLATFORM_NAME}" != "macosx" && "${WK_PLATFORM_NAME}" !=
> "iphoneos" ]]; then
> exit 0
> fi
Why only these platforms?
>
> # Delete database if it exists.
> if [[ -f "${OUTPUT_FILE_PATH}" ]]; then
> rm "${OUTPUT_FILE_PATH}"
> fi
>
> # Create database.
> sqlite3 "${OUTPUT_FILE_PATH}" "PRAGMA user_version=${DB_VERSION}"
> "${DB_SCHEMA}" ".import ${INPUT_FILE_PATH} hosts" ".exit"
> ```
You haven't specified any input or output paths in Xcode, so I think this phase will re-create the database on every incremental build. That's not great.
Usually we solve this problem with a Makefile. You should teach Source/WebKit/DerivedSources.make how to generate this database so that we only rebuild it when necessary.
--
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20181213/95a9ed32/attachment.html>
More information about the webkit-unassigned
mailing list