<html>
    <head>
      <base href="https://bugs.webkit.org/">
    </head>
    <body>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - HTTPS Upgrade: Scripts / preprocessing necessary to create new database in future"
   href="https://bugs.webkit.org/show_bug.cgi?id=192612#c6">Comment # 6</a>
              on <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - HTTPS Upgrade: Scripts / preprocessing necessary to create new database in future"
   href="https://bugs.webkit.org/show_bug.cgi?id=192612">bug 192612</a>
              from <span class="vcard"><a class="email" href="mailto:aestes@apple.com" title="Andy Estes <aestes@apple.com>"> <span class="fn">Andy Estes</span></a>
</span></b>
        <pre>(In reply to Vivek Seth from <a href="show_bug.cgi?id=192612#c4">comment #4</a>)
<span class="quote">> Comment on <span class="bz_obsolete"><a href="attachment.cgi?id=357101&action=diff" name="attach_357101" title="Patch">attachment 357101</a> <a href="attachment.cgi?id=357101&action=edit" title="Patch">[details]</a></span>
> Patch

> View in context:
> <a href="https://bugs.webkit.org/attachment.cgi?id=357101&action=review">https://bugs.webkit.org/attachment.cgi?id=357101&action=review</a>

> This is the script: </span >

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).

<span class="quote">> 
> ```
> # 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"</span >

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).

<span class="quote">> OUTPUT_FILE_PATH="${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/
> HTTPSUpgradeList.db"</span >

$BUILT_PRODUCTS_DIR/DerivedSources/WebKit2/ is the usual place WebKit puts generated files.

<span class="quote">> 
> # Only create database for macOS and iOS.
> if [[ "${WK_PLATFORM_NAME}" != "macosx" && "${WK_PLATFORM_NAME}" !=
> "iphoneos" ]]; then
>     exit 0
> fi</span >

Why only these platforms?

<span class="quote">> 
> # 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"
> ```</span >

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.</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>